@digitalsee-ai/rcs 2.0.3-beta → 2.0.3-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rcs.umd.js CHANGED
@@ -6,7 +6,7 @@
6
6
  `);s=a===-1?"":i.slice(a+1)}if(!r.stack)r.stack=s;else if(s){const a=s.indexOf(`
7
7
  `),l=a===-1?-1:s.indexOf(`
8
8
  `,a+1),c=l===-1?"":s.slice(l+1);String(r.stack).endsWith(c)||(r.stack+=`
9
- `+s)}}catch{}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ui(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Hu.assertOptions(r,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean)},!1),o!=null&&(J.isFunction(o)?n.paramsSerializer={serialize:o}:Hu.assertOptions(o,{encode:mn.function,serialize:mn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Hu.assertOptions(n,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),n.method=(J.getSafeProp(n,"method")||J.getSafeProp(this.defaults,"method")||"get").toLowerCase();let s=i&&J.merge(i.common,i[n.method]);i&&J.forEach(_C.concat("common"),m=>{delete i[m]}),n.headers=pn.concat(s,i);const a=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;l=l&&g.synchronous;const v=n.transitional||lm;v&&v.legacyInterceptorReqResOrdering?a.unshift(g.fulfilled,g.rejected):a.push(g.fulfilled,g.rejected)});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const m=[gm.bind(this),void 0];for(m.unshift(...a),m.push(...c),h=m.length,u=Promise.resolve(n);d<h;)u=u.then(m[d++],m[d++]);return u}h=a.length;let f=n;for(;d<h;){const m=a[d++],g=a[d++];try{f=m?m(f):f}catch(v){if(!g){u=Promise.reject(v);break}try{const w=g.call(this,v);J.isThenable(w)&&(u=Promise.resolve(w).then(()=>gm.call(this,f)))}catch(w){u=Promise.reject(w)}break}}if(!u)try{u=gm.call(this,f)}catch(m){u=Promise.reject(m)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Ui(this.defaults,e);const n=IC(e.baseURL,e.url,e.allowAbsoluteUrls,e);return CC(n,e.params,e.paramsSerializer)}};J.forEach(["delete","get","head","options"],function(e){Ri.prototype[e]=function(n,r){return this.request(Ui(r||{},{method:e,url:n,data:r&&J.hasOwnProp(r,"data")?r.data:void 0}))}}),J.forEach(["post","put","patch","query"],function(e){function n(r){return function(i,s,a){return this.request(Ui(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}Ri.prototype[e]=n(),e!=="query"&&(Ri.prototype[e+"Form"]=n(!0))});let D4=class PL{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(a=>{r.subscribe(a),i=a}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,a){r.reason||(r.reason=new gl(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new PL(function(o){e=o}),cancel:e}}};function A4(t){return function(n){return t.apply(null,n)}}function _4(t){return J.isObject(t)&&t.isAxiosError===!0}const Vu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Vu).forEach(([t,e])=>{Vu[e]===void 0&&(Vu[e]=t)});function YC(t){const e=new Ri(t),n=tC(Ri.prototype.request,e);return J.extend(n,Ri.prototype,e,{allOwnKeys:!0}),J.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return YC(Ui(t,o))},n}const Pt=YC(ml);Pt.Axios=Ri,Pt.CanceledError=gl,Pt.CancelToken=D4,Pt.isCancel=TC,Pt.VERSION=fm,Pt.toFormData=Iu,Pt.AxiosError=Ae,Pt.Cancel=Pt.CanceledError,Pt.all=function(e){return Promise.all(e)},Pt.spread=A4,Pt.isAxiosError=_4,Pt.mergeConfig=Ui,Pt.AxiosHeaders=pn,Pt.formToJSON=t=>AC(J.isHTMLForm(t)?new FormData(t):t),Pt.getAdapter=GC.getAdapter,Pt.HttpStatusCode=Vu,Pt.default=Pt;const{Axios:dde,AxiosError:hde,CanceledError:fde,isCancel:pde,CancelToken:mde,VERSION:gde,all:wde,Cancel:bde,isAxiosError:vde,spread:yde,toFormData:Cde,AxiosHeaders:kde,HttpStatusCode:Sde,formToJSON:xde,getAdapter:Ede,mergeConfig:Dde,create:Ade}=Pt,T4={nodeCategory:"/acm/links/domain/v2",nodesList:"/acm/links/v2",searchLinks:"/acm/links/search",connectableNodePackageCategories:"/acm/node-package/categories/connectable",connectableNodePackagePlugins:"/acm/node-package/plugins/connectable",actions:"/acm/actions/v2",actionNodeSchema:"/acm/actions/:nodeKey/:version",createNode:"/acm/flows/nodes/v2",updateNode:"/acm/flows/nodes/v2/:id",updateEdges:"/acm/flows/edge/v2/:flowId",copyFlow:"/acm/flows/copy/:id",proxyGroup:"/iam/api/proxyGroup",createFlow:"/acm/flows/v2",flowDetail:"/acm/flows/v2/:flowId",testRunNode:"/acm/flows/nodes/run/v2/:id",listenWebhook:"/acm/flows/:flowId/webhook/listen",connectors:"/acm/allLinks",connectorDetail:"/acm/links/:connectorId",nodeDetail:"/acm/flows/nodes/:id",cancelDebug:"/acm/flows/nodes/cancelDebug/v2/:id",deleteNode:"/acm/flows/nodes/v2/:id",checkFlow:"/acm/flows/check/:id",templateFlow:"/acm/flows/templates/:id",flowOutput:"/acm/flows/output/:id",flowOutputTree:"/acm/flows/outputTree/v2/:flowId",globalVariables:"/acm/api/globalVariables/list",accountModel:"/acm/accounts/:account_key",accountInstanceCollection:"/acm/accountInstance",accountInstanceDetail:"/acm/accountInstance/:id",accountInstanceTest:"/acm/accountInstance/test",moveNode:"/acm/flows/nodes/move/:nodeId",copyNode:"/acm/flows/nodes/copy/v2/:nodeId",updateNodeNote:"/acm/flows/nodes/updateNote",nodeStatus:"/acm/flows/nodes/close/:nodeId",exportNode:"/acm/export/flowNode",importNode:"/acm/import/flowNode",stopFlow:"/acm/flows/stop/v2/:id",runFlow:"/acm/flows/run/v2/:id",removeEdges:"/acm/flows/remove/edge/:flowId",selectOptions:"/acm/actions/select/item",flowOpStatus:"/acm/flows/op/v2/:paramsId/:opStatus",onlineFlow:"/acm/flows/online/v2/:id",templateSettingsFlowDetail:"/acm/flows/:flowId",templateCategoryList:"/acm/flows/templates/category",templateCategoryDetail:"/acm/flows/templates/category/:id",templateCategoryRelation:"/acm/flows/templates/:templateId/category/:categoryId",templateTagList:"/acm/flows/templates/tag",templateTagDetail:"/acm/flows/templates/tag/:id",templateTagRelation:"/acm/flows/templates/:templateId/tag/:tagId",getAppList:"/iam/api/apps/v2",subFlowList:"/acm/flow/sub-flow/list",flowVersionStatus:"/acm/flows/v2/:flowId/versions/status"},O4=async(t,e={})=>{const{params:n,data:r,headers:o,method:i="GET",transformResponse:s=void 0}=e,a={};o&&Object.assign(a,o);const l={url:t,method:i,params:n,data:r,headers:Object.keys(a).length?a:void 0,transformResponse:s},u=(await Pt(l)).data;return(u==null?void 0:u.data)!==void 0?u.data:u};let Ls={endpoints:{...T4},httpClient:O4};const zu=t=>{t.httpClient&&(Ls.httpClient=t.httpClient),t.endpoints&&(Ls.endpoints={...Ls.endpoints,...t.endpoints})},N4=/:([A-Za-z0-9_]+)/g,XC=(t,e)=>{const n=Ls.endpoints[t];if(!n)throw new Error(`Workflow endpoint "${t}" is not configured.`);return n.replace(N4,(r,o)=>{if(!e||e[o]===void 0||e[o]===null)throw new Error(`Missing path parameter "${o}" for endpoint "${t}".`);return encodeURIComponent(String(e[o]))})},Je=async(t,e,n)=>{const r=XC(t,n);return Ls.httpClient(r,e)},M4=new Set(["data","success","code","message","msg","error","errorCode","requestId","traceId"]),B4=t=>!t||typeof t!="object"||Array.isArray(t)||!Object.hasOwn(t,"data")?!1:Object.keys(t).every(e=>M4.has(e));function wm(t,e){let n=t;for(;B4(n);)n=n.data;return n}async function F4(t){return Je("connectableNodePackageCategories",{method:"POST",data:Q1(t)})}async function I4(t){return Je("connectableNodePackagePlugins",{method:"POST",data:Q1(t)})}const JC=async t=>Je("actions",{params:t}),QC=async(t,e)=>{const n=await Je("actionNodeSchema",void 0,{nodeKey:t,version:e});return P4(n,t,e)};function ZC(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function P4(t,e,n){const r=ZC(t),o=ZC((r==null?void 0:r.node_schema)??(r==null?void 0:r.nodeSchema)??r);return{...o,key:(o==null?void 0:o.key)??(r==null?void 0:r.action_key)??(r==null?void 0:r.node_key)??(r==null?void 0:r.nodeKey)??e,version:(o==null?void 0:o.version)??(r==null?void 0:r.action_ver)??(r==null?void 0:r.node_ver)??(r==null?void 0:r.nodeVersion)??n,name:(o==null?void 0:o.name)??(r==null?void 0:r.name)??(r==null?void 0:r.action_name)??e,description:(o==null?void 0:o.description)??(r==null?void 0:r.description),input_fields:Array.isArray(o==null?void 0:o.input_fields)?o.input_fields:[],output_fields:Array.isArray(o==null?void 0:o.output_fields)?o.output_fields:[],credentials:(o==null?void 0:o.credentials)??[]}}async function ek(t){return Je("createNode",{method:"POST",headers:{"Content-Type":"text/plain"},data:Bs(t)})}async function Wu(t,e){return Je("updateNode",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs(e)},{id:t})}async function bm(){return Je("proxyGroup")}async function vm(t){try{return await Je("flowDetail",void 0,{flowId:t})}catch(e){throw console.error("Failed to fetch workflow data",e),e}}async function ju(t,e){return Je("flowDetail",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs(e)},{flowId:t})}async function tk(t){return Je("templateSettingsFlowDetail",void 0,{flowId:t})}async function nk(t,e){return Je("templateSettingsFlowDetail",{method:"PUT",data:e},{flowId:t})}async function rk(){return Je("templateCategoryList")}async function ok(t){return Je("templateCategoryList",{method:"POST",data:t})}async function ik(t,e){return Je("templateCategoryDetail",{method:"PATCH",data:e},{id:t})}async function sk(t){return Je("templateCategoryDetail",{method:"DELETE"},{id:t})}async function ak(t,e){return Je("templateCategoryRelation",{method:"POST"},{templateId:t,categoryId:e})}async function lk(t,e){return Je("templateCategoryRelation",{method:"DELETE"},{templateId:t,categoryId:e})}async function ck(){return Je("templateTagList")}async function uk(t){return Je("templateTagList",{method:"POST",data:t})}async function dk(t,e){return Je("templateTagDetail",{method:"PATCH",data:e},{id:t})}async function hk(t){return Je("templateTagDetail",{method:"DELETE"},{id:t})}async function fk(t,e){return Je("templateTagRelation",{method:"POST"},{templateId:t,tagId:e})}async function pk(t,e){return Je("templateTagRelation",{method:"DELETE"},{templateId:t,tagId:e})}async function mk(t){return Je("testRunNode",{method:"POST",data:{},transformResponse:e=>({data:JSON.parse(e)})},{id:t})}async function gk(t,e){return Je("listenWebhook",{method:"GET",params:e},{flowId:t})}async function wk(t,e,n,r,o,i,s){return Je("cancelDebug",{method:"PATCH",data:{connector_id:e,action_id:n,account_id:r,output:i,properties:o}},{id:t})}async function ym(t){return Je("deleteNode",{method:"DELETE"},{id:t})}async function bk(t,e){return Je("flowOutputTree",{method:"POST",data:{...e,node_id:e.nodeId}},{flowId:t})}async function Cm(){return Je("globalVariables",{method:"GET",params:{page:1,size:1e3}})}async function km(t,e){const n=XC("accountModel",{account_key:t}),r=e==null?"":`/${encodeURIComponent(String(e))}`,o=await Ls.httpClient(`${n}${r}`);return wm(o)}async function vk(t){const e=await Je("accountInstanceDetail",void 0,{id:t});return wm(e)}function Sm(t,e){return e&&(e.account_key&&(t.account_key=e.account_key),e.account_ver!==void 0&&e.account_ver!==null&&(t.account_ver=e.account_ver)),t}async function yk(t,e,n,r,o,i,s){const a=Sm({connector_id:t,account_schema_id:e,auth_type:n,name:r,config:o},s);return i&&(a.proxy_id=i),Je("accountInstanceCollection",{method:"POST",headers:{"Content-Type":"text/plain"},data:Bs(a)})}async function xm(t,e,n,r,o,i,s,a){const l=Sm({connector_id:t,account_schema_id:e,auth_type:n,name:r,config:o,id:i},a);return s&&(l.proxy_id=s),Je("accountInstanceTest",{method:"POST",data:l})}async function Ck(t,e,n,r,o,i,s,a){const l=Sm({connector_id:e,account_schema_id:n,auth_type:r,name:o,config:i},a);return s&&(l.proxy_id=s),Je("accountInstanceDetail",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs(l)},{id:t})}async function kk(t,e){return Je("accountInstanceDetail",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs({connector_id:null,account_schema_id:null,auth_type:null,name:e,config:null})},{id:t})}async function Em(t){return Je("copyNode",void 0,{nodeId:t})}async function Sk(t,e){return Je("updateNodeNote",{method:"POST",data:{id:t,note:e}})}async function xk(t,e){return Je("nodeStatus",{params:{closed:e==="on"?0:1}},{nodeId:t})}async function Ek(t,e){return Je("removeEdges",{method:"POST",data:e},{flowId:t})}async function Dk(t){return Je("selectOptions",{method:"GET",params:{type:t}})}async function Ak(t){return Je("flowVersionStatus",void 0,{flowId:t})}const _k=async(t,e)=>{const n={account_schema_id:e??null};t&&(n.linkId=t);const r=await Je("accountInstanceCollection",{params:n});return wm(r)},Tk=async(t,e={})=>{var n;return Je("getAppList",{params:{size:t.pageSize,page:t.current,filter:(n=e.filter)==null?void 0:n.trim()}})},Ok=async(t,e={})=>Je("subFlowList",{params:{name:t}}),Nk=Object.freeze(Object.defineProperty({__proto__:null,apiAddTemplateCategoryRelation:ak,apiAddTemplateTagRelation:fk,apiCancelDebug:wk,apiCopyNode:Em,apiCreateAccountInstance:yk,apiCreateNode:ek,apiCreateTemplateCategory:ok,apiCreateTemplateTag:uk,apiDeleteNode:ym,apiDeleteTemplateCategory:sk,apiDeleteTemplateTag:hk,apiGetAccountInstanceDetail:vk,apiGetAccountInstanceV2:_k,apiGetAccountModel:km,apiGetActionNodeSchema:QC,apiGetActions:JC,apiGetFlow:vm,apiGetFlowOutputTree:bk,apiGetFlowVersionStatus:Ak,apiGetGlobalVariables:Cm,apiGetProxyGroup:bm,apiGetSelectOptions:Dk,apiGetTemplateCategories:rk,apiGetTemplateSettings:tk,apiGetTemplateTags:ck,apiListenWebhook:gk,apiQueryConnectableNodePackageCategories:F4,apiQueryConnectableNodePackagePlugins:I4,apiRemoveEdges:Ek,apiRemoveTemplateCategoryRelation:lk,apiRemoveTemplateTagRelation:pk,apiSaveTemplateSettings:nk,apiTestAccountInstanceValid:xm,apiTestRunNode:mk,apiUpdateAccountInstance:Ck,apiUpdateAccountInstanceName:kk,apiUpdateFlow:ju,apiUpdateNode:Wu,apiUpdateNodeNote:Sk,apiUpdateNodeStatus:xk,apiUpdateTemplateCategory:ik,apiUpdateTemplateTag:dk,configureWorkflowApi:zu,fetchSubFlowList:Ok,getAppList:Tk},Symbol.toStringTag,{value:"Module"}));function L4(t){return typeof t=="number"?Number.isFinite(t)&&t>0:typeof t=="string"&&/^[1-9]\d*$/.test(t.trim())}function $4(t,e){const n=e.connector_id??e.connectorId;return n!=null?{connector_id:n}:L4(t)?{}:{connector_id:null}}var pe=(t=>(t.TRIGGER="StartEventNode",t.ACTION="ActionNode",t.CONDITION="ConditionNode",t.LOOP="LoopNode",t.SELF_LOOP="SelfLoopNode",t.MCPServer="MCPServerNode",t.MCP_TRIGGER_NODE="MCP_TRIGGER_NODE",t.BuiltinMCP="BuiltinMCPNode",t.VECTOR_STORE="VectorStoreNode",t.AGENT="AgentNode",t.BROWSER="BrowserNode",t.AI_SUB_NODE="AISubNode",t.MCP_TOOL="MCPToolNode",t.MCP_TOOLS_NODE="MCP_TOOLS_NODE",t.SWITCH="SwitchNode",t.STICKY="StickyNoteNode",t.CUSTOM="custom",t.DYNAMIC="dynamic",t))(pe||{}),ge=(t=>(t.INVALID="INVALID",t.IDLE="IDLE",t.RUNNING="RUNNING",t.FAILED="FAILED",t.SUCCESS="SUCCESS",t.RUNNABLE="RUNNABLE",t.ACTIVE="ACTIVE",t.DEACTIVATED="DEACTIVATED",t.WARNING="WARNING",t))(ge||{}),He=(t=>(t.AI_LANGUAGE_MODEL="AI_LANGUAGE_MODEL",t.AI_VECTOR_STORE="AI_VECTORSTORE",t.AI_MEMORY="AI_MEMORY",t.AI_DOCUMENT="AI_DOCUMENT",t.AI_TEXT_SPLITTER="AI_TEXTSPLITTER",t.AI_EMBEDDING="AI_EMBEDDING",t.AI_TOOL="AI_TOOL",t.MCP="MCP",t.BUILTIN_MCP="BUILTIN_MCP",t.MCP_SERVER="MCP_SERVER",t))(He||{}),Ee=(t=>(t.HIDDEN="HIDDEN",t.LABEL="LABEL",t.TEXT="TEXT",t.TEXTAREA="TEXTAREA",t.DATE="DATE",t.TIME="TIME",t.DATETIME="DATETIME",t.SELECT="SELECT",t.API_SELECT="API_SELECT",t.FIXED_OBJ="FIXED_OBJ",t.JSON="JSON",t.EXTEND_OBJ="EXTEND_OBJ",t.PASSWORD="PASSWORD",t.MultiRowAIExtractConfig="MULTI_ROW_EXTRACT",t.MULTI_SELECT_LIST="MULTI_SELECT_LIST",t.SYNC_HOUR_MINUTE="SYNC_HOUR_MINUTE",t.AUTH_TOKEN="AUTH_TOKEN",t.SECRET_KEY="SECRET_KEY",t.SELECT_CLIENT="SELECT_CLIENT",t))(Ee||{}),Yt=(t=>(t.REQUIRED="required",t.TYPE="type",t.ENUM="enum",t.RANGE="range",t))(Yt||{}),Uu=(t=>(t.ERROR="Error",t.WARNING="Warning",t))(Uu||{}),$s=(t=>(t.STRING="string",t.NUMBER="number",t.BOOLEAN="boolean",t.OBJECT="object",t.ARRAY="array",t))($s||{});const Ru={token:{colorPrimary:"#2d5bff",colorInfo:"#2d5bff",colorSuccess:"#16a34a",colorWarning:"#d97706",colorError:"#dc2626",colorText:"#0f172a",colorTextSecondary:"#64748b",colorBorder:"#e2e8f0",colorBorderSecondary:"#eef1f5",colorBgContainer:"#ffffff",colorBgLayout:"#eef0f4",colorFillSecondary:"#f1f5f9",borderRadius:8,borderRadiusSM:6,borderRadiusLG:14,controlHeight:34,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif",boxShadow:"0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04)",boxShadowSecondary:"0 18px 48px -16px rgba(15, 23, 42, 0.3)"},components:{Button:{borderRadius:8,controlHeight:34,defaultShadow:"none",primaryShadow:"none"},Card:{borderRadiusLG:12},Drawer:{paddingLG:20},Form:{itemMarginBottom:18,labelColor:"#334155",labelFontSize:13},Input:{activeBorderColor:"#2d5bff",hoverBorderColor:"#9db0ff"},Modal:{borderRadiusLG:14,titleColor:"#0f172a"},Select:{activeBorderColor:"#2d5bff",hoverBorderColor:"#9db0ff",optionSelectedBg:"#eff3ff"},Tabs:{inkBarColor:"#2d5bff",itemActiveColor:"#2d5bff",itemSelectedColor:"#2d5bff"},Tree:{nodeHoverBg:"#f1f5f9",nodeSelectedBg:"#eff3ff"}}},En={default:"#007FFF",selected:"#3395ff",hovered:"#66b2ff",disabled:"#c7ccd1",[ge.IDLE]:"#aab2c2",[ge.INVALID]:"#fa8c16",[ge.RUNNING]:"#1890ff",[ge.FAILED]:"rgb(220, 38, 38)",[ge.SUCCESS]:"#52c41a",[ge.RUNNABLE]:"#52c41a",aiProtocol:"#007FFF"},qi={[ge.IDLE]:"#007FFF",[ge.INVALID]:"#F7CD8F",[ge.RUNNING]:"#007FFF",[ge.FAILED]:"#F3B096",[ge.SUCCESS]:"#98D7A9",[ge.RUNNABLE]:"#00B042",[ge.ACTIVE]:"#00B042",[ge.DEACTIVATED]:"#c7ccd1",[ge.WARNING]:"#FF9200"},wl={default:{stroke:En[ge.IDLE],strokeWidth:1,fill:"none"},hovered:{stroke:En.hovered,fill:"none"},selected:{stroke:En.selected,fill:"none"},vertical:{stroke:En.aiProtocol,strokeWidth:1,fill:"none",strokeDasharray:"5,5"},loop:{stroke:En.default,strokeWidth:1,strokeDasharray:"5,5",fill:"none"}},Gi={default:{color:En.default},main:{color:En.default},connected:{color:En.default},connecting:{color:En.selected},error:{color:qi[ge.FAILED]},full:{opacity:.5,cursor:"not-allowed"},nodeStatus:{[ge.IDLE]:{color:qi[ge.IDLE]},[ge.INVALID]:{color:qi[ge.INVALID]},[ge.RUNNING]:{color:qi[ge.RUNNING]},[ge.FAILED]:{color:qi[ge.FAILED]},[ge.SUCCESS]:{color:qi[ge.SUCCESS]},[ge.RUNNABLE]:{color:qi[ge.RUNNABLE]}}},Tr={line:{backgroundColor:En[ge.IDLE],height:"1px"},horizontal:{width:"64px",height:"1px"},vertical:{width:"1px",height:"36px",left:0},button:{fontSize:"20px",borderRadius:"4px",cursor:"pointer",color:En.default}},Mk={default:{fontSize:"12px",fontWeight:"normal",color:En.default},edge:{background:"#fff",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",fontWeight:"bold",pointerEvents:"none"},loop:{background:"rgba(0, 127, 255, 0.08)",color:En.default,border:`1px solid ${En.default}`,padding:"2px 6px",borderRadius:"4px",fontSize:"12px",fontWeight:"bold",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",pointerEvents:"none"}},bl={default:{border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fff",fontSize:"16px"},add:{},delete:{}},Dm={EDGE_PADDING_BOTTOM:130,EDGE_BORDER_RADIUS:16,HANDLE_SIZE:20,SELF_LOOP_EXIT_OFFSET:40,SELF_LOOP_DEPTH:130,SELF_LOOP_TIP_OFFSET:40},Bk={undeletableEdgeTargetTypes:[],unAddableTargetTypes:[]},Fk=C.createContext(null),jt=()=>{const t=C.useContext(Fk);if(!t)throw new Error("useCanvasConfig must be used inside Provider");return t},H4=Fk.Provider,{SELF_LOOP_EXIT_OFFSET:Ik,SELF_LOOP_DEPTH:Pk,SELF_LOOP_TIP_OFFSET:V4}=Dm;function z4(t){return t===ne.Position.Top||t===ne.Position.Bottom}function W4(t){return t.isVerticalEdge?wl.vertical:t.isLoopEdge?wl.loop:t.isHovered?wl.hovered:wl.default}function j4(t){return t.sourcePosition===ne.Position.Bottom&&t.targetPosition===ne.Position.Top?t.sourceAboveTarget:t.sourcePosition===ne.Position.Right&&t.targetPosition===ne.Position.Left?t.sourceLeftOfTarget:!1}function U4(t){const{sourceX:e,sourceY:n,targetX:r,targetY:o,borderRadius:i}=t,s=t.sourcePosition??ne.Position.Right,a=t.targetPosition??ne.Position.Left,l=R4(e,n,s,r,o,a),[c,u]=$k(l);return{edgePath:Lk(l,i),labelX:c,labelY:u}}function R4(t,e,n,r,o,i){const s=Ik,a=Pk,l=V4,c=Math.max(e,o)+a,u=Math.min(e,o)-a,d=Math.max(t,r)+a,h=Math.min(t,r)-a;switch(n){case ne.Position.Right:return i===ne.Position.Left?[[t,e],[t+s,e],[t+s,c],[r-l,c],[r-l,o],[r,o]]:i===ne.Position.Right?[[t,e],[t+s,e],[t+s,c],[r+s,c],[r+s,o+l],[r,o+l],[r,o]]:i===ne.Position.Top?[[t,e],[t+s,e],[t+s,u],[r,u],[r,o-l],[r,o]]:[[t,e],[t+s,e],[t+s,c],[r+l,c],[r+l,o+l],[r,o+l],[r,o]];case ne.Position.Left:return i===ne.Position.Right?[[t,e],[t-s,e],[t-s,c],[r-l,c],[r-l,o+l],[r,o+l],[r,o]]:i===ne.Position.Left?[[t,e],[t-s,e],[t-s,c],[r-s,c],[r-s,o+l],[r,o+l],[r,o]]:i===ne.Position.Top?[[t,e],[t-s,e],[t-s,u],[r,u],[r,o-l],[r,o]]:[[t,e],[t-s,e],[t-s,c],[r-l,c],[r-l,o+l],[r,o+l],[r,o]];case ne.Position.Top:return i===ne.Position.Bottom?[[t,e],[t,e-s],[d,e-s],[d,o+l],[r,o+l],[r,o]]:i===ne.Position.Top?[[t,e],[t,e-s],[d,e-s],[d,o-l],[r,o-l],[r,o]]:i===ne.Position.Right?[[t,e],[t,e-s],[d,e-s],[d,o+l],[r,o+l],[r,o]]:[[t,e],[t,e-s],[h,e-s],[h,o+l],[r-l,o+l],[r-l,o],[r,o]];default:return i===ne.Position.Top?[[t,e],[t,e+s],[d,e+s],[d,o-l],[r,o-l],[r,o]]:i===ne.Position.Bottom?[[t,e],[t,e+s],[d,e+s],[d,o+l],[r,o+l],[r,o]]:i===ne.Position.Right?[[t,e],[t,e+s],[d,e+s],[d,o+l],[r,o+l],[r,o]]:[[t,e],[t,e+s],[h,e+s],[h,o+l],[r-l,o+l],[r-l,o],[r,o]]}}function Lk(t,e){const n=t.length;if(n===0)return"";if(n===1)return`M ${t[0][0]} ${t[0][1]}`;let r=`M ${t[0][0]} ${t[0][1]}`;for(let s=1;s<n-1;s++){const[a,l]=t[s],[c,u]=t[s-1],[d,h]=t[s+1],f=Math.abs(a-c)+Math.abs(l-u),m=Math.abs(d-a)+Math.abs(h-l),g=Math.min(e,f/2,m/2),v=Math.sign(a-c),w=Math.sign(l-u),b=Math.sign(d-a),y=Math.sign(h-l);r+=` L ${a-v*g} ${l-w*g} Q ${a} ${l} ${a+b*g} ${l+y*g}`}const[o,i]=t[n-1];return r+=` L ${o} ${i}`,r}function $k(t){let e=-1,n=[t[0][0],t[0][1]];for(let r=0;r<t.length-1;r++){const[o,i]=t[r],[s,a]=t[r+1],l=Math.abs(s-o)+Math.abs(a-i);l>e&&(e=l,n=[(o+s)/2,(i+a)/2])}return n}function q4(t){const{sourceX:e,sourceY:n,targetX:r,targetY:o,borderRadius:i}=t,s=t.sourcePosition??ne.Position.Right,a=t.targetPosition??ne.Position.Left,l=Ik,c=Pk,u=Math.max(n,o)+c,d=[];d.push([e,n]),s===ne.Position.Right?d.push([e+l,n]):s===ne.Position.Left?d.push([e-l,n]):s===ne.Position.Bottom?d.push([e,n+l]):d.push([e,n-l]),d.push([d[1][0],u]);const h=a===ne.Position.Left?r-l:a===ne.Position.Right?r+l:r;d.push([h,u]),(a===ne.Position.Left||a===ne.Position.Right)&&d.push([h,o]),d.push([r,o]);const[f,m]=$k(d);return{edgePath:Lk(d,i),labelX:f,labelY:m}}const vl=()=>jt().canvas.mode??"edit";function Qe(){return Qe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qe.apply(null,arguments)}var Hs;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Hs||(Hs={}));var Hk=function(t){return t},Vk="beforeunload",G4="popstate";function K4(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function i(){var x=r.location,E=x.pathname,T=x.search,A=x.hash,O=o.state||{};return[O.idx,Hk({pathname:E,search:T,hash:A,state:O.usr||null,key:O.key||"default"})]}var s=null;function a(){if(s)f.call(s),s=null;else{var x=Hs.Pop,E=i(),T=E[0],A=E[1];if(f.length){if(T!=null){var O=u-T;O&&(s={action:x,location:A,retry:function(){D(O*-1)}},D(O))}}else b(x)}}r.addEventListener(G4,a);var l=Hs.Pop,c=i(),u=c[0],d=c[1],h=Wk(),f=Wk();u==null&&(u=0,o.replaceState(Qe({},o.state,{idx:u}),""));function m(x){return typeof x=="string"?x:X4(x)}function g(x,E){return E===void 0&&(E=null),Hk(Qe({pathname:d.pathname,hash:"",search:""},typeof x=="string"?J4(x):x,{state:E,key:Y4()}))}function v(x,E){return[{usr:x.state,key:x.key,idx:E},m(x)]}function w(x,E,T){return!f.length||(f.call({action:x,location:E,retry:T}),!1)}function b(x){l=x;var E=i();u=E[0],d=E[1],h.call({action:l,location:d})}function y(x,E){var T=Hs.Push,A=g(x,E);function O(){y(x,E)}if(w(T,A,O)){var B=v(A,u+1),M=B[0],I=B[1];try{o.pushState(M,"",I)}catch{r.location.assign(I)}b(T)}}function k(x,E){var T=Hs.Replace,A=g(x,E);function O(){k(x,E)}if(w(T,A,O)){var B=v(A,u),M=B[0],I=B[1];o.replaceState(M,"",I),b(T)}}function D(x){o.go(x)}var S={get action(){return l},get location(){return d},createHref:m,push:y,replace:k,go:D,back:function(){D(-1)},forward:function(){D(1)},listen:function(E){return h.push(E)},block:function(E){var T=f.push(E);return f.length===1&&r.addEventListener(Vk,zk),function(){T(),f.length||r.removeEventListener(Vk,zk)}}};return S}function zk(t){t.preventDefault(),t.returnValue=""}function Wk(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function Y4(){return Math.random().toString(36).substr(2,8)}function X4(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,i=t.hash,s=i===void 0?"":i;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function J4(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}const qu=K4(),jk=t=>[new URLSearchParams(location.href)],Q4={nodeSelectorVisible:!1,nodeAddInfo:null,nodeAddCallback:null},Uk=Jp.createSlice({name:"panel",initialState:Q4,reducers:{openNodeSelector:(t,e)=>{t.nodeSelectorVisible=!0,t.nodeAddInfo=e.payload},closeNodeSelector:t=>{t.nodeSelectorVisible=!1},setNodeAddCallback:(t,e)=>{t.nodeAddCallback=e.payload},executeNodeAddCallback:(t,e)=>{t.nodeAddCallback&&t.nodeAddInfo}}}),{openNodeSelector:Z4,closeNodeSelector:Rk,setNodeAddCallback:e5,executeNodeAddCallback:_de}=Uk.actions,t5=Uk.reducer,qk=C.createContext(null),n5=({value:t,children:e})=>p.jsx(qk.Provider,{value:t,children:e}),Gu=()=>C.useContext(qk)??{hasTriggerNode:!1,isMcpServerCanvas:!1};var Dn=(t=>(t.SOURCE="source",t.TARGET="target",t))(Dn||{}),ze=(t=>(t.INPUT="input",t.OUTPUT="output",t.CHAT_MODEL="chat_model",t.DONE="done",t.LOOP="loop",t.FALSE="false",t.TRUE="true",t.MEMORY="memory",t.TOOLS="tools",t.AI_MODEL="ai_model",t.AI_MEMORY="ai_memory",t.AI_TOOL="ai_tool",t.BUILTIN_MCP="builtin_mcp",t))(ze||{}),Am=(t=>(t.INPUT="input",t.OUTPUT="output",t))(Am||{});const r5="main",o5="main",i5={left:ne.Position.Left,top:ne.Position.Top,right:ne.Position.Right,bottom:ne.Position.Bottom};function s5(t){return t?i5[t]:void 0}function a5(t,e){return{id:t.name,position:s5(t.position)??(e==="input"?ne.Position.Left:ne.Position.Right),type:t.handleType??(e==="input"?Dn.TARGET:Dn.SOURCE),protocol:t.protocol??o5,maxConnections:typeof t.maxConnections=="number"?t.maxConnections:void 0,label:t.displayName,isMain:t.isMain??t.name===r5,shape:t.shape,category:t.category,style:t.style}}function Gk(t,e){return(t??[]).map(r=>a5(r,e))}var we=(t=>(t.TEXT="TEXT",t.TEXTAREA="TEXTAREA",t.NUMBER="NUMBER",t.PASSWORD="PASSWORD",t.SELECT="SELECT",t.MULTI_SELECT="MULTI_SELECT",t.RADIO="RADIO",t.CHECKBOX="CHECKBOX",t.CHECKBOX_GROUP="CHECKBOX_GROUP",t.SWITCH="SWITCH",t.CASCADER="CASCADER",t.TREE_SELECT="TREE_SELECT",t.DATE="DATE",t.DATE_RANGE="DATE_RANGE",t.TIME="TIME",t.TIME_RANGE="TIME_RANGE",t.DATETIME="DATETIME",t.UPLOAD="UPLOAD",t.RATE="RATE",t.SLIDER="SLIDER",t.COLOR_PICKER="COLOR_PICKER",t.MENTIONS="MENTIONS",t.AUTO_COMPLETE="AUTO_COMPLETE",t.LABEL="LABEL",t.HIDDEN="HIDDEN",t.JSON="JSON",t.CODE="CODE",t.PROXY="PROXY",t.GLOBAL_VARIABLE_KEY="GLOBAL_VARIABLE_KEY",t.DIVIDER="DIVIDER",t.INFO_CARD="INFO_CARD",t.ARRAY="ARRAY",t.OBJECT="OBJECT",t.KEY_VALUE="KEY_VALUE",t.ARRAY_OBJECT="ARRAY_OBJECT",t))(we||{});const l5="dip.core.flow.switch",Ku="default-branch";function Yu(t){return t===l5}function _m(t){const e=[t.config_schema,t.properties,t.params];for(const n of e){const r=h5(n);if(Array.isArray(r==null?void 0:r.branches))return r}return{}}function c5(t){const e=Array.isArray(t)?t:[],n=new Set;let r=!Array.isArray(t);return{branches:e.map((i,s)=>{const a=Vs(i)?i:{};a!==i&&(r=!0);const l=typeof a.id=="string"?a.id.trim():"",u=l.startsWith("branch")&&l!==Ku&&!n.has(l)?l:f5(s,n);n.add(u);const d=typeof a.name=="string"?a.name:"",h=d.trim()?d:`分支 ${s+1}`;return(u!==a.id||h!==a.name)&&(r=!0),{...a,id:u,name:h}}),changed:r}}function yl(t){const e=Vs(t)?t:{},n=c5(e.branches);return{...n,properties:n.changed?{...e,branches:n.branches}:e}}function Tm(t,e){if(!e.length)return{inputs:t.inputs,outputs:t.outputs};const n=t.outputs??[],r=n.find(i=>i.name!==Ku)??{name:"branch-1",protocol:"main"},o=n.find(i=>i.name===Ku)??{name:Ku,displayName:"Default",protocol:"main"};return{inputs:t.inputs,outputs:[...e.map(i=>({...r,name:i.id,displayName:i.name,display_name:i.name})),o]}}function u5(t,e){if(!Yu(t.key))return t;const n=_m(e),r=yl(n);return{...t,...Tm(t,r.branches)}}function d5(t,e){if(!Yu(e))return t;let n=!1;const r=t.fields.map(o=>!Kk(o)||o.name!=="branches"?o:(n=!0,{...o,createItem:({index:i,items:s})=>({...Om(o.columns),id:p5(s),name:`分支 ${i+1}`})}));return n?{...t,fields:r}:t}function h5(t){if(Vs(t))return Array.isArray(t.branches)?t:Vs(t.properties)?t.properties:Vs(t.params)?t.params:t}function f5(t,e){let n=t+1,r=`branch-migrated-${n}`;for(;e.has(r);)n+=1,r=`branch-migrated-${n}`;return r}function p5(t){const e=new Set(t.map(r=>typeof r.id=="string"?r.id:"").filter(r=>!!r));let n="";do n=`branch_${Date.now()}_${Math.random().toString(36).slice(2,11)}`;while(e.has(n));return n}function Om(t){const e={};for(const n of t){const r=m5(n);r!==void 0&&(e[n.name]=r)}return e}function m5(t){if(t.defaultValue!==void 0)return Nm(t.defaultValue);if(g5(t))return Om(Object.values(t.properties));if(Kk(t)){const e=Math.max(0,t.minItems??0);return Array.from({length:e},()=>Om(t.columns))}}function Nm(t){return Array.isArray(t)?t.map(Nm):Vs(t)?Object.fromEntries(Object.entries(t).map(([e,n])=>[e,Nm(n)])):t}function Vs(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function Kk(t){return t.type===we.ARRAY_OBJECT&&"columns"in t}function g5(t){return t.type===we.OBJECT&&"properties"in t}const w5=({icon:t,label:e})=>{const n=t?p.jsx("img",{src:t,alt:e,style:{width:24,height:24}}):p.jsx(ie.ReloadOutlined,{style:{fontSize:24,color:"#007fff"}});return p.jsx(_.Badge,{offset:[-22,2],count:p.jsx(ie.ReloadOutlined,{style:{fontSize:12,color:"#007fff"}}),children:n})},Or=p.jsx(ie.PlayCircleOutlined,{style:{fontSize:24,color:"#007fff"}}),b5=p.jsx(ie.ReloadOutlined,{style:{fontSize:24,color:"#007fff"}}),Yk=p.jsx(ie.FilterOutlined,{style:{fontSize:24,color:"#007fff"}}),v5=p.jsx(c$.PiCursorFill,{style:{color:"#007fff",fontSize:24}}),y5=p.jsx(ie.ApiOutlined,{style:{color:"#2d5bff",fontSize:22}}),C5=p.jsx(w5,{icon:void 0,label:void 0}),Nr=[],Xk=[{name:ze.INPUT,position:"left",maxConnections:1}],Jk=[{name:ze.OUTPUT,position:"right",maxConnections:1}],k5=[{name:ze.OUTPUT,position:"right",displayName:"",maxConnections:1}],S5=[{name:ze.INPUT,position:"left",maxConnections:1}],x5=[{name:ze.TRUE,position:"right",maxConnections:1,displayName:"true",style:{top:"33%"}},{name:ze.FALSE,position:"right",maxConnections:1,displayName:"false",style:{top:"67%"}}],Qk=[{name:ze.INPUT,position:"left",maxConnections:1}],Zk=[{name:ze.DONE,position:"right",maxConnections:1,displayName:"done",style:{top:"33%"}},{name:ze.LOOP,position:"right",maxConnections:1,displayName:"loop",style:{top:"67%"}}],eS=[{source:ze.LOOP,target:ze.INPUT}],E5=[{name:ze.INPUT,position:"left",maxConnections:1}],D5=[{name:"default-branch",position:"right",maxConnections:1,displayName:"default"}],tS=[{name:ze.OUTPUT,position:"right",maxConnections:1}],A5=[{name:ze.INPUT,position:"left"},{name:ze.AI_MODEL,position:"bottom",category:"slave",maxConnections:1,displayName:"Chat Model",protocol:He.AI_LANGUAGE_MODEL,shape:"rhombus",style:{left:"35%"}},{name:ze.AI_MEMORY,position:"bottom",category:"slave",maxConnections:1,displayName:"Memory",protocol:He.AI_MEMORY,shape:"rhombus",style:{left:"50%"}},{name:ze.AI_TOOL,position:"bottom",category:"slave",displayName:"Tools",protocol:He.AI_TOOL,shape:"rhombus",style:{left:"65%"},maxConnections:1}],_5=[{name:ze.INPUT,position:"left"},{name:ze.AI_MODEL,position:"bottom",category:"slave",maxConnections:1,displayName:"Chat Model",protocol:He.AI_LANGUAGE_MODEL,shape:"rhombus",style:{left:"50%"}}],T5=[{name:ze.INPUT,position:"left",maxConnections:1}],O5=[{name:ze.OUTPUT,position:"right",maxConnections:1}],Cl=t=>({name:ze.AI_MODEL,position:"top",protocol:t,maxConnections:1}),nS=[{name:ze.INPUT,position:"top",protocol:He.MCP_SERVER,isMain:!0}],rS=[{name:ze.BUILTIN_MCP,position:"bottom",protocol:He.BUILTIN_MCP,isMain:!0,maxConnections:1/0}],N5=[{name:ze.INPUT,position:"top",isMain:!0}],M5=[{name:ze.BUILTIN_MCP,position:"bottom",protocol:He.BUILTIN_MCP,isMain:!0,shape:"rhombus",style:{left:"50%"},maxConnections:1}],oS=[{name:ze.INPUT,position:"top",protocol:He.BUILTIN_MCP,isMain:!0}],iS=[{name:ze.OUTPUT,position:"bottom",isMain:!0,maxConnections:1}],zs={[pe.ACTION]:{type:pe.ACTION,className:"action-node",fallbackIcon:Or,inputs:Xk,outputs:Jk,byProtocol:{[He.BUILTIN_MCP]:{outputs:Nr},[He.MCP_SERVER]:{outputs:Nr}},useNodePackagePorts:!0},[pe.TRIGGER]:{type:pe.TRIGGER,className:"workflow-trigger-node",fallbackIcon:v5,inputs:Nr,outputs:k5,useNodePackagePorts:!0},[pe.CONDITION]:{type:pe.CONDITION,className:"condition-node",fallbackIcon:Yk,inputs:S5,outputs:x5,useNodePackagePorts:!0},[pe.LOOP]:{type:pe.LOOP,className:"loop-node",fallbackIcon:b5,inputs:Qk,outputs:Zk,autoConnect:eS,useNodePackagePorts:!0},[pe.SELF_LOOP]:{type:pe.SELF_LOOP,className:"loop-node",fallbackIcon:C5,inputs:Qk,outputs:Zk,autoConnect:eS,useNodePackagePorts:!0},[pe.SWITCH]:{type:pe.SWITCH,className:"switch-node",fallbackIcon:Yk,inputs:E5,outputs:D5,useNodePackagePorts:!0},[pe.AGENT]:{type:pe.AGENT,className:"agent-node",fallbackIcon:Or,inputs:A5,outputs:tS,useNodePackagePorts:!0},[pe.BROWSER]:{type:pe.BROWSER,className:"agent-node",fallbackIcon:Or,inputs:_5,outputs:tS,useNodePackagePorts:!0},[pe.CUSTOM]:{type:pe.CUSTOM,className:"workflow-custom-node",fallbackIcon:y5,inputs:T5,outputs:O5,useNodePackagePorts:!0},[pe.AI_SUB_NODE]:{type:pe.AI_SUB_NODE,className:"workflow-aisub-node",fallbackIcon:Or,inputs:Nr,outputs:[Cl(He.AI_LANGUAGE_MODEL)],byProtocol:{[He.AI_MEMORY]:{outputs:[Cl(He.AI_MEMORY)]},[He.AI_TOOL]:{outputs:[Cl(He.AI_TOOL)]}},useNodePackagePorts:!0},[pe.VECTOR_STORE]:{type:pe.VECTOR_STORE,className:"workflow-aisub-node",fallbackIcon:Or,inputs:Nr,outputs:[Cl(He.AI_LANGUAGE_MODEL)],byProtocol:{[He.AI_VECTOR_STORE]:{outputs:[Cl(He.AI_VECTOR_STORE)]}},useNodePackagePorts:!0},[pe.STICKY]:{type:pe.STICKY,className:"workflow-sticky-note",fallbackIcon:null,inputs:Nr,outputs:Nr,useNodePackagePorts:!1},[pe.DYNAMIC]:{type:pe.ACTION,className:"action-node",fallbackIcon:Or,inputs:Xk,outputs:Jk,useNodePackagePorts:!0},[pe.MCPServer]:{type:pe.MCPServer,className:"workflow-aisub-node",fallbackIcon:Or,inputs:nS,outputs:rS,useNodePackagePorts:!0},[pe.MCP_TRIGGER_NODE]:{type:pe.MCP_TRIGGER_NODE,className:"workflow-aisub-node",fallbackIcon:Or,inputs:nS,outputs:rS,useNodePackagePorts:!0},[pe.BuiltinMCP]:{type:pe.BuiltinMCP,className:"workflow-aisub-node",fallbackIcon:Or,inputs:N5,outputs:M5,useNodePackagePorts:!0},[pe.MCP_TOOL]:{type:pe.MCP_TOOL,className:"workflow-mcp-tool-node",fallbackIcon:Or,inputs:oS,outputs:iS,byProtocol:{[He.BUILTIN_MCP]:{outputs:Nr},[He.MCP_SERVER]:{outputs:Nr}},useNodePackagePorts:!0},[pe.MCP_TOOLS_NODE]:{type:pe.MCP_TOOLS_NODE,className:"workflow-mcp-tool-node",fallbackIcon:Or,inputs:oS,outputs:iS,byProtocol:{[He.BUILTIN_MCP]:{outputs:Nr},[He.MCP_SERVER]:{outputs:Nr}},useNodePackagePorts:!0}},Mm=new Map,Bm=new Set;let Fm=null;function B5(){Fm||(Fm=setTimeout(()=>{Fm=null,Bm.forEach(t=>t())},0))}function kl(t,e){return t?e==null?`${t}@`:Number.isFinite(e)?`${t}@${e}`:`${t}@`:null}function F5(t){const e=kl(t.nodeKey,t.nodeVersion);if(!e)return console.warn("[workflow:node-types] register skipped, missing nodeKey",{baseNodeType:t.baseNodeType,nodeKey:t.nodeKey,nodeVersion:t.nodeVersion}),null;if(Mm.has(e))return e;const n=zs[t.baseNodeType]??zs[pe.CUSTOM],r={...n,type:e,nodeKey:t.nodeKey,nodeVersion:t.nodeVersion,descriptorId:e,className:`${n.className} ${t.nodeKey.replaceAll(".","-")}`};return Mm.set(e,r),B5(),e}function sS(){return Array.from(Mm.keys())}function I5(t){return Bm.add(t),()=>{Bm.delete(t)}}function Im(t){return zs[t]??zs[pe.CUSTOM]}function aS(t){const e=t==null?void 0:t.protocol;return typeof e=="string"&&e?e:void 0}function P5(t,e){var o;const n=zs[t]??zs[pe.CUSTOM],r=(o=n.byProtocol)==null?void 0:o[aS(e)??""];return{inputs:(r==null?void 0:r.inputs)??n.inputs,outputs:(r==null?void 0:r.outputs)??n.outputs}}const lS=new Map;function Ws(t,e){const n=`${t}|${aS(e)??""}`,r=lS.get(n);if(r)return r;const o=P5(t,e),i={inputs:Gk(o.inputs,"input"),outputs:Gk(o.outputs,"output")};return lS.set(n,i),i}function cS(t,e){const n=Ws(t.type,t.data),r=new Map([...n.inputs,...n.outputs].map(o=>[o.id,o]));if(r.has(e)){const o=r.get(e);return{name:o.id,type:o.type,protocol:o.protocol??"main"}}return null}function L5(t,e,n,r){const o=Ws(t.type,t.data),s=(n?o.inputs:o.outputs).filter(c=>(c.protocol??"main")===e),l=(r?s.find(c=>c.id===r):void 0)??s[0];return l?{name:l.id,type:l.type,protocol:l.protocol??"main",position:l.position}:null}function $5(t){const e=_m(t??{}),n=yl(e);return H5(n.branches)}function uS(t){const e=_m(t??{});return yl(e).branches}function H5(t){const e=t.map((r,o)=>({id:r.id,position:ne.Position.Right,type:Dn.SOURCE,maxConnections:1,label:r.name,style:{top:`${(o+1)/(t.length+2)*100}%`},isMain:!1})),n={id:"default-branch",position:ne.Position.Right,type:Dn.SOURCE,maxConnections:1,label:"default",style:{top:`${(t.length+1)/(t.length+2)*100}%`},isMain:!1};return[...e,n]}function Pm(t,e,n){if(!t||!e)return!1;if(t===e)return!0;const r=new Map;for(const s of n){const a=r.get(s.target);a?a.push(s.source):r.set(s.target,[s.source])}const o=new Set,i=[t];for(;i.length>0;){const s=i.pop();if(s===e)return!0;if(o.has(s))continue;o.add(s);const a=r.get(s);a&&i.push(...a)}return!1}const V5=(t,e,n,r)=>t.filter(o=>r==="output"?o.source===e&&o.sourceHandle===n:!(o.target!==e||o.targetHandle!==n||o.source===o.target||Pm(o.source,e,t)));function z5(){const t=ne.useStore(r=>r.edges),e=C.useCallback((r,o,i)=>t?V5(t,r,o,i):[],[t]),n=C.useCallback((r,o)=>t&&t.some(s=>s.source===r&&s.sourceHandle===o||s.target===r&&s.targetHandle===o)?"connected":"default",[t]);return{getHandleConnections:e,handleStatus:n}}function Xu(){const t=Ya(),{nodeSelectorVisible:e,nodeAddInfo:n,nodeAddCallback:r}=Xa(c=>c.panel),o=C.useCallback(c=>{t(Z4(c))},[t]),i=C.useCallback(()=>{t(Rk())},[t]),s=C.useCallback(c=>{r&&n&&r(n,c),t(Rk())},[t,n,r]),a=C.useCallback((c,u)=>{r&&c&&r(c,u)},[t,n,r]),l=C.useCallback(c=>{t(e5(c))},[t]);return{nodeSelectorVisible:e,nodeAddInfo:n,openNodeSelector:o,closeNodeSelector:i,handleNodeSelect:s,handleManualAdd:a,setNodeAddCallback:l}}ze.AI_MODEL,ze.AI_MEMORY,ze.AI_TOOL,ze.CHAT_MODEL+"",ze.AI_MODEL,ze.MEMORY+"",ze.AI_MEMORY,ze.TOOLS+"",ze.AI_TOOL,ze.AI_MODEL+"",ze.AI_MODEL,ze.AI_MEMORY+"",ze.AI_MEMORY,ze.AI_TOOL+"",ze.AI_TOOL,ze.AI_MODEL+"",He.AI_LANGUAGE_MODEL,ze.AI_MEMORY+"",He.AI_MEMORY,ze.AI_TOOL+"",He.AI_TOOL;function Lm(t){return t===ze.AI_MODEL||t===ze.AI_MEMORY||t===ze.AI_TOOL}var ri=(t=>(t.MAIN="main",t))(ri||{});const Mr=new Map,Ju=new Map;function Qu(t,e){if(!t)throw new Error("nodePackageSchemaCache: nodeKey is required");return e==null?`${t}@latest`:typeof e!="number"||!Number.isFinite(e)||e<0?`${t}@latest`:`${t}@${e}`}function W5(t){return t!=null&&typeof t=="number"&&Number.isFinite(t)&&t>=0}function dS(t,e,n){if(!t||!n)return;const r=Qu(t,e);Mr.set(r,n)}function js(t,e){return t?Mr.get(Qu(t,e))??null:null}function hS(t){return t?Mr.get(t)??null:null}function fS(t,e){if(!t)return null;const n=Mr.get(t)??null;if(n){const r=new Map;if(n.inputs.forEach(o=>{const i={...o,protocol:o.protocol??"main",type:o.type??"target"};r.set(i.name,i)}),n.outputs.forEach(o=>{const i={...o,protocol:o.protocol??"main",type:o.type??"source"};r.set(i.name,i)}),r.has(e))return r.get(e)}return null}function j5(t,e,n,r){if(!t)return null;const o=Mr.get(t)??null;if(o){const i=new Map;(n?o.inputs:o.outputs).forEach(a=>{const l={...a,protocol:a.protocol??"main"},c=l.protocol??"main",u=i.get(c);u?u.push(l):i.set(c,[l])});const s=i.get(e);if(s)return(r?s.find(l=>l.name===r):void 0)??s[0]}return null}async function Zu(t,e){if(!t)return null;const n=Qu(t,e);if(Mr.has(n))return Mr.get(n);if(Ju.has(n))return Ju.get(n);if(!W5(e))return Mr.get(n)??null;const r=QC(t,e).then(o=>(Mr.set(n,o),o)).catch(()=>null).finally(()=>{Ju.delete(n)});return Ju.set(n,r),r}function U5(t,e){if(!t)return null;const n=Qu(t,e);return Mr.has(n)?Mr.get(n):null}const Us=t=>typeof t=="string"&&t.includes("@"),pS=(t,e)=>{if(Us(t.type)){const n=fS(t.type,e);if(n)return n.type}else{const n=cS(t,e);if(n)return n.protocol}return null},Sl=(t,e)=>{var n;if(!t)return null;if(((n=t.data)==null?void 0:n.node_type)==="SwitchNode")return{name:e,type:"main",protocol:"main"};if(Us(t.type)){const r=fS(t.type,e);if(r)return r}else{const r=cS(t,e);if(r)return r}return null},$m=(t,e,n,r)=>{if(Us(t.type)){const o=j5(t.type,e,n,r);if(o)return o}else{const o=L5(t,e,n,r);if(o)return o}return null};function mS(t){var e;if(/@/.test(t.type??"")){const n=hS(t.type);return n!=null&&n.auto_connections?n.auto_connections:(e=t.data)!=null&&e.saveType&&["SelfLoopNode","LoopNode"].includes(t.data.saveType)?[{source:"loop",target:"input"}]:[]}return Im(t.type).autoConnect??[]}function gS(t,e,n){return!e||!n?!1:mS(t).some(r=>r.source===e&&r.target===n)}function R5(t){const e=mS(t),n=[];for(const r of e){const o=Sl(t,r.source),i=Sl(t,r.target);if(!o||!i){console.warn("[workflow:auto-connect] 端口不存在,跳过自动连线",{nodeId:t.id,nodeType:t.type,rule:r});continue}if(o.protocol!==i.protocol){console.warn("[workflow:auto-connect] 自连线两端协议不一致,跳过",{nodeId:t.id,nodeType:t.type,rule:r,sourceProtocol:o.protocol,targetProtocol:i.protocol});continue}n.push(Bi.createEdge(ri.MAIN,`${t.id}-self-${r.source}-${r.target}`,t.id,t.id,{sourceHandle:r.source,targetHandle:r.target,data:{renderType:r.source,connectionType:r.source}}))}return n}function q5(t){const e=t.type==="target"&&Lm(t.handleId);return(t.type==="source"||e)&&!t.isFull&&!t.connectionInProgress&&t.canEdit}function G5(t,e){return{isConnectableStart:e&&t==="source",isConnectableEnd:e&&t==="target"}}function K5(t,e){const{connection:n,nodeId:r,handleId:o}=t;if(!n.inProgress)return!1;const{fromHandle:i,fromNode:s,toHandle:a}=n;return!(i!=null&&i.id)||!s||i.type!=="source"?!1:!!(i.nodeId===r&&gS(s,i.id,o)||a!=null&&a.nodeId&&Pm(i.nodeId,a.nodeId,e))}function Y5(t){const e={position:t.position,refresh:t.refresh};return t.type==="target"?{...e,targetNodeId:t.nodeId,targetHandle:t.handleId,...t.anchorNode?{targetNode:t.anchorNode}:{}}:{...e,sourceNodeId:t.nodeId,sourceHandle:t.handleId,protocol:t.protocol,...t.anchorNode?{sourceNode:t.anchorNode}:{}}}const xl=()=>{const t=ne.useReactFlow(),e=ne.useStoreApi(),n=C.useCallback(a=>{t.addEdges(a)},[t]),r=C.useCallback(a=>{t.addNodes(a)},[t]),o=C.useCallback(a=>{const{nodes:l,edges:c}=e.getState(),u=c.filter(h=>a.includes(h.target)||a.includes(h.source)),d=l.filter(h=>a.includes(h.id));t.deleteElements({edges:u,nodes:d})},[t,e]),i=C.useCallback(a=>{const{edges:l}=e.getState(),c=l.filter(u=>a.includes(u.id));t.deleteElements({edges:c})},[e,t]);return{getNodes:C.useCallback(()=>{const{nodes:a}=e.getState();return a},[e]),removeNodes:o,removeEdges:i,addEdges:n,addNodes:r}};function ed(t,e){const n=e.source?t.find(s=>s.id===e.source):void 0;if(!n)return{valid:!1,code:"SOURCE_NODE_NOT_FOUND",message:"源节点不存在"};const r=e.target?t.find(s=>s.id===e.target):void 0;if(!r)return{valid:!1,code:"TARGET_NODE_NOT_FOUND",message:"目标节点不存在"};const o=pS(n,e.sourceHandle)??"main",i=pS(r,e.targetHandle)??"main";return o.toLowerCase()!==i.toLowerCase()?{valid:!1,code:"PROTOCOL_MISMATCH",message:`连接双方协议不相符:${o} -> ${i}`}:n.id===r.id&&!gS(n,e.sourceHandle,e.targetHandle)?{valid:!1,code:"SELF_CONNECTION_NOT_ALLOWED",message:"节点不能连接到自身(端口对未在 auto_connect 规则中声明)"}:{valid:!0,code:"VALID",message:""}}var td=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hm={exports:{}};/*!
9
+ `+s)}}catch{}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ui(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Hu.assertOptions(r,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean)},!1),o!=null&&(J.isFunction(o)?n.paramsSerializer={serialize:o}:Hu.assertOptions(o,{encode:mn.function,serialize:mn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Hu.assertOptions(n,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),n.method=(J.getSafeProp(n,"method")||J.getSafeProp(this.defaults,"method")||"get").toLowerCase();let s=i&&J.merge(i.common,i[n.method]);i&&J.forEach(_C.concat("common"),m=>{delete i[m]}),n.headers=pn.concat(s,i);const a=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;l=l&&g.synchronous;const v=n.transitional||lm;v&&v.legacyInterceptorReqResOrdering?a.unshift(g.fulfilled,g.rejected):a.push(g.fulfilled,g.rejected)});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const m=[gm.bind(this),void 0];for(m.unshift(...a),m.push(...c),h=m.length,u=Promise.resolve(n);d<h;)u=u.then(m[d++],m[d++]);return u}h=a.length;let f=n;for(;d<h;){const m=a[d++],g=a[d++];try{f=m?m(f):f}catch(v){if(!g){u=Promise.reject(v);break}try{const w=g.call(this,v);J.isThenable(w)&&(u=Promise.resolve(w).then(()=>gm.call(this,f)))}catch(w){u=Promise.reject(w)}break}}if(!u)try{u=gm.call(this,f)}catch(m){u=Promise.reject(m)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Ui(this.defaults,e);const n=IC(e.baseURL,e.url,e.allowAbsoluteUrls,e);return CC(n,e.params,e.paramsSerializer)}};J.forEach(["delete","get","head","options"],function(e){Ri.prototype[e]=function(n,r){return this.request(Ui(r||{},{method:e,url:n,data:r&&J.hasOwnProp(r,"data")?r.data:void 0}))}}),J.forEach(["post","put","patch","query"],function(e){function n(r){return function(i,s,a){return this.request(Ui(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}Ri.prototype[e]=n(),e!=="query"&&(Ri.prototype[e+"Form"]=n(!0))});let D4=class PL{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(a=>{r.subscribe(a),i=a}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,a){r.reason||(r.reason=new gl(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new PL(function(o){e=o}),cancel:e}}};function A4(t){return function(n){return t.apply(null,n)}}function _4(t){return J.isObject(t)&&t.isAxiosError===!0}const Vu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Vu).forEach(([t,e])=>{Vu[e]===void 0&&(Vu[e]=t)});function YC(t){const e=new Ri(t),n=tC(Ri.prototype.request,e);return J.extend(n,Ri.prototype,e,{allOwnKeys:!0}),J.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return YC(Ui(t,o))},n}const Pt=YC(ml);Pt.Axios=Ri,Pt.CanceledError=gl,Pt.CancelToken=D4,Pt.isCancel=TC,Pt.VERSION=fm,Pt.toFormData=Iu,Pt.AxiosError=Ae,Pt.Cancel=Pt.CanceledError,Pt.all=function(e){return Promise.all(e)},Pt.spread=A4,Pt.isAxiosError=_4,Pt.mergeConfig=Ui,Pt.AxiosHeaders=pn,Pt.formToJSON=t=>AC(J.isHTMLForm(t)?new FormData(t):t),Pt.getAdapter=GC.getAdapter,Pt.HttpStatusCode=Vu,Pt.default=Pt;const{Axios:dde,AxiosError:hde,CanceledError:fde,isCancel:pde,CancelToken:mde,VERSION:gde,all:wde,Cancel:bde,isAxiosError:vde,spread:yde,toFormData:Cde,AxiosHeaders:kde,HttpStatusCode:Sde,formToJSON:xde,getAdapter:Ede,mergeConfig:Dde,create:Ade}=Pt,T4={nodeCategory:"/acm/links/domain/v2",nodesList:"/acm/links/v2",searchLinks:"/acm/links/search",connectableNodePackageCategories:"/acm/node-package/categories/connectable",connectableNodePackagePlugins:"/acm/node-package/plugins/connectable",actions:"/acm/actions/v2",actionNodeSchema:"/acm/actions/:nodeKey/:version",createNode:"/acm/flows/nodes/v2",updateNode:"/acm/flows/nodes/v2/:id",updateEdges:"/acm/flows/edge/v2/:flowId",copyFlow:"/acm/flows/copy/:id",proxyGroup:"/iam/api/proxyGroup",createFlow:"/acm/flows/v2",flowDetail:"/acm/flows/v2/:flowId",testRunNode:"/acm/flows/nodes/run/v2/:id",listenWebhook:"/acm/flows/:flowId/webhook/listen",connectors:"/acm/allLinks",connectorDetail:"/acm/links/:connectorId",nodeDetail:"/acm/flows/nodes/:id",cancelDebug:"/acm/flows/nodes/cancelDebug/v2/:id",deleteNode:"/acm/flows/nodes/v2/:id",checkFlow:"/acm/flows/check/:id",templateFlow:"/acm/flows/templates/:id",flowOutput:"/acm/flows/output/:id",flowOutputTree:"/acm/flows/outputTree/v2/:flowId",globalVariables:"/acm/api/globalVariables/list",accountModel:"/acm/accounts/:account_key",accountInstanceCollection:"/acm/accountInstance",accountInstanceDetail:"/acm/accountInstance/:id",accountInstanceTest:"/acm/accountInstance/test",moveNode:"/acm/flows/nodes/move/:nodeId",copyNode:"/acm/flows/nodes/copy/v2/:nodeId",updateNodeNote:"/acm/flows/nodes/updateNote",nodeStatus:"/acm/flows/nodes/close/:nodeId",exportNode:"/acm/export/flowNode",importNode:"/acm/import/flowNode",stopFlow:"/acm/flows/stop/v2/:id",runFlow:"/acm/flows/run/v2/:id",removeEdges:"/acm/flows/remove/edge/:flowId",selectOptions:"/acm/actions/select/item",flowOpStatus:"/acm/flows/op/v2/:paramsId/:opStatus",onlineFlow:"/acm/flows/online/v2/:id",templateSettingsFlowDetail:"/acm/flows/:flowId",templateCategoryList:"/acm/flows/templates/category",templateCategoryDetail:"/acm/flows/templates/category/:id",templateCategoryRelation:"/acm/flows/templates/:templateId/category/:categoryId",templateTagList:"/acm/flows/templates/tag",templateTagDetail:"/acm/flows/templates/tag/:id",templateTagRelation:"/acm/flows/templates/:templateId/tag/:tagId",getAppList:"/iam/api/apps/v2",subFlowList:"/acm/flow/sub-flow/list",flowVersionStatus:"/acm/flows/v2/:flowId/versions/status"},O4=async(t,e={})=>{const{params:n,data:r,headers:o,method:i="GET",transformResponse:s=void 0}=e,a={};o&&Object.assign(a,o);const l={url:t,method:i,params:n,data:r,headers:Object.keys(a).length?a:void 0,transformResponse:s},u=(await Pt(l)).data;return(u==null?void 0:u.data)!==void 0?u.data:u};let Ls={endpoints:{...T4},httpClient:O4};const zu=t=>{t.httpClient&&(Ls.httpClient=t.httpClient),t.endpoints&&(Ls.endpoints={...Ls.endpoints,...t.endpoints})},N4=/:([A-Za-z0-9_]+)/g,XC=(t,e)=>{const n=Ls.endpoints[t];if(!n)throw new Error(`Workflow endpoint "${t}" is not configured.`);return n.replace(N4,(r,o)=>{if(!e||e[o]===void 0||e[o]===null)throw new Error(`Missing path parameter "${o}" for endpoint "${t}".`);return encodeURIComponent(String(e[o]))})},Je=async(t,e,n)=>{const r=XC(t,n);return Ls.httpClient(r,e)},M4=new Set(["data","success","code","message","msg","error","errorCode","requestId","traceId"]),B4=t=>!t||typeof t!="object"||Array.isArray(t)||!Object.hasOwn(t,"data")?!1:Object.keys(t).every(e=>M4.has(e));function wm(t,e){let n=t;for(;B4(n);)n=n.data;return n}async function F4(t){return Je("connectableNodePackageCategories",{method:"POST",data:Q1(t)})}async function I4(t){return Je("connectableNodePackagePlugins",{method:"POST",data:Q1(t)})}const JC=async t=>Je("actions",{params:t}),QC=async(t,e)=>{const n=await Je("actionNodeSchema",void 0,{nodeKey:t,version:e});return P4(n,t,e)};function ZC(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function P4(t,e,n){const r=ZC(t),o=ZC((r==null?void 0:r.node_schema)??(r==null?void 0:r.nodeSchema)??r);return{...o,key:(o==null?void 0:o.key)??(r==null?void 0:r.action_key)??(r==null?void 0:r.node_key)??(r==null?void 0:r.nodeKey)??e,version:(o==null?void 0:o.version)??(r==null?void 0:r.action_ver)??(r==null?void 0:r.node_ver)??(r==null?void 0:r.nodeVersion)??n,name:(o==null?void 0:o.name)??(r==null?void 0:r.name)??(r==null?void 0:r.action_name)??e,description:(o==null?void 0:o.description)??(r==null?void 0:r.description),input_fields:Array.isArray(o==null?void 0:o.input_fields)?o.input_fields:[],output_fields:Array.isArray(o==null?void 0:o.output_fields)?o.output_fields:[],credentials:(o==null?void 0:o.credentials)??[]}}async function ek(t){return Je("createNode",{method:"POST",headers:{"Content-Type":"text/plain"},data:Bs(t)})}async function Wu(t,e){return Je("updateNode",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs(e)},{id:t})}async function bm(){return Je("proxyGroup")}async function vm(t){try{return await Je("flowDetail",void 0,{flowId:t})}catch(e){throw console.error("Failed to fetch workflow data",e),e}}async function ju(t,e){return Je("flowDetail",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs(e)},{flowId:t})}async function tk(t){return Je("templateSettingsFlowDetail",void 0,{flowId:t})}async function nk(t,e){return Je("templateSettingsFlowDetail",{method:"PUT",data:e},{flowId:t})}async function rk(){return Je("templateCategoryList")}async function ok(t){return Je("templateCategoryList",{method:"POST",data:t})}async function ik(t,e){return Je("templateCategoryDetail",{method:"PATCH",data:e},{id:t})}async function sk(t){return Je("templateCategoryDetail",{method:"DELETE"},{id:t})}async function ak(t,e){return Je("templateCategoryRelation",{method:"POST"},{templateId:t,categoryId:e})}async function lk(t,e){return Je("templateCategoryRelation",{method:"DELETE"},{templateId:t,categoryId:e})}async function ck(){return Je("templateTagList")}async function uk(t){return Je("templateTagList",{method:"POST",data:t})}async function dk(t,e){return Je("templateTagDetail",{method:"PATCH",data:e},{id:t})}async function hk(t){return Je("templateTagDetail",{method:"DELETE"},{id:t})}async function fk(t,e){return Je("templateTagRelation",{method:"POST"},{templateId:t,tagId:e})}async function pk(t,e){return Je("templateTagRelation",{method:"DELETE"},{templateId:t,tagId:e})}async function mk(t){return Je("testRunNode",{method:"POST",data:{},transformResponse:e=>({data:JSON.parse(e)})},{id:t})}async function gk(t,e){return Je("listenWebhook",{method:"GET",params:e},{flowId:t})}async function wk(t,e,n,r,o,i,s){return Je("cancelDebug",{method:"PATCH",data:{connector_id:e,action_id:n,account_id:r,output:i,properties:o}},{id:t})}async function ym(t){return Je("deleteNode",{method:"DELETE"},{id:t})}async function bk(t,e){return Je("flowOutputTree",{method:"POST",data:{...e,node_id:e.nodeId}},{flowId:t})}async function Cm(t={}){return Je("globalVariables",{method:"GET",params:{page:1,size:1e3,...t.allowFlowUpdate!==void 0?{allowFlowUpdate:t.allowFlowUpdate}:{}}})}async function km(t,e){const n=XC("accountModel",{account_key:t}),r=e==null?"":`/${encodeURIComponent(String(e))}`,o=await Ls.httpClient(`${n}${r}`);return wm(o)}async function vk(t){const e=await Je("accountInstanceDetail",void 0,{id:t});return wm(e)}function Sm(t,e){return e&&(e.account_key&&(t.account_key=e.account_key),e.account_ver!==void 0&&e.account_ver!==null&&(t.account_ver=e.account_ver)),t}async function yk(t,e,n,r,o,i,s){const a=Sm({connector_id:t,account_schema_id:e,auth_type:n,name:r,config:o},s);return i&&(a.proxy_id=i),Je("accountInstanceCollection",{method:"POST",headers:{"Content-Type":"text/plain"},data:Bs(a)})}async function xm(t,e,n,r,o,i,s,a){const l=Sm({connector_id:t,account_schema_id:e,auth_type:n,name:r,config:o,id:i},a);return s&&(l.proxy_id=s),Je("accountInstanceTest",{method:"POST",data:l})}async function Ck(t,e,n,r,o,i,s,a){const l=Sm({connector_id:e,account_schema_id:n,auth_type:r,name:o,config:i},a);return s&&(l.proxy_id=s),Je("accountInstanceDetail",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs(l)},{id:t})}async function kk(t,e){return Je("accountInstanceDetail",{method:"PATCH",headers:{"Content-Type":"text/plain"},data:Bs({connector_id:null,account_schema_id:null,auth_type:null,name:e,config:null})},{id:t})}async function Em(t){return Je("copyNode",void 0,{nodeId:t})}async function Sk(t,e){return Je("updateNodeNote",{method:"POST",data:{id:t,note:e}})}async function xk(t,e){return Je("nodeStatus",{params:{closed:e==="on"?0:1}},{nodeId:t})}async function Ek(t,e){return Je("removeEdges",{method:"POST",data:e},{flowId:t})}async function Dk(t){return Je("selectOptions",{method:"GET",params:{type:t}})}async function Ak(t){return Je("flowVersionStatus",void 0,{flowId:t})}const _k=async(t,e)=>{const n={account_schema_id:e??null};t&&(n.linkId=t);const r=await Je("accountInstanceCollection",{params:n});return wm(r)},Tk=async(t,e={})=>{var n;return Je("getAppList",{params:{size:t.pageSize,page:t.current,filter:(n=e.filter)==null?void 0:n.trim()}})},Ok=async(t,e={})=>Je("subFlowList",{params:{name:t}}),Nk=Object.freeze(Object.defineProperty({__proto__:null,apiAddTemplateCategoryRelation:ak,apiAddTemplateTagRelation:fk,apiCancelDebug:wk,apiCopyNode:Em,apiCreateAccountInstance:yk,apiCreateNode:ek,apiCreateTemplateCategory:ok,apiCreateTemplateTag:uk,apiDeleteNode:ym,apiDeleteTemplateCategory:sk,apiDeleteTemplateTag:hk,apiGetAccountInstanceDetail:vk,apiGetAccountInstanceV2:_k,apiGetAccountModel:km,apiGetActionNodeSchema:QC,apiGetActions:JC,apiGetFlow:vm,apiGetFlowOutputTree:bk,apiGetFlowVersionStatus:Ak,apiGetGlobalVariables:Cm,apiGetProxyGroup:bm,apiGetSelectOptions:Dk,apiGetTemplateCategories:rk,apiGetTemplateSettings:tk,apiGetTemplateTags:ck,apiListenWebhook:gk,apiQueryConnectableNodePackageCategories:F4,apiQueryConnectableNodePackagePlugins:I4,apiRemoveEdges:Ek,apiRemoveTemplateCategoryRelation:lk,apiRemoveTemplateTagRelation:pk,apiSaveTemplateSettings:nk,apiTestAccountInstanceValid:xm,apiTestRunNode:mk,apiUpdateAccountInstance:Ck,apiUpdateAccountInstanceName:kk,apiUpdateFlow:ju,apiUpdateNode:Wu,apiUpdateNodeNote:Sk,apiUpdateNodeStatus:xk,apiUpdateTemplateCategory:ik,apiUpdateTemplateTag:dk,configureWorkflowApi:zu,fetchSubFlowList:Ok,getAppList:Tk},Symbol.toStringTag,{value:"Module"}));function L4(t){return typeof t=="number"?Number.isFinite(t)&&t>0:typeof t=="string"&&/^[1-9]\d*$/.test(t.trim())}function $4(t,e){const n=e.connector_id??e.connectorId;return n!=null?{connector_id:n}:L4(t)?{}:{connector_id:null}}var pe=(t=>(t.TRIGGER="StartEventNode",t.ACTION="ActionNode",t.CONDITION="ConditionNode",t.LOOP="LoopNode",t.SELF_LOOP="SelfLoopNode",t.MCPServer="MCPServerNode",t.MCP_TRIGGER_NODE="MCP_TRIGGER_NODE",t.BuiltinMCP="BuiltinMCPNode",t.VECTOR_STORE="VectorStoreNode",t.AGENT="AgentNode",t.BROWSER="BrowserNode",t.AI_SUB_NODE="AISubNode",t.MCP_TOOL="MCPToolNode",t.MCP_TOOLS_NODE="MCP_TOOLS_NODE",t.SWITCH="SwitchNode",t.STICKY="StickyNoteNode",t.CUSTOM="custom",t.DYNAMIC="dynamic",t))(pe||{}),ge=(t=>(t.INVALID="INVALID",t.IDLE="IDLE",t.RUNNING="RUNNING",t.FAILED="FAILED",t.SUCCESS="SUCCESS",t.RUNNABLE="RUNNABLE",t.ACTIVE="ACTIVE",t.DEACTIVATED="DEACTIVATED",t.WARNING="WARNING",t))(ge||{}),He=(t=>(t.AI_LANGUAGE_MODEL="AI_LANGUAGE_MODEL",t.AI_VECTOR_STORE="AI_VECTORSTORE",t.AI_MEMORY="AI_MEMORY",t.AI_DOCUMENT="AI_DOCUMENT",t.AI_TEXT_SPLITTER="AI_TEXTSPLITTER",t.AI_EMBEDDING="AI_EMBEDDING",t.AI_TOOL="AI_TOOL",t.MCP="MCP",t.BUILTIN_MCP="BUILTIN_MCP",t.MCP_SERVER="MCP_SERVER",t))(He||{}),Ee=(t=>(t.HIDDEN="HIDDEN",t.LABEL="LABEL",t.TEXT="TEXT",t.TEXTAREA="TEXTAREA",t.DATE="DATE",t.TIME="TIME",t.DATETIME="DATETIME",t.SELECT="SELECT",t.API_SELECT="API_SELECT",t.FIXED_OBJ="FIXED_OBJ",t.JSON="JSON",t.EXTEND_OBJ="EXTEND_OBJ",t.PASSWORD="PASSWORD",t.MultiRowAIExtractConfig="MULTI_ROW_EXTRACT",t.MULTI_SELECT_LIST="MULTI_SELECT_LIST",t.SYNC_HOUR_MINUTE="SYNC_HOUR_MINUTE",t.AUTH_TOKEN="AUTH_TOKEN",t.SECRET_KEY="SECRET_KEY",t.SELECT_CLIENT="SELECT_CLIENT",t))(Ee||{}),Yt=(t=>(t.REQUIRED="required",t.TYPE="type",t.ENUM="enum",t.RANGE="range",t))(Yt||{}),Uu=(t=>(t.ERROR="Error",t.WARNING="Warning",t))(Uu||{}),$s=(t=>(t.STRING="string",t.NUMBER="number",t.BOOLEAN="boolean",t.OBJECT="object",t.ARRAY="array",t))($s||{});const Ru={token:{colorPrimary:"#2d5bff",colorInfo:"#2d5bff",colorSuccess:"#16a34a",colorWarning:"#d97706",colorError:"#dc2626",colorText:"#0f172a",colorTextSecondary:"#64748b",colorBorder:"#e2e8f0",colorBorderSecondary:"#eef1f5",colorBgContainer:"#ffffff",colorBgLayout:"#eef0f4",colorFillSecondary:"#f1f5f9",borderRadius:8,borderRadiusSM:6,borderRadiusLG:14,controlHeight:34,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif",boxShadow:"0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04)",boxShadowSecondary:"0 18px 48px -16px rgba(15, 23, 42, 0.3)"},components:{Button:{borderRadius:8,controlHeight:34,defaultShadow:"none",primaryShadow:"none"},Card:{borderRadiusLG:12},Drawer:{paddingLG:20},Form:{itemMarginBottom:18,labelColor:"#334155",labelFontSize:13},Input:{activeBorderColor:"#2d5bff",hoverBorderColor:"#9db0ff"},Modal:{borderRadiusLG:14,titleColor:"#0f172a"},Select:{activeBorderColor:"#2d5bff",hoverBorderColor:"#9db0ff",optionSelectedBg:"#eff3ff"},Tabs:{inkBarColor:"#2d5bff",itemActiveColor:"#2d5bff",itemSelectedColor:"#2d5bff"},Tree:{nodeHoverBg:"#f1f5f9",nodeSelectedBg:"#eff3ff"}}},En={default:"#007FFF",selected:"#3395ff",hovered:"#66b2ff",disabled:"#c7ccd1",[ge.IDLE]:"#aab2c2",[ge.INVALID]:"#fa8c16",[ge.RUNNING]:"#1890ff",[ge.FAILED]:"rgb(220, 38, 38)",[ge.SUCCESS]:"#52c41a",[ge.RUNNABLE]:"#52c41a",aiProtocol:"#007FFF"},qi={[ge.IDLE]:"#007FFF",[ge.INVALID]:"#F7CD8F",[ge.RUNNING]:"#007FFF",[ge.FAILED]:"#F3B096",[ge.SUCCESS]:"#98D7A9",[ge.RUNNABLE]:"#00B042",[ge.ACTIVE]:"#00B042",[ge.DEACTIVATED]:"#c7ccd1",[ge.WARNING]:"#FF9200"},wl={default:{stroke:En[ge.IDLE],strokeWidth:1,fill:"none"},hovered:{stroke:En.hovered,fill:"none"},selected:{stroke:En.selected,fill:"none"},vertical:{stroke:En.aiProtocol,strokeWidth:1,fill:"none",strokeDasharray:"5,5"},loop:{stroke:En.default,strokeWidth:1,strokeDasharray:"5,5",fill:"none"}},Gi={default:{color:En.default},main:{color:En.default},connected:{color:En.default},connecting:{color:En.selected},error:{color:qi[ge.FAILED]},full:{opacity:.5,cursor:"not-allowed"},nodeStatus:{[ge.IDLE]:{color:qi[ge.IDLE]},[ge.INVALID]:{color:qi[ge.INVALID]},[ge.RUNNING]:{color:qi[ge.RUNNING]},[ge.FAILED]:{color:qi[ge.FAILED]},[ge.SUCCESS]:{color:qi[ge.SUCCESS]},[ge.RUNNABLE]:{color:qi[ge.RUNNABLE]}}},Tr={line:{backgroundColor:En[ge.IDLE],height:"1px"},horizontal:{width:"64px",height:"1px"},vertical:{width:"1px",height:"36px",left:0},button:{fontSize:"20px",borderRadius:"4px",cursor:"pointer",color:En.default}},Mk={default:{fontSize:"12px",fontWeight:"normal",color:En.default},edge:{background:"#fff",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",fontWeight:"bold",pointerEvents:"none"},loop:{background:"rgba(0, 127, 255, 0.08)",color:En.default,border:`1px solid ${En.default}`,padding:"2px 6px",borderRadius:"4px",fontSize:"12px",fontWeight:"bold",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",pointerEvents:"none"}},bl={default:{border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fff",fontSize:"16px"},add:{},delete:{}},Dm={EDGE_PADDING_BOTTOM:130,EDGE_BORDER_RADIUS:16,HANDLE_SIZE:20,SELF_LOOP_EXIT_OFFSET:40,SELF_LOOP_DEPTH:130,SELF_LOOP_TIP_OFFSET:40},Bk={undeletableEdgeTargetTypes:[],unAddableTargetTypes:[]},Fk=C.createContext(null),jt=()=>{const t=C.useContext(Fk);if(!t)throw new Error("useCanvasConfig must be used inside Provider");return t},H4=Fk.Provider,{SELF_LOOP_EXIT_OFFSET:Ik,SELF_LOOP_DEPTH:Pk,SELF_LOOP_TIP_OFFSET:V4}=Dm;function z4(t){return t===ne.Position.Top||t===ne.Position.Bottom}function W4(t){return t.isVerticalEdge?wl.vertical:t.isLoopEdge?wl.loop:t.isHovered?wl.hovered:wl.default}function j4(t){return t.sourcePosition===ne.Position.Bottom&&t.targetPosition===ne.Position.Top?t.sourceAboveTarget:t.sourcePosition===ne.Position.Right&&t.targetPosition===ne.Position.Left?t.sourceLeftOfTarget:!1}function U4(t){const{sourceX:e,sourceY:n,targetX:r,targetY:o,borderRadius:i}=t,s=t.sourcePosition??ne.Position.Right,a=t.targetPosition??ne.Position.Left,l=R4(e,n,s,r,o,a),[c,u]=$k(l);return{edgePath:Lk(l,i),labelX:c,labelY:u}}function R4(t,e,n,r,o,i){const s=Ik,a=Pk,l=V4,c=Math.max(e,o)+a,u=Math.min(e,o)-a,d=Math.max(t,r)+a,h=Math.min(t,r)-a;switch(n){case ne.Position.Right:return i===ne.Position.Left?[[t,e],[t+s,e],[t+s,c],[r-l,c],[r-l,o],[r,o]]:i===ne.Position.Right?[[t,e],[t+s,e],[t+s,c],[r+s,c],[r+s,o+l],[r,o+l],[r,o]]:i===ne.Position.Top?[[t,e],[t+s,e],[t+s,u],[r,u],[r,o-l],[r,o]]:[[t,e],[t+s,e],[t+s,c],[r+l,c],[r+l,o+l],[r,o+l],[r,o]];case ne.Position.Left:return i===ne.Position.Right?[[t,e],[t-s,e],[t-s,c],[r-l,c],[r-l,o+l],[r,o+l],[r,o]]:i===ne.Position.Left?[[t,e],[t-s,e],[t-s,c],[r-s,c],[r-s,o+l],[r,o+l],[r,o]]:i===ne.Position.Top?[[t,e],[t-s,e],[t-s,u],[r,u],[r,o-l],[r,o]]:[[t,e],[t-s,e],[t-s,c],[r-l,c],[r-l,o+l],[r,o+l],[r,o]];case ne.Position.Top:return i===ne.Position.Bottom?[[t,e],[t,e-s],[d,e-s],[d,o+l],[r,o+l],[r,o]]:i===ne.Position.Top?[[t,e],[t,e-s],[d,e-s],[d,o-l],[r,o-l],[r,o]]:i===ne.Position.Right?[[t,e],[t,e-s],[d,e-s],[d,o+l],[r,o+l],[r,o]]:[[t,e],[t,e-s],[h,e-s],[h,o+l],[r-l,o+l],[r-l,o],[r,o]];default:return i===ne.Position.Top?[[t,e],[t,e+s],[d,e+s],[d,o-l],[r,o-l],[r,o]]:i===ne.Position.Bottom?[[t,e],[t,e+s],[d,e+s],[d,o+l],[r,o+l],[r,o]]:i===ne.Position.Right?[[t,e],[t,e+s],[d,e+s],[d,o+l],[r,o+l],[r,o]]:[[t,e],[t,e+s],[h,e+s],[h,o+l],[r-l,o+l],[r-l,o],[r,o]]}}function Lk(t,e){const n=t.length;if(n===0)return"";if(n===1)return`M ${t[0][0]} ${t[0][1]}`;let r=`M ${t[0][0]} ${t[0][1]}`;for(let s=1;s<n-1;s++){const[a,l]=t[s],[c,u]=t[s-1],[d,h]=t[s+1],f=Math.abs(a-c)+Math.abs(l-u),m=Math.abs(d-a)+Math.abs(h-l),g=Math.min(e,f/2,m/2),v=Math.sign(a-c),w=Math.sign(l-u),b=Math.sign(d-a),y=Math.sign(h-l);r+=` L ${a-v*g} ${l-w*g} Q ${a} ${l} ${a+b*g} ${l+y*g}`}const[o,i]=t[n-1];return r+=` L ${o} ${i}`,r}function $k(t){let e=-1,n=[t[0][0],t[0][1]];for(let r=0;r<t.length-1;r++){const[o,i]=t[r],[s,a]=t[r+1],l=Math.abs(s-o)+Math.abs(a-i);l>e&&(e=l,n=[(o+s)/2,(i+a)/2])}return n}function q4(t){const{sourceX:e,sourceY:n,targetX:r,targetY:o,borderRadius:i}=t,s=t.sourcePosition??ne.Position.Right,a=t.targetPosition??ne.Position.Left,l=Ik,c=Pk,u=Math.max(n,o)+c,d=[];d.push([e,n]),s===ne.Position.Right?d.push([e+l,n]):s===ne.Position.Left?d.push([e-l,n]):s===ne.Position.Bottom?d.push([e,n+l]):d.push([e,n-l]),d.push([d[1][0],u]);const h=a===ne.Position.Left?r-l:a===ne.Position.Right?r+l:r;d.push([h,u]),(a===ne.Position.Left||a===ne.Position.Right)&&d.push([h,o]),d.push([r,o]);const[f,m]=$k(d);return{edgePath:Lk(d,i),labelX:f,labelY:m}}const vl=()=>jt().canvas.mode??"edit";function Qe(){return Qe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qe.apply(null,arguments)}var Hs;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Hs||(Hs={}));var Hk=function(t){return t},Vk="beforeunload",G4="popstate";function K4(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function i(){var x=r.location,E=x.pathname,T=x.search,A=x.hash,O=o.state||{};return[O.idx,Hk({pathname:E,search:T,hash:A,state:O.usr||null,key:O.key||"default"})]}var s=null;function a(){if(s)f.call(s),s=null;else{var x=Hs.Pop,E=i(),T=E[0],A=E[1];if(f.length){if(T!=null){var O=u-T;O&&(s={action:x,location:A,retry:function(){D(O*-1)}},D(O))}}else b(x)}}r.addEventListener(G4,a);var l=Hs.Pop,c=i(),u=c[0],d=c[1],h=Wk(),f=Wk();u==null&&(u=0,o.replaceState(Qe({},o.state,{idx:u}),""));function m(x){return typeof x=="string"?x:X4(x)}function g(x,E){return E===void 0&&(E=null),Hk(Qe({pathname:d.pathname,hash:"",search:""},typeof x=="string"?J4(x):x,{state:E,key:Y4()}))}function v(x,E){return[{usr:x.state,key:x.key,idx:E},m(x)]}function w(x,E,T){return!f.length||(f.call({action:x,location:E,retry:T}),!1)}function b(x){l=x;var E=i();u=E[0],d=E[1],h.call({action:l,location:d})}function y(x,E){var T=Hs.Push,A=g(x,E);function O(){y(x,E)}if(w(T,A,O)){var B=v(A,u+1),M=B[0],I=B[1];try{o.pushState(M,"",I)}catch{r.location.assign(I)}b(T)}}function k(x,E){var T=Hs.Replace,A=g(x,E);function O(){k(x,E)}if(w(T,A,O)){var B=v(A,u),M=B[0],I=B[1];o.replaceState(M,"",I),b(T)}}function D(x){o.go(x)}var S={get action(){return l},get location(){return d},createHref:m,push:y,replace:k,go:D,back:function(){D(-1)},forward:function(){D(1)},listen:function(E){return h.push(E)},block:function(E){var T=f.push(E);return f.length===1&&r.addEventListener(Vk,zk),function(){T(),f.length||r.removeEventListener(Vk,zk)}}};return S}function zk(t){t.preventDefault(),t.returnValue=""}function Wk(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function Y4(){return Math.random().toString(36).substr(2,8)}function X4(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,i=t.hash,s=i===void 0?"":i;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function J4(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}const qu=K4(),jk=t=>[new URLSearchParams(location.href)],Q4={nodeSelectorVisible:!1,nodeAddInfo:null,nodeAddCallback:null},Uk=Jp.createSlice({name:"panel",initialState:Q4,reducers:{openNodeSelector:(t,e)=>{t.nodeSelectorVisible=!0,t.nodeAddInfo=e.payload},closeNodeSelector:t=>{t.nodeSelectorVisible=!1},setNodeAddCallback:(t,e)=>{t.nodeAddCallback=e.payload},executeNodeAddCallback:(t,e)=>{t.nodeAddCallback&&t.nodeAddInfo}}}),{openNodeSelector:Z4,closeNodeSelector:Rk,setNodeAddCallback:e5,executeNodeAddCallback:_de}=Uk.actions,t5=Uk.reducer,qk=C.createContext(null),n5=({value:t,children:e})=>p.jsx(qk.Provider,{value:t,children:e}),Gu=()=>C.useContext(qk)??{hasTriggerNode:!1,isMcpServerCanvas:!1};var Dn=(t=>(t.SOURCE="source",t.TARGET="target",t))(Dn||{}),ze=(t=>(t.INPUT="input",t.OUTPUT="output",t.CHAT_MODEL="chat_model",t.DONE="done",t.LOOP="loop",t.FALSE="false",t.TRUE="true",t.MEMORY="memory",t.TOOLS="tools",t.AI_MODEL="ai_model",t.AI_MEMORY="ai_memory",t.AI_TOOL="ai_tool",t.BUILTIN_MCP="builtin_mcp",t))(ze||{}),Am=(t=>(t.INPUT="input",t.OUTPUT="output",t))(Am||{});const r5="main",o5="main",i5={left:ne.Position.Left,top:ne.Position.Top,right:ne.Position.Right,bottom:ne.Position.Bottom};function s5(t){return t?i5[t]:void 0}function a5(t,e){return{id:t.name,position:s5(t.position)??(e==="input"?ne.Position.Left:ne.Position.Right),type:t.handleType??(e==="input"?Dn.TARGET:Dn.SOURCE),protocol:t.protocol??o5,maxConnections:typeof t.maxConnections=="number"?t.maxConnections:void 0,label:t.displayName,isMain:t.isMain??t.name===r5,shape:t.shape,category:t.category,style:t.style}}function Gk(t,e){return(t??[]).map(r=>a5(r,e))}var we=(t=>(t.TEXT="TEXT",t.TEXTAREA="TEXTAREA",t.NUMBER="NUMBER",t.PASSWORD="PASSWORD",t.SELECT="SELECT",t.MULTI_SELECT="MULTI_SELECT",t.RADIO="RADIO",t.CHECKBOX="CHECKBOX",t.CHECKBOX_GROUP="CHECKBOX_GROUP",t.SWITCH="SWITCH",t.CASCADER="CASCADER",t.TREE_SELECT="TREE_SELECT",t.DATE="DATE",t.DATE_RANGE="DATE_RANGE",t.TIME="TIME",t.TIME_RANGE="TIME_RANGE",t.DATETIME="DATETIME",t.UPLOAD="UPLOAD",t.RATE="RATE",t.SLIDER="SLIDER",t.COLOR_PICKER="COLOR_PICKER",t.MENTIONS="MENTIONS",t.AUTO_COMPLETE="AUTO_COMPLETE",t.LABEL="LABEL",t.HIDDEN="HIDDEN",t.JSON="JSON",t.CODE="CODE",t.PROXY="PROXY",t.GLOBAL_VARIABLE_KEY="GLOBAL_VARIABLE_KEY",t.DIVIDER="DIVIDER",t.INFO_CARD="INFO_CARD",t.ARRAY="ARRAY",t.OBJECT="OBJECT",t.KEY_VALUE="KEY_VALUE",t.ARRAY_OBJECT="ARRAY_OBJECT",t))(we||{});const l5="dip.core.flow.switch",Ku="default-branch";function Yu(t){return t===l5}function _m(t){const e=[t.config_schema,t.properties,t.params];for(const n of e){const r=h5(n);if(Array.isArray(r==null?void 0:r.branches))return r}return{}}function c5(t){const e=Array.isArray(t)?t:[],n=new Set;let r=!Array.isArray(t);return{branches:e.map((i,s)=>{const a=Vs(i)?i:{};a!==i&&(r=!0);const l=typeof a.id=="string"?a.id.trim():"",u=l.startsWith("branch")&&l!==Ku&&!n.has(l)?l:f5(s,n);n.add(u);const d=typeof a.name=="string"?a.name:"",h=d.trim()?d:`分支 ${s+1}`;return(u!==a.id||h!==a.name)&&(r=!0),{...a,id:u,name:h}}),changed:r}}function yl(t){const e=Vs(t)?t:{},n=c5(e.branches);return{...n,properties:n.changed?{...e,branches:n.branches}:e}}function Tm(t,e){if(!e.length)return{inputs:t.inputs,outputs:t.outputs};const n=t.outputs??[],r=n.find(i=>i.name!==Ku)??{name:"branch-1",protocol:"main"},o=n.find(i=>i.name===Ku)??{name:Ku,displayName:"Default",protocol:"main"};return{inputs:t.inputs,outputs:[...e.map(i=>({...r,name:i.id,displayName:i.name,display_name:i.name})),o]}}function u5(t,e){if(!Yu(t.key))return t;const n=_m(e),r=yl(n);return{...t,...Tm(t,r.branches)}}function d5(t,e){if(!Yu(e))return t;let n=!1;const r=t.fields.map(o=>!Kk(o)||o.name!=="branches"?o:(n=!0,{...o,createItem:({index:i,items:s})=>({...Om(o.columns),id:p5(s),name:`分支 ${i+1}`})}));return n?{...t,fields:r}:t}function h5(t){if(Vs(t))return Array.isArray(t.branches)?t:Vs(t.properties)?t.properties:Vs(t.params)?t.params:t}function f5(t,e){let n=t+1,r=`branch-migrated-${n}`;for(;e.has(r);)n+=1,r=`branch-migrated-${n}`;return r}function p5(t){const e=new Set(t.map(r=>typeof r.id=="string"?r.id:"").filter(r=>!!r));let n="";do n=`branch_${Date.now()}_${Math.random().toString(36).slice(2,11)}`;while(e.has(n));return n}function Om(t){const e={};for(const n of t){const r=m5(n);r!==void 0&&(e[n.name]=r)}return e}function m5(t){if(t.defaultValue!==void 0)return Nm(t.defaultValue);if(g5(t))return Om(Object.values(t.properties));if(Kk(t)){const e=Math.max(0,t.minItems??0);return Array.from({length:e},()=>Om(t.columns))}}function Nm(t){return Array.isArray(t)?t.map(Nm):Vs(t)?Object.fromEntries(Object.entries(t).map(([e,n])=>[e,Nm(n)])):t}function Vs(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function Kk(t){return t.type===we.ARRAY_OBJECT&&"columns"in t}function g5(t){return t.type===we.OBJECT&&"properties"in t}const w5=({icon:t,label:e})=>{const n=t?p.jsx("img",{src:t,alt:e,style:{width:24,height:24}}):p.jsx(ie.ReloadOutlined,{style:{fontSize:24,color:"#007fff"}});return p.jsx(_.Badge,{offset:[-22,2],count:p.jsx(ie.ReloadOutlined,{style:{fontSize:12,color:"#007fff"}}),children:n})},Or=p.jsx(ie.PlayCircleOutlined,{style:{fontSize:24,color:"#007fff"}}),b5=p.jsx(ie.ReloadOutlined,{style:{fontSize:24,color:"#007fff"}}),Yk=p.jsx(ie.FilterOutlined,{style:{fontSize:24,color:"#007fff"}}),v5=p.jsx(c$.PiCursorFill,{style:{color:"#007fff",fontSize:24}}),y5=p.jsx(ie.ApiOutlined,{style:{color:"#2d5bff",fontSize:22}}),C5=p.jsx(w5,{icon:void 0,label:void 0}),Nr=[],Xk=[{name:ze.INPUT,position:"left",maxConnections:1}],Jk=[{name:ze.OUTPUT,position:"right",maxConnections:1}],k5=[{name:ze.OUTPUT,position:"right",displayName:"",maxConnections:1}],S5=[{name:ze.INPUT,position:"left",maxConnections:1}],x5=[{name:ze.TRUE,position:"right",maxConnections:1,displayName:"true",style:{top:"33%"}},{name:ze.FALSE,position:"right",maxConnections:1,displayName:"false",style:{top:"67%"}}],Qk=[{name:ze.INPUT,position:"left",maxConnections:1}],Zk=[{name:ze.DONE,position:"right",maxConnections:1,displayName:"done",style:{top:"33%"}},{name:ze.LOOP,position:"right",maxConnections:1,displayName:"loop",style:{top:"67%"}}],eS=[{source:ze.LOOP,target:ze.INPUT}],E5=[{name:ze.INPUT,position:"left",maxConnections:1}],D5=[{name:"default-branch",position:"right",maxConnections:1,displayName:"default"}],tS=[{name:ze.OUTPUT,position:"right",maxConnections:1}],A5=[{name:ze.INPUT,position:"left"},{name:ze.AI_MODEL,position:"bottom",category:"slave",maxConnections:1,displayName:"Chat Model",protocol:He.AI_LANGUAGE_MODEL,shape:"rhombus",style:{left:"35%"}},{name:ze.AI_MEMORY,position:"bottom",category:"slave",maxConnections:1,displayName:"Memory",protocol:He.AI_MEMORY,shape:"rhombus",style:{left:"50%"}},{name:ze.AI_TOOL,position:"bottom",category:"slave",displayName:"Tools",protocol:He.AI_TOOL,shape:"rhombus",style:{left:"65%"},maxConnections:1}],_5=[{name:ze.INPUT,position:"left"},{name:ze.AI_MODEL,position:"bottom",category:"slave",maxConnections:1,displayName:"Chat Model",protocol:He.AI_LANGUAGE_MODEL,shape:"rhombus",style:{left:"50%"}}],T5=[{name:ze.INPUT,position:"left",maxConnections:1}],O5=[{name:ze.OUTPUT,position:"right",maxConnections:1}],Cl=t=>({name:ze.AI_MODEL,position:"top",protocol:t,maxConnections:1}),nS=[{name:ze.INPUT,position:"top",protocol:He.MCP_SERVER,isMain:!0}],rS=[{name:ze.BUILTIN_MCP,position:"bottom",protocol:He.BUILTIN_MCP,isMain:!0,maxConnections:1/0}],N5=[{name:ze.INPUT,position:"top",isMain:!0}],M5=[{name:ze.BUILTIN_MCP,position:"bottom",protocol:He.BUILTIN_MCP,isMain:!0,shape:"rhombus",style:{left:"50%"},maxConnections:1}],oS=[{name:ze.INPUT,position:"top",protocol:He.BUILTIN_MCP,isMain:!0}],iS=[{name:ze.OUTPUT,position:"bottom",isMain:!0,maxConnections:1}],zs={[pe.ACTION]:{type:pe.ACTION,className:"action-node",fallbackIcon:Or,inputs:Xk,outputs:Jk,byProtocol:{[He.BUILTIN_MCP]:{outputs:Nr},[He.MCP_SERVER]:{outputs:Nr}},useNodePackagePorts:!0},[pe.TRIGGER]:{type:pe.TRIGGER,className:"workflow-trigger-node",fallbackIcon:v5,inputs:Nr,outputs:k5,useNodePackagePorts:!0},[pe.CONDITION]:{type:pe.CONDITION,className:"condition-node",fallbackIcon:Yk,inputs:S5,outputs:x5,useNodePackagePorts:!0},[pe.LOOP]:{type:pe.LOOP,className:"loop-node",fallbackIcon:b5,inputs:Qk,outputs:Zk,autoConnect:eS,useNodePackagePorts:!0},[pe.SELF_LOOP]:{type:pe.SELF_LOOP,className:"loop-node",fallbackIcon:C5,inputs:Qk,outputs:Zk,autoConnect:eS,useNodePackagePorts:!0},[pe.SWITCH]:{type:pe.SWITCH,className:"switch-node",fallbackIcon:Yk,inputs:E5,outputs:D5,useNodePackagePorts:!0},[pe.AGENT]:{type:pe.AGENT,className:"agent-node",fallbackIcon:Or,inputs:A5,outputs:tS,useNodePackagePorts:!0},[pe.BROWSER]:{type:pe.BROWSER,className:"agent-node",fallbackIcon:Or,inputs:_5,outputs:tS,useNodePackagePorts:!0},[pe.CUSTOM]:{type:pe.CUSTOM,className:"workflow-custom-node",fallbackIcon:y5,inputs:T5,outputs:O5,useNodePackagePorts:!0},[pe.AI_SUB_NODE]:{type:pe.AI_SUB_NODE,className:"workflow-aisub-node",fallbackIcon:Or,inputs:Nr,outputs:[Cl(He.AI_LANGUAGE_MODEL)],byProtocol:{[He.AI_MEMORY]:{outputs:[Cl(He.AI_MEMORY)]},[He.AI_TOOL]:{outputs:[Cl(He.AI_TOOL)]}},useNodePackagePorts:!0},[pe.VECTOR_STORE]:{type:pe.VECTOR_STORE,className:"workflow-aisub-node",fallbackIcon:Or,inputs:Nr,outputs:[Cl(He.AI_LANGUAGE_MODEL)],byProtocol:{[He.AI_VECTOR_STORE]:{outputs:[Cl(He.AI_VECTOR_STORE)]}},useNodePackagePorts:!0},[pe.STICKY]:{type:pe.STICKY,className:"workflow-sticky-note",fallbackIcon:null,inputs:Nr,outputs:Nr,useNodePackagePorts:!1},[pe.DYNAMIC]:{type:pe.ACTION,className:"action-node",fallbackIcon:Or,inputs:Xk,outputs:Jk,useNodePackagePorts:!0},[pe.MCPServer]:{type:pe.MCPServer,className:"workflow-aisub-node",fallbackIcon:Or,inputs:nS,outputs:rS,useNodePackagePorts:!0},[pe.MCP_TRIGGER_NODE]:{type:pe.MCP_TRIGGER_NODE,className:"workflow-aisub-node",fallbackIcon:Or,inputs:nS,outputs:rS,useNodePackagePorts:!0},[pe.BuiltinMCP]:{type:pe.BuiltinMCP,className:"workflow-aisub-node",fallbackIcon:Or,inputs:N5,outputs:M5,useNodePackagePorts:!0},[pe.MCP_TOOL]:{type:pe.MCP_TOOL,className:"workflow-mcp-tool-node",fallbackIcon:Or,inputs:oS,outputs:iS,byProtocol:{[He.BUILTIN_MCP]:{outputs:Nr},[He.MCP_SERVER]:{outputs:Nr}},useNodePackagePorts:!0},[pe.MCP_TOOLS_NODE]:{type:pe.MCP_TOOLS_NODE,className:"workflow-mcp-tool-node",fallbackIcon:Or,inputs:oS,outputs:iS,byProtocol:{[He.BUILTIN_MCP]:{outputs:Nr},[He.MCP_SERVER]:{outputs:Nr}},useNodePackagePorts:!0}},Mm=new Map,Bm=new Set;let Fm=null;function B5(){Fm||(Fm=setTimeout(()=>{Fm=null,Bm.forEach(t=>t())},0))}function kl(t,e){return t?e==null?`${t}@`:Number.isFinite(e)?`${t}@${e}`:`${t}@`:null}function F5(t){const e=kl(t.nodeKey,t.nodeVersion);if(!e)return console.warn("[workflow:node-types] register skipped, missing nodeKey",{baseNodeType:t.baseNodeType,nodeKey:t.nodeKey,nodeVersion:t.nodeVersion}),null;if(Mm.has(e))return e;const n=zs[t.baseNodeType]??zs[pe.CUSTOM],r={...n,type:e,nodeKey:t.nodeKey,nodeVersion:t.nodeVersion,descriptorId:e,className:`${n.className} ${t.nodeKey.replaceAll(".","-")}`};return Mm.set(e,r),B5(),e}function sS(){return Array.from(Mm.keys())}function I5(t){return Bm.add(t),()=>{Bm.delete(t)}}function Im(t){return zs[t]??zs[pe.CUSTOM]}function aS(t){const e=t==null?void 0:t.protocol;return typeof e=="string"&&e?e:void 0}function P5(t,e){var o;const n=zs[t]??zs[pe.CUSTOM],r=(o=n.byProtocol)==null?void 0:o[aS(e)??""];return{inputs:(r==null?void 0:r.inputs)??n.inputs,outputs:(r==null?void 0:r.outputs)??n.outputs}}const lS=new Map;function Ws(t,e){const n=`${t}|${aS(e)??""}`,r=lS.get(n);if(r)return r;const o=P5(t,e),i={inputs:Gk(o.inputs,"input"),outputs:Gk(o.outputs,"output")};return lS.set(n,i),i}function cS(t,e){const n=Ws(t.type,t.data),r=new Map([...n.inputs,...n.outputs].map(o=>[o.id,o]));if(r.has(e)){const o=r.get(e);return{name:o.id,type:o.type,protocol:o.protocol??"main"}}return null}function L5(t,e,n,r){const o=Ws(t.type,t.data),s=(n?o.inputs:o.outputs).filter(c=>(c.protocol??"main")===e),l=(r?s.find(c=>c.id===r):void 0)??s[0];return l?{name:l.id,type:l.type,protocol:l.protocol??"main",position:l.position}:null}function $5(t){const e=_m(t??{}),n=yl(e);return H5(n.branches)}function uS(t){const e=_m(t??{});return yl(e).branches}function H5(t){const e=t.map((r,o)=>({id:r.id,position:ne.Position.Right,type:Dn.SOURCE,maxConnections:1,label:r.name,style:{top:`${(o+1)/(t.length+2)*100}%`},isMain:!1})),n={id:"default-branch",position:ne.Position.Right,type:Dn.SOURCE,maxConnections:1,label:"default",style:{top:`${(t.length+1)/(t.length+2)*100}%`},isMain:!1};return[...e,n]}function Pm(t,e,n){if(!t||!e)return!1;if(t===e)return!0;const r=new Map;for(const s of n){const a=r.get(s.target);a?a.push(s.source):r.set(s.target,[s.source])}const o=new Set,i=[t];for(;i.length>0;){const s=i.pop();if(s===e)return!0;if(o.has(s))continue;o.add(s);const a=r.get(s);a&&i.push(...a)}return!1}const V5=(t,e,n,r)=>t.filter(o=>r==="output"?o.source===e&&o.sourceHandle===n:!(o.target!==e||o.targetHandle!==n||o.source===o.target||Pm(o.source,e,t)));function z5(){const t=ne.useStore(r=>r.edges),e=C.useCallback((r,o,i)=>t?V5(t,r,o,i):[],[t]),n=C.useCallback((r,o)=>t&&t.some(s=>s.source===r&&s.sourceHandle===o||s.target===r&&s.targetHandle===o)?"connected":"default",[t]);return{getHandleConnections:e,handleStatus:n}}function Xu(){const t=Ya(),{nodeSelectorVisible:e,nodeAddInfo:n,nodeAddCallback:r}=Xa(c=>c.panel),o=C.useCallback(c=>{t(Z4(c))},[t]),i=C.useCallback(()=>{t(Rk())},[t]),s=C.useCallback(c=>{r&&n&&r(n,c),t(Rk())},[t,n,r]),a=C.useCallback((c,u)=>{r&&c&&r(c,u)},[t,n,r]),l=C.useCallback(c=>{t(e5(c))},[t]);return{nodeSelectorVisible:e,nodeAddInfo:n,openNodeSelector:o,closeNodeSelector:i,handleNodeSelect:s,handleManualAdd:a,setNodeAddCallback:l}}ze.AI_MODEL,ze.AI_MEMORY,ze.AI_TOOL,ze.CHAT_MODEL+"",ze.AI_MODEL,ze.MEMORY+"",ze.AI_MEMORY,ze.TOOLS+"",ze.AI_TOOL,ze.AI_MODEL+"",ze.AI_MODEL,ze.AI_MEMORY+"",ze.AI_MEMORY,ze.AI_TOOL+"",ze.AI_TOOL,ze.AI_MODEL+"",He.AI_LANGUAGE_MODEL,ze.AI_MEMORY+"",He.AI_MEMORY,ze.AI_TOOL+"",He.AI_TOOL;function Lm(t){return t===ze.AI_MODEL||t===ze.AI_MEMORY||t===ze.AI_TOOL}var ri=(t=>(t.MAIN="main",t))(ri||{});const Mr=new Map,Ju=new Map;function Qu(t,e){if(!t)throw new Error("nodePackageSchemaCache: nodeKey is required");return e==null?`${t}@latest`:typeof e!="number"||!Number.isFinite(e)||e<0?`${t}@latest`:`${t}@${e}`}function W5(t){return t!=null&&typeof t=="number"&&Number.isFinite(t)&&t>=0}function dS(t,e,n){if(!t||!n)return;const r=Qu(t,e);Mr.set(r,n)}function js(t,e){return t?Mr.get(Qu(t,e))??null:null}function hS(t){return t?Mr.get(t)??null:null}function fS(t,e){if(!t)return null;const n=Mr.get(t)??null;if(n){const r=new Map;if(n.inputs.forEach(o=>{const i={...o,protocol:o.protocol??"main",type:o.type??"target"};r.set(i.name,i)}),n.outputs.forEach(o=>{const i={...o,protocol:o.protocol??"main",type:o.type??"source"};r.set(i.name,i)}),r.has(e))return r.get(e)}return null}function j5(t,e,n,r){if(!t)return null;const o=Mr.get(t)??null;if(o){const i=new Map;(n?o.inputs:o.outputs).forEach(a=>{const l={...a,protocol:a.protocol??"main"},c=l.protocol??"main",u=i.get(c);u?u.push(l):i.set(c,[l])});const s=i.get(e);if(s)return(r?s.find(l=>l.name===r):void 0)??s[0]}return null}async function Zu(t,e){if(!t)return null;const n=Qu(t,e);if(Mr.has(n))return Mr.get(n);if(Ju.has(n))return Ju.get(n);if(!W5(e))return Mr.get(n)??null;const r=QC(t,e).then(o=>(Mr.set(n,o),o)).catch(()=>null).finally(()=>{Ju.delete(n)});return Ju.set(n,r),r}function U5(t,e){if(!t)return null;const n=Qu(t,e);return Mr.has(n)?Mr.get(n):null}const Us=t=>typeof t=="string"&&t.includes("@"),pS=(t,e)=>{if(Us(t.type)){const n=fS(t.type,e);if(n)return n.type}else{const n=cS(t,e);if(n)return n.protocol}return null},Sl=(t,e)=>{var n;if(!t)return null;if(((n=t.data)==null?void 0:n.node_type)==="SwitchNode")return{name:e,type:"main",protocol:"main"};if(Us(t.type)){const r=fS(t.type,e);if(r)return r}else{const r=cS(t,e);if(r)return r}return null},$m=(t,e,n,r)=>{if(Us(t.type)){const o=j5(t.type,e,n,r);if(o)return o}else{const o=L5(t,e,n,r);if(o)return o}return null};function mS(t){var e;if(/@/.test(t.type??"")){const n=hS(t.type);return n!=null&&n.auto_connections?n.auto_connections:(e=t.data)!=null&&e.saveType&&["SelfLoopNode","LoopNode"].includes(t.data.saveType)?[{source:"loop",target:"input"}]:[]}return Im(t.type).autoConnect??[]}function gS(t,e,n){return!e||!n?!1:mS(t).some(r=>r.source===e&&r.target===n)}function R5(t){const e=mS(t),n=[];for(const r of e){const o=Sl(t,r.source),i=Sl(t,r.target);if(!o||!i){console.warn("[workflow:auto-connect] 端口不存在,跳过自动连线",{nodeId:t.id,nodeType:t.type,rule:r});continue}if(o.protocol!==i.protocol){console.warn("[workflow:auto-connect] 自连线两端协议不一致,跳过",{nodeId:t.id,nodeType:t.type,rule:r,sourceProtocol:o.protocol,targetProtocol:i.protocol});continue}n.push(Bi.createEdge(ri.MAIN,`${t.id}-self-${r.source}-${r.target}`,t.id,t.id,{sourceHandle:r.source,targetHandle:r.target,data:{renderType:r.source,connectionType:r.source}}))}return n}function q5(t){const e=t.type==="target"&&Lm(t.handleId);return(t.type==="source"||e)&&!t.isFull&&!t.connectionInProgress&&t.canEdit}function G5(t,e){return{isConnectableStart:e&&t==="source",isConnectableEnd:e&&t==="target"}}function K5(t,e){const{connection:n,nodeId:r,handleId:o}=t;if(!n.inProgress)return!1;const{fromHandle:i,fromNode:s,toHandle:a}=n;return!(i!=null&&i.id)||!s||i.type!=="source"?!1:!!(i.nodeId===r&&gS(s,i.id,o)||a!=null&&a.nodeId&&Pm(i.nodeId,a.nodeId,e))}function Y5(t){const e={position:t.position,refresh:t.refresh};return t.type==="target"?{...e,targetNodeId:t.nodeId,targetHandle:t.handleId,...t.anchorNode?{targetNode:t.anchorNode}:{}}:{...e,sourceNodeId:t.nodeId,sourceHandle:t.handleId,protocol:t.protocol,...t.anchorNode?{sourceNode:t.anchorNode}:{}}}const xl=()=>{const t=ne.useReactFlow(),e=ne.useStoreApi(),n=C.useCallback(a=>{t.addEdges(a)},[t]),r=C.useCallback(a=>{t.addNodes(a)},[t]),o=C.useCallback(a=>{const{nodes:l,edges:c}=e.getState(),u=c.filter(h=>a.includes(h.target)||a.includes(h.source)),d=l.filter(h=>a.includes(h.id));t.deleteElements({edges:u,nodes:d})},[t,e]),i=C.useCallback(a=>{const{edges:l}=e.getState(),c=l.filter(u=>a.includes(u.id));t.deleteElements({edges:c})},[e,t]);return{getNodes:C.useCallback(()=>{const{nodes:a}=e.getState();return a},[e]),removeNodes:o,removeEdges:i,addEdges:n,addNodes:r}};function ed(t,e){const n=e.source?t.find(s=>s.id===e.source):void 0;if(!n)return{valid:!1,code:"SOURCE_NODE_NOT_FOUND",message:"源节点不存在"};const r=e.target?t.find(s=>s.id===e.target):void 0;if(!r)return{valid:!1,code:"TARGET_NODE_NOT_FOUND",message:"目标节点不存在"};const o=pS(n,e.sourceHandle)??"main",i=pS(r,e.targetHandle)??"main";return o.toLowerCase()!==i.toLowerCase()?{valid:!1,code:"PROTOCOL_MISMATCH",message:`连接双方协议不相符:${o} -> ${i}`}:n.id===r.id&&!gS(n,e.sourceHandle,e.targetHandle)?{valid:!1,code:"SELF_CONNECTION_NOT_ALLOWED",message:"节点不能连接到自身(端口对未在 auto_connect 规则中声明)"}:{valid:!0,code:"VALID",message:""}}var td=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hm={exports:{}};/*!
10
10
  Copyright (c) 2018 Jed Watson.
11
11
  Licensed under the MIT License (MIT), see
12
12
  http://jedwatson.github.io/classnames
@@ -116,12 +116,12 @@ The error may be correlated with this previous error:
116
116
  *
117
117
  * This source code is licensed under the ISC license.
118
118
  * See the LICENSE file in the root directory of this source tree.
119
- */const lQ=_i("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),cQ=/\{\{.*\}\}/;function MB(t){return typeof t=="string"&&cQ.test(t)?"expression":"normal"}const BB=({field:t,disabled:e,readOnly:n,context:r})=>{const{renderVariableTag:o,renderVariableTooltip:i,validateVariable:s}=r,a=uQ(t),l=t.keyPlaceholder||"Key",c=t.valuePlaceholder||"Value",u=0;return p.jsx(_.Form.List,{name:t.name,rules:a,children:(d,{add:h,remove:f},{errors:m})=>p.jsxs(_.Space,{direction:"vertical",style:{width:"100%"},children:[d.map(g=>p.jsx(FB,{field:t,listField:g,disabled:e,readOnly:n,canRemove:!(e||t.minItems!==void 0&&d.length<=t.minItems),keyPlaceholder:l,valuePlaceholder:c,valueModeSwitchOffset:u,onRemove:f,validateVariable:s,renderVariableTag:o,renderVariableTooltip:i},g.key)),p.jsx(_.Button,{block:!0,icon:p.jsx(Kr,{size:16}),onClick:()=>h(),disabled:e||t.maxItems!==void 0&&d.length>=t.maxItems,children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})}),p.jsx(_.Form.ErrorList,{errors:m})]})})};BB.displayName="KeyValueFieldControl";const FB=({field:t,listField:e,disabled:n,readOnly:r,canRemove:o,keyPlaceholder:i,valuePlaceholder:s,valueModeSwitchOffset:a,onRemove:l,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})=>{const h=t.valueModePolicy,f=_.Form.useFormInstance(),[m,g]=C.useState(()=>{if(h){if(h==="BOTH"||h==="EXPRESSION")return"expression";if(h==="TEXT")return"normal"}const w=f.getFieldValue([t.name,e.name]),b=MB(w==null?void 0:w.key);return b==="expression"?b:MB(w==null?void 0:w.value)}),v=h==="TEXT"?["normal"]:["normal","expression"];return p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[p.jsx(_.Form.Item,{style:{flex:1,marginBottom:0,marginTop:a},name:[e.name,"key"],rules:[{required:!0,message:"请输入Key"}],children:p.jsx(ks,{availableModes:v,mode:m,hideModeSwitch:!0,disabled:n,readOnly:r,placeholder:i,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})}),p.jsx(_.Form.Item,{style:{flex:1,marginBottom:0},name:[e.name,"value"],children:p.jsx(ks,{availableModes:v,mode:m,onModeChange:g,disabled:n,readOnly:r,placeholder:s,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d,modeSwitchPosition:"top-right",compact:!0})}),p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>l(e.name),disabled:!o})]})};FB.displayName="KeyValueRow";function uQ(t){var n;const e=[];if((n=t.rules)!=null&&n.some(r=>r.type==="required")){const r=t.rules.find(o=>o.type==="required");e.push({validator:async(o,i)=>{if(!i||i.length===0)throw new Error((r==null?void 0:r.message)||"此项为必填")}})}if(t.minItems!==void 0){const r=t.minItems;e.push({validator:async(o,i)=>{if(r&&(!i||i.length<r))throw new Error(`至少需要 ${r} 项`)}})}if(t.maxItems!==void 0){const r=t.maxItems;e.push({validator:async(o,i)=>{if(i&&i.length>r)throw new Error(`最多允许 ${r} 项`)}})}return e}const dQ=Ai(BB,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});function hQ(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.name=="string"&&e.name.trim()!==""&&typeof e.type=="string"}function fQ(t){return!t||typeof t!="object"||Array.isArray(t)?[]:Object.values(t).filter(hQ)}const IB=({field:t,disabled:e,readOnly:n,context:r})=>{const o=_.Form.useFormInstance(),s=pQ(t.name),[a,l]=_t.useState(null);_t.useEffect(()=>{Promise.resolve().then(()=>wZ).then(b=>{l(()=>b.FieldRenderer)})},[]);const{renderVariableTag:c,renderVariableTooltip:u,validateVariable:d,values:h,optionsLoader:f}=r,m=_t.useMemo(()=>fQ(t.properties),[t.properties]),g=o.getFieldValue(s)??hr(h,s.join("."))??{},v=p.jsx(_.Space,{direction:"vertical",style:{width:"100%"},children:m.map(b=>{const y=mv(b,t.valueModePolicy),k=[...s,b.name];return tu(y,g)&&a?p.jsx(a,{field:{...y,name:k},values:h,optionsLoader:f,disabled:e,renderVariableTag:c,renderVariableTooltip:u,validateVariable:d},k.join(".")):null})}),w=p.jsx(gv,{policy:t.valueModePolicy,disabled:e,readOnly:n,children:v});return t.collapsible?p.jsx(_.Collapse,{defaultActiveKey:t.defaultCollapsed?[]:["main"],items:[{key:"main",label:t.label||t.name,children:w}]}):p.jsx(_.Card,{size:"small",title:t.label,children:w})};IB.displayName="ObjectFieldControl";function pQ(t){return Array.isArray(t)?t:[t]}const mQ=Ai(IB,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});var Xf={exports:{}},gQ=Xf.exports,PB;function wQ(){return PB||(PB=1,(function(t,e){(function(n,r){t.exports=r()})(gQ,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",s="second",a="minute",l="hour",c="day",u="week",d="month",h="quarter",f="year",m="date",g="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var N=["th","st","nd","rd"],P=I%100;return"["+I+(N[(P-20)%10]||N[P]||N[0])+"]"}},y=function(I,N,P){var F=String(I);return!F||F.length>=N?I:""+Array(N+1-F.length).join(P)+I},k={s:y,z:function(I){var N=-I.utcOffset(),P=Math.abs(N),F=Math.floor(P/60),H=P%60;return(N<=0?"+":"-")+y(F,2,"0")+":"+y(H,2,"0")},m:function I(N,P){if(N.date()<P.date())return-I(P,N);var F=12*(P.year()-N.year())+(P.month()-N.month()),H=N.clone().add(F,d),V=P-H<0,q=N.clone().add(F+(V?-1:1),d);return+(-(F+(P-H)/(V?H-q:q-H))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:d,y:f,w:u,d:c,D:m,h:l,m:a,s,ms:i,Q:h}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},D="en",S={};S[D]=b;var x="$isDayjsObject",E=function(I){return I instanceof B||!(!I||!I[x])},T=function I(N,P,F){var H;if(!N)return D;if(typeof N=="string"){var V=N.toLowerCase();S[V]&&(H=V),P&&(S[V]=P,H=V);var q=N.split("-");if(!H&&q.length>1)return I(q[0])}else{var Q=N.name;S[Q]=N,H=Q}return!F&&H&&(D=H),H||!F&&D},A=function(I,N){if(E(I))return I.clone();var P=typeof N=="object"?N:{};return P.date=I,P.args=arguments,new B(P)},O=k;O.l=T,O.i=E,O.w=function(I,N){return A(I,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var B=(function(){function I(P){this.$L=T(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[x]=!0}var N=I.prototype;return N.parse=function(P){this.$d=(function(F){var H=F.date,V=F.utc;if(H===null)return new Date(NaN);if(O.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var q=H.match(v);if(q){var Q=q[2]-1||0,te=(q[7]||"0").substring(0,3);return V?new Date(Date.UTC(q[1],Q,q[3]||1,q[4]||0,q[5]||0,q[6]||0,te)):new Date(q[1],Q,q[3]||1,q[4]||0,q[5]||0,q[6]||0,te)}}return new Date(H)})(P),this.init()},N.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},N.$utils=function(){return O},N.isValid=function(){return this.$d.toString()!==g},N.isSame=function(P,F){var H=A(P);return this.startOf(F)<=H&&H<=this.endOf(F)},N.isAfter=function(P,F){return A(P)<this.startOf(F)},N.isBefore=function(P,F){return this.endOf(F)<A(P)},N.$g=function(P,F,H){return O.u(P)?this[F]:this.set(H,P)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(P,F){var H=this,V=!!O.u(F)||F,q=O.p(P),Q=function(j,K){var W=O.w(H.$u?Date.UTC(H.$y,K,j):new Date(H.$y,K,j),H);return V?W:W.endOf(c)},te=function(j,K){return O.w(H.toDate()[j].apply(H.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(K)),H)},$=this.$W,U=this.$M,R=this.$D,ee="set"+(this.$u?"UTC":"");switch(q){case f:return V?Q(1,0):Q(31,11);case d:return V?Q(1,U):Q(0,U+1);case u:var se=this.$locale().weekStart||0,he=($<se?$+7:$)-se;return Q(V?R-he:R+(6-he),U);case c:case m:return te(ee+"Hours",0);case l:return te(ee+"Minutes",1);case a:return te(ee+"Seconds",2);case s:return te(ee+"Milliseconds",3);default:return this.clone()}},N.endOf=function(P){return this.startOf(P,!1)},N.$set=function(P,F){var H,V=O.p(P),q="set"+(this.$u?"UTC":""),Q=(H={},H[c]=q+"Date",H[m]=q+"Date",H[d]=q+"Month",H[f]=q+"FullYear",H[l]=q+"Hours",H[a]=q+"Minutes",H[s]=q+"Seconds",H[i]=q+"Milliseconds",H)[V],te=V===c?this.$D+(F-this.$W):F;if(V===d||V===f){var $=this.clone().set(m,1);$.$d[Q](te),$.init(),this.$d=$.set(m,Math.min(this.$D,$.daysInMonth())).$d}else Q&&this.$d[Q](te);return this.init(),this},N.set=function(P,F){return this.clone().$set(P,F)},N.get=function(P){return this[O.p(P)]()},N.add=function(P,F){var H,V=this;P=Number(P);var q=O.p(F),Q=function(U){var R=A(V);return O.w(R.date(R.date()+Math.round(U*P)),V)};if(q===d)return this.set(d,this.$M+P);if(q===f)return this.set(f,this.$y+P);if(q===c)return Q(1);if(q===u)return Q(7);var te=(H={},H[a]=r,H[l]=o,H[s]=n,H)[q]||1,$=this.$d.getTime()+P*te;return O.w($,this)},N.subtract=function(P,F){return this.add(-1*P,F)},N.format=function(P){var F=this,H=this.$locale();if(!this.isValid())return H.invalidDate||g;var V=P||"YYYY-MM-DDTHH:mm:ssZ",q=O.z(this),Q=this.$H,te=this.$m,$=this.$M,U=H.weekdays,R=H.months,ee=H.meridiem,se=function(K,W,X,re){return K&&(K[W]||K(F,V))||X[W].slice(0,re)},he=function(K){return O.s(Q%12||12,K,"0")},j=ee||function(K,W,X){var re=K<12?"AM":"PM";return X?re.toLowerCase():re};return V.replace(w,(function(K,W){return W||(function(X){switch(X){case"YY":return String(F.$y).slice(-2);case"YYYY":return O.s(F.$y,4,"0");case"M":return $+1;case"MM":return O.s($+1,2,"0");case"MMM":return se(H.monthsShort,$,R,3);case"MMMM":return se(R,$);case"D":return F.$D;case"DD":return O.s(F.$D,2,"0");case"d":return String(F.$W);case"dd":return se(H.weekdaysMin,F.$W,U,2);case"ddd":return se(H.weekdaysShort,F.$W,U,3);case"dddd":return U[F.$W];case"H":return String(Q);case"HH":return O.s(Q,2,"0");case"h":return he(1);case"hh":return he(2);case"a":return j(Q,te,!0);case"A":return j(Q,te,!1);case"m":return String(te);case"mm":return O.s(te,2,"0");case"s":return String(F.$s);case"ss":return O.s(F.$s,2,"0");case"SSS":return O.s(F.$ms,3,"0");case"Z":return q}return null})(K)||q.replace(":","")}))},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(P,F,H){var V,q=this,Q=O.p(F),te=A(P),$=(te.utcOffset()-this.utcOffset())*r,U=this-te,R=function(){return O.m(q,te)};switch(Q){case f:V=R()/12;break;case d:V=R();break;case h:V=R()/3;break;case u:V=(U-$)/6048e5;break;case c:V=(U-$)/864e5;break;case l:V=U/o;break;case a:V=U/r;break;case s:V=U/n;break;default:V=U}return H?V:O.a(V)},N.daysInMonth=function(){return this.endOf(d).$D},N.$locale=function(){return S[this.$L]},N.locale=function(P,F){if(!P)return this.$L;var H=this.clone(),V=T(P,F,!0);return V&&(H.$L=V),H},N.clone=function(){return O.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},I})(),M=B.prototype;return A.prototype=M,[["$ms",i],["$s",s],["$m",a],["$H",l],["$W",c],["$M",d],["$y",f],["$D",m]].forEach((function(I){M[I[1]]=function(N){return this.$g(N,I[0],I[1])}})),A.extend=function(I,N){return I.$i||(I(N,B,A),I.$i=!0),A},A.locale=T,A.isDayjs=E,A.unix=function(I){return A(1e3*I)},A.en=S[D],A.Ls=S,A.p={},A}))})(Xf)),Xf.exports}var bQ=wQ();const Qt=dr(bQ);var Jf={exports:{}},vQ=Jf.exports,LB;function yQ(){return LB||(LB=1,(function(t,e){(function(n,r){t.exports=r()})(vQ,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(s){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(s);var c=this.$utils(),u=(s||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(d){switch(d){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),d==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return d}}));return i.bind(this)(u)}}}))})(Jf)),Jf.exports}var CQ=yQ();const kQ=dr(CQ);var Qf={exports:{}},SQ=Qf.exports,$B;function xQ(){return $B||($B=1,(function(t,e){(function(n,r){t.exports=r()})(SQ,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,o=/\d/,i=/\d\d/,s=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(w){this[v]=+w}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(w){if(!w||w==="Z")return 0;var b=w.match(/([+-]|\d\d)/g),y=60*b[1]+(+b[2]||0);return y===0?0:b[0]==="+"?-y:y})(v)}],h=function(v){var w=l[v];return w&&(w.indexOf?w:w.s.concat(w.f))},f=function(v,w){var b,y=l.meridiem;if(y){for(var k=1;k<=24;k+=1)if(v.indexOf(y(k,0,w))>-1){b=k>12;break}}else b=v===(w?"pm":"PM");return b},m={A:[a,function(v){this.afternoon=f(v,!1)}],a:[a,function(v){this.afternoon=f(v,!0)}],Q:[o,function(v){this.month=3*(v-1)+1}],S:[o,function(v){this.milliseconds=100*+v}],SS:[i,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[s,u("seconds")],ss:[s,u("seconds")],m:[s,u("minutes")],mm:[s,u("minutes")],H:[s,u("hours")],h:[s,u("hours")],HH:[s,u("hours")],hh:[s,u("hours")],D:[s,u("day")],DD:[i,u("day")],Do:[a,function(v){var w=l.ordinal,b=v.match(/\d+/);if(this.day=b[0],w)for(var y=1;y<=31;y+=1)w(y).replace(/\[|\]/g,"")===v&&(this.day=y)}],w:[s,u("week")],ww:[i,u("week")],M:[s,u("month")],MM:[i,u("month")],MMM:[a,function(v){var w=h("months"),b=(h("monthsShort")||w.map((function(y){return y.slice(0,3)}))).indexOf(v)+1;if(b<1)throw new Error;this.month=b%12||b}],MMMM:[a,function(v){var w=h("months").indexOf(v)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(v){this.year=c(v)}],YYYY:[/\d{4}/,u("year")],Z:d,ZZ:d};function g(v){var w,b;w=v,b=l&&l.formats;for(var y=(v=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(A,O,B){var M=B&&B.toUpperCase();return O||b[B]||n[B]||b[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(I,N,P){return N||P.slice(1)}))}))).match(r),k=y.length,D=0;D<k;D+=1){var S=y[D],x=m[S],E=x&&x[0],T=x&&x[1];y[D]=T?{regex:E,parser:T}:S.replace(/^\[|\]$/g,"")}return function(A){for(var O={},B=0,M=0;B<k;B+=1){var I=y[B];if(typeof I=="string")M+=I.length;else{var N=I.regex,P=I.parser,F=A.slice(M),H=N.exec(F)[0];P.call(O,H),A=A.replace(H,"")}}return(function(V){var q=V.afternoon;if(q!==void 0){var Q=V.hours;q?Q<12&&(V.hours+=12):Q===12&&(V.hours=0),delete V.afternoon}})(O),O}}return function(v,w,b){b.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(c=v.parseTwoDigitYear);var y=w.prototype,k=y.parse;y.parse=function(D){var S=D.date,x=D.utc,E=D.args;this.$u=x;var T=E[1];if(typeof T=="string"){var A=E[2]===!0,O=E[3]===!0,B=A||O,M=E[2];O&&(M=E[2]),l=this.$locale(),!A&&M&&(l=b.Ls[M]),this.$d=(function(F,H,V,q){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*F);var Q=g(H)(F),te=Q.year,$=Q.month,U=Q.day,R=Q.hours,ee=Q.minutes,se=Q.seconds,he=Q.milliseconds,j=Q.zone,K=Q.week,W=new Date,X=U||(te||$?1:W.getDate()),re=te||W.getFullYear(),Z=0;te&&!$||(Z=$>0?$-1:W.getMonth());var ae,be=R||0,me=ee||0,ue=se||0,le=he||0;return j?new Date(Date.UTC(re,Z,X,be,me,ue,le+60*j.offset*1e3)):V?new Date(Date.UTC(re,Z,X,be,me,ue,le)):(ae=new Date(re,Z,X,be,me,ue,le),K&&(ae=q(ae).week(K).toDate()),ae)}catch{return new Date("")}})(S,T,x,b),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),B&&S!=this.format(T)&&(this.$d=new Date("")),l={}}else if(T instanceof Array)for(var I=T.length,N=1;N<=I;N+=1){E[1]=T[N-1];var P=b.apply(this,E);if(P.isValid()){this.$d=P.$d,this.$L=P.$L,this.init();break}N===I&&(this.$d=new Date(""))}else k.call(this,D)}}}))})(Qf)),Qf.exports}var EQ=xQ();const DQ=dr(EQ);var Zf={exports:{}},AQ=Zf.exports,HB;function _Q(){return HB||(HB=1,(function(t,e){(function(n,r){t.exports=r()})(AQ,(function(){return function(n,r,o){var i=r.prototype,s=function(d){return d&&(d.indexOf?d:d.s)},a=function(d,h,f,m,g){var v=d.name?d:d.$locale(),w=s(v[h]),b=s(v[f]),y=w||b.map((function(D){return D.slice(0,m)}));if(!g)return y;var k=v.weekStart;return y.map((function(D,S){return y[(S+(k||0))%7]}))},l=function(){return o.Ls[o.locale()]},c=function(d,h){return d.formats[h]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,g,v){return g||v.slice(1)}))})(d.formats[h.toUpperCase()])},u=function(){var d=this;return{months:function(h){return h?h.format("MMMM"):a(d,"months")},monthsShort:function(h){return h?h.format("MMM"):a(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(h){return h?h.format("dddd"):a(d,"weekdays")},weekdaysMin:function(h){return h?h.format("dd"):a(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(h){return h?h.format("ddd"):a(d,"weekdaysShort","weekdays",3)},longDateFormat:function(h){return c(d.$locale(),h)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},o.localeData=function(){var d=l();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return o.weekdays()},weekdaysShort:function(){return o.weekdaysShort()},weekdaysMin:function(){return o.weekdaysMin()},months:function(){return o.months()},monthsShort:function(){return o.monthsShort()},longDateFormat:function(h){return c(d,h)},meridiem:d.meridiem,ordinal:d.ordinal}},o.months=function(){return a(l(),"months")},o.monthsShort=function(){return a(l(),"monthsShort","months",3)},o.weekdays=function(d){return a(l(),"weekdays",null,null,d)},o.weekdaysShort=function(d){return a(l(),"weekdaysShort","weekdays",3,d)},o.weekdaysMin=function(d){return a(l(),"weekdaysMin","weekdays",2,d)}}}))})(Zf)),Zf.exports}var TQ=_Q();const OQ=dr(TQ);var ep={exports:{}},NQ=ep.exports,VB;function MQ(){return VB||(VB=1,(function(t,e){(function(n,r){t.exports=r()})(NQ,(function(){return function(n,r){r.prototype.weekday=function(o){var i=this.$locale().weekStart||0,s=this.$W,a=(s<i?s+7:s)-i;return this.$utils().u(o)?a:this.subtract(a,"day").add(o,"day")}}}))})(ep)),ep.exports}var BQ=MQ();const FQ=dr(BQ);var tp={exports:{}},IQ=tp.exports,zB;function PQ(){return zB||(zB=1,(function(t,e){(function(n,r){t.exports=r()})(IQ,(function(){var n="week",r="year";return function(o,i,s){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=s(this).startOf(r).add(1,r).date(c),d=s(this).endOf(n);if(u.isBefore(d))return 1}var h=s(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),f=this.diff(h,n,!0);return f<0?s(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(tp)),tp.exports}var LQ=PQ();const $Q=dr(LQ);var np={exports:{}},HQ=np.exports,WB;function VQ(){return WB||(WB=1,(function(t,e){(function(n,r){t.exports=r()})(HQ,(function(){return function(n,r){r.prototype.weekYear=function(){var o=this.month(),i=this.week(),s=this.year();return i===1&&o===11?s+1:o===0&&i>=52?s-1:s}}}))})(np)),np.exports}var zQ=VQ();const WQ=dr(zQ);Qt.extend(DQ),Qt.extend(kQ),Qt.extend(FQ),Qt.extend(OQ),Qt.extend($Q),Qt.extend(WQ);function nu(t,e){if(t==null||t==="")return null;if(Qt.isDayjs(t))return t.isValid()?t:null;const n=e?Qt(t,e):Qt(t);if(n.isValid())return n;const r=Qt(t);return r.isValid()?r:null}function jB(t,e){if(!Array.isArray(t))return null;const n=nu(t[0],e),r=nu(t[1],e);return n||r?[n,r]:null}function ru(t,e,n){if(t)return e==="timestamp"?t.valueOf():e==="string"?t.format(n):t}function UB(t,e,n){if(t)return[ru(t[0],e,n),ru(t[1],e,n)]}const jQ="YYYY-MM-DD",RB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||jQ,s=nu(n,i);return p.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,picker:t.picker,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(ru(a,t.outputFormat,i)),id:o})};RB.displayName="DateFieldControl";const UQ=gt(RB,{needsFormItemName:!0}),RQ="YYYY-MM-DD",qB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||RQ,s=jB(n,i);return p.jsx(_.DatePicker.RangePicker,{disabled:e,picker:t.picker,showTime:t.showTime,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(UB(a,t.outputFormat,i)),id:o})};qB.displayName="DateRangeFieldControl";const qQ=gt(qB,{needsFormItemName:!0}),GQ="YYYY-MM-DD HH:mm:ss",GB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||GQ,s=nu(n,i);return p.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,showTime:t.showTime??!0,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(ru(a,t.outputFormat,i)),id:o})};GB.displayName="DateTimeFieldControl";const KQ=gt(GB,{needsFormItemName:!0}),YQ="HH:mm:ss",KB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||YQ,s=nu(n,i);return p.jsx(_.TimePicker,{disabled:e,placeholder:t.placeholder,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(ru(a,t.outputFormat,i)),id:o})};KB.displayName="TimeFieldControl";const XQ=gt(KB,{needsFormItemName:!0}),JQ="HH:mm:ss",YB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||JQ,s=jB(n,i);return p.jsx(_.TimePicker.RangePicker,{disabled:e,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(UB(a,t.outputFormat,i)),id:o})};YB.displayName="TimeRangeFieldControl";const QQ=gt(YB,{needsFormItemName:!0}),XB=({field:t})=>p.jsx(_.Divider,{children:t.label});XB.displayName="DividerFieldControl";const ZQ=Ai(XB,{isDisplayOnly:!0,needsFormItemName:!1}),JB=({value:t,onChange:e,id:n})=>p.jsx(_.Input,{type:"hidden",value:t,onChange:r=>e==null?void 0:e(r.target.value),id:n});JB.displayName="HiddenFieldControl";const eZ=Ai(JB,{needsFormItemName:!0,isHidden:!0}),QB=({field:t})=>p.jsx(_.Alert,{message:t.label,description:t.description||t.placeholder,type:t.status||"info",showIcon:t.showIcon,closable:t.closable});QB.displayName="InfoCardFieldControl";const tZ=Ai(QB,{isDisplayOnly:!0,needsFormItemName:!1}),ZB=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Input.TextArea,{disabled:e,placeholder:t.placeholder,rows:6,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});ZB.displayName="JsonFieldControl";const nZ=gt(ZB,{needsFormItemName:!0}),eF=({field:t,value:e})=>p.jsx("span",{children:e||t.placeholder||t.defaultValue});eF.displayName="LabelFieldControl";const rZ=gt(eF,{needsFormItemName:!0}),tF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Cascader,{disabled:e,placeholder:t.placeholder,options:t.options,changeOnSelect:t.changeOnSelect,multiple:t.multiple||void 0,showSearch:t.showSearch,value:n,onChange:(i,s)=>r==null?void 0:r(i),id:o});tF.displayName="CascaderFieldControl";const oZ=gt(tF,{needsFormItemName:!0}),nF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Checkbox,{disabled:e,checked:n,onChange:i=>r==null?void 0:r(i.target.checked),id:o,children:t.placeholder});nF.displayName="CheckboxFieldControl";const iZ=gt(nF,{needsFormItemName:!0,valuePropName:"checked"}),rF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Checkbox.Group,{disabled:e,options:t.options,value:n,onChange:i=>r==null?void 0:r(i)});rF.displayName="CheckboxGroupFieldControl";const sZ=gt(rF,{needsFormItemName:!0}),oF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Radio.Group,{disabled:e,options:t.options,optionType:t.optionType,buttonStyle:t.buttonStyle,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});oF.displayName="RadioFieldControl";const aZ=gt(oF,{needsFormItemName:!0}),iF=({field:t,disabled:e,context:n,value:r,onChange:o,id:i})=>{const{values:s,optionsLoader:a}=n,[l,c]=C.useState(sF(t)),[u,d]=C.useState(!1),h=t.type===we.MULTI_SELECT||t.mode==="multiple",f=w=>!w||w.kind==="static"?[]:w.deps||[],m=C.useMemo(()=>{const b=f(t.optionsSource).map(y=>hr(s,y));return JSON.stringify(b)},[t.optionsSource,s]);C.useEffect(()=>{if(!t.optionsSource||t.optionsSource.kind==="static"){c(sF(t));return}const w=t.optionsSource;if(!a){c(w.fallbackOptions||t.options||[]);return}const y=f(w).reduce((S,x)=>(S[x]=hr(s,x),S),{}),k={...w.params||{},deps:y};d(!0);let D=!1;return a(w.action,k,{values:s}).then(S=>{D||c(S)}).catch(()=>{D||c(w.fallbackOptions||t.options||[])}).finally(()=>{D||d(!1)}),()=>{D=!0}},[m,t.optionsSource,t.options]);const g=()=>{var w;(w=n.eventHandlers)==null||w.onBlur(t.name)},v=()=>{var w;(w=n.eventHandlers)==null||w.onFocus(t.name)};return p.jsx(_.Select,{disabled:e,placeholder:t.placeholder,options:l,mode:h?"multiple":t.mode,showSearch:t.showSearch,allowClear:t.allowClear,maxTagCount:t.maxTagCount,loading:u,value:r,onChange:o,onBlur:g,onFocus:v,id:i})};iF.displayName="SelectFieldControl";function sF(t){var n;if((n=t.options)!=null&&n.length)return t.options;const e=t.optionsSource;return e?e.kind==="static"?e.items||[]:e.fallbackOptions||[]:[]}const aF=gt(iF,{supportsVariableInsert:!1,needsFormItemName:!0}),lF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Switch,{disabled:e,checkedChildren:t.checkedChildren,unCheckedChildren:t.unCheckedChildren,checked:n,onChange:r,id:o});lF.displayName="SwitchFieldControl";const lZ=gt(lF,{needsFormItemName:!0,valuePropName:"checked"}),cF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.TreeSelect,{disabled:e,placeholder:t.placeholder,treeData:t.options,multiple:t.multiple,showSearch:t.showSearch,allowClear:t.allowClear,treeCheckable:t.treeCheckable,value:n,onChange:r,id:o});cF.displayName="TreeSelectFieldControl";const cZ=gt(cF,{needsFormItemName:!0}),uF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.AutoComplete,{disabled:e,placeholder:t.placeholder,options:t.options,allowClear:t.allowClear,value:n,onChange:r,id:o});uF.displayName="AutoCompleteFieldControl";const uZ=gt(uF,{needsFormItemName:!0}),dF=({disabled:t,value:e,onChange:n})=>p.jsx(_.ColorPicker,{disabled:t,value:e,onChange:(r,o)=>n==null?void 0:n(o)});dF.displayName="ColorPickerFieldControl";const dZ=gt(dF,{needsFormItemName:!0}),hF="globalVariables",fF=({field:t,disabled:e,readOnly:n,context:r,value:o,onChange:i,id:s})=>{const{optionsLoader:a,values:l}=r,[c,u]=C.useState(t.options??[]),[d,h]=C.useState(!1);return C.useEffect(()=>{if(!a){u(t.options??[]);return}let f=!1;return h(!0),a(hF,{},{values:l}).then(m=>{f||u(m)}).catch(()=>{f||u(t.options??[])}).finally(()=>{f||h(!1)}),()=>{f=!0}},[a,t.options]),p.jsx(_.Select,{id:s,value:o==null?void 0:String(o),options:c,loading:d,placeholder:t.placeholder,showSearch:!0,optionFilterProp:"label",allowClear:!0,disabled:e||n,onChange:f=>i==null?void 0:i(f??null)})};fF.displayName="GlobalVariableKeyFieldControl";const hZ=gt(fF,{needsFormItemName:!0,supportsVariableInsert:!0}),pF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Mentions,{disabled:e,placeholder:t.placeholder,value:n,onChange:r,id:o});pF.displayName="MentionsFieldControl";const fZ=gt(pF,{needsFormItemName:!0}),mF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Rate,{disabled:e,count:t.count,allowHalf:t.allowHalf,value:n,onChange:r,id:o});mF.displayName="RateFieldControl";const pZ=gt(mF,{needsFormItemName:!0}),gF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Slider,{disabled:e,min:t.min,max:t.max,step:t.step,marks:t.marks,range:t.range,value:n,onChange:i=>r==null?void 0:r(i),id:o});gF.displayName="SliderFieldControl";const mZ=gt(gF,{needsFormItemName:!0}),wF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Upload,{disabled:e,accept:t.accept,maxCount:t.maxCount,listType:t.listType||"text",action:t.action,multiple:t.multiple,fileList:n,onChange:r,id:o,children:p.jsx(_.Button,{icon:p.jsx(ie.UploadOutlined,{}),disabled:e,children:"上传文件"})});wF.displayName="UploadFieldControl";const gZ=gt(wF,{needsFormItemName:!0});function bF(t=yd){t.register(we.TEXT,FJ),t.register(we.TEXTAREA,BJ),t.register(we.NUMBER,NJ),t.register(we.PASSWORD,MJ),t.register(we.SELECT,aF),t.register(we.MULTI_SELECT,aF),t.register(we.RADIO,aZ),t.register(we.CHECKBOX,iZ),t.register(we.CHECKBOX_GROUP,sZ),t.register(we.SWITCH,lZ),t.register(we.CASCADER,oZ),t.register(we.TREE_SELECT,cZ),t.register(we.DATE,UQ),t.register(we.DATETIME,KQ),t.register(we.DATE_RANGE,qQ),t.register(we.TIME,XQ),t.register(we.TIME_RANGE,QQ),t.register(we.UPLOAD,gZ),t.register(we.RATE,pZ),t.register(we.SLIDER,mZ),t.register(we.COLOR_PICKER,dZ),t.register(we.MENTIONS,fZ),t.register(we.AUTO_COMPLETE,uZ),t.register(we.GLOBAL_VARIABLE_KEY,hZ),t.register(we.LABEL,rZ),t.register(we.HIDDEN,eZ),t.register(we.JSON,nZ),t.register(we.DIVIDER,ZQ),t.register(we.INFO_CARD,tZ),t.register(we.ARRAY,PJ),t.register(we.OBJECT,mQ),t.register(we.KEY_VALUE,dQ),t.register(we.ARRAY_OBJECT,JJ)}bF();const vv=({field:t,disabled:e,required:n,readOnly:r,rules:o,values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u,nodeId:d})=>{const h=Cd(),f=e??Wa(t.disabled,i,!1),m=n??Wa(t.required,i,!1),g=r??Wa(t.readOnly,i,!1),v=o??Es(t.rules||[],i,t.type),w={values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u,nodeId:d},b=h.get(t.type);if(!b)return p.jsxs("span",{children:["不支持的字段类型: ",t.type]});const{component:y,meta:k}=b;return k.isDisplayOnly?p.jsx(y,{field:t,disabled:f,readOnly:g,context:w}):k.isComplexField?p.jsx(_.Form.Item,{label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:m,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,children:p.jsx(y,{field:t,disabled:f,readOnly:g,context:w})}):k.isHidden?p.jsx(_.Form.Item,{name:k.needsFormItemName!==!1?t.name:void 0,hidden:!0,rules:v,valuePropName:k.valuePropName,validateTrigger:t.validateTrigger,children:p.jsx(y,{field:t,disabled:f,readOnly:g,context:w})}):p.jsx(_.Form.Item,{name:k.needsFormItemName!==!1?t.name:void 0,label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:m,rules:v,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,valuePropName:k.valuePropName,validateTrigger:t.validateTrigger,children:p.jsx(y,{field:t,disabled:f,readOnly:g,context:w})})},wZ=Object.freeze(Object.defineProperty({__proto__:null,FieldRenderer:vv},Symbol.toStringTag,{value:"Module"})),bZ={meta:{name:"antd-5x-apple-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#007AFF",colorInfo:"#007AFF",colorSuccess:"#34C759",colorWarning:"#FF9F0A",colorError:"#FF3B30",colorTextBase:"#0B0B0F",colorBgBase:"#FFFFFF",colorBorder:"#D1D1D6",colorBorderSecondary:"#E5E5EA",colorPrimaryBorder:"#007AFF",colorPrimaryBorderHover:"#007AFF",colorPrimaryHover:"#0066D6",colorPrimaryActive:"#0056B3",controlOutlineWidth:2,controlOutline:"rgba(0, 122, 255, 0.25)",fontFamily:'"SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:10,borderRadiusSM:8,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:52,sizeUnit:4,sizeStep:4,padding:16,paddingXS:10,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:10,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)",boxShadowSecondary:"0 6px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06)",boxShadowTertiary:"0 2px 8px rgba(0,0,0,0.08)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:18,paddingInlineLG:20,paddingInlineSM:14,contentFontSize:14,contentFontSizeLG:16,contentFontSizeSM:14,primaryShadow:"0 2px 0 rgba(0,122,255,0.14)",dangerShadow:"0 2px 0 rgba(255,59,48,0.12)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:14},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:44,controlHeightLG:52,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:44,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:14,paddingInlineSM:12,paddingInlineLG:14,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:12,borderRadius:10,hoverBorderColor:"#C7C7CC",activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Layout:{headerBg:"#FFFFFF",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F2F2F7",siderBg:"#FFFFFF",triggerBg:"#F2F2F7"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Menu:{itemHeight:44,iconSize:16,collapsedIconSize:18,horizontalItemBorderRadius:10,itemBorderRadius:10},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:14},Notification:{},Pagination:{itemSize:44,itemSizeSM:36},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#007AFF"},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F2F2F7",headerSortActiveBg:"#EDEDF2",headerSortHoverBg:"#F2F2F7",rowHoverBg:"#F2F2F7",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:36,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},vZ={meta:{name:"antd-5x-google-material3-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#1A73E8",colorInfo:"#1A73E8",colorSuccess:"#34A853",colorWarning:"#FBBC04",colorError:"#EA4335",colorTextBase:"#202124",colorBgBase:"#FFFFFF",colorBorder:"#DADCE0",colorBorderSecondary:"#E0E3E7",colorPrimaryBorder:"#1A73E8",colorPrimaryBorderHover:"#1A73E8",colorPrimaryHover:"#1967D2",colorPrimaryActive:"#174EA6",controlOutlineWidth:2,controlOutline:"rgba(26, 115, 232, 0.24)",fontFamily:'"Google Sans", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.5714285714285714,borderRadius:8,borderRadiusSM:4,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:56,controlHeightSM:40,controlHeightLG:64,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(60,64,67,0.16), 0 2px 6px rgba(60,64,67,0.12)",boxShadowSecondary:"0 2px 8px rgba(60,64,67,0.14)",boxShadowTertiary:"0 1px 3px rgba(60,64,67,0.12)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:40,controlHeightSM:32,controlHeightLG:48,paddingInline:24,paddingInlineLG:24,paddingInlineSM:16,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(26,115,232,0.20)",dangerShadow:"0 1px 0 rgba(234,67,53,0.18)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:4},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:40,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:14,paddingBlockSM:8,paddingBlockLG:16,borderRadius:4,hoverBorderColor:"#BDC1C6",activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},InputNumber:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Layout:{headerBg:"#202124",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8F9FA",siderBg:"#202124",triggerBg:"#303134"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:12,itemBorderRadius:12},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:16},Notification:{},Pagination:{itemSize:40,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#1A73E8"},Rate:{},Result:{},Segmented:{controlHeight:40},Select:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F8F9FA",headerSortActiveBg:"#F1F3F4",headerSortHoverBg:"#F3F5F6",rowHoverBg:"#F8F9FA",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 18px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},yZ={meta:{name:"antd-5x-preline-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#2563EB",colorInfo:"#2563EB",colorSuccess:"#16A34A",colorWarning:"#F59E0B",colorError:"#EF4444",colorTextBase:"#0F172A",colorBgBase:"#FFFFFF",colorBorder:"#E5E7EB",colorBorderSecondary:"#E5E7EB",colorPrimaryBorder:"#3B82F6",colorPrimaryBorderHover:"#3B82F6",colorPrimaryHover:"#1D4ED8",colorPrimaryActive:"#1E40AF",controlOutlineWidth:1,controlOutline:"rgba(59, 130, 246, 0.45)",fontFamily:'Graphik, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:8,borderRadiusSM:6,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:48,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(15,23,42,0.06), 0 6px 18px rgba(15,23,42,0.08)",boxShadowSecondary:"0 1px 2px rgba(15,23,42,0.05), 0 10px 24px rgba(15,23,42,0.10)",boxShadowTertiary:"0 1px 2px rgba(15,23,42,0.06)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:8,borderRadiusSM:8,borderRadiusLG:10,controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineLG:18,paddingInlineSM:12,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(37,99,235,0.18)",dangerShadow:"0 1px 0 rgba(239,68,68,0.16)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:36,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:10,borderRadius:8,hoverBorderColor:"#D1D5DB",activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Layout:{headerBg:"#0B1220",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8FAFC",siderBg:"#0B1220",triggerBg:"#0F1A2E"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:8,itemBorderRadius:8},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:12},Notification:{},Pagination:{itemSize:36,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:22,trackMinWidth:44,handleSize:18},Table:{headerBg:"#F8FAFC",headerSortActiveBg:"#F1F5F9",headerSortHoverBg:"#F3F6FB",rowHoverBg:"#F8FAFC",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:6,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:6},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}};function CZ(t){return"optionsSource"in t&&t.optionsSource&&t.optionsSource.kind!=="static"?t.optionsSource.deps||[]:[]}function kZ(t){const e=[];for(const n of t.fields){const r=CZ(n);if(r.length>0)for(const o of r)e.push({id:`auto-clear-${n.name}-on-${o}-change`,trigger:{type:"fieldChange",field:o},actions:[{type:"clearFields",targets:[n.name]}]})}return e}function SZ(t,e,n=!0){return[...n?kZ(t):[],...e||[]]}const xZ={default:sg,apple:bZ,google:vZ,preline:yZ};function yv({schema:t,disabled:e=!1,initialValues:n,onSubmit:r,onChange:o,onValuesObserved:i,submitLabel:s="提交",showReset:a=!1,resetLabel:l="重置",onReset:c,form:u,showSubmit:d=!0,optionsLoader:h,nodeId:f,mcpMode:m,validateVariable:g,renderVariableTag:v,renderVariableTooltip:w,availableVariables:b,theme:y,customTheme:k,locale:D,prefixCls:S,events:x,customHandlers:E,maxExecutionDepth:T,debugEvents:A,preRender:O}){var K;const[B]=_.Form.useForm(),M=u||B,I=_t.useMemo(()=>{const W={};for(const X of t.fields)X.defaultValue!==void 0&&(W[X.name]=X.defaultValue);return{...W,...n||{}}},[t.fields,n]),N=_t.useMemo(()=>{const W=t.enableAutoEvents!==!1,X=t.events||[],re=x||[];return SZ(t,[...X,...re],W)},[t,x]),P=L8({events:N,form:M,optionsLoader:h,customHandlers:E,maxExecutionDepth:T,debug:A}),F=_t.useRef({}),H=_t.useMemo(()=>{if(k)return k;if(y)return xZ[y]},[k,y]),V=_.Form.useWatch([],M),q=_t.useMemo(()=>JSON.stringify({...I||{},...V||{}}),[I,V]),Q=_t.useMemo(()=>({...I||{},...V||{}}),[q]),te=_t.useRef(q);_t.useEffect(()=>{!i||te.current===q||(te.current=q,i(Q))},[i,Q,q]);const[$,U]=_t.useState({}),R=_t.useRef({});_t.useEffect(()=>{var X;const W={};for(const re of t.fields){const Z=tu(re,Q);if(W[re.name]=Z,R.current[re.name]===!0&&Z===!1){const be=AJ(re),me=((X=re.visibleWhen)==null?void 0:X.clearOnHide)??!0;be==="unregister"&&M.setFieldValue(re.name,me?void 0:M.getFieldValue(re.name))}}R.current=W,U(re=>{const Z=Object.keys(re),ae=Object.keys(W);return Z.length===ae.length&&ae.every(be=>re[be]===W[be])?re:W})},[t.fields,M,Q]);const ee=async W=>{const X=t.pruneInvisibleOnSubmit===!1?W:TJ(t,W,$);await(r==null?void 0:r(X))},se=(W,X)=>{if(o==null||o(W,X),P.triggerFieldChange&&W){const re=F.current;for(const Z in W){const ae=hr(re,Z),be=W[Z];P.triggerFieldChange(Z,be,ae)}}F.current={...X}},he=d||a,j=_t.useMemo(()=>({nodeId:f,mcpMode:m,validateVariable:g,renderVariableTag:v,renderVariableTooltip:w,availableVariables:b}),[f,m,g,v,w,b]);return p.jsx(zS,{customTheme:H,locale:D,prefixCls:S,children:p.jsx(RS,{value:j,children:p.jsxs(_.Form,{form:M,disabled:e,autoComplete:"off",layout:t.layout||"vertical",labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,size:t.size,initialValues:I,onFinish:ee,onValuesChange:se,className:"workflow-config-form",children:[O,t.fields.map(W=>{if(!tu(W,Q))return null;const re=e||Wa(W.disabled,Q,!1),Z=Wa(W.required,Q,!1),ae=Es(W.rules||[],Q,W.type),be=(W.rules||[]).some(ue=>ue.type==="required"),me=Z&&!be?[bv(`${W.label||W.name}为必填项`),...ae]:ae;return p.jsx(vv,{field:W,disabled:re,required:Z,rules:me,values:Q,optionsLoader:h,validateVariable:g,renderVariableTag:v,renderVariableTooltip:w,eventHandlers:P.fieldEventHandlers,nodeId:f},W.name)}),he&&p.jsx(_.Form.Item,{wrapperCol:{offset:((K=t.labelCol)==null?void 0:K.span)||0},children:p.jsxs(_.Space,{children:[a&&p.jsx(_.Button,{disabled:e,onClick:()=>{M.resetFields(),c==null||c()},children:l}),d&&p.jsx(_.Button,{type:"primary",htmlType:"submit",children:s})]})})]})})})}const ou=()=>{const t=jt();return C.useCallback((e,n=!1)=>{if(/^https?:\/\//i.test(e)){window.open(e,"_blank");return}if(t.onNavigate){t.onNavigate(e,n);return}n?window.open(e,"_blank"):qu.push(e)},[t.onNavigate])},Cv=C.forwardRef((t,e)=>{const n=ou(),[r,o]=C.useState([]),[i,s]=C.useState("");C.useEffect(()=>{s(t.proxyId)},[t.proxyId]),C.useEffect(()=>{bm().then(c=>{o(c??[])})},[]);const a=()=>i;C.useImperativeHandle(e,()=>({getProxyId:a}));const l=c=>{s(c)};return p.jsxs(h$,{label:Y("link.flow.use_proxy_gateway"),children:[p.jsxs(_.Select,{className:"proxy_id_select",value:i,dropdownStyle:{zIndex:bd.nestedPopover},onChange:l,style:{width:"100%"},children:[p.jsx(_.Select.Option,{value:"0",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.do_not_use"})}),r.map(c=>p.jsx(_.Select.Option,{value:c.id,children:c.group_name},c.id))]}),p.jsxs("p",{className:"field-desc",children:[p.jsx(Oe.FormattedMessage,{id:"link.flow.private_network_deployment"}),p.jsx("span",{style:{margin:"0 2px"},onClick:()=>{n("/setting/gateway")},children:p.jsx(Oe.FormattedMessage,{id:"link.flow.proxy_gateway"})}),p.jsx(Oe.FormattedMessage,{id:"link.flow.secure_connection"})]})]})}),EZ="RDBMS_ACCOUNT",DZ=t=>t===EZ,vF=({formSchema:t,initialValues:e,connector:n,proxy_id:r,authType:o,onCancel:i,onSubmit:s})=>{var h;const[a]=_.Form.useForm(),l=C.useRef(null),c=(n==null?void 0:n.deployment_type)!=="SaasApp",u=DZ(o);C.useEffect(()=>{e&&a.setFieldsValue(e)},[a,e]);const d=async f=>{var g;const m=await a.validateFields();c&&(m.proxy_id=(g=l.current)==null?void 0:g.getProxyId()),s(m,f)};try{(h=t==null?void 0:t.fields)==null||h.forEach(f=>{f.valueModePolicy!=="TEXT"&&console.warn("config error: value mode policy is not TEXT")})}catch{console.warn("form schema fmt err")}return p.jsxs("div",{className:Oo.formLayout,children:[p.jsxs("div",{className:Oo.formContent,children:[p.jsx(yv,{schema:t,form:a,initialValues:e,showSubmit:!1,showReset:!1,customTheme:Ru}),c?p.jsx(Cv,{proxyId:r||"0",ref:l}):null]}),p.jsx("div",{className:Oo.formActions,children:p.jsxs(_.Space,{children:[p.jsx(_.Button,{onClick:i,children:"取消"}),u?p.jsx(_.Button,{onClick:()=>d(!0),children:"测试连接"}):null,p.jsx(_.Button,{type:"primary",onClick:()=>d(!1),children:"保存"})]})})]})},AZ=t=>p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",value:Qt(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD")))}}),_Z=t=>p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",showTime:!0,value:Qt(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD hh:mm:ss")))}}),TZ=({value:t=[],onChange:e,valueType:n})=>{const r=a=>{const l=[...t];l.splice(a,1),e==null||e(l)},o=()=>{e==null||e([...t,{key:"",value:""}])},i=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,key:l}:c))},s=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,value:l}:c))};return p.jsxs("div",{children:[t.map((a,l)=>p.jsxs(_.Space,{size:"small",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[p.jsx(_.Input,{value:a.key,onChange:c=>i(l,c.target.value),placeholder:"Key"}),p.jsx(_.Input,{placeholder:"Value",style:{width:300},value:a.value,onChange:c=>s(l,c.target.value)}),p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{r(l)}})]},a.key)),p.jsxs(_.Button,{type:"default",onClick:o,block:!0,children:[p.jsx(Kr,{size:16})," ",p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})]})]})},OZ=t=>null;class rp{constructor(e,n,r,o,i,s,a,l,c,u=0,d){this.p=e,this.stack=n,this.state=r,this.reducePos=o,this.pos=i,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let o=e.parser.context;return new rp(e,[],n,r,r,0,[],0,o?new yF(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,o=e&65535,{parser:i}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(o);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,o,!0),this.reducePos),o<i.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(o,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[o])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-d;if(o<i.minRepeatTerm||e&131072){let f=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,c,f,h+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=i.getGoto(f,o,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(o,c)}storeNode(e,n,r,o=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,o);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,o>4&&(o-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=o}}shift(e,n,r,o){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:s}=this.p;this.pos=o,!s.stateFlag(i,1)&&(o>r||n<=s.maxNode)&&(this.reducePos=o),this.pushState(i,Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=s.maxNode&&this.buffer.push(n,r,o,4)}else this.pos=o,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,o,4)}apply(e,n,r,o){e&65536?this.reduce(e):this.shift(e,n,r,o)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(n,o),this.buffer.push(r,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),o=e.bufferBase+n;for(;e&&o==e.bufferBase;)e=e.parent;return new rp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new NZ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let o=[];for(let i=0,s;i<n.length;i+=2)(s=n[i+1])!=this.state&&this.p.parser.hasAction(s,e)&&o.push(n[i],s);if(this.stack.length<120)for(let i=0;o.length<8&&i<n.length;i+=2){let s=n[i+1];o.some((a,l)=>l&1&&a==s)||o.push(n[i],s)}n=o}let r=[];for(let o=0;o<n.length&&r.length<4;o+=2){let i=n[o+1];if(i==this.state)continue;let s=this.split();s.pushState(i,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[o],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,o=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],o,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(o,i)=>{if(!n.includes(o))return n.push(o),e.allActions(o,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-i;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new yF(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class yF{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class NZ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=o}}class op{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new op(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new op(this.stack,this.pos,this.index)}}function ip(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,o=0;r<t.length;){let i=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){i=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[o++]=i:n=new e(i)}return n}class sp{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const CF=new sp;class MZ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=CF,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,o=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!o)return null;let s=this.ranges[--o];i-=r.from-s.to,r=s}for(;n<0?i>r.to:i>=r.to;){if(o==this.ranges.length-1)return null;let s=this.ranges[++o];i+=s.from-r.to,r=s}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,o;if(n>=0&&n<this.chunk.length)r=this.pos+e,o=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),o=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),o}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=CF,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let o of this.ranges){if(o.from>=n)break;o.to>e&&(r+=this.input.read(Math.max(o.from,e),Math.min(o.to,n)))}return r}}class ja{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;BZ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}ja.prototype.contextual=ja.prototype.fallback=ja.prototype.extend=!1,ja.prototype.fallback=ja.prototype.extend=!1;function BZ(t,e,n,r,o,i){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let f=s+3;f<c;f+=2)if((t[f+1]&a)>0){let m=t[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||FZ(m,e.token.value,o,i))){e.acceptToken(m);break}}let u=e.next,d=0,h=t[s+2];if(e.next<0&&h>d&&t[c+h*3-3]==65535){s=t[c+h*3-1];continue e}for(;d<h;){let f=d+h>>1,m=c+f+(f<<1),g=t[m],v=t[m+1]||65536;if(u<g)h=f;else if(u>=v)d=f+1;else{s=t[m+2],e.advance();continue e}}break}}function kF(t,e,n){for(let r=e,o;(o=t[r])!=65535;r++)if(o==n)return r-e;return-1}function FZ(t,e,n,r){let o=kF(n,r,e);return o<0||kF(n,r,t)<o}const or=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let kv=null;function SF(t,e,n){let r=t.cursor(Nt.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class IZ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?SF(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?SF(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],o=this.index[n];if(o==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[o],s=this.start[n]+r.positions[o];if(s>e)return this.nextStart=s,null;if(i instanceof Lt){if(s==e){if(s<this.safeFrom)return null;let a=s+i.length;if(a<=this.safeTo){let l=i.prop(nt.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,s+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+i.length}}}class PZ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new sp)}getActions(e){let n=0,r=null,{parser:o}=e.p,{tokenizers:i}=o,s=o.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<i.length;c++){if((1<<c&s)==0)continue;let u=i[c],d=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=s||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=s,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let h=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!u.extend&&(r=d,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new sp,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new sp,{pos:r,p:o}=e;return n.start=r,n.end=Math.min(r+1,o.stream.end),n.value=r==o.stream.end?o.parser.eofTerm:0,n}updateCachedToken(e,n,r){let o=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(o,e),r),e.value>-1){let{parser:i}=r.p;for(let s=0;s<i.specialized.length;s++)if(i.specialized[s]==e.value){let a=i.specializers[s](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,n,r,o){for(let i=0;i<o;i+=3)if(this.actions[i]==e)return o;return this.actions[o++]=e,this.actions[o++]=n,this.actions[o++]=r,o}addActions(e,n,r,o){let{state:i}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(i,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Ko(a,c+2);else{o==0&&a[c+1]==2&&(o=this.putAction(Ko(a,c+2),n,r,o));break}a[c]==n&&(o=this.putAction(Ko(a,c+1),n,r,o))}return o}}class LZ{constructor(e,n,r,o){this.parser=e,this.input=n,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new MZ(n,o),this.tokens=new PZ(e,this.stream),this.topTerm=e.top[1];let{from:i}=o[0];this.stacks=[rp.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new IZ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],o,i;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{o||(o=[],i=[]),o.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let s=o&&HZ(o);if(s)return or&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw or&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&o){let s=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,i,r);if(s)return or&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,l)=>l.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let a=r[s];for(let l=s+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(s--,1);continue e}}}r.length>12&&(r.sort((s,a)=>a.score-s.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)r[s].pos<this.minStackPos&&(this.minStackPos=r[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let o=e.pos,{parser:i}=this,s=or?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(o);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(e.state,d.type.id):-1;if(h>-1&&d.length&&(!c||(d.prop(nt.contextHash)||0)==u))return e.useNode(d,h),or&&console.log(s+this.stackID(e)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof Lt)||d.children.length==0||d.positions[0]>0)break;let f=d.children[0];if(f instanceof Lt&&d.positions[0]==0)d=f;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),or&&console.log(s+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],h=l[c++],f=c==l.length||!r,m=f?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,d,g?g.start:m.pos,h),or&&console.log(s+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${i.getName(u&65535)}`} for ${i.getName(d)} @ ${o}${m==e?"":", split"})`),f)return!0;m.pos>o?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return xF(e,n),!0}}runRecovery(e,n,r){let o=null,i=!1;for(let s=0;s<e.length;s++){let a=e[s],l=n[s<<1],c=n[(s<<1)+1],u=or?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),or&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let d=a.split(),h=u;for(let f=0;f<10&&d.forceReduce()&&(or&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,r));f++)or&&(h=this.stackID(d)+" -> ");for(let f of a.recoverByInsert(l))or&&console.log(u+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),or&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),xF(a,r)):(!o||o.score<d.score)&&(o=d)}return o}stackToTree(e){return e.close(),Lt.build({buffer:op.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(kv||(kv=new WeakMap)).get(e);return n||kv.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function xF(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class $Z{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class ap extends lx{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),o=[];for(let a=0;a<n.length;a++)o.push([]);function i(a,l,c){o[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=nt[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let d=a[c+-u];for(let h=-u;h>0;h--)i(a[c++],l,d);c++}}}this.nodeSet=new dg(n.map((a,l)=>Hn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:o[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=tx;let s=ip(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(EF),this.states=ip(e.states,Uint32Array),this.data=ip(e.stateData),this.goto=ip(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new ja(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let o=new LZ(this,e,n,r);for(let i of this.wrappers)o=i(o,e,n,r);return o}getGoto(e,n,r=!1){let o=this.goto;if(n>=o[0])return-1;for(let i=o[n+1];;){let s=o[i++],a=s&1,l=o[i++];if(a&&r)return l;for(let c=i+(s>>1);i<c;i++)if(o[i]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let o=0;o<2;o++)for(let i=this.stateSlot(e,o?2:1),s;;i+=3){if((s=r[i])==65535)if(r[i+1]==1)s=r[i=Ko(r,i+2)];else{if(r[i+1]==2)return Ko(r,i+2);break}if(s==n||s==0)return Ko(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),o=r?n(r):void 0;for(let i=this.stateSlot(e,1);o==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Ko(this.data,i+2);else break;o=n(Ko(this.data,i+1))}return o}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Ko(this.data,r+2);else break;if((this.data[r+2]&1)==0){let o=this.data[r+1];n.some((i,s)=>s&1&&i==o)||n.push(this.data[r],o)}}return n}configure(e){let n=Object.assign(Object.create(ap.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let o=e.tokenizers.find(i=>i.from==r);return o?o.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,o)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let s=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[o]=EF(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let s=n.indexOf(i);s>=0&&(r[s]=!0)}let o=null;for(let i=0;i<n.length;i++)if(!r[i])for(let s=this.dialects[n[i]],a;(a=this.data[s++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[a]=1;return new $Z(e,r,o)}static deserialize(e){return new ap(e)}}function Ko(t,e){return t[e]|t[e+1]<<16}function HZ(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function EF(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const VZ=cx({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,", :":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),zZ=ap.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[VZ],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),WZ=dh.define({name:"json",parser:zZ.configure({props:[WD.add({Object:UD({except:/^\s*\}/}),Array:UD({except:/^\s*\]/})}),RD.add({"Object Array":Tz})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Sv(){return new wz(WZ)}const jZ=t=>p.jsx(Hc,{height:"300px",style:{borderRadius:4,overflow:"hidden"},theme:bh,extensions:[Sv()],...t}),{Text:UZ}=_.Typography,RZ=t=>p.jsx("div",{style:{padding:6,paddingRight:0,border:"1px solid #b0b5cb",borderRadius:4},children:p.jsx(_.Tooltip,{title:t.value,color:"cyan",placement:"topLeft",styles:{body:{width:500}},children:p.jsx(UZ,{style:{color:"#b0b5cb"},ellipsis:!0,copyable:{text:t.value},children:t.value})})}),qZ=t=>p.jsx(_.Input.Password,{addonBefore:Y("link.flow.cipherText"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),GZ=t=>{var r;const{multiple:e,...n}=t;return p.jsx(_.Select,{style:{borderRadius:6},mode:e?"multiple":void 0,...n,getPopupContainer:o=>o.parentNode,children:(r=t==null?void 0:t.options)==null?void 0:r.map(o=>p.jsx(_.Select.Option,{label:o.label,value:o.value,children:o.label},o.value))})},{TextArea:KZ}=_.Input,YZ=t=>p.jsx(KZ,{value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),XZ=t=>p.jsx(_.Input,{addonBefore:Y("link.flow.text"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),JZ=t=>p.jsx(_.TimePicker,{style:{width:"100%"},value:Qt(t.value??"00:00:00","HH:mm:ss"),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("HH:mm:ss")))}}),QZ={configFormContainer:"_configFormContainer_s061b_1"},ZZ=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],xv=t=>Array.isArray(t)?t.map(e=>{if(typeof e=="string"){const s=e.trim();return s?{label:s,value:s}:null}const n=(e==null?void 0:e.value)??(e==null?void 0:e.label)??"",r=n==null?"":String(n).trim();if(!r)return null;const o=(e==null?void 0:e.label)??"";return{label:o==null?r:String(o).trim()||r,value:r}}).filter(Boolean):[],eee=t=>{const e=t.display_name;switch(t.page_control){case Ee.SELECT:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_select")+t.display_name}],label:e,name:t.name,children:p.jsx(GZ,{options:xv(t.option_value_objects??t.option_values),multiple:t.multi_valued})},t.ui_id);case Ee.EXTEND_OBJ:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(TZ,{valueType:t.value_type})},t.ui_id);case Ee.HIDDEN:return p.jsx(_.Form.Item,{style:{display:"none"},required:t.required,label:e,name:t.name,children:p.jsx(OZ,{})},t.ui_id);case Ee.TEXT:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(XZ,{})},t.ui_id);case Ee.PASSWORD:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(qZ,{})},t.ui_id);case Ee.LABEL:return p.jsx(_.Form.Item,{required:t.required,label:e,name:t.name,children:p.jsx(RZ,{})},t.ui_id);case Ee.DATE:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(AZ,{})},t.ui_id);case Ee.TIME:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(JZ,{})},t.ui_id);case Ee.DATETIME:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(_Z,{})},t.ui_id);case Ee.TEXTAREA:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(YZ,{})},t.ui_id);case Ee.FIXED_OBJ:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(_.Input.TextArea,{})},t.ui_id);case Ee.JSON:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(jZ,{})},t.ui_id)}},tee=t=>{switch(t.page_control){case Ee.SELECT:return t.multi_valued?[]:null;case Ee.EXTEND_OBJ:return{};case Ee.HIDDEN:return"";case Ee.TEXT:return"";case Ee.PASSWORD:return"";case Ee.LABEL:return"";case Ee.DATE:return null;case Ee.TIME:return null;case Ee.DATETIME:return null;case Ee.TEXTAREA:return"";case Ee.FIXED_OBJ:return"";case Ee.JSON:return JSON.stringify({})}},DF=C.memo(t=>{var c;const{config:e,proxy_id:n,connector:r}=t,[o]=_.Form.useForm(),i=C.useRef(null),s=It.useReactive({proxyId:"0"});C.useEffect(()=>{var u;(u=e==null?void 0:e.sub_params)!=null&&u.length&&o.setFieldsValue({...e.sub_params.reduce((d,h)=>{let f=h.value;return h.page_control===Ee.EXTEND_OBJ&&(f=ZZ(f)),d[h.name]=f??tee(h),d},{})})},[e,o]),C.useEffect(()=>{n&&(s.proxyId=n)},[n]);const a=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u)})},l=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u,!0)})};return p.jsxs("div",{className:Oo.formLayout,style:{position:"relative"},onClick:u=>{u.stopPropagation(),u.preventDefault()},children:[p.jsx("div",{className:Oo.formContent,children:p.jsxs(_.Form,{form:o,layout:"vertical",className:`${QZ.configFormContainer} workflow-credential-form`,children:[(c=e==null?void 0:e.sub_params)==null?void 0:c.map(u=>p.jsxs("div",{children:[eee(u),u.page_control!==Ee.HIDDEN&&p.jsx("p",{className:"field-desc",children:u.description})]},u.ui_id)),r.deployment_type!=="SaasApp"?p.jsx(Cv,{proxyId:s.proxyId,ref:i}):null]})}),t.auth_type==="RDBMS_ACCOUNT"&&p.jsx("div",{className:Oo.rdbmsTestAction,children:p.jsx(_.Button,{type:"primary",style:{width:"100%"},onClick:l,children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.connection-test"})})}),p.jsxs("div",{className:Oo.formActions,children:[p.jsx(_.Button,{icon:p.jsx(ie.RollbackOutlined,{}),style:{width:90,borderRadius:4,marginRight:10},onClick:t.onCancel,children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.cancel"})}),p.jsx(_.Button,{type:"primary",icon:p.jsx(ie.CloudUploadOutlined,{}),style:{width:90,borderRadius:4},onClick:()=>a(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})]})]})}),nee={overflow:"hidden"},ree=72,oee=16,iee=t=>{const{visible:e,connector:n,config:r,formSchema:o,onCancel:i,onSubmit:s,auth_type:a,inAI:l}=t;return p.jsx(_.Modal,{title:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-account"}),style:{marginTop:0,paddingBottom:0,position:"absolute",top:ree,bottom:oee,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Oo.accountModal,mask:!1,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:bd.nestedModal,width:560,styles:{body:nee},footer:null,maskClosable:!l,open:e,onCancel:i,children:o?p.jsx(vF,{formSchema:o,connector:n,authType:a,onCancel:i,onSubmit:s}):p.jsx(DF,{config:r,connector:n,nodeId:"",auth_type:a,onCancel:i,onSubmit:s})})},see={overflow:"hidden"},aee=72,lee=16,cee=t=>{const{visible:e,connector:n,config:r,formSchema:o,initialValues:i,onCancel:s,onSubmit:a,auth_type:l,proxy_id:c,inAI:u}=t;return p.jsx(_.Modal,{title:Y("link.flow.edit_account"),mask:!1,style:{marginTop:0,paddingBottom:0,position:"absolute",top:aee,bottom:lee,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Oo.accountModal,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:bd.nestedModal,width:560,footer:null,styles:{body:see},open:e,maskClosable:!u,onCancel:s,children:o?p.jsx(vF,{formSchema:o,initialValues:i,connector:n,proxy_id:c,authType:l,onCancel:s,onSubmit:a}):p.jsx(DF,{config:r,proxy_id:c,connector:n,nodeId:"",auth_type:l,onCancel:s,onSubmit:a})})},As={accountOption:"_accountOption_4vdjt_14",accountName:"_accountName_4vdjt_21",nameEditIcon:"_nameEditIcon_4vdjt_34",editInputWrapper:"_editInputWrapper_4vdjt_44",nameEditInput:"_nameEditInput_4vdjt_48",accountActions:"_accountActions_4vdjt_53",updateTime:"_updateTime_4vdjt_58"},uee=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],Ev=(t=[])=>{const e={};return t.forEach(n=>{e[n.key]=n.value}),e},dee={eq:"EQ",ne:"NOT",in:"IN",notin:"NOT_IN",not_in:"NOT_IN",gt:"GT",lt:"LT",gte:"GE",lte:"LE"};function hee(t){if(!(t!=null&&t.field)||!t.operator)return;const e=dee[String(t.operator).toLowerCase()];if(e)return{deps:[t.field],conditions:{key:t.field,keyword:e,value:t.value}}}function fee(t){return Sn(t.visible_when)??hee(t.display_condition)}const AF={STRING:we.TEXT,TEXTAREA:we.TEXTAREA,PASSWORD:we.PASSWORD,HIDDEN:we.HIDDEN,NUMBER:we.NUMBER,BOOLEAN:we.SWITCH,SELECT:we.SELECT,DATETIME:we.DATETIME,CODE:we.CODE,PROXY:we.PROXY,GLOBAL_VARIABLE_KEY:we.GLOBAL_VARIABLE_KEY,OBJECT:we.OBJECT,ARRAY:we.ARRAY,DYNAMIC_ARRAY:we.ARRAY,KEYVALUE:we.KEY_VALUE},pee=t=>String(t.type??"").toUpperCase(),mee=t=>t.item_schema??[],_F=t=>String(t.item_type??"").toUpperCase(),Sn=t=>t??void 0,gee=t=>Object.fromEntries((t??[]).map(e=>[e.key,Av(e)])),wee=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?we.DATE:e==="TIME"?we.TIME:we.DATETIME},Dv=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?"YYYY-MM-DD":e==="TIME"?"HH:mm:ss":"YYYY-MM-DD HH:mm:ss"},bee=t=>({type:AF[_F(t)]||we.TEXT,name:"item",label:t.item_label||"项"});function vee(t){if(!t)return[];const e=[],n=t.minLength??t.min_length,r=t.maxLength??t.max_length;return n!=null&&e.push({type:"min",value:n,message:`最少 ${n} 个字符`}),r!=null&&e.push({type:"max",value:r,message:`最多 ${r} 个字符`}),t.pattern&&e.push({type:"pattern",value:t.pattern,message:"格式不正确"}),t.min!=null&&e.push({type:"min",value:t.min,message:`最小值 ${t.min}`}),t.max!=null&&e.push({type:"max",value:t.max,message:`最大值 ${t.max}`}),e}function Av(t){var o,i,s;const e=pee(t),n=e==="DATETIME"?wee(t):AF[e]||e,r={type:n,name:t.key,label:t.label||t.key,placeholder:Sn(t.placeholder),helpText:Sn(t.help_text),defaultValue:Sn(t.default_value),required:Sn(t.required),disabled:Sn(t.disabled),visibleWhen:fee(t),rules:vee(t.validation),valueModePolicy:Sn(t.value_mode_policy)};switch(n){case we.SELECT:return{...r,type:we.SELECT,options:(o=t.options)==null?void 0:o.map(a=>({label:a.label,value:a.value})),showSearch:!0,allowClear:!0};case we.NUMBER:return{...r,type:we.NUMBER,min:Sn((i=t.validation)==null?void 0:i.min),max:Sn((s=t.validation)==null?void 0:s.max)};case we.DATETIME:return{...r,type:we.DATETIME,showTime:!0,format:Dv(t),outputFormat:"string"};case we.DATE:return{...r,type:we.DATE,format:Dv(t),outputFormat:"string"};case we.TIME:return{...r,type:we.TIME,format:Dv(t),outputFormat:"string"};case we.OBJECT:return{...r,type:we.OBJECT,properties:gee(t.properties)};case we.ARRAY:if(_F(t)==="OBJECT"){const a=mee(t).map(Av);return{...r,type:we.ARRAY_OBJECT,columns:a,minItems:Sn(t.min_items),maxItems:Sn(t.max_items),columnLayout:a.length>1?"grid":"vertical",titleFieldName:void 0}}return{...r,type:we.ARRAY,itemSchema:bee(t),minItems:Sn(t.min_items),maxItems:Sn(t.max_items),itemLabel:Sn(t.item_label)};case we.KEY_VALUE:return{...r,type:we.KEY_VALUE,keyPlaceholder:Sn(t.key_placeholder),valuePlaceholder:Sn(t.value_placeholder)};default:return r}}function TF(t){return{fields:t.map(Av),layout:"vertical"}}const OF=(...t)=>{for(const e of t)if(typeof e=="string"&&e.trim())return e.trim()};function yee(t){if(!t)return null;const e=OF(t.key,t.credentialKey,t.name);return e?{key:e,label:OF(t.displayName,t.label,t.name,e)??e,required:t.required===!0}:null}function _v(t){if(!Array.isArray(t))return[];const e=[],n=new Set;for(const r of t){const o=yee(r);!o||n.has(o.key)||(n.add(o.key),e.push(o))}return e}function Cee(t){var n,r;const e=_v(t);return((n=e.find(o=>o.required))==null?void 0:n.key)??((r=e[0])==null?void 0:r.key)}const kee=_.Form.Item,{Option:See}=_.Select,{Text:xee,Title:whe}=_.Typography,Ua="[workflow:account-debug]",Eee=t=>!!(t&&/^\d+$/.test(t)),_s=t=>t&&typeof t=="object"&&!Array.isArray(t)?Object.keys(t):[],Dee=t=>Array.isArray(t)?t.map(e=>e==null?void 0:e.key).filter(Boolean):[],Aee=t=>!!(t&&typeof t=="object"&&Array.isArray(t.sub_params)),_ee=t=>[t==null?void 0:t.auth_schema,t==null?void 0:t.config_schema,t==null?void 0:t.schema,t].find(Aee)??{},NF=t=>{var o,i,s,a,l;const e=(o=t==null?void 0:t.credential_schema)==null?void 0:o.fields,n=(i=t==null?void 0:t.auth_schema)==null?void 0:i.sub_params,r=((s=t==null?void 0:t.config_schema)==null?void 0:s.sub_params)??(t==null?void 0:t.sub_params);return{type:Array.isArray(t)?"array":t===null?"null":typeof t,keys:_s(t),id:t==null?void 0:t.id,auth_type:t==null?void 0:t.auth_type,account_key:(t==null?void 0:t.account_key)??((a=t==null?void 0:t.credential_schema)==null?void 0:a.key),account_ver:(t==null?void 0:t.account_ver)??((l=t==null?void 0:t.credential_schema)==null?void 0:l.version),credentialSchemaKeys:_s(t==null?void 0:t.credential_schema),credentialFieldCount:Array.isArray(e)?e.length:void 0,credentialFieldKeys:Dee(e),authSchemaKeys:_s(t==null?void 0:t.auth_schema),authSchemaSubParamCount:Array.isArray(n)?n.length:void 0,authSchemaSubParamNames:Array.isArray(n)?n.map(c=>c==null?void 0:c.name).filter(Boolean):void 0,configSchemaKeys:_s(t==null?void 0:t.config_schema),configSubParamCount:Array.isArray(r)?r.length:void 0}},Tv=t=>({keys:_s(t),subParamCount:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.length:0,subParamNames:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.name).filter(Boolean):[],subParamControls:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.page_control).filter(Boolean):[]}),lp=(t,e)=>{var n,r;return{account_key:(t==null?void 0:t.account_key)??((n=t==null?void 0:t.credential_schema)==null?void 0:n.key)??e??null,account_ver:(t==null?void 0:t.account_ver)??((r=t==null?void 0:t.credential_schema)==null?void 0:r.version)??null}},MF=t=>{const e=t==null?void 0:t.credential_schema,n=e==null?void 0:e.fields;return(!Array.isArray(n)||!n.length)&&console.warn(`${Ua} credential_schema.fields missing or empty`,{model:NF(t)}),Array.isArray(n)&&n.length?TF(n):null},Tee=({value:t,onChange:e,linkApp:n,actionAccountSchemaId:r,selectTitle:o="授权配置",disabled:i=!1,placeholder:s="请选择账号"})=>{const[a,l]=C.useState([]),[c,u]=C.useState(!1),[d,h]=C.useState(!1),[f,m]=C.useState(!1),g=C.useRef(null),v=C.useRef(null),w=_.Form.useFormInstance(),b=C.useMemo(()=>r?`_account_${r}`:"_account",[r]);C.useEffect(()=>{w&&w.validateFields([b]).catch(()=>{})},[t,w,b]);const y=It.useReactive({createModalVisible:!1,modifyModalVisible:!1,configModel:{},credentialFormSchema:null,credentialInitialValues:{},schemaMeta:{},account_scheme_id:"",name:"",auth_type:"",modifyId:"",proxy_id:"",editId:"",editValue:"",createLoading:!1,createRequestLock:!1,isEditing:!1}),k=r==null?void 0:String(r),D=async()=>{if(!(!(n!=null&&n.id)&&!k)){u(!0);try{const F=Eee(k)?n==null?void 0:n.id:void 0,H=await _k(F,k);H?l(H.items||[]):_.message.error("获取账号列表失败")}catch(F){console.error(`${Ua} 获取账号列表失败:`,F),_.message.error("获取账号列表失败")}finally{u(!1)}}};C.useEffect(()=>{D()},[n==null?void 0:n.id,k]),C.useEffect(()=>{y.editId&&g.current&&setTimeout(()=>{var F;(F=g.current)==null||F.focus()},100)},[y.editId]);const S=F=>{if(f){h(!0);return}h(F)},x=()=>{if(!y.editId||!y.editValue){y.editId="",y.isEditing=!1,m(!1);return}kk(y.editId,y.editValue).then(()=>{D(),y.editId="",y.editValue="",y.isEditing=!1,m(!1),_.message.success(Y("link.flow.modification_success"))}).catch(()=>{y.editId="",y.isEditing=!1,m(!1)})},E=(F,H,V)=>{F.stopPropagation(),F.preventDefault(),y.isEditing=!0,m(!0),h(!0),y.editId=H,y.editValue=V,setTimeout(()=>{v.current&&v.current.focus()},0)},T=F=>{F.stopPropagation(),F.preventDefault(),m(!0)},A=F=>{y.isEditing||e&&e(F)},O=()=>{if(!k){_.message.error("未配置账号模式");return}y.createLoading=!0,km(k).then(F=>{var Q;const H=MF(F),V=lp(F,k),q=H?{}:_ee(F);H||console.warn(`${Ua} create modal will use legacy DynamicAccountForm`,{reason:"credentialFormSchema is null",model:NF(F),configModel:Tv(q)}),y.credentialFormSchema=H,y.credentialInitialValues={},y.schemaMeta=V,y.configModel=q,y.account_scheme_id=F.id,y.name=F.name,y.auth_type=F.auth_type??((Q=F.credential_schema)==null?void 0:Q.type),y.createModalVisible=!0}).catch(F=>{console.error(`${Ua} account model load failed for create`,{schemaId:k,error:F})}).finally(()=>{y.createLoading=!1})},B=F=>{vk(F).then(async H=>{var R;const V=H.account_schema_id,q=H.account_key,Q=H.account_ver,te=q??V??k;let $=null;if(te)try{$=await km(String(te),Q)}catch(ee){console.error("获取账号模型失败:",ee)}const U=MF($);y.credentialFormSchema=U,y.credentialInitialValues=U?H.config??{}:{},y.schemaMeta={...lp($,q??k),account_key:q??lp($,k).account_key,account_ver:Q??lp($).account_ver},y.configModel=U?{}:H.config,y.account_scheme_id=V??($==null?void 0:$.id)??H.id,y.name=H.name,y.proxy_id=H.proxy_id,y.auth_type=H.auth_type??($==null?void 0:$.auth_type)??((R=$==null?void 0:$.credential_schema)==null?void 0:R.type)??"",y.modifyId=F,y.modifyModalVisible=!0})},M=C.useCallback((F,H)=>{if(y.createRequestLock)return;let V=F;if(!y.credentialFormSchema){if(V=Kt.cloneDeep(y.configModel),!Array.isArray(V==null?void 0:V.sub_params)){console.error(`${Ua} create account legacy config has no sub_params`,{configModel:Tv(y.configModel),valueKeys:_s(F)}),_.message.error("账号模型配置为空,无法保存");return}V.sub_params.forEach(Q=>{let te=F[Q.name];Q.page_control===Ee.EXTEND_OBJ&&(te=Ev(te)),Q.value=te})}const q=F.proxy_id;delete F.proxy_id,y.createRequestLock=!0,H?xm((n==null?void 0:n.id)??null,y.account_scheme_id,y.auth_type,y.name,V,y.modifyId,q,y.schemaMeta).then(Q=>{Q&&_.message.success("测试连接成功!")}).finally(()=>{y.createRequestLock=!1}):yk((n==null?void 0:n.id)??null,y.account_scheme_id,y.auth_type,y.name,V,q,y.schemaMeta).then(()=>{_.message.success(Y("link.flow.creation_success")),D(),y.createModalVisible=!1}).finally(()=>{y.createRequestLock=!1})},[]),I=C.useCallback(()=>{y.createModalVisible=!1},[]),N=(F,H)=>{let V=F;if(!y.credentialFormSchema){if(V=Kt.cloneDeep(y.configModel),!Array.isArray(V==null?void 0:V.sub_params)){console.error(`${Ua} modify account legacy config has no sub_params`,{configModel:Tv(y.configModel),valueKeys:_s(F)}),_.message.error("账号模型配置为空,无法保存");return}V.sub_params.forEach(Q=>{let te=F[Q.name];Q.page_control===Ee.EXTEND_OBJ&&(te=Ev(te)),Q.value=te})}const q=F.proxy_id;delete F.proxy_id,H?xm((n==null?void 0:n.id)??null,y.account_scheme_id,y.auth_type,y.name,V,y.modifyId,q,y.schemaMeta).then(Q=>{Q&&_.message.success("测试连接成功!")}):Ck(y.modifyId,null,null,null,null,V,q,y.schemaMeta).then(()=>{_.message.success(Y("link.flow.modification_success")),D(),y.modifyModalVisible=!1,y.modifyId=""})},P=F=>p.jsxs("div",{children:[F,p.jsx(_.Divider,{style:{margin:"4px 0"}}),p.jsx("div",{style:{padding:"4px",textAlign:"center"},children:p.jsx(_.Button,{icon:p.jsx(ie.UserAddOutlined,{}),onClick:O,loading:y.createLoading,type:"link",block:!0,children:"创建新账号"})})]});return p.jsxs(p.Fragment,{children:[p.jsx(kee,{label:o,layout:"vertical",required:!0,name:b,initialValue:t,rules:[{validator:()=>t?Promise.resolve():Promise.reject(new Error(s||"请选择账号"))}],children:p.jsx(_.Select,{ref:v,value:t,onChange:A,style:{width:"100%"},placeholder:s,disabled:i,loading:c,allowClear:!0,popupRender:P,classNames:{popup:{root:"workflow-account-select__popup"}},listHeight:320,open:d,onOpenChange:S,children:a.map(F=>p.jsx(See,{value:F.id,children:p.jsxs("div",{className:As.accountOption,onClick:H=>{y.isEditing&&H.stopPropagation()},children:[p.jsx("div",{className:`${As.accountName} workflow-account-select__name`,children:y.editId!==F.id?p.jsxs(C.Fragment,{children:[p.jsx("span",{children:F.name}),p.jsx(ie.EditOutlined,{className:`${As.nameEditIcon} workflow-account-select__edit`,onClick:H=>E(H,F.id,F.name)})]}):p.jsx("div",{className:As.editInputWrapper,onClick:T,children:p.jsx(_.Input,{ref:g,defaultValue:F.name,className:As.nameEditInput,onClick:T,onMouseDown:H=>{H.stopPropagation(),H.preventDefault()},onFocus:H=>{H.stopPropagation(),m(!0)},onPressEnter:H=>{H.stopPropagation(),H.preventDefault(),x()},onBlur:()=>{x()},onChange:H=>{y.editValue=H.target.value}})})}),p.jsxs("div",{className:As.accountActions,children:[p.jsx(xee,{type:"secondary",className:As.updateTime,children:Qt(Number(F.update_time)*1e3).format("YYYY-MM-DD HH:mm:ss")}),p.jsx(_.Button,{type:"link",icon:p.jsx(ie.FileSearchOutlined,{}),size:"small",onClick:H=>{H.stopPropagation(),B(F.id)},children:"编辑"})]})]})},F.id))})}),p.jsx(iee,{onSubmit:M,onCancel:I,inAI:!0,auth_type:y.auth_type,config:y.configModel,formSchema:y.credentialFormSchema,visible:y.createModalVisible,connector:n}),p.jsx(cee,{onSubmit:N,inAI:!0,onCancel:()=>{y.modifyModalVisible=!1},proxy_id:y.proxy_id,auth_type:y.auth_type,config:y.configModel,formSchema:y.credentialFormSchema,initialValues:y.credentialInitialValues,visible:y.modifyModalVisible,connector:n})]})},BF=({credentialRequirements:t,actionAccountSchemaId:e,value:n,onChange:r,...o})=>{var l;const i=C.useMemo(()=>{const c=e?[{key:String(e)}]:[];return _v(t!=null&&t.length?t:c)},[e,t]),[s,a]=C.useState(n?(l=i[0])==null?void 0:l.key:void 0);return C.useEffect(()=>{var c;if(!n){a(void 0);return}!s&&((c=i[0])!=null&&c.key)&&a(i[0].key)},[s,i,n]),i.length===0?null:p.jsx(C.Fragment,{children:i.map(c=>p.jsx(Tee,{...o,actionAccountSchemaId:c.key,selectTitle:i.length>1?c.label:"授权配置",value:s===c.key?n:void 0,onChange:u=>{a(u?c.key:void 0),r==null||r(u)}},c.key))})},Oee=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Nee=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=C.useState(e||""),[s,a]=C.useState(!1);C.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const h=Oee();i(h),a(!0),n==null||n(h)},c=()=>{l()},u=async()=>{if(!o){_.message.warning(Y("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(Y("components.authTokenField.copySuccess"))}catch{_.message.error(Y("components.authTokenField.copyFailed"))}},d=()=>{a(h=>!h)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:Y("components.authTokenField.placeholder")}),p.jsx(_.Tooltip,{title:Y("components.authTokenField.copy"),children:p.jsx(_.Button,{icon:p.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:p.jsx(_.Button,{icon:s?p.jsx(ie.EyeInvisibleOutlined,{}):p.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:p.jsx(_.Button,{icon:p.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},Mee=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Bee=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=C.useState(e||""),[s,a]=C.useState(!1);C.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const h=Mee();i(h),a(!0),n==null||n(h)},c=()=>{if(!o){l();return}_.Modal.confirm({title:Y("common.info"),content:Y("components.authTokenField.regenerateConfirm"),okText:Y("app.common.word.confirm"),cancelText:Y("app.common.word.cancel"),onOk:l})},u=async()=>{if(!o){_.message.warning(Y("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(Y("components.authTokenField.copySuccess"))}catch{_.message.error(Y("components.authTokenField.copyFailed"))}},d=()=>{a(h=>!h)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:Y("components.authTokenField.placeholder")}),p.jsx(_.Tooltip,{title:Y("components.authTokenField.copy"),children:p.jsx(_.Button,{icon:p.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:p.jsx(_.Button,{icon:s?p.jsx(ie.EyeInvisibleOutlined,{}):p.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:p.jsx(_.Button,{icon:p.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},FF=10,Fee=["OAUTH","OAUTH2","OIDC"],Iee=t=>{const e=new Set([...t.support_protocol??[],...t.auth_protocol?[t.auth_protocol]:[]]);return Array.from(e).some(n=>Fee.includes(n))},Pee=t=>{const{value:e,onChange:n,disabled:r}=t,o=ou(),[i,s]=C.useState([]),[a,l]=C.useState(!1),[c,u]=C.useState(!1),[d,h]=C.useState(""),[f,m]=C.useState(1),[g,v]=C.useState(!1),w=C.useRef(0),b=C.useMemo(()=>`${window.location.origin}/iam/token`,[]),y=async(T=1,A=!1,O="")=>{const B=w.current+1;w.current=B,A?u(!0):l(!0);try{const M=await Tk({current:T,pageSize:FF},{filter:O});if(w.current!==B)return;const I=(M.items??[]).filter(Iee),P=(A?[...i,...I]:I).filter((F,H,V)=>V.findIndex(q=>q.client_id===F.client_id)===H);s(P),m(T),v((M.total??0)>T*FF)}catch{w.current===B&&_.message.error(Y("components.selectOAuth2ClientField.fetchFailed"))}finally{w.current===B&&(l(!1),u(!1))}};let k=null;C.useEffect(()=>{k&&(clearTimeout(k),k=null),k=window.setTimeout(()=>{y(1,!1,d.trim())},300)},[d]);const D=async()=>{!g||a||c||await y(f+1,!0,d.trim())},S=async()=>{try{await navigator.clipboard.writeText(b),_.message.success(Y("components.selectOAuth2ClientField.copySuccess"))}catch{_.message.error(Y("components.selectOAuth2ClientField.copyFailed"))}},x=()=>{o("/apps/manage",!0)},E=()=>{o("https://1in15q85qd.apifox.cn/8698545m0",!0)};return p.jsxs(_.Space,{direction:"vertical",size:12,style:{width:"100%"},children:[p.jsxs("div",{children:[p.jsx(_.Select,{value:e,onChange:n,disabled:r,loading:a,showSearch:!0,filterOption:!1,optionLabelProp:"label",placeholder:Y("components.selectOAuth2ClientField.placeholder"),onSearch:h,notFoundContent:a?p.jsx(_.Spin,{size:"small"}):null,getPopupContainer:T=>T.parentNode,popupRender:T=>p.jsxs("div",{children:[T,!a&&i.length===0?p.jsx("div",{style:{padding:"16px 12px"},children:p.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:p.jsxs(_.Space,{direction:"vertical",size:4,children:[p.jsx(_.Typography.Text,{type:"secondary",children:Y("components.selectOAuth2ClientField.emptyTitle")}),p.jsx(_.Typography.Text,{type:"secondary",style:{fontSize:12},children:Y("components.selectOAuth2ClientField.emptyDescription")})]}),children:p.jsx(_.Button,{type:"primary",ghost:!0,icon:p.jsx(ie.LinkOutlined,{}),onClick:x,children:Y("components.selectOAuth2ClientField.goToAppManage")})})}):null,i.length>0?p.jsx("div",{style:{padding:"8px 12px",textAlign:"center",borderTop:"1px solid #f0f0f0"},children:p.jsx(_.Button,{type:"link",icon:p.jsx(ie.ReloadOutlined,{}),onClick:D,loading:c,disabled:!g,children:Y(g?"components.selectOAuth2ClientField.loadMore":"components.selectOAuth2ClientField.loadedAll")})}):null]}),options:i.map(T=>({label:T.client_name,value:T.client_id}))}),p.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[Y("components.selectOAuth2ClientField.selectDescriptionPrefix"),p.jsx(_.Button,{style:{padding:0},type:"link",onClick:x,children:Y("components.selectOAuth2ClientField.goToAppManage")}),Y("components.selectOAuth2ClientField.selectDescriptionSuffix")]})]}),p.jsxs("div",{children:[p.jsx(_.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:Y("components.selectOAuth2ClientField.tokenEndpoint")}),p.jsxs(_.Space.Compact,{block:!0,className:"workflow-oauth-token-endpoint",children:[p.jsx(_.Input,{value:b,readOnly:!0}),p.jsx(_.Button,{icon:p.jsx(ie.CopyOutlined,{}),onClick:S,disabled:r,children:Y("components.selectOAuth2ClientField.copy")})]}),p.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[Y("components.selectOAuth2ClientField.tokenDescriptionPrefix"),p.jsx(_.Button,{style:{padding:0},type:"link",onClick:E,children:Y("components.selectOAuth2ClientField.documentation")})]})]})]})},Lee=({children:t,value:e,onChange:n})=>{const[r,o]=C.useState(e==="{{$fromAI}}"),i=()=>{const a=!r;o(a),a?n==null||n("{{$fromAI}}"):n==null||n("")},s=()=>r?p.jsxs("div",{style:{position:"relative"},children:[p.jsx(_.Input,{value:"由AI生成 ",readOnly:!0,style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"1px solid transparent",borderImage:"linear-gradient(45deg, #00d4ff, #9b59b6, #e74c3c) 1",color:"#ffffff",fontWeight:"500",textShadow:"0 1px 2px rgba(0,0,0,0.3)",borderRadius:"6px",fontSize:"13px",paddingLeft:"32px",paddingRight:"28px",height:"32px",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)"},prefix:p.jsx("div",{style:{background:"linear-gradient(45deg, #00d4ff, #1e3c72)",borderRadius:"50%",width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"4px",animation:"pulse 2s ease-in-out infinite alternate"},children:p.jsx("span",{style:{color:"#fff",fontSize:"8px"},children:"AI"})}),suffix:p.jsx(_.Button,{type:"text",size:"small",onClick:i,style:{color:"#ffffff",border:"none",background:"rgba(255,255,255,0.2)",borderRadius:"50%",width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minWidth:"18px",padding:0},onMouseEnter:a=>{a.currentTarget.style.background="rgba(255,255,255,0.3)",a.currentTarget.style.transform="scale(1.1)"},onMouseLeave:a=>{a.currentTarget.style.background="rgba(255,255,255,0.2)",a.currentTarget.style.transform="scale(1)"},children:p.jsx(ie.CloseOutlined,{style:{fontSize:"10px"}})})}),p.jsx("style",{children:`
119
+ */const lQ=_i("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),cQ=/\{\{.*\}\}/;function MB(t){return typeof t=="string"&&cQ.test(t)?"expression":"normal"}const BB=({field:t,disabled:e,readOnly:n,context:r})=>{const{renderVariableTag:o,renderVariableTooltip:i,validateVariable:s}=r,a=uQ(t),l=t.keyPlaceholder||"Key",c=t.valuePlaceholder||"Value",u=0;return p.jsx(_.Form.List,{name:t.name,rules:a,children:(d,{add:h,remove:f},{errors:m})=>p.jsxs(_.Space,{direction:"vertical",style:{width:"100%"},children:[d.map(g=>p.jsx(FB,{field:t,listField:g,disabled:e,readOnly:n,canRemove:!(e||t.minItems!==void 0&&d.length<=t.minItems),keyPlaceholder:l,valuePlaceholder:c,valueModeSwitchOffset:u,onRemove:f,validateVariable:s,renderVariableTag:o,renderVariableTooltip:i},g.key)),p.jsx(_.Button,{block:!0,icon:p.jsx(Kr,{size:16}),onClick:()=>h(),disabled:e||t.maxItems!==void 0&&d.length>=t.maxItems,children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})}),p.jsx(_.Form.ErrorList,{errors:m})]})})};BB.displayName="KeyValueFieldControl";const FB=({field:t,listField:e,disabled:n,readOnly:r,canRemove:o,keyPlaceholder:i,valuePlaceholder:s,valueModeSwitchOffset:a,onRemove:l,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})=>{const h=t.valueModePolicy,f=_.Form.useFormInstance(),[m,g]=C.useState(()=>{if(h){if(h==="BOTH"||h==="EXPRESSION")return"expression";if(h==="TEXT")return"normal"}const w=f.getFieldValue([t.name,e.name]),b=MB(w==null?void 0:w.key);return b==="expression"?b:MB(w==null?void 0:w.value)}),v=h==="TEXT"?["normal"]:["normal","expression"];return p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[p.jsx(_.Form.Item,{style:{flex:1,marginBottom:0,marginTop:a},name:[e.name,"key"],rules:[{required:!0,message:"请输入Key"}],children:p.jsx(ks,{availableModes:v,mode:m,hideModeSwitch:!0,disabled:n,readOnly:r,placeholder:i,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})}),p.jsx(_.Form.Item,{style:{flex:1,marginBottom:0},name:[e.name,"value"],children:p.jsx(ks,{availableModes:v,mode:m,onModeChange:g,disabled:n,readOnly:r,placeholder:s,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d,modeSwitchPosition:"top-right",compact:!0})}),p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>l(e.name),disabled:!o})]})};FB.displayName="KeyValueRow";function uQ(t){var n;const e=[];if((n=t.rules)!=null&&n.some(r=>r.type==="required")){const r=t.rules.find(o=>o.type==="required");e.push({validator:async(o,i)=>{if(!i||i.length===0)throw new Error((r==null?void 0:r.message)||"此项为必填")}})}if(t.minItems!==void 0){const r=t.minItems;e.push({validator:async(o,i)=>{if(r&&(!i||i.length<r))throw new Error(`至少需要 ${r} 项`)}})}if(t.maxItems!==void 0){const r=t.maxItems;e.push({validator:async(o,i)=>{if(i&&i.length>r)throw new Error(`最多允许 ${r} 项`)}})}return e}const dQ=Ai(BB,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});function hQ(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.name=="string"&&e.name.trim()!==""&&typeof e.type=="string"}function fQ(t){return!t||typeof t!="object"||Array.isArray(t)?[]:Object.values(t).filter(hQ)}const IB=({field:t,disabled:e,readOnly:n,context:r})=>{const o=_.Form.useFormInstance(),s=pQ(t.name),[a,l]=_t.useState(null);_t.useEffect(()=>{Promise.resolve().then(()=>wZ).then(b=>{l(()=>b.FieldRenderer)})},[]);const{renderVariableTag:c,renderVariableTooltip:u,validateVariable:d,values:h,optionsLoader:f}=r,m=_t.useMemo(()=>fQ(t.properties),[t.properties]),g=o.getFieldValue(s)??hr(h,s.join("."))??{},v=p.jsx(_.Space,{direction:"vertical",style:{width:"100%"},children:m.map(b=>{const y=mv(b,t.valueModePolicy),k=[...s,b.name];return tu(y,g)&&a?p.jsx(a,{field:{...y,name:k},values:h,optionsLoader:f,disabled:e,renderVariableTag:c,renderVariableTooltip:u,validateVariable:d},k.join(".")):null})}),w=p.jsx(gv,{policy:t.valueModePolicy,disabled:e,readOnly:n,children:v});return t.collapsible?p.jsx(_.Collapse,{defaultActiveKey:t.defaultCollapsed?[]:["main"],items:[{key:"main",label:t.label||t.name,children:w}]}):p.jsx(_.Card,{size:"small",title:t.label,children:w})};IB.displayName="ObjectFieldControl";function pQ(t){return Array.isArray(t)?t:[t]}const mQ=Ai(IB,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});var Xf={exports:{}},gQ=Xf.exports,PB;function wQ(){return PB||(PB=1,(function(t,e){(function(n,r){t.exports=r()})(gQ,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",s="second",a="minute",l="hour",c="day",u="week",d="month",h="quarter",f="year",m="date",g="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var N=["th","st","nd","rd"],P=I%100;return"["+I+(N[(P-20)%10]||N[P]||N[0])+"]"}},y=function(I,N,P){var F=String(I);return!F||F.length>=N?I:""+Array(N+1-F.length).join(P)+I},k={s:y,z:function(I){var N=-I.utcOffset(),P=Math.abs(N),F=Math.floor(P/60),H=P%60;return(N<=0?"+":"-")+y(F,2,"0")+":"+y(H,2,"0")},m:function I(N,P){if(N.date()<P.date())return-I(P,N);var F=12*(P.year()-N.year())+(P.month()-N.month()),H=N.clone().add(F,d),V=P-H<0,q=N.clone().add(F+(V?-1:1),d);return+(-(F+(P-H)/(V?H-q:q-H))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:d,y:f,w:u,d:c,D:m,h:l,m:a,s,ms:i,Q:h}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},D="en",S={};S[D]=b;var x="$isDayjsObject",E=function(I){return I instanceof B||!(!I||!I[x])},T=function I(N,P,F){var H;if(!N)return D;if(typeof N=="string"){var V=N.toLowerCase();S[V]&&(H=V),P&&(S[V]=P,H=V);var q=N.split("-");if(!H&&q.length>1)return I(q[0])}else{var Q=N.name;S[Q]=N,H=Q}return!F&&H&&(D=H),H||!F&&D},A=function(I,N){if(E(I))return I.clone();var P=typeof N=="object"?N:{};return P.date=I,P.args=arguments,new B(P)},O=k;O.l=T,O.i=E,O.w=function(I,N){return A(I,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var B=(function(){function I(P){this.$L=T(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[x]=!0}var N=I.prototype;return N.parse=function(P){this.$d=(function(F){var H=F.date,V=F.utc;if(H===null)return new Date(NaN);if(O.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var q=H.match(v);if(q){var Q=q[2]-1||0,te=(q[7]||"0").substring(0,3);return V?new Date(Date.UTC(q[1],Q,q[3]||1,q[4]||0,q[5]||0,q[6]||0,te)):new Date(q[1],Q,q[3]||1,q[4]||0,q[5]||0,q[6]||0,te)}}return new Date(H)})(P),this.init()},N.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},N.$utils=function(){return O},N.isValid=function(){return this.$d.toString()!==g},N.isSame=function(P,F){var H=A(P);return this.startOf(F)<=H&&H<=this.endOf(F)},N.isAfter=function(P,F){return A(P)<this.startOf(F)},N.isBefore=function(P,F){return this.endOf(F)<A(P)},N.$g=function(P,F,H){return O.u(P)?this[F]:this.set(H,P)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(P,F){var H=this,V=!!O.u(F)||F,q=O.p(P),Q=function(j,K){var W=O.w(H.$u?Date.UTC(H.$y,K,j):new Date(H.$y,K,j),H);return V?W:W.endOf(c)},te=function(j,K){return O.w(H.toDate()[j].apply(H.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(K)),H)},$=this.$W,U=this.$M,R=this.$D,ee="set"+(this.$u?"UTC":"");switch(q){case f:return V?Q(1,0):Q(31,11);case d:return V?Q(1,U):Q(0,U+1);case u:var se=this.$locale().weekStart||0,he=($<se?$+7:$)-se;return Q(V?R-he:R+(6-he),U);case c:case m:return te(ee+"Hours",0);case l:return te(ee+"Minutes",1);case a:return te(ee+"Seconds",2);case s:return te(ee+"Milliseconds",3);default:return this.clone()}},N.endOf=function(P){return this.startOf(P,!1)},N.$set=function(P,F){var H,V=O.p(P),q="set"+(this.$u?"UTC":""),Q=(H={},H[c]=q+"Date",H[m]=q+"Date",H[d]=q+"Month",H[f]=q+"FullYear",H[l]=q+"Hours",H[a]=q+"Minutes",H[s]=q+"Seconds",H[i]=q+"Milliseconds",H)[V],te=V===c?this.$D+(F-this.$W):F;if(V===d||V===f){var $=this.clone().set(m,1);$.$d[Q](te),$.init(),this.$d=$.set(m,Math.min(this.$D,$.daysInMonth())).$d}else Q&&this.$d[Q](te);return this.init(),this},N.set=function(P,F){return this.clone().$set(P,F)},N.get=function(P){return this[O.p(P)]()},N.add=function(P,F){var H,V=this;P=Number(P);var q=O.p(F),Q=function(U){var R=A(V);return O.w(R.date(R.date()+Math.round(U*P)),V)};if(q===d)return this.set(d,this.$M+P);if(q===f)return this.set(f,this.$y+P);if(q===c)return Q(1);if(q===u)return Q(7);var te=(H={},H[a]=r,H[l]=o,H[s]=n,H)[q]||1,$=this.$d.getTime()+P*te;return O.w($,this)},N.subtract=function(P,F){return this.add(-1*P,F)},N.format=function(P){var F=this,H=this.$locale();if(!this.isValid())return H.invalidDate||g;var V=P||"YYYY-MM-DDTHH:mm:ssZ",q=O.z(this),Q=this.$H,te=this.$m,$=this.$M,U=H.weekdays,R=H.months,ee=H.meridiem,se=function(K,W,X,re){return K&&(K[W]||K(F,V))||X[W].slice(0,re)},he=function(K){return O.s(Q%12||12,K,"0")},j=ee||function(K,W,X){var re=K<12?"AM":"PM";return X?re.toLowerCase():re};return V.replace(w,(function(K,W){return W||(function(X){switch(X){case"YY":return String(F.$y).slice(-2);case"YYYY":return O.s(F.$y,4,"0");case"M":return $+1;case"MM":return O.s($+1,2,"0");case"MMM":return se(H.monthsShort,$,R,3);case"MMMM":return se(R,$);case"D":return F.$D;case"DD":return O.s(F.$D,2,"0");case"d":return String(F.$W);case"dd":return se(H.weekdaysMin,F.$W,U,2);case"ddd":return se(H.weekdaysShort,F.$W,U,3);case"dddd":return U[F.$W];case"H":return String(Q);case"HH":return O.s(Q,2,"0");case"h":return he(1);case"hh":return he(2);case"a":return j(Q,te,!0);case"A":return j(Q,te,!1);case"m":return String(te);case"mm":return O.s(te,2,"0");case"s":return String(F.$s);case"ss":return O.s(F.$s,2,"0");case"SSS":return O.s(F.$ms,3,"0");case"Z":return q}return null})(K)||q.replace(":","")}))},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(P,F,H){var V,q=this,Q=O.p(F),te=A(P),$=(te.utcOffset()-this.utcOffset())*r,U=this-te,R=function(){return O.m(q,te)};switch(Q){case f:V=R()/12;break;case d:V=R();break;case h:V=R()/3;break;case u:V=(U-$)/6048e5;break;case c:V=(U-$)/864e5;break;case l:V=U/o;break;case a:V=U/r;break;case s:V=U/n;break;default:V=U}return H?V:O.a(V)},N.daysInMonth=function(){return this.endOf(d).$D},N.$locale=function(){return S[this.$L]},N.locale=function(P,F){if(!P)return this.$L;var H=this.clone(),V=T(P,F,!0);return V&&(H.$L=V),H},N.clone=function(){return O.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},I})(),M=B.prototype;return A.prototype=M,[["$ms",i],["$s",s],["$m",a],["$H",l],["$W",c],["$M",d],["$y",f],["$D",m]].forEach((function(I){M[I[1]]=function(N){return this.$g(N,I[0],I[1])}})),A.extend=function(I,N){return I.$i||(I(N,B,A),I.$i=!0),A},A.locale=T,A.isDayjs=E,A.unix=function(I){return A(1e3*I)},A.en=S[D],A.Ls=S,A.p={},A}))})(Xf)),Xf.exports}var bQ=wQ();const Qt=dr(bQ);var Jf={exports:{}},vQ=Jf.exports,LB;function yQ(){return LB||(LB=1,(function(t,e){(function(n,r){t.exports=r()})(vQ,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(s){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(s);var c=this.$utils(),u=(s||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(d){switch(d){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),d==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return d}}));return i.bind(this)(u)}}}))})(Jf)),Jf.exports}var CQ=yQ();const kQ=dr(CQ);var Qf={exports:{}},SQ=Qf.exports,$B;function xQ(){return $B||($B=1,(function(t,e){(function(n,r){t.exports=r()})(SQ,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,o=/\d/,i=/\d\d/,s=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(w){this[v]=+w}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(w){if(!w||w==="Z")return 0;var b=w.match(/([+-]|\d\d)/g),y=60*b[1]+(+b[2]||0);return y===0?0:b[0]==="+"?-y:y})(v)}],h=function(v){var w=l[v];return w&&(w.indexOf?w:w.s.concat(w.f))},f=function(v,w){var b,y=l.meridiem;if(y){for(var k=1;k<=24;k+=1)if(v.indexOf(y(k,0,w))>-1){b=k>12;break}}else b=v===(w?"pm":"PM");return b},m={A:[a,function(v){this.afternoon=f(v,!1)}],a:[a,function(v){this.afternoon=f(v,!0)}],Q:[o,function(v){this.month=3*(v-1)+1}],S:[o,function(v){this.milliseconds=100*+v}],SS:[i,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[s,u("seconds")],ss:[s,u("seconds")],m:[s,u("minutes")],mm:[s,u("minutes")],H:[s,u("hours")],h:[s,u("hours")],HH:[s,u("hours")],hh:[s,u("hours")],D:[s,u("day")],DD:[i,u("day")],Do:[a,function(v){var w=l.ordinal,b=v.match(/\d+/);if(this.day=b[0],w)for(var y=1;y<=31;y+=1)w(y).replace(/\[|\]/g,"")===v&&(this.day=y)}],w:[s,u("week")],ww:[i,u("week")],M:[s,u("month")],MM:[i,u("month")],MMM:[a,function(v){var w=h("months"),b=(h("monthsShort")||w.map((function(y){return y.slice(0,3)}))).indexOf(v)+1;if(b<1)throw new Error;this.month=b%12||b}],MMMM:[a,function(v){var w=h("months").indexOf(v)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(v){this.year=c(v)}],YYYY:[/\d{4}/,u("year")],Z:d,ZZ:d};function g(v){var w,b;w=v,b=l&&l.formats;for(var y=(v=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(A,O,B){var M=B&&B.toUpperCase();return O||b[B]||n[B]||b[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(I,N,P){return N||P.slice(1)}))}))).match(r),k=y.length,D=0;D<k;D+=1){var S=y[D],x=m[S],E=x&&x[0],T=x&&x[1];y[D]=T?{regex:E,parser:T}:S.replace(/^\[|\]$/g,"")}return function(A){for(var O={},B=0,M=0;B<k;B+=1){var I=y[B];if(typeof I=="string")M+=I.length;else{var N=I.regex,P=I.parser,F=A.slice(M),H=N.exec(F)[0];P.call(O,H),A=A.replace(H,"")}}return(function(V){var q=V.afternoon;if(q!==void 0){var Q=V.hours;q?Q<12&&(V.hours+=12):Q===12&&(V.hours=0),delete V.afternoon}})(O),O}}return function(v,w,b){b.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(c=v.parseTwoDigitYear);var y=w.prototype,k=y.parse;y.parse=function(D){var S=D.date,x=D.utc,E=D.args;this.$u=x;var T=E[1];if(typeof T=="string"){var A=E[2]===!0,O=E[3]===!0,B=A||O,M=E[2];O&&(M=E[2]),l=this.$locale(),!A&&M&&(l=b.Ls[M]),this.$d=(function(F,H,V,q){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*F);var Q=g(H)(F),te=Q.year,$=Q.month,U=Q.day,R=Q.hours,ee=Q.minutes,se=Q.seconds,he=Q.milliseconds,j=Q.zone,K=Q.week,W=new Date,X=U||(te||$?1:W.getDate()),re=te||W.getFullYear(),Z=0;te&&!$||(Z=$>0?$-1:W.getMonth());var ae,be=R||0,me=ee||0,ue=se||0,le=he||0;return j?new Date(Date.UTC(re,Z,X,be,me,ue,le+60*j.offset*1e3)):V?new Date(Date.UTC(re,Z,X,be,me,ue,le)):(ae=new Date(re,Z,X,be,me,ue,le),K&&(ae=q(ae).week(K).toDate()),ae)}catch{return new Date("")}})(S,T,x,b),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),B&&S!=this.format(T)&&(this.$d=new Date("")),l={}}else if(T instanceof Array)for(var I=T.length,N=1;N<=I;N+=1){E[1]=T[N-1];var P=b.apply(this,E);if(P.isValid()){this.$d=P.$d,this.$L=P.$L,this.init();break}N===I&&(this.$d=new Date(""))}else k.call(this,D)}}}))})(Qf)),Qf.exports}var EQ=xQ();const DQ=dr(EQ);var Zf={exports:{}},AQ=Zf.exports,HB;function _Q(){return HB||(HB=1,(function(t,e){(function(n,r){t.exports=r()})(AQ,(function(){return function(n,r,o){var i=r.prototype,s=function(d){return d&&(d.indexOf?d:d.s)},a=function(d,h,f,m,g){var v=d.name?d:d.$locale(),w=s(v[h]),b=s(v[f]),y=w||b.map((function(D){return D.slice(0,m)}));if(!g)return y;var k=v.weekStart;return y.map((function(D,S){return y[(S+(k||0))%7]}))},l=function(){return o.Ls[o.locale()]},c=function(d,h){return d.formats[h]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,g,v){return g||v.slice(1)}))})(d.formats[h.toUpperCase()])},u=function(){var d=this;return{months:function(h){return h?h.format("MMMM"):a(d,"months")},monthsShort:function(h){return h?h.format("MMM"):a(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(h){return h?h.format("dddd"):a(d,"weekdays")},weekdaysMin:function(h){return h?h.format("dd"):a(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(h){return h?h.format("ddd"):a(d,"weekdaysShort","weekdays",3)},longDateFormat:function(h){return c(d.$locale(),h)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},o.localeData=function(){var d=l();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return o.weekdays()},weekdaysShort:function(){return o.weekdaysShort()},weekdaysMin:function(){return o.weekdaysMin()},months:function(){return o.months()},monthsShort:function(){return o.monthsShort()},longDateFormat:function(h){return c(d,h)},meridiem:d.meridiem,ordinal:d.ordinal}},o.months=function(){return a(l(),"months")},o.monthsShort=function(){return a(l(),"monthsShort","months",3)},o.weekdays=function(d){return a(l(),"weekdays",null,null,d)},o.weekdaysShort=function(d){return a(l(),"weekdaysShort","weekdays",3,d)},o.weekdaysMin=function(d){return a(l(),"weekdaysMin","weekdays",2,d)}}}))})(Zf)),Zf.exports}var TQ=_Q();const OQ=dr(TQ);var ep={exports:{}},NQ=ep.exports,VB;function MQ(){return VB||(VB=1,(function(t,e){(function(n,r){t.exports=r()})(NQ,(function(){return function(n,r){r.prototype.weekday=function(o){var i=this.$locale().weekStart||0,s=this.$W,a=(s<i?s+7:s)-i;return this.$utils().u(o)?a:this.subtract(a,"day").add(o,"day")}}}))})(ep)),ep.exports}var BQ=MQ();const FQ=dr(BQ);var tp={exports:{}},IQ=tp.exports,zB;function PQ(){return zB||(zB=1,(function(t,e){(function(n,r){t.exports=r()})(IQ,(function(){var n="week",r="year";return function(o,i,s){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=s(this).startOf(r).add(1,r).date(c),d=s(this).endOf(n);if(u.isBefore(d))return 1}var h=s(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),f=this.diff(h,n,!0);return f<0?s(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(tp)),tp.exports}var LQ=PQ();const $Q=dr(LQ);var np={exports:{}},HQ=np.exports,WB;function VQ(){return WB||(WB=1,(function(t,e){(function(n,r){t.exports=r()})(HQ,(function(){return function(n,r){r.prototype.weekYear=function(){var o=this.month(),i=this.week(),s=this.year();return i===1&&o===11?s+1:o===0&&i>=52?s-1:s}}}))})(np)),np.exports}var zQ=VQ();const WQ=dr(zQ);Qt.extend(DQ),Qt.extend(kQ),Qt.extend(FQ),Qt.extend(OQ),Qt.extend($Q),Qt.extend(WQ);function nu(t,e){if(t==null||t==="")return null;if(Qt.isDayjs(t))return t.isValid()?t:null;const n=e?Qt(t,e):Qt(t);if(n.isValid())return n;const r=Qt(t);return r.isValid()?r:null}function jB(t,e){if(!Array.isArray(t))return null;const n=nu(t[0],e),r=nu(t[1],e);return n||r?[n,r]:null}function ru(t,e,n){if(t)return e==="timestamp"?t.valueOf():e==="string"?t.format(n):t}function UB(t,e,n){if(t)return[ru(t[0],e,n),ru(t[1],e,n)]}const jQ="YYYY-MM-DD",RB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||jQ,s=nu(n,i);return p.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,picker:t.picker,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(ru(a,t.outputFormat,i)),id:o})};RB.displayName="DateFieldControl";const UQ=gt(RB,{needsFormItemName:!0}),RQ="YYYY-MM-DD",qB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||RQ,s=jB(n,i);return p.jsx(_.DatePicker.RangePicker,{disabled:e,picker:t.picker,showTime:t.showTime,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(UB(a,t.outputFormat,i)),id:o})};qB.displayName="DateRangeFieldControl";const qQ=gt(qB,{needsFormItemName:!0}),GQ="YYYY-MM-DD HH:mm:ss",GB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||GQ,s=nu(n,i);return p.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,showTime:t.showTime??!0,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(ru(a,t.outputFormat,i)),id:o})};GB.displayName="DateTimeFieldControl";const KQ=gt(GB,{needsFormItemName:!0}),YQ="HH:mm:ss",KB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||YQ,s=nu(n,i);return p.jsx(_.TimePicker,{disabled:e,placeholder:t.placeholder,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(ru(a,t.outputFormat,i)),id:o})};KB.displayName="TimeFieldControl";const XQ=gt(KB,{needsFormItemName:!0}),JQ="HH:mm:ss",YB=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||JQ,s=jB(n,i);return p.jsx(_.TimePicker.RangePicker,{disabled:e,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(UB(a,t.outputFormat,i)),id:o})};YB.displayName="TimeRangeFieldControl";const QQ=gt(YB,{needsFormItemName:!0}),XB=({field:t})=>p.jsx(_.Divider,{children:t.label});XB.displayName="DividerFieldControl";const ZQ=Ai(XB,{isDisplayOnly:!0,needsFormItemName:!1}),JB=({value:t,onChange:e,id:n})=>p.jsx(_.Input,{type:"hidden",value:t,onChange:r=>e==null?void 0:e(r.target.value),id:n});JB.displayName="HiddenFieldControl";const eZ=Ai(JB,{needsFormItemName:!0,isHidden:!0}),QB=({field:t})=>p.jsx(_.Alert,{message:t.label,description:t.description||t.placeholder,type:t.status||"info",showIcon:t.showIcon,closable:t.closable});QB.displayName="InfoCardFieldControl";const tZ=Ai(QB,{isDisplayOnly:!0,needsFormItemName:!1}),ZB=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Input.TextArea,{disabled:e,placeholder:t.placeholder,rows:6,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});ZB.displayName="JsonFieldControl";const nZ=gt(ZB,{needsFormItemName:!0}),eF=({field:t,value:e})=>p.jsx("span",{children:e||t.placeholder||t.defaultValue});eF.displayName="LabelFieldControl";const rZ=gt(eF,{needsFormItemName:!0}),tF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Cascader,{disabled:e,placeholder:t.placeholder,options:t.options,changeOnSelect:t.changeOnSelect,multiple:t.multiple||void 0,showSearch:t.showSearch,value:n,onChange:(i,s)=>r==null?void 0:r(i),id:o});tF.displayName="CascaderFieldControl";const oZ=gt(tF,{needsFormItemName:!0}),nF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Checkbox,{disabled:e,checked:n,onChange:i=>r==null?void 0:r(i.target.checked),id:o,children:t.placeholder});nF.displayName="CheckboxFieldControl";const iZ=gt(nF,{needsFormItemName:!0,valuePropName:"checked"}),rF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Checkbox.Group,{disabled:e,options:t.options,value:n,onChange:i=>r==null?void 0:r(i)});rF.displayName="CheckboxGroupFieldControl";const sZ=gt(rF,{needsFormItemName:!0}),oF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Radio.Group,{disabled:e,options:t.options,optionType:t.optionType,buttonStyle:t.buttonStyle,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});oF.displayName="RadioFieldControl";const aZ=gt(oF,{needsFormItemName:!0}),iF=({field:t,disabled:e,context:n,value:r,onChange:o,id:i})=>{const{values:s,optionsLoader:a}=n,[l,c]=C.useState(sF(t)),[u,d]=C.useState(!1),h=t.type===we.MULTI_SELECT||t.mode==="multiple",f=w=>!w||w.kind==="static"?[]:w.deps||[],m=C.useMemo(()=>{const b=f(t.optionsSource).map(y=>hr(s,y));return JSON.stringify(b)},[t.optionsSource,s]);C.useEffect(()=>{if(!t.optionsSource||t.optionsSource.kind==="static"){c(sF(t));return}const w=t.optionsSource;if(!a){c(w.fallbackOptions||t.options||[]);return}const y=f(w).reduce((S,x)=>(S[x]=hr(s,x),S),{}),k={...w.params||{},deps:y};d(!0);let D=!1;return a(w.action,k,{values:s}).then(S=>{D||c(S)}).catch(()=>{D||c(w.fallbackOptions||t.options||[])}).finally(()=>{D||d(!1)}),()=>{D=!0}},[m,t.optionsSource,t.options]);const g=()=>{var w;(w=n.eventHandlers)==null||w.onBlur(t.name)},v=()=>{var w;(w=n.eventHandlers)==null||w.onFocus(t.name)};return p.jsx(_.Select,{disabled:e,placeholder:t.placeholder,options:l,mode:h?"multiple":t.mode,showSearch:t.showSearch,allowClear:t.allowClear,maxTagCount:t.maxTagCount,loading:u,value:r,onChange:o,onBlur:g,onFocus:v,id:i})};iF.displayName="SelectFieldControl";function sF(t){var n;if((n=t.options)!=null&&n.length)return t.options;const e=t.optionsSource;return e?e.kind==="static"?e.items||[]:e.fallbackOptions||[]:[]}const aF=gt(iF,{supportsVariableInsert:!1,needsFormItemName:!0}),lF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Switch,{disabled:e,checkedChildren:t.checkedChildren,unCheckedChildren:t.unCheckedChildren,checked:n,onChange:r,id:o});lF.displayName="SwitchFieldControl";const lZ=gt(lF,{needsFormItemName:!0,valuePropName:"checked"}),cF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.TreeSelect,{disabled:e,placeholder:t.placeholder,treeData:t.options,multiple:t.multiple,showSearch:t.showSearch,allowClear:t.allowClear,treeCheckable:t.treeCheckable,value:n,onChange:r,id:o});cF.displayName="TreeSelectFieldControl";const cZ=gt(cF,{needsFormItemName:!0}),uF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.AutoComplete,{disabled:e,placeholder:t.placeholder,options:t.options,allowClear:t.allowClear,value:n,onChange:r,id:o});uF.displayName="AutoCompleteFieldControl";const uZ=gt(uF,{needsFormItemName:!0}),dF=({disabled:t,value:e,onChange:n})=>p.jsx(_.ColorPicker,{disabled:t,value:e,onChange:(r,o)=>n==null?void 0:n(o)});dF.displayName="ColorPickerFieldControl";const dZ=gt(dF,{needsFormItemName:!0}),hF="globalVariables",fF=({field:t,disabled:e,readOnly:n,context:r,value:o,onChange:i,id:s})=>{const{optionsLoader:a,values:l}=r,[c,u]=C.useState(t.options??[]),[d,h]=C.useState(!1);return C.useEffect(()=>{if(!a){u(t.options??[]);return}let f=!1;return h(!0),a(hF,{},{values:l}).then(m=>{f||u(m)}).catch(()=>{f||u(t.options??[])}).finally(()=>{f||h(!1)}),()=>{f=!0}},[a,t.options]),p.jsx(_.Select,{id:s,value:o==null?void 0:String(o),options:c,loading:d,placeholder:t.placeholder,showSearch:!0,filterOption:(f,m)=>{const g=f.trim().toLowerCase();if(!g)return!0;const v=String((m==null?void 0:m.label)??"").toLowerCase(),w=String((m==null?void 0:m.value)??"").toLowerCase();return v.includes(g)||w.includes(g)},allowClear:!0,disabled:e||n,onChange:f=>i==null?void 0:i(f??null)})};fF.displayName="GlobalVariableKeyFieldControl";const hZ=gt(fF,{needsFormItemName:!0,supportsVariableInsert:!0}),pF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Mentions,{disabled:e,placeholder:t.placeholder,value:n,onChange:r,id:o});pF.displayName="MentionsFieldControl";const fZ=gt(pF,{needsFormItemName:!0}),mF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Rate,{disabled:e,count:t.count,allowHalf:t.allowHalf,value:n,onChange:r,id:o});mF.displayName="RateFieldControl";const pZ=gt(mF,{needsFormItemName:!0}),gF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Slider,{disabled:e,min:t.min,max:t.max,step:t.step,marks:t.marks,range:t.range,value:n,onChange:i=>r==null?void 0:r(i),id:o});gF.displayName="SliderFieldControl";const mZ=gt(gF,{needsFormItemName:!0}),wF=({field:t,disabled:e,value:n,onChange:r,id:o})=>p.jsx(_.Upload,{disabled:e,accept:t.accept,maxCount:t.maxCount,listType:t.listType||"text",action:t.action,multiple:t.multiple,fileList:n,onChange:r,id:o,children:p.jsx(_.Button,{icon:p.jsx(ie.UploadOutlined,{}),disabled:e,children:"上传文件"})});wF.displayName="UploadFieldControl";const gZ=gt(wF,{needsFormItemName:!0});function bF(t=yd){t.register(we.TEXT,FJ),t.register(we.TEXTAREA,BJ),t.register(we.NUMBER,NJ),t.register(we.PASSWORD,MJ),t.register(we.SELECT,aF),t.register(we.MULTI_SELECT,aF),t.register(we.RADIO,aZ),t.register(we.CHECKBOX,iZ),t.register(we.CHECKBOX_GROUP,sZ),t.register(we.SWITCH,lZ),t.register(we.CASCADER,oZ),t.register(we.TREE_SELECT,cZ),t.register(we.DATE,UQ),t.register(we.DATETIME,KQ),t.register(we.DATE_RANGE,qQ),t.register(we.TIME,XQ),t.register(we.TIME_RANGE,QQ),t.register(we.UPLOAD,gZ),t.register(we.RATE,pZ),t.register(we.SLIDER,mZ),t.register(we.COLOR_PICKER,dZ),t.register(we.MENTIONS,fZ),t.register(we.AUTO_COMPLETE,uZ),t.register(we.GLOBAL_VARIABLE_KEY,hZ),t.register(we.LABEL,rZ),t.register(we.HIDDEN,eZ),t.register(we.JSON,nZ),t.register(we.DIVIDER,ZQ),t.register(we.INFO_CARD,tZ),t.register(we.ARRAY,PJ),t.register(we.OBJECT,mQ),t.register(we.KEY_VALUE,dQ),t.register(we.ARRAY_OBJECT,JJ)}bF();const vv=({field:t,disabled:e,required:n,readOnly:r,rules:o,values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u,nodeId:d})=>{const h=Cd(),f=e??Wa(t.disabled,i,!1),m=n??Wa(t.required,i,!1),g=r??Wa(t.readOnly,i,!1),v=o??Es(t.rules||[],i,t.type),w={values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u,nodeId:d},b=h.get(t.type);if(!b)return p.jsxs("span",{children:["不支持的字段类型: ",t.type]});const{component:y,meta:k}=b;return k.isDisplayOnly?p.jsx(y,{field:t,disabled:f,readOnly:g,context:w}):k.isComplexField?p.jsx(_.Form.Item,{label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:m,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,children:p.jsx(y,{field:t,disabled:f,readOnly:g,context:w})}):k.isHidden?p.jsx(_.Form.Item,{name:k.needsFormItemName!==!1?t.name:void 0,hidden:!0,rules:v,valuePropName:k.valuePropName,validateTrigger:t.validateTrigger,children:p.jsx(y,{field:t,disabled:f,readOnly:g,context:w})}):p.jsx(_.Form.Item,{name:k.needsFormItemName!==!1?t.name:void 0,label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:m,rules:v,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,valuePropName:k.valuePropName,validateTrigger:t.validateTrigger,children:p.jsx(y,{field:t,disabled:f,readOnly:g,context:w})})},wZ=Object.freeze(Object.defineProperty({__proto__:null,FieldRenderer:vv},Symbol.toStringTag,{value:"Module"})),bZ={meta:{name:"antd-5x-apple-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#007AFF",colorInfo:"#007AFF",colorSuccess:"#34C759",colorWarning:"#FF9F0A",colorError:"#FF3B30",colorTextBase:"#0B0B0F",colorBgBase:"#FFFFFF",colorBorder:"#D1D1D6",colorBorderSecondary:"#E5E5EA",colorPrimaryBorder:"#007AFF",colorPrimaryBorderHover:"#007AFF",colorPrimaryHover:"#0066D6",colorPrimaryActive:"#0056B3",controlOutlineWidth:2,controlOutline:"rgba(0, 122, 255, 0.25)",fontFamily:'"SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:10,borderRadiusSM:8,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:52,sizeUnit:4,sizeStep:4,padding:16,paddingXS:10,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:10,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)",boxShadowSecondary:"0 6px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06)",boxShadowTertiary:"0 2px 8px rgba(0,0,0,0.08)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:18,paddingInlineLG:20,paddingInlineSM:14,contentFontSize:14,contentFontSizeLG:16,contentFontSizeSM:14,primaryShadow:"0 2px 0 rgba(0,122,255,0.14)",dangerShadow:"0 2px 0 rgba(255,59,48,0.12)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:14},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:44,controlHeightLG:52,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:44,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:14,paddingInlineSM:12,paddingInlineLG:14,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:12,borderRadius:10,hoverBorderColor:"#C7C7CC",activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Layout:{headerBg:"#FFFFFF",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F2F2F7",siderBg:"#FFFFFF",triggerBg:"#F2F2F7"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Menu:{itemHeight:44,iconSize:16,collapsedIconSize:18,horizontalItemBorderRadius:10,itemBorderRadius:10},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:14},Notification:{},Pagination:{itemSize:44,itemSizeSM:36},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#007AFF"},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F2F2F7",headerSortActiveBg:"#EDEDF2",headerSortHoverBg:"#F2F2F7",rowHoverBg:"#F2F2F7",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:36,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},vZ={meta:{name:"antd-5x-google-material3-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#1A73E8",colorInfo:"#1A73E8",colorSuccess:"#34A853",colorWarning:"#FBBC04",colorError:"#EA4335",colorTextBase:"#202124",colorBgBase:"#FFFFFF",colorBorder:"#DADCE0",colorBorderSecondary:"#E0E3E7",colorPrimaryBorder:"#1A73E8",colorPrimaryBorderHover:"#1A73E8",colorPrimaryHover:"#1967D2",colorPrimaryActive:"#174EA6",controlOutlineWidth:2,controlOutline:"rgba(26, 115, 232, 0.24)",fontFamily:'"Google Sans", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.5714285714285714,borderRadius:8,borderRadiusSM:4,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:56,controlHeightSM:40,controlHeightLG:64,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(60,64,67,0.16), 0 2px 6px rgba(60,64,67,0.12)",boxShadowSecondary:"0 2px 8px rgba(60,64,67,0.14)",boxShadowTertiary:"0 1px 3px rgba(60,64,67,0.12)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:40,controlHeightSM:32,controlHeightLG:48,paddingInline:24,paddingInlineLG:24,paddingInlineSM:16,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(26,115,232,0.20)",dangerShadow:"0 1px 0 rgba(234,67,53,0.18)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:4},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:40,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:14,paddingBlockSM:8,paddingBlockLG:16,borderRadius:4,hoverBorderColor:"#BDC1C6",activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},InputNumber:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Layout:{headerBg:"#202124",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8F9FA",siderBg:"#202124",triggerBg:"#303134"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:12,itemBorderRadius:12},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:16},Notification:{},Pagination:{itemSize:40,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#1A73E8"},Rate:{},Result:{},Segmented:{controlHeight:40},Select:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F8F9FA",headerSortActiveBg:"#F1F3F4",headerSortHoverBg:"#F3F5F6",rowHoverBg:"#F8F9FA",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 18px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},yZ={meta:{name:"antd-5x-preline-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#2563EB",colorInfo:"#2563EB",colorSuccess:"#16A34A",colorWarning:"#F59E0B",colorError:"#EF4444",colorTextBase:"#0F172A",colorBgBase:"#FFFFFF",colorBorder:"#E5E7EB",colorBorderSecondary:"#E5E7EB",colorPrimaryBorder:"#3B82F6",colorPrimaryBorderHover:"#3B82F6",colorPrimaryHover:"#1D4ED8",colorPrimaryActive:"#1E40AF",controlOutlineWidth:1,controlOutline:"rgba(59, 130, 246, 0.45)",fontFamily:'Graphik, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:8,borderRadiusSM:6,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:48,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(15,23,42,0.06), 0 6px 18px rgba(15,23,42,0.08)",boxShadowSecondary:"0 1px 2px rgba(15,23,42,0.05), 0 10px 24px rgba(15,23,42,0.10)",boxShadowTertiary:"0 1px 2px rgba(15,23,42,0.06)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:8,borderRadiusSM:8,borderRadiusLG:10,controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineLG:18,paddingInlineSM:12,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(37,99,235,0.18)",dangerShadow:"0 1px 0 rgba(239,68,68,0.16)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:36,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:10,borderRadius:8,hoverBorderColor:"#D1D5DB",activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Layout:{headerBg:"#0B1220",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8FAFC",siderBg:"#0B1220",triggerBg:"#0F1A2E"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:8,itemBorderRadius:8},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:12},Notification:{},Pagination:{itemSize:36,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:22,trackMinWidth:44,handleSize:18},Table:{headerBg:"#F8FAFC",headerSortActiveBg:"#F1F5F9",headerSortHoverBg:"#F3F6FB",rowHoverBg:"#F8FAFC",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:6,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:6},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}};function CZ(t){return"optionsSource"in t&&t.optionsSource&&t.optionsSource.kind!=="static"?t.optionsSource.deps||[]:[]}function kZ(t){const e=[];for(const n of t.fields){const r=CZ(n);if(r.length>0)for(const o of r)e.push({id:`auto-clear-${n.name}-on-${o}-change`,trigger:{type:"fieldChange",field:o},actions:[{type:"clearFields",targets:[n.name]}]})}return e}function SZ(t,e,n=!0){return[...n?kZ(t):[],...e||[]]}const xZ={default:sg,apple:bZ,google:vZ,preline:yZ};function yv({schema:t,disabled:e=!1,initialValues:n,onSubmit:r,onChange:o,onValuesObserved:i,submitLabel:s="提交",showReset:a=!1,resetLabel:l="重置",onReset:c,form:u,showSubmit:d=!0,optionsLoader:h,nodeId:f,mcpMode:m,validateVariable:g,renderVariableTag:v,renderVariableTooltip:w,availableVariables:b,theme:y,customTheme:k,locale:D,prefixCls:S,events:x,customHandlers:E,maxExecutionDepth:T,debugEvents:A,preRender:O}){var K;const[B]=_.Form.useForm(),M=u||B,I=_t.useMemo(()=>{const W={};for(const X of t.fields)X.defaultValue!==void 0&&(W[X.name]=X.defaultValue);return{...W,...n||{}}},[t.fields,n]),N=_t.useMemo(()=>{const W=t.enableAutoEvents!==!1,X=t.events||[],re=x||[];return SZ(t,[...X,...re],W)},[t,x]),P=L8({events:N,form:M,optionsLoader:h,customHandlers:E,maxExecutionDepth:T,debug:A}),F=_t.useRef({}),H=_t.useMemo(()=>{if(k)return k;if(y)return xZ[y]},[k,y]),V=_.Form.useWatch([],M),q=_t.useMemo(()=>JSON.stringify({...I||{},...V||{}}),[I,V]),Q=_t.useMemo(()=>({...I||{},...V||{}}),[q]),te=_t.useRef(q);_t.useEffect(()=>{!i||te.current===q||(te.current=q,i(Q))},[i,Q,q]);const[$,U]=_t.useState({}),R=_t.useRef({});_t.useEffect(()=>{var X;const W={};for(const re of t.fields){const Z=tu(re,Q);if(W[re.name]=Z,R.current[re.name]===!0&&Z===!1){const be=AJ(re),me=((X=re.visibleWhen)==null?void 0:X.clearOnHide)??!0;be==="unregister"&&M.setFieldValue(re.name,me?void 0:M.getFieldValue(re.name))}}R.current=W,U(re=>{const Z=Object.keys(re),ae=Object.keys(W);return Z.length===ae.length&&ae.every(be=>re[be]===W[be])?re:W})},[t.fields,M,Q]);const ee=async W=>{const X=t.pruneInvisibleOnSubmit===!1?W:TJ(t,W,$);await(r==null?void 0:r(X))},se=(W,X)=>{if(o==null||o(W,X),P.triggerFieldChange&&W){const re=F.current;for(const Z in W){const ae=hr(re,Z),be=W[Z];P.triggerFieldChange(Z,be,ae)}}F.current={...X}},he=d||a,j=_t.useMemo(()=>({nodeId:f,mcpMode:m,validateVariable:g,renderVariableTag:v,renderVariableTooltip:w,availableVariables:b}),[f,m,g,v,w,b]);return p.jsx(zS,{customTheme:H,locale:D,prefixCls:S,children:p.jsx(RS,{value:j,children:p.jsxs(_.Form,{form:M,disabled:e,autoComplete:"off",layout:t.layout||"vertical",labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,size:t.size,initialValues:I,onFinish:ee,onValuesChange:se,className:"workflow-config-form",children:[O,t.fields.map(W=>{if(!tu(W,Q))return null;const re=e||Wa(W.disabled,Q,!1),Z=Wa(W.required,Q,!1),ae=Es(W.rules||[],Q,W.type),be=(W.rules||[]).some(ue=>ue.type==="required"),me=Z&&!be?[bv(`${W.label||W.name}为必填项`),...ae]:ae;return p.jsx(vv,{field:W,disabled:re,required:Z,rules:me,values:Q,optionsLoader:h,validateVariable:g,renderVariableTag:v,renderVariableTooltip:w,eventHandlers:P.fieldEventHandlers,nodeId:f},W.name)}),he&&p.jsx(_.Form.Item,{wrapperCol:{offset:((K=t.labelCol)==null?void 0:K.span)||0},children:p.jsxs(_.Space,{children:[a&&p.jsx(_.Button,{disabled:e,onClick:()=>{M.resetFields(),c==null||c()},children:l}),d&&p.jsx(_.Button,{type:"primary",htmlType:"submit",children:s})]})})]})})})}const ou=()=>{const t=jt();return C.useCallback((e,n=!1)=>{if(/^https?:\/\//i.test(e)){window.open(e,"_blank");return}if(t.onNavigate){t.onNavigate(e,n);return}n?window.open(e,"_blank"):qu.push(e)},[t.onNavigate])},Cv=C.forwardRef((t,e)=>{const n=ou(),[r,o]=C.useState([]),[i,s]=C.useState("");C.useEffect(()=>{s(t.proxyId)},[t.proxyId]),C.useEffect(()=>{bm().then(c=>{o(c??[])})},[]);const a=()=>i;C.useImperativeHandle(e,()=>({getProxyId:a}));const l=c=>{s(c)};return p.jsxs(h$,{label:Y("link.flow.use_proxy_gateway"),children:[p.jsxs(_.Select,{className:"proxy_id_select",value:i,dropdownStyle:{zIndex:bd.nestedPopover},onChange:l,style:{width:"100%"},children:[p.jsx(_.Select.Option,{value:"0",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.do_not_use"})}),r.map(c=>p.jsx(_.Select.Option,{value:c.id,children:c.group_name},c.id))]}),p.jsxs("p",{className:"field-desc",children:[p.jsx(Oe.FormattedMessage,{id:"link.flow.private_network_deployment"}),p.jsx("span",{style:{margin:"0 2px"},onClick:()=>{n("/setting/gateway")},children:p.jsx(Oe.FormattedMessage,{id:"link.flow.proxy_gateway"})}),p.jsx(Oe.FormattedMessage,{id:"link.flow.secure_connection"})]})]})}),EZ="RDBMS_ACCOUNT",DZ=t=>t===EZ,vF=({formSchema:t,initialValues:e,connector:n,proxy_id:r,authType:o,onCancel:i,onSubmit:s})=>{var h;const[a]=_.Form.useForm(),l=C.useRef(null),c=(n==null?void 0:n.deployment_type)!=="SaasApp",u=DZ(o);C.useEffect(()=>{e&&a.setFieldsValue(e)},[a,e]);const d=async f=>{var g;const m=await a.validateFields();c&&(m.proxy_id=(g=l.current)==null?void 0:g.getProxyId()),s(m,f)};try{(h=t==null?void 0:t.fields)==null||h.forEach(f=>{f.valueModePolicy!=="TEXT"&&console.warn("config error: value mode policy is not TEXT")})}catch{console.warn("form schema fmt err")}return p.jsxs("div",{className:Oo.formLayout,children:[p.jsxs("div",{className:Oo.formContent,children:[p.jsx(yv,{schema:t,form:a,initialValues:e,showSubmit:!1,showReset:!1,customTheme:Ru}),c?p.jsx(Cv,{proxyId:r||"0",ref:l}):null]}),p.jsx("div",{className:Oo.formActions,children:p.jsxs(_.Space,{children:[p.jsx(_.Button,{onClick:i,children:"取消"}),u?p.jsx(_.Button,{onClick:()=>d(!0),children:"测试连接"}):null,p.jsx(_.Button,{type:"primary",onClick:()=>d(!1),children:"保存"})]})})]})},AZ=t=>p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",value:Qt(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD")))}}),_Z=t=>p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",showTime:!0,value:Qt(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD hh:mm:ss")))}}),TZ=({value:t=[],onChange:e,valueType:n})=>{const r=a=>{const l=[...t];l.splice(a,1),e==null||e(l)},o=()=>{e==null||e([...t,{key:"",value:""}])},i=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,key:l}:c))},s=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,value:l}:c))};return p.jsxs("div",{children:[t.map((a,l)=>p.jsxs(_.Space,{size:"small",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[p.jsx(_.Input,{value:a.key,onChange:c=>i(l,c.target.value),placeholder:"Key"}),p.jsx(_.Input,{placeholder:"Value",style:{width:300},value:a.value,onChange:c=>s(l,c.target.value)}),p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{r(l)}})]},a.key)),p.jsxs(_.Button,{type:"default",onClick:o,block:!0,children:[p.jsx(Kr,{size:16})," ",p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})]})]})},OZ=t=>null;class rp{constructor(e,n,r,o,i,s,a,l,c,u=0,d){this.p=e,this.stack=n,this.state=r,this.reducePos=o,this.pos=i,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let o=e.parser.context;return new rp(e,[],n,r,r,0,[],0,o?new yF(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,o=e&65535,{parser:i}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(o);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,o,!0),this.reducePos),o<i.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(o,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[o])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-d;if(o<i.minRepeatTerm||e&131072){let f=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,c,f,h+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=i.getGoto(f,o,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(o,c)}storeNode(e,n,r,o=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,o);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,o>4&&(o-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=o}}shift(e,n,r,o){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:s}=this.p;this.pos=o,!s.stateFlag(i,1)&&(o>r||n<=s.maxNode)&&(this.reducePos=o),this.pushState(i,Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=s.maxNode&&this.buffer.push(n,r,o,4)}else this.pos=o,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,o,4)}apply(e,n,r,o){e&65536?this.reduce(e):this.shift(e,n,r,o)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(n,o),this.buffer.push(r,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),o=e.bufferBase+n;for(;e&&o==e.bufferBase;)e=e.parent;return new rp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new NZ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let o=[];for(let i=0,s;i<n.length;i+=2)(s=n[i+1])!=this.state&&this.p.parser.hasAction(s,e)&&o.push(n[i],s);if(this.stack.length<120)for(let i=0;o.length<8&&i<n.length;i+=2){let s=n[i+1];o.some((a,l)=>l&1&&a==s)||o.push(n[i],s)}n=o}let r=[];for(let o=0;o<n.length&&r.length<4;o+=2){let i=n[o+1];if(i==this.state)continue;let s=this.split();s.pushState(i,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[o],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,o=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],o,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(o,i)=>{if(!n.includes(o))return n.push(o),e.allActions(o,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-i;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new yF(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class yF{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class NZ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=o}}class op{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new op(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new op(this.stack,this.pos,this.index)}}function ip(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,o=0;r<t.length;){let i=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){i=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[o++]=i:n=new e(i)}return n}class sp{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const CF=new sp;class MZ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=CF,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,o=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!o)return null;let s=this.ranges[--o];i-=r.from-s.to,r=s}for(;n<0?i>r.to:i>=r.to;){if(o==this.ranges.length-1)return null;let s=this.ranges[++o];i+=s.from-r.to,r=s}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,o;if(n>=0&&n<this.chunk.length)r=this.pos+e,o=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),o=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),o}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=CF,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let o of this.ranges){if(o.from>=n)break;o.to>e&&(r+=this.input.read(Math.max(o.from,e),Math.min(o.to,n)))}return r}}class ja{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;BZ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}ja.prototype.contextual=ja.prototype.fallback=ja.prototype.extend=!1,ja.prototype.fallback=ja.prototype.extend=!1;function BZ(t,e,n,r,o,i){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let f=s+3;f<c;f+=2)if((t[f+1]&a)>0){let m=t[f];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||FZ(m,e.token.value,o,i))){e.acceptToken(m);break}}let u=e.next,d=0,h=t[s+2];if(e.next<0&&h>d&&t[c+h*3-3]==65535){s=t[c+h*3-1];continue e}for(;d<h;){let f=d+h>>1,m=c+f+(f<<1),g=t[m],v=t[m+1]||65536;if(u<g)h=f;else if(u>=v)d=f+1;else{s=t[m+2],e.advance();continue e}}break}}function kF(t,e,n){for(let r=e,o;(o=t[r])!=65535;r++)if(o==n)return r-e;return-1}function FZ(t,e,n,r){let o=kF(n,r,e);return o<0||kF(n,r,t)<o}const or=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let kv=null;function SF(t,e,n){let r=t.cursor(Nt.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class IZ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?SF(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?SF(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],o=this.index[n];if(o==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[o],s=this.start[n]+r.positions[o];if(s>e)return this.nextStart=s,null;if(i instanceof Lt){if(s==e){if(s<this.safeFrom)return null;let a=s+i.length;if(a<=this.safeTo){let l=i.prop(nt.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,s+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+i.length}}}class PZ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new sp)}getActions(e){let n=0,r=null,{parser:o}=e.p,{tokenizers:i}=o,s=o.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<i.length;c++){if((1<<c&s)==0)continue;let u=i[c],d=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=s||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=s,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let h=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!u.extend&&(r=d,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new sp,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new sp,{pos:r,p:o}=e;return n.start=r,n.end=Math.min(r+1,o.stream.end),n.value=r==o.stream.end?o.parser.eofTerm:0,n}updateCachedToken(e,n,r){let o=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(o,e),r),e.value>-1){let{parser:i}=r.p;for(let s=0;s<i.specialized.length;s++)if(i.specialized[s]==e.value){let a=i.specializers[s](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,n,r,o){for(let i=0;i<o;i+=3)if(this.actions[i]==e)return o;return this.actions[o++]=e,this.actions[o++]=n,this.actions[o++]=r,o}addActions(e,n,r,o){let{state:i}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(i,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Ko(a,c+2);else{o==0&&a[c+1]==2&&(o=this.putAction(Ko(a,c+2),n,r,o));break}a[c]==n&&(o=this.putAction(Ko(a,c+1),n,r,o))}return o}}class LZ{constructor(e,n,r,o){this.parser=e,this.input=n,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new MZ(n,o),this.tokens=new PZ(e,this.stream),this.topTerm=e.top[1];let{from:i}=o[0];this.stacks=[rp.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new IZ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],o,i;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{o||(o=[],i=[]),o.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let s=o&&HZ(o);if(s)return or&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw or&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&o){let s=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,i,r);if(s)return or&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,l)=>l.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let a=r[s];for(let l=s+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(s--,1);continue e}}}r.length>12&&(r.sort((s,a)=>a.score-s.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)r[s].pos<this.minStackPos&&(this.minStackPos=r[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let o=e.pos,{parser:i}=this,s=or?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(o);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(e.state,d.type.id):-1;if(h>-1&&d.length&&(!c||(d.prop(nt.contextHash)||0)==u))return e.useNode(d,h),or&&console.log(s+this.stackID(e)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof Lt)||d.children.length==0||d.positions[0]>0)break;let f=d.children[0];if(f instanceof Lt&&d.positions[0]==0)d=f;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),or&&console.log(s+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],h=l[c++],f=c==l.length||!r,m=f?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,d,g?g.start:m.pos,h),or&&console.log(s+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${i.getName(u&65535)}`} for ${i.getName(d)} @ ${o}${m==e?"":", split"})`),f)return!0;m.pos>o?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return xF(e,n),!0}}runRecovery(e,n,r){let o=null,i=!1;for(let s=0;s<e.length;s++){let a=e[s],l=n[s<<1],c=n[(s<<1)+1],u=or?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),or&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let d=a.split(),h=u;for(let f=0;f<10&&d.forceReduce()&&(or&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,r));f++)or&&(h=this.stackID(d)+" -> ");for(let f of a.recoverByInsert(l))or&&console.log(u+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),or&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),xF(a,r)):(!o||o.score<d.score)&&(o=d)}return o}stackToTree(e){return e.close(),Lt.build({buffer:op.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(kv||(kv=new WeakMap)).get(e);return n||kv.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function xF(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class $Z{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class ap extends lx{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),o=[];for(let a=0;a<n.length;a++)o.push([]);function i(a,l,c){o[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=nt[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let d=a[c+-u];for(let h=-u;h>0;h--)i(a[c++],l,d);c++}}}this.nodeSet=new dg(n.map((a,l)=>Hn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:o[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=tx;let s=ip(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(EF),this.states=ip(e.states,Uint32Array),this.data=ip(e.stateData),this.goto=ip(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new ja(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let o=new LZ(this,e,n,r);for(let i of this.wrappers)o=i(o,e,n,r);return o}getGoto(e,n,r=!1){let o=this.goto;if(n>=o[0])return-1;for(let i=o[n+1];;){let s=o[i++],a=s&1,l=o[i++];if(a&&r)return l;for(let c=i+(s>>1);i<c;i++)if(o[i]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let o=0;o<2;o++)for(let i=this.stateSlot(e,o?2:1),s;;i+=3){if((s=r[i])==65535)if(r[i+1]==1)s=r[i=Ko(r,i+2)];else{if(r[i+1]==2)return Ko(r,i+2);break}if(s==n||s==0)return Ko(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),o=r?n(r):void 0;for(let i=this.stateSlot(e,1);o==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Ko(this.data,i+2);else break;o=n(Ko(this.data,i+1))}return o}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Ko(this.data,r+2);else break;if((this.data[r+2]&1)==0){let o=this.data[r+1];n.some((i,s)=>s&1&&i==o)||n.push(this.data[r],o)}}return n}configure(e){let n=Object.assign(Object.create(ap.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let o=e.tokenizers.find(i=>i.from==r);return o?o.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,o)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let s=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[o]=EF(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let s=n.indexOf(i);s>=0&&(r[s]=!0)}let o=null;for(let i=0;i<n.length;i++)if(!r[i])for(let s=this.dialects[n[i]],a;(a=this.data[s++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[a]=1;return new $Z(e,r,o)}static deserialize(e){return new ap(e)}}function Ko(t,e){return t[e]|t[e+1]<<16}function HZ(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function EF(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const VZ=cx({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,", :":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),zZ=ap.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[VZ],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),WZ=dh.define({name:"json",parser:zZ.configure({props:[WD.add({Object:UD({except:/^\s*\}/}),Array:UD({except:/^\s*\]/})}),RD.add({"Object Array":Tz})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Sv(){return new wz(WZ)}const jZ=t=>p.jsx(Hc,{height:"300px",style:{borderRadius:4,overflow:"hidden"},theme:bh,extensions:[Sv()],...t}),{Text:UZ}=_.Typography,RZ=t=>p.jsx("div",{style:{padding:6,paddingRight:0,border:"1px solid #b0b5cb",borderRadius:4},children:p.jsx(_.Tooltip,{title:t.value,color:"cyan",placement:"topLeft",styles:{body:{width:500}},children:p.jsx(UZ,{style:{color:"#b0b5cb"},ellipsis:!0,copyable:{text:t.value},children:t.value})})}),qZ=t=>p.jsx(_.Input.Password,{addonBefore:Y("link.flow.cipherText"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),GZ=t=>{var r;const{multiple:e,...n}=t;return p.jsx(_.Select,{style:{borderRadius:6},mode:e?"multiple":void 0,...n,getPopupContainer:o=>o.parentNode,children:(r=t==null?void 0:t.options)==null?void 0:r.map(o=>p.jsx(_.Select.Option,{label:o.label,value:o.value,children:o.label},o.value))})},{TextArea:KZ}=_.Input,YZ=t=>p.jsx(KZ,{value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),XZ=t=>p.jsx(_.Input,{addonBefore:Y("link.flow.text"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),JZ=t=>p.jsx(_.TimePicker,{style:{width:"100%"},value:Qt(t.value??"00:00:00","HH:mm:ss"),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("HH:mm:ss")))}}),QZ={configFormContainer:"_configFormContainer_s061b_1"},ZZ=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],xv=t=>Array.isArray(t)?t.map(e=>{if(typeof e=="string"){const s=e.trim();return s?{label:s,value:s}:null}const n=(e==null?void 0:e.value)??(e==null?void 0:e.label)??"",r=n==null?"":String(n).trim();if(!r)return null;const o=(e==null?void 0:e.label)??"";return{label:o==null?r:String(o).trim()||r,value:r}}).filter(Boolean):[],eee=t=>{const e=t.display_name;switch(t.page_control){case Ee.SELECT:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_select")+t.display_name}],label:e,name:t.name,children:p.jsx(GZ,{options:xv(t.option_value_objects??t.option_values),multiple:t.multi_valued})},t.ui_id);case Ee.EXTEND_OBJ:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(TZ,{valueType:t.value_type})},t.ui_id);case Ee.HIDDEN:return p.jsx(_.Form.Item,{style:{display:"none"},required:t.required,label:e,name:t.name,children:p.jsx(OZ,{})},t.ui_id);case Ee.TEXT:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(XZ,{})},t.ui_id);case Ee.PASSWORD:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(qZ,{})},t.ui_id);case Ee.LABEL:return p.jsx(_.Form.Item,{required:t.required,label:e,name:t.name,children:p.jsx(RZ,{})},t.ui_id);case Ee.DATE:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(AZ,{})},t.ui_id);case Ee.TIME:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(JZ,{})},t.ui_id);case Ee.DATETIME:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(_Z,{})},t.ui_id);case Ee.TEXTAREA:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(YZ,{})},t.ui_id);case Ee.FIXED_OBJ:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(_.Input.TextArea,{})},t.ui_id);case Ee.JSON:return p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:Y("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:p.jsx(jZ,{})},t.ui_id)}},tee=t=>{switch(t.page_control){case Ee.SELECT:return t.multi_valued?[]:null;case Ee.EXTEND_OBJ:return{};case Ee.HIDDEN:return"";case Ee.TEXT:return"";case Ee.PASSWORD:return"";case Ee.LABEL:return"";case Ee.DATE:return null;case Ee.TIME:return null;case Ee.DATETIME:return null;case Ee.TEXTAREA:return"";case Ee.FIXED_OBJ:return"";case Ee.JSON:return JSON.stringify({})}},DF=C.memo(t=>{var c;const{config:e,proxy_id:n,connector:r}=t,[o]=_.Form.useForm(),i=C.useRef(null),s=It.useReactive({proxyId:"0"});C.useEffect(()=>{var u;(u=e==null?void 0:e.sub_params)!=null&&u.length&&o.setFieldsValue({...e.sub_params.reduce((d,h)=>{let f=h.value;return h.page_control===Ee.EXTEND_OBJ&&(f=ZZ(f)),d[h.name]=f??tee(h),d},{})})},[e,o]),C.useEffect(()=>{n&&(s.proxyId=n)},[n]);const a=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u)})},l=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u,!0)})};return p.jsxs("div",{className:Oo.formLayout,style:{position:"relative"},onClick:u=>{u.stopPropagation(),u.preventDefault()},children:[p.jsx("div",{className:Oo.formContent,children:p.jsxs(_.Form,{form:o,layout:"vertical",className:`${QZ.configFormContainer} workflow-credential-form`,children:[(c=e==null?void 0:e.sub_params)==null?void 0:c.map(u=>p.jsxs("div",{children:[eee(u),u.page_control!==Ee.HIDDEN&&p.jsx("p",{className:"field-desc",children:u.description})]},u.ui_id)),r.deployment_type!=="SaasApp"?p.jsx(Cv,{proxyId:s.proxyId,ref:i}):null]})}),t.auth_type==="RDBMS_ACCOUNT"&&p.jsx("div",{className:Oo.rdbmsTestAction,children:p.jsx(_.Button,{type:"primary",style:{width:"100%"},onClick:l,children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.connection-test"})})}),p.jsxs("div",{className:Oo.formActions,children:[p.jsx(_.Button,{icon:p.jsx(ie.RollbackOutlined,{}),style:{width:90,borderRadius:4,marginRight:10},onClick:t.onCancel,children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.cancel"})}),p.jsx(_.Button,{type:"primary",icon:p.jsx(ie.CloudUploadOutlined,{}),style:{width:90,borderRadius:4},onClick:()=>a(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})]})]})}),nee={overflow:"hidden"},ree=72,oee=16,iee=t=>{const{visible:e,connector:n,config:r,formSchema:o,onCancel:i,onSubmit:s,auth_type:a,inAI:l}=t;return p.jsx(_.Modal,{title:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-account"}),style:{marginTop:0,paddingBottom:0,position:"absolute",top:ree,bottom:oee,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Oo.accountModal,mask:!1,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:bd.nestedModal,width:560,styles:{body:nee},footer:null,maskClosable:!l,open:e,onCancel:i,children:o?p.jsx(vF,{formSchema:o,connector:n,authType:a,onCancel:i,onSubmit:s}):p.jsx(DF,{config:r,connector:n,nodeId:"",auth_type:a,onCancel:i,onSubmit:s})})},see={overflow:"hidden"},aee=72,lee=16,cee=t=>{const{visible:e,connector:n,config:r,formSchema:o,initialValues:i,onCancel:s,onSubmit:a,auth_type:l,proxy_id:c,inAI:u}=t;return p.jsx(_.Modal,{title:Y("link.flow.edit_account"),mask:!1,style:{marginTop:0,paddingBottom:0,position:"absolute",top:aee,bottom:lee,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Oo.accountModal,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:bd.nestedModal,width:560,footer:null,styles:{body:see},open:e,maskClosable:!u,onCancel:s,children:o?p.jsx(vF,{formSchema:o,initialValues:i,connector:n,proxy_id:c,authType:l,onCancel:s,onSubmit:a}):p.jsx(DF,{config:r,proxy_id:c,connector:n,nodeId:"",auth_type:l,onCancel:s,onSubmit:a})})},As={accountOption:"_accountOption_4vdjt_14",accountName:"_accountName_4vdjt_21",nameEditIcon:"_nameEditIcon_4vdjt_34",editInputWrapper:"_editInputWrapper_4vdjt_44",nameEditInput:"_nameEditInput_4vdjt_48",accountActions:"_accountActions_4vdjt_53",updateTime:"_updateTime_4vdjt_58"},uee=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],Ev=(t=[])=>{const e={};return t.forEach(n=>{e[n.key]=n.value}),e},dee={eq:"EQ",ne:"NOT",in:"IN",notin:"NOT_IN",not_in:"NOT_IN",gt:"GT",lt:"LT",gte:"GE",lte:"LE"};function hee(t){if(!(t!=null&&t.field)||!t.operator)return;const e=dee[String(t.operator).toLowerCase()];if(e)return{deps:[t.field],conditions:{key:t.field,keyword:e,value:t.value}}}function fee(t){return Sn(t.visible_when)??hee(t.display_condition)}const AF={STRING:we.TEXT,TEXTAREA:we.TEXTAREA,PASSWORD:we.PASSWORD,HIDDEN:we.HIDDEN,NUMBER:we.NUMBER,BOOLEAN:we.SWITCH,SELECT:we.SELECT,DATETIME:we.DATETIME,CODE:we.CODE,PROXY:we.PROXY,GLOBAL_VARIABLE_KEY:we.GLOBAL_VARIABLE_KEY,OBJECT:we.OBJECT,ARRAY:we.ARRAY,DYNAMIC_ARRAY:we.ARRAY,KEYVALUE:we.KEY_VALUE},pee=t=>String(t.type??"").toUpperCase(),mee=t=>t.item_schema??[],_F=t=>String(t.item_type??"").toUpperCase(),Sn=t=>t??void 0,gee=t=>Object.fromEntries((t??[]).map(e=>[e.key,Av(e)])),wee=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?we.DATE:e==="TIME"?we.TIME:we.DATETIME},Dv=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?"YYYY-MM-DD":e==="TIME"?"HH:mm:ss":"YYYY-MM-DD HH:mm:ss"},bee=t=>({type:AF[_F(t)]||we.TEXT,name:"item",label:t.item_label||"项"});function vee(t){if(!t)return[];const e=[],n=t.minLength??t.min_length,r=t.maxLength??t.max_length;return n!=null&&e.push({type:"min",value:n,message:`最少 ${n} 个字符`}),r!=null&&e.push({type:"max",value:r,message:`最多 ${r} 个字符`}),t.pattern&&e.push({type:"pattern",value:t.pattern,message:"格式不正确"}),t.min!=null&&e.push({type:"min",value:t.min,message:`最小值 ${t.min}`}),t.max!=null&&e.push({type:"max",value:t.max,message:`最大值 ${t.max}`}),e}function Av(t){var o,i,s;const e=pee(t),n=e==="DATETIME"?wee(t):AF[e]||e,r={type:n,name:t.key,label:t.label||t.key,placeholder:Sn(t.placeholder),helpText:Sn(t.help_text),defaultValue:Sn(t.default_value),required:Sn(t.required),disabled:Sn(t.disabled),visibleWhen:fee(t),rules:vee(t.validation),valueModePolicy:Sn(t.value_mode_policy)};switch(n){case we.SELECT:return{...r,type:we.SELECT,options:(o=t.options)==null?void 0:o.map(a=>({label:a.label,value:a.value})),showSearch:!0,allowClear:!0};case we.NUMBER:return{...r,type:we.NUMBER,min:Sn((i=t.validation)==null?void 0:i.min),max:Sn((s=t.validation)==null?void 0:s.max)};case we.DATETIME:return{...r,type:we.DATETIME,showTime:!0,format:Dv(t),outputFormat:"string"};case we.DATE:return{...r,type:we.DATE,format:Dv(t),outputFormat:"string"};case we.TIME:return{...r,type:we.TIME,format:Dv(t),outputFormat:"string"};case we.OBJECT:return{...r,type:we.OBJECT,properties:gee(t.properties)};case we.ARRAY:if(_F(t)==="OBJECT"){const a=mee(t).map(Av);return{...r,type:we.ARRAY_OBJECT,columns:a,minItems:Sn(t.min_items),maxItems:Sn(t.max_items),columnLayout:a.length>1?"grid":"vertical",titleFieldName:void 0}}return{...r,type:we.ARRAY,itemSchema:bee(t),minItems:Sn(t.min_items),maxItems:Sn(t.max_items),itemLabel:Sn(t.item_label)};case we.KEY_VALUE:return{...r,type:we.KEY_VALUE,keyPlaceholder:Sn(t.key_placeholder),valuePlaceholder:Sn(t.value_placeholder)};default:return r}}function TF(t){return{fields:t.map(Av),layout:"vertical"}}const OF=(...t)=>{for(const e of t)if(typeof e=="string"&&e.trim())return e.trim()};function yee(t){if(!t)return null;const e=OF(t.key,t.credentialKey,t.name);return e?{key:e,label:OF(t.displayName,t.label,t.name,e)??e,required:t.required===!0}:null}function _v(t){if(!Array.isArray(t))return[];const e=[],n=new Set;for(const r of t){const o=yee(r);!o||n.has(o.key)||(n.add(o.key),e.push(o))}return e}function Cee(t){var n,r;const e=_v(t);return((n=e.find(o=>o.required))==null?void 0:n.key)??((r=e[0])==null?void 0:r.key)}const kee=_.Form.Item,{Option:See}=_.Select,{Text:xee,Title:whe}=_.Typography,Ua="[workflow:account-debug]",Eee=t=>!!(t&&/^\d+$/.test(t)),_s=t=>t&&typeof t=="object"&&!Array.isArray(t)?Object.keys(t):[],Dee=t=>Array.isArray(t)?t.map(e=>e==null?void 0:e.key).filter(Boolean):[],Aee=t=>!!(t&&typeof t=="object"&&Array.isArray(t.sub_params)),_ee=t=>[t==null?void 0:t.auth_schema,t==null?void 0:t.config_schema,t==null?void 0:t.schema,t].find(Aee)??{},NF=t=>{var o,i,s,a,l;const e=(o=t==null?void 0:t.credential_schema)==null?void 0:o.fields,n=(i=t==null?void 0:t.auth_schema)==null?void 0:i.sub_params,r=((s=t==null?void 0:t.config_schema)==null?void 0:s.sub_params)??(t==null?void 0:t.sub_params);return{type:Array.isArray(t)?"array":t===null?"null":typeof t,keys:_s(t),id:t==null?void 0:t.id,auth_type:t==null?void 0:t.auth_type,account_key:(t==null?void 0:t.account_key)??((a=t==null?void 0:t.credential_schema)==null?void 0:a.key),account_ver:(t==null?void 0:t.account_ver)??((l=t==null?void 0:t.credential_schema)==null?void 0:l.version),credentialSchemaKeys:_s(t==null?void 0:t.credential_schema),credentialFieldCount:Array.isArray(e)?e.length:void 0,credentialFieldKeys:Dee(e),authSchemaKeys:_s(t==null?void 0:t.auth_schema),authSchemaSubParamCount:Array.isArray(n)?n.length:void 0,authSchemaSubParamNames:Array.isArray(n)?n.map(c=>c==null?void 0:c.name).filter(Boolean):void 0,configSchemaKeys:_s(t==null?void 0:t.config_schema),configSubParamCount:Array.isArray(r)?r.length:void 0}},Tv=t=>({keys:_s(t),subParamCount:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.length:0,subParamNames:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.name).filter(Boolean):[],subParamControls:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.page_control).filter(Boolean):[]}),lp=(t,e)=>{var n,r;return{account_key:(t==null?void 0:t.account_key)??((n=t==null?void 0:t.credential_schema)==null?void 0:n.key)??e??null,account_ver:(t==null?void 0:t.account_ver)??((r=t==null?void 0:t.credential_schema)==null?void 0:r.version)??null}},MF=t=>{const e=t==null?void 0:t.credential_schema,n=e==null?void 0:e.fields;return(!Array.isArray(n)||!n.length)&&console.warn(`${Ua} credential_schema.fields missing or empty`,{model:NF(t)}),Array.isArray(n)&&n.length?TF(n):null},Tee=({value:t,onChange:e,linkApp:n,actionAccountSchemaId:r,selectTitle:o="授权配置",disabled:i=!1,placeholder:s="请选择账号"})=>{const[a,l]=C.useState([]),[c,u]=C.useState(!1),[d,h]=C.useState(!1),[f,m]=C.useState(!1),g=C.useRef(null),v=C.useRef(null),w=_.Form.useFormInstance(),b=C.useMemo(()=>r?`_account_${r}`:"_account",[r]);C.useEffect(()=>{w&&w.validateFields([b]).catch(()=>{})},[t,w,b]);const y=It.useReactive({createModalVisible:!1,modifyModalVisible:!1,configModel:{},credentialFormSchema:null,credentialInitialValues:{},schemaMeta:{},account_scheme_id:"",name:"",auth_type:"",modifyId:"",proxy_id:"",editId:"",editValue:"",createLoading:!1,createRequestLock:!1,isEditing:!1}),k=r==null?void 0:String(r),D=async()=>{if(!(!(n!=null&&n.id)&&!k)){u(!0);try{const F=Eee(k)?n==null?void 0:n.id:void 0,H=await _k(F,k);H?l(H.items||[]):_.message.error("获取账号列表失败")}catch(F){console.error(`${Ua} 获取账号列表失败:`,F),_.message.error("获取账号列表失败")}finally{u(!1)}}};C.useEffect(()=>{D()},[n==null?void 0:n.id,k]),C.useEffect(()=>{y.editId&&g.current&&setTimeout(()=>{var F;(F=g.current)==null||F.focus()},100)},[y.editId]);const S=F=>{if(f){h(!0);return}h(F)},x=()=>{if(!y.editId||!y.editValue){y.editId="",y.isEditing=!1,m(!1);return}kk(y.editId,y.editValue).then(()=>{D(),y.editId="",y.editValue="",y.isEditing=!1,m(!1),_.message.success(Y("link.flow.modification_success"))}).catch(()=>{y.editId="",y.isEditing=!1,m(!1)})},E=(F,H,V)=>{F.stopPropagation(),F.preventDefault(),y.isEditing=!0,m(!0),h(!0),y.editId=H,y.editValue=V,setTimeout(()=>{v.current&&v.current.focus()},0)},T=F=>{F.stopPropagation(),F.preventDefault(),m(!0)},A=F=>{y.isEditing||e&&e(F)},O=()=>{if(!k){_.message.error("未配置账号模式");return}y.createLoading=!0,km(k).then(F=>{var Q;const H=MF(F),V=lp(F,k),q=H?{}:_ee(F);H||console.warn(`${Ua} create modal will use legacy DynamicAccountForm`,{reason:"credentialFormSchema is null",model:NF(F),configModel:Tv(q)}),y.credentialFormSchema=H,y.credentialInitialValues={},y.schemaMeta=V,y.configModel=q,y.account_scheme_id=F.id,y.name=F.name,y.auth_type=F.auth_type??((Q=F.credential_schema)==null?void 0:Q.type),y.createModalVisible=!0}).catch(F=>{console.error(`${Ua} account model load failed for create`,{schemaId:k,error:F})}).finally(()=>{y.createLoading=!1})},B=F=>{vk(F).then(async H=>{var R;const V=H.account_schema_id,q=H.account_key,Q=H.account_ver,te=q??V??k;let $=null;if(te)try{$=await km(String(te),Q)}catch(ee){console.error("获取账号模型失败:",ee)}const U=MF($);y.credentialFormSchema=U,y.credentialInitialValues=U?H.config??{}:{},y.schemaMeta={...lp($,q??k),account_key:q??lp($,k).account_key,account_ver:Q??lp($).account_ver},y.configModel=U?{}:H.config,y.account_scheme_id=V??($==null?void 0:$.id)??H.id,y.name=H.name,y.proxy_id=H.proxy_id,y.auth_type=H.auth_type??($==null?void 0:$.auth_type)??((R=$==null?void 0:$.credential_schema)==null?void 0:R.type)??"",y.modifyId=F,y.modifyModalVisible=!0})},M=C.useCallback((F,H)=>{if(y.createRequestLock)return;let V=F;if(!y.credentialFormSchema){if(V=Kt.cloneDeep(y.configModel),!Array.isArray(V==null?void 0:V.sub_params)){console.error(`${Ua} create account legacy config has no sub_params`,{configModel:Tv(y.configModel),valueKeys:_s(F)}),_.message.error("账号模型配置为空,无法保存");return}V.sub_params.forEach(Q=>{let te=F[Q.name];Q.page_control===Ee.EXTEND_OBJ&&(te=Ev(te)),Q.value=te})}const q=F.proxy_id;delete F.proxy_id,y.createRequestLock=!0,H?xm((n==null?void 0:n.id)??null,y.account_scheme_id,y.auth_type,y.name,V,y.modifyId,q,y.schemaMeta).then(Q=>{Q&&_.message.success("测试连接成功!")}).finally(()=>{y.createRequestLock=!1}):yk((n==null?void 0:n.id)??null,y.account_scheme_id,y.auth_type,y.name,V,q,y.schemaMeta).then(()=>{_.message.success(Y("link.flow.creation_success")),D(),y.createModalVisible=!1}).finally(()=>{y.createRequestLock=!1})},[]),I=C.useCallback(()=>{y.createModalVisible=!1},[]),N=(F,H)=>{let V=F;if(!y.credentialFormSchema){if(V=Kt.cloneDeep(y.configModel),!Array.isArray(V==null?void 0:V.sub_params)){console.error(`${Ua} modify account legacy config has no sub_params`,{configModel:Tv(y.configModel),valueKeys:_s(F)}),_.message.error("账号模型配置为空,无法保存");return}V.sub_params.forEach(Q=>{let te=F[Q.name];Q.page_control===Ee.EXTEND_OBJ&&(te=Ev(te)),Q.value=te})}const q=F.proxy_id;delete F.proxy_id,H?xm((n==null?void 0:n.id)??null,y.account_scheme_id,y.auth_type,y.name,V,y.modifyId,q,y.schemaMeta).then(Q=>{Q&&_.message.success("测试连接成功!")}):Ck(y.modifyId,null,null,null,null,V,q,y.schemaMeta).then(()=>{_.message.success(Y("link.flow.modification_success")),D(),y.modifyModalVisible=!1,y.modifyId=""})},P=F=>p.jsxs("div",{children:[F,p.jsx(_.Divider,{style:{margin:"4px 0"}}),p.jsx("div",{style:{padding:"4px",textAlign:"center"},children:p.jsx(_.Button,{icon:p.jsx(ie.UserAddOutlined,{}),onClick:O,loading:y.createLoading,type:"link",block:!0,children:"创建新账号"})})]});return p.jsxs(p.Fragment,{children:[p.jsx(kee,{label:o,layout:"vertical",required:!0,name:b,initialValue:t,rules:[{validator:()=>t?Promise.resolve():Promise.reject(new Error(s||"请选择账号"))}],children:p.jsx(_.Select,{ref:v,value:t,onChange:A,style:{width:"100%"},placeholder:s,disabled:i,loading:c,allowClear:!0,popupRender:P,classNames:{popup:{root:"workflow-account-select__popup"}},listHeight:320,open:d,onOpenChange:S,children:a.map(F=>p.jsx(See,{value:F.id,children:p.jsxs("div",{className:As.accountOption,onClick:H=>{y.isEditing&&H.stopPropagation()},children:[p.jsx("div",{className:`${As.accountName} workflow-account-select__name`,children:y.editId!==F.id?p.jsxs(C.Fragment,{children:[p.jsx("span",{children:F.name}),p.jsx(ie.EditOutlined,{className:`${As.nameEditIcon} workflow-account-select__edit`,onClick:H=>E(H,F.id,F.name)})]}):p.jsx("div",{className:As.editInputWrapper,onClick:T,children:p.jsx(_.Input,{ref:g,defaultValue:F.name,className:As.nameEditInput,onClick:T,onMouseDown:H=>{H.stopPropagation(),H.preventDefault()},onFocus:H=>{H.stopPropagation(),m(!0)},onPressEnter:H=>{H.stopPropagation(),H.preventDefault(),x()},onBlur:()=>{x()},onChange:H=>{y.editValue=H.target.value}})})}),p.jsxs("div",{className:As.accountActions,children:[p.jsx(xee,{type:"secondary",className:As.updateTime,children:Qt(Number(F.update_time)*1e3).format("YYYY-MM-DD HH:mm:ss")}),p.jsx(_.Button,{type:"link",icon:p.jsx(ie.FileSearchOutlined,{}),size:"small",onClick:H=>{H.stopPropagation(),B(F.id)},children:"编辑"})]})]})},F.id))})}),p.jsx(iee,{onSubmit:M,onCancel:I,inAI:!0,auth_type:y.auth_type,config:y.configModel,formSchema:y.credentialFormSchema,visible:y.createModalVisible,connector:n}),p.jsx(cee,{onSubmit:N,inAI:!0,onCancel:()=>{y.modifyModalVisible=!1},proxy_id:y.proxy_id,auth_type:y.auth_type,config:y.configModel,formSchema:y.credentialFormSchema,initialValues:y.credentialInitialValues,visible:y.modifyModalVisible,connector:n})]})},BF=({credentialRequirements:t,actionAccountSchemaId:e,value:n,onChange:r,...o})=>{var l;const i=C.useMemo(()=>{const c=e?[{key:String(e)}]:[];return _v(t!=null&&t.length?t:c)},[e,t]),[s,a]=C.useState(n?(l=i[0])==null?void 0:l.key:void 0);return C.useEffect(()=>{var c;if(!n){a(void 0);return}!s&&((c=i[0])!=null&&c.key)&&a(i[0].key)},[s,i,n]),i.length===0?null:p.jsx(C.Fragment,{children:i.map(c=>p.jsx(Tee,{...o,actionAccountSchemaId:c.key,selectTitle:i.length>1?c.label:"授权配置",value:s===c.key?n:void 0,onChange:u=>{a(u?c.key:void 0),r==null||r(u)}},c.key))})},Oee=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Nee=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=C.useState(e||""),[s,a]=C.useState(!1);C.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const h=Oee();i(h),a(!0),n==null||n(h)},c=()=>{l()},u=async()=>{if(!o){_.message.warning(Y("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(Y("components.authTokenField.copySuccess"))}catch{_.message.error(Y("components.authTokenField.copyFailed"))}},d=()=>{a(h=>!h)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:Y("components.authTokenField.placeholder")}),p.jsx(_.Tooltip,{title:Y("components.authTokenField.copy"),children:p.jsx(_.Button,{icon:p.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:p.jsx(_.Button,{icon:s?p.jsx(ie.EyeInvisibleOutlined,{}):p.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:p.jsx(_.Button,{icon:p.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},Mee=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Bee=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=C.useState(e||""),[s,a]=C.useState(!1);C.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const h=Mee();i(h),a(!0),n==null||n(h)},c=()=>{if(!o){l();return}_.Modal.confirm({title:Y("common.info"),content:Y("components.authTokenField.regenerateConfirm"),okText:Y("app.common.word.confirm"),cancelText:Y("app.common.word.cancel"),onOk:l})},u=async()=>{if(!o){_.message.warning(Y("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(Y("components.authTokenField.copySuccess"))}catch{_.message.error(Y("components.authTokenField.copyFailed"))}},d=()=>{a(h=>!h)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:Y("components.authTokenField.placeholder")}),p.jsx(_.Tooltip,{title:Y("components.authTokenField.copy"),children:p.jsx(_.Button,{icon:p.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:p.jsx(_.Button,{icon:s?p.jsx(ie.EyeInvisibleOutlined,{}):p.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),p.jsx(_.Tooltip,{title:Y(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:p.jsx(_.Button,{icon:p.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},FF=10,Fee=["OAUTH","OAUTH2","OIDC"],Iee=t=>{const e=new Set([...t.support_protocol??[],...t.auth_protocol?[t.auth_protocol]:[]]);return Array.from(e).some(n=>Fee.includes(n))},Pee=t=>{const{value:e,onChange:n,disabled:r}=t,o=ou(),[i,s]=C.useState([]),[a,l]=C.useState(!1),[c,u]=C.useState(!1),[d,h]=C.useState(""),[f,m]=C.useState(1),[g,v]=C.useState(!1),w=C.useRef(0),b=C.useMemo(()=>`${window.location.origin}/iam/token`,[]),y=async(T=1,A=!1,O="")=>{const B=w.current+1;w.current=B,A?u(!0):l(!0);try{const M=await Tk({current:T,pageSize:FF},{filter:O});if(w.current!==B)return;const I=(M.items??[]).filter(Iee),P=(A?[...i,...I]:I).filter((F,H,V)=>V.findIndex(q=>q.client_id===F.client_id)===H);s(P),m(T),v((M.total??0)>T*FF)}catch{w.current===B&&_.message.error(Y("components.selectOAuth2ClientField.fetchFailed"))}finally{w.current===B&&(l(!1),u(!1))}};let k=null;C.useEffect(()=>{k&&(clearTimeout(k),k=null),k=window.setTimeout(()=>{y(1,!1,d.trim())},300)},[d]);const D=async()=>{!g||a||c||await y(f+1,!0,d.trim())},S=async()=>{try{await navigator.clipboard.writeText(b),_.message.success(Y("components.selectOAuth2ClientField.copySuccess"))}catch{_.message.error(Y("components.selectOAuth2ClientField.copyFailed"))}},x=()=>{o("/apps/manage",!0)},E=()=>{o("https://1in15q85qd.apifox.cn/8698545m0",!0)};return p.jsxs(_.Space,{direction:"vertical",size:12,style:{width:"100%"},children:[p.jsxs("div",{children:[p.jsx(_.Select,{value:e,onChange:n,disabled:r,loading:a,showSearch:!0,filterOption:!1,optionLabelProp:"label",placeholder:Y("components.selectOAuth2ClientField.placeholder"),onSearch:h,notFoundContent:a?p.jsx(_.Spin,{size:"small"}):null,getPopupContainer:T=>T.parentNode,popupRender:T=>p.jsxs("div",{children:[T,!a&&i.length===0?p.jsx("div",{style:{padding:"16px 12px"},children:p.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:p.jsxs(_.Space,{direction:"vertical",size:4,children:[p.jsx(_.Typography.Text,{type:"secondary",children:Y("components.selectOAuth2ClientField.emptyTitle")}),p.jsx(_.Typography.Text,{type:"secondary",style:{fontSize:12},children:Y("components.selectOAuth2ClientField.emptyDescription")})]}),children:p.jsx(_.Button,{type:"primary",ghost:!0,icon:p.jsx(ie.LinkOutlined,{}),onClick:x,children:Y("components.selectOAuth2ClientField.goToAppManage")})})}):null,i.length>0?p.jsx("div",{style:{padding:"8px 12px",textAlign:"center",borderTop:"1px solid #f0f0f0"},children:p.jsx(_.Button,{type:"link",icon:p.jsx(ie.ReloadOutlined,{}),onClick:D,loading:c,disabled:!g,children:Y(g?"components.selectOAuth2ClientField.loadMore":"components.selectOAuth2ClientField.loadedAll")})}):null]}),options:i.map(T=>({label:T.client_name,value:T.client_id}))}),p.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[Y("components.selectOAuth2ClientField.selectDescriptionPrefix"),p.jsx(_.Button,{style:{padding:0},type:"link",onClick:x,children:Y("components.selectOAuth2ClientField.goToAppManage")}),Y("components.selectOAuth2ClientField.selectDescriptionSuffix")]})]}),p.jsxs("div",{children:[p.jsx(_.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:Y("components.selectOAuth2ClientField.tokenEndpoint")}),p.jsxs(_.Space.Compact,{block:!0,className:"workflow-oauth-token-endpoint",children:[p.jsx(_.Input,{value:b,readOnly:!0}),p.jsx(_.Button,{icon:p.jsx(ie.CopyOutlined,{}),onClick:S,disabled:r,children:Y("components.selectOAuth2ClientField.copy")})]}),p.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[Y("components.selectOAuth2ClientField.tokenDescriptionPrefix"),p.jsx(_.Button,{style:{padding:0},type:"link",onClick:E,children:Y("components.selectOAuth2ClientField.documentation")})]})]})]})},Lee=({children:t,value:e,onChange:n})=>{const[r,o]=C.useState(e==="{{$fromAI}}"),i=()=>{const a=!r;o(a),a?n==null||n("{{$fromAI}}"):n==null||n("")},s=()=>r?p.jsxs("div",{style:{position:"relative"},children:[p.jsx(_.Input,{value:"由AI生成 ",readOnly:!0,style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"1px solid transparent",borderImage:"linear-gradient(45deg, #00d4ff, #9b59b6, #e74c3c) 1",color:"#ffffff",fontWeight:"500",textShadow:"0 1px 2px rgba(0,0,0,0.3)",borderRadius:"6px",fontSize:"13px",paddingLeft:"32px",paddingRight:"28px",height:"32px",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)"},prefix:p.jsx("div",{style:{background:"linear-gradient(45deg, #00d4ff, #1e3c72)",borderRadius:"50%",width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"4px",animation:"pulse 2s ease-in-out infinite alternate"},children:p.jsx("span",{style:{color:"#fff",fontSize:"8px"},children:"AI"})}),suffix:p.jsx(_.Button,{type:"text",size:"small",onClick:i,style:{color:"#ffffff",border:"none",background:"rgba(255,255,255,0.2)",borderRadius:"50%",width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minWidth:"18px",padding:0},onMouseEnter:a=>{a.currentTarget.style.background="rgba(255,255,255,0.3)",a.currentTarget.style.transform="scale(1.1)"},onMouseLeave:a=>{a.currentTarget.style.background="rgba(255,255,255,0.2)",a.currentTarget.style.transform="scale(1)"},children:p.jsx(ie.CloseOutlined,{style:{fontSize:"10px"}})})}),p.jsx("style",{children:`
120
120
  @keyframes pulse {
121
121
  0% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.6); }
122
122
  100% { box-shadow: 0 0 0 6px rgba(0, 212, 255, 0); }
123
123
  }
124
- `})]}):C.isValidElement(t)?C.cloneElement(t,{value:e,onChange:n,...t.props}):t;return p.jsxs(p.Fragment,{children:[!r&&p.jsx("div",{style:{marginBottom:6,textAlign:"right"},children:p.jsxs(_.Button,{size:"small",type:"primary",onClick:i,style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"none",borderRadius:"14px",padding:"0 10px",height:"24px",fontSize:"11px",fontWeight:"500",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"4px",lineHeight:1},onMouseEnter:a=>{a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow="0 4px 12px rgba(102, 126, 234, 0.5)"},onMouseLeave:a=>{a.currentTarget.style.transform="translateY(0)",a.currentTarget.style.boxShadow="0 2px 8px rgba(102, 126, 234, 0.3)"},children:[p.jsx(ie.RobotOutlined,{style:{fontSize:"11px"}}),"由AI生成"]})}),s()]})},$ee=t=>{var n;const e=nr();return p.jsx(_.Select,{id:e,style:{borderRadius:6},...t,getPopupContainer:r=>r.parentNode,children:(n=t==null?void 0:t.options)==null?void 0:n.map(r=>p.jsx(_.Select.Option,{label:r.label,value:r.value,children:r.label},r.value))})},Hee=t=>p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",value:t.value?Qt(t.value):null,onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD")))}}),Vee=t=>p.jsx(C.Fragment,{children:p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",showTime:!0,value:t.value?Qt(t.value):null,onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD hh:mm:ss")))}})}),zee=({value:t=[],onChange:e,selectType:n="KNOWLEDGE_BASE",placeholder:r="请选择"})=>{const o=It.useReactive({items:[]}),[i,s]=C.useState([]),[a,l]=C.useState(!1);C.useEffect(()=>{n&&(l(!0),Dk(n).then(f=>{f&&Array.isArray(f)&&s(f)}).catch(f=>{console.error("获取选项失败:",f),s([])}).finally(()=>{l(!1)}))},[n]),C.useEffect(()=>{const f=Array.isArray(t)?t:[];o.items=f.map(m=>({...m,id:m.id??nr()}))},[t]);const c=zt(),u=f=>{const m=o.items.filter(g=>g.id!==f);e==null||e(m)},d=()=>{e([...o.items,{value:"",id:nr()}])},h=(f,m)=>{e(o.items.map((g,v)=>v===f?{...g,value:m}:g))};return p.jsxs("div",{children:[o.items.length?o.items.map((f,m)=>p.jsxs(_.Space,{size:"small",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[p.jsx(_.Select,{value:f.value||void 0,onChange:g=>h(m,g),placeholder:r,style:{width:300},disabled:!c||a,loading:a,options:i,showSearch:!0,filterOption:(g,v)=>((v==null?void 0:v.label)??"").toLowerCase().includes(g.toLowerCase()),getPopupContainer:g=>g.parentNode}),c&&p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{u(f.id)}})]},f.id)):null,c&&p.jsx(_.Button,{type:"default",onClick:d,block:!0,icon:p.jsx(Kr,{size:16}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})})]})},Wee=({value:t=[],onChange:e,valueType:n})=>{const r=u=>{let d=[...o.items];d=d.filter(h=>h.id!==u),e==null||e(d)},o=It.useReactive({items:[]}),i=u=>{const d=u.which||u.keyCode;(d===37||d===229)&&u.preventDefault()};C.useEffect(()=>{const u=Array.isArray(t)?t:[];o.items=u.map(d=>({...d,id:d.id??nr()}))},[t]);const s=()=>{e==null||e([...o.items,{key:"",value:"",id:nr()}])},a=(u,d)=>{e==null||e(o.items.map(h=>h.id===u?{...h,key:d}:h))},l=(u,d)=>{e==null||e(o.items.map(h=>h.id===u?{...h,value:d}:h))},c=zt();return p.jsxs("div",{className:"workflow-extend-object",children:[o.items.length?o.items.map((u,d)=>p.jsxs(_.Space,{size:"small",className:"workflow-extend-object__row",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[p.jsx(_.Input,{defaultValue:u.key,onKeyDown:i,onChange:h=>{var f;a(u.id,(f=h.target.value)==null?void 0:f.replace(/'/g,""))},placeholder:"Key"}),p.jsx("span",{className:"workflow-extend-object__value",style:{display:"inline-block",transform:"translateY(2px)",width:300},children:p.jsx(rr,{borrow:!0,disableIDE:!0,placeholder:"Value",style:{width:300},value:u.value,onChange:h=>l(u.id,h),valueType:n,nodeId:""})}),c&&p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{r(u.id)}})]},u.id)):null,p.jsxs(_.Button,{type:"default",onClick:s,block:!0,children:[p.jsx(Kr,{size:16})," ",p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})]})]})},jee=t=>null,Uee=t=>p.jsx(_.TimePicker,{style:{width:"100%"},use12Hours:!1,format:"HH:mm",value:t.value?Qt(t.value,"HH:mm"):null,onChange:e=>{const n=Qt(e).format("HH:mm:00");t.onChange&&(t==null||t.onChange(n))}}),{Text:Ree}=_.Typography,IF=t=>p.jsx("div",{className:"ce-tag_input label-field",children:p.jsx("p",{children:p.jsx(_.Tooltip,{title:t.value,color:"cyan",placement:"topLeft",children:p.jsx(Ree,{ellipsis:!0,copyable:{text:t.value},children:t.value})})})}),qee=({value:t=[],onChange:e,...n})=>{const[r,o]=C.useState([]);C.useEffect(()=>{const h=Array.isArray(t)?t:[];o(h.map(f=>({...f,id:f.id??nr()})))},[t]);const i=zt(),s=h=>{const f=r.filter(m=>m.id!==h);o(f),e==null||e(f)},a=()=>{const h={field:"",dataType:"string",desc:"",required:!1,id:nr()},f=[...r,h];o(f),e(f)},l=(h,f)=>{const m=r.map(g=>g.id===h?{...g,field:f}:g);o(m),e(m)},c=(h,f)=>{const m=r.map(g=>g.id===h?{...g,dataType:f}:g);o(m),e(m)},u=(h,f)=>{const m=r.map(g=>g.id===h?{...g,desc:f}:g);o(m),e(m)},d=(h,f)=>{const m=r.map(g=>g.id===h?{...g,required:f}:g);o(m),e(m)};return p.jsxs("div",{className:"workflow-multi-row-extract",children:[r.length?r.map(h=>p.jsxs(_.Space,{size:"small",className:"workflow-multi-row-extract__row",style:{display:"flex",marginBottom:8,width:"100%"},align:"start",children:[p.jsx(_.Input,{value:h.field,onChange:f=>l(h.id,f.target.value),placeholder:"字段名称",status:"",style:{width:130},disabled:!i}),p.jsx(_.Select,{value:h.dataType,onChange:f=>c(h.id,f),placeholder:"数据类型",style:{width:100},disabled:!i,options:[{label:"字符串",value:"string"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"布尔",value:"boolean"}]}),p.jsx(_.Input,{value:h.desc,onChange:f=>u(h.id,f.target.value),placeholder:"字段描述",status:"",style:{width:200},disabled:!i}),p.jsx(_.Select,{value:h.required,onChange:f=>d(h.id,f),placeholder:"是否必填",style:{width:100},disabled:!i,options:[{label:"是",value:!0},{label:"否",value:!1}]}),i&&p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{s(h.id)}})]},h.id)):null,i&&p.jsx(_.Button,{type:"default",onClick:a,block:!0,icon:p.jsx(Kr,{size:16}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})})]})},Gee=t=>{const e=C.useMemo(()=>nr(),[]),{event$:n}=C.useContext(jo),r=kb(e),[o,i]=C.useState("");n.useSubscription(a=>{var l;if(a.type==="insert"&&a.currentInputId===e){const c=(o??"")+(t.valueType==="FIX_VALUE"?a.expression.slice(2,-2):a.expression);i(c),(l=t.onChange)==null||l.call(t,c)}}),C.useEffect(()=>{i(t.value)},[t.value]);const s=a=>{var l;i(a.target.value),(l=t.onChange)==null||l.call(t,a.target.value)};return p.jsxs(_.Space.Compact,{block:!0,className:`workflow-password-field${r?` ${xf}`:""}`,children:[p.jsx("span",{className:"workflow-password-field__prefix",children:Y("link.flow.cipherText")}),p.jsx(_.Input.Password,{id:e,onFocus:()=>{(t.valueType==="JS_EXP"||t.valueType==="FIX_VALUE"||t.valueType==="PLAIN_TEXT"||t.valueType==="PLAIN_CODE")&&(n.emit({type:"visible",visible:!0}),n.emit({type:"setCurrentInputId",currentInputId:e}))},value:o,onChange:s})]})},Kee=t=>{var o;const e=nr(),{multiple:n,...r}=t;return p.jsx(_.Select,{id:e,style:{borderRadius:6},mode:n?"multiple":void 0,...r,getPopupContainer:i=>i.parentNode,children:(o=t==null?void 0:t.options)==null?void 0:o.map(i=>p.jsx(_.Select.Option,{label:i.label,value:i.value,children:i.label},i.value))})},Yee=t=>p.jsx(_.TimePicker,{style:{width:"100%"},value:t.value?Qt(t.value,"HH:mm:ss"):null,onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("HH:mm:ss")))}}),iu=()=>jt().flowId,Xee=["sample","test","payload","body"],Jee=["测试","样本","sample","test","payload","body"],PF=t=>{var n,r,o;return[Ee.JSON,Ee.TEXTAREA,Ee.FIXED_OBJ].includes(t.page_control)?!0:((o=(r=(n=t.value_type)==null?void 0:n.toLowerCase)==null?void 0:r.call(n))==null?void 0:o.includes("json"))??!1},LF=(t,e)=>{if(!t)return!1;const n=t.toLowerCase();return e.some(r=>n.includes(r))},Qee=t=>{if(t==null)return;const e=(t==null?void 0:t.data)!==void 0?t.data:t;if(typeof e=="string")try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return}},Zee=t=>{const{form:e,configList:n=[],disabled:r,...o}=t;jk();const[i,s]=C.useState(!1),[a,l]=C.useState(0),c=C.useRef(void 0),u=iu(),d=C.useMemo(()=>{const m=n.find(g=>PF(g)&&(LF(g.name,Xee)||LF(g.display_name,Jee)));return m||n.find(g=>PF(g))},[n]),h=C.useCallback(()=>{c.current&&(clearInterval(c.current),c.current=void 0)},[]);C.useEffect(()=>()=>{h()},[h]);const f=C.useCallback(async()=>{if(!u){_.message.warning("缺少连接流ID,无法监听Webhook");return}if(!(d!=null&&d.name)){_.message.warning("未找到测试数据字段,无法填充监听结果");return}if(!i){s(!0),l(10),c.current=setInterval(()=>{l(m=>m<=1?(h(),0):m-1)},1e3);try{const m=await gk(u,{timeout_seconds:10}),g=Qee(m);g?(e.setFieldsValue({[d.name]:g}),_.message.success("已捕获Webhook推送数据并填充测试样例")):_.message.info("监听结束,暂无新的推送数据")}catch(m){console.error("监听Webhook失败:",m),_.message.error("监听失败,请稍后重试")}finally{h(),s(!1),l(0)}}},[u,e,i,d==null?void 0:d.name,h]);return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},className:"web-hook",children:[p.jsx("div",{style:{flex:1},className:"web-hook-input",children:p.jsx(IF,{...o})}),p.jsx(_.Button,{size:"small",type:"primary",ghost:!0,onClick:f,disabled:r||!(d!=null&&d.name),loading:i,style:{height:32,minWidth:110,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i?`监听中${a?`(${a}s)`:""}`:"监听"})]})},ete={configFormContainer:"_configFormContainer_1frpl_1"};function tte(t){return Cee(t==null?void 0:t.credentials)}const nte=t=>String(t.type).toUpperCase();function $F(t){var e,n;return(n=(e=t==null?void 0:t.input_fields)==null?void 0:e.find(r=>nte(r)==="PROXY"))==null?void 0:n.key}function HF(t){return t==null||t===""?"0":String(t)}function rte(t,e,n){const r=$F(e);return r?{...t,[r]:HF(n??t[r])}:t}function ote(t,e){const n=$F(e);if(!n)return{properties:t};const r={...t},o=HF(r[n]);return delete r[n],{properties:r,proxyId:o}}const VF=({field:t,disabled:e,readOnly:n,context:r,value:o="",onChange:i,id:s,allowVariableInsert:a,hasModeSwitch:l})=>{const c=qS(),u=C.useId(),d=s||`workflow-code-${u}`,h=C.useRef(null),[f,m]=C.useState(0),g=!e&&!n,v=C.useCallback(D=>{var E;if(!a)return;const S=(E=h.current)==null?void 0:E.view,x=S==null?void 0:S.state.selection.main;if(!S||!x){i==null||i(`${o}${D}`);return}S.dispatch({changes:{from:x.from,to:x.to,insert:D},selection:{anchor:x.from+D.length}}),S.focus()},[a,i,o]),w=VS(d,D=>v(D),()=>{var D,S;return(S=(D=h.current)==null?void 0:D.view)==null?void 0:S.focus()}),b=ig(),y=(b==null?void 0:b.activeFieldId)===d,k=C.useCallback(()=>{if(g)try{i==null||i(JSON.stringify(JSON.parse(o),null,2))}catch{_.message.warning(Y("link.flow.format_json_failed"))}},[g,i,o]);return p.jsx(ex,{id:d,canEditInEditor:g,openEditorNumber:f,nodeId:c.nodeId||r.nodeId||"",value:o,language:"json",showVariableSidebar:a,onFinish:i,children:p.jsxs("div",{style:{position:"relative"},className:y?xf:void 0,children:[p.jsx(Hc,{id:d,ref:h,value:o,readOnly:!g,height:"220px",placeholder:t.placeholder,theme:bh,extensions:[Sv()],onFocus:()=>{g&&a&&w.activate()},onChange:i}),g?p.jsxs(_.Space,{size:4,style:{position:"absolute",right:8,top:6,zIndex:2},children:[p.jsx(_.Tooltip,{title:Y("link.flow.format_json"),children:p.jsx(_.Button,{type:"text",size:"small","aria-label":Y("link.flow.format_json"),icon:p.jsx(ie.FormatPainterOutlined,{}),onClick:k,style:{color:"#fff"}})}),p.jsx(_.Tooltip,{title:Y("link.flow.open_code_editor"),children:p.jsx(_.Button,{type:"text",size:"small","aria-label":Y("link.flow.open_code_editor"),icon:p.jsx(ie.FullscreenOutlined,{}),onClick:()=>m(D=>D+1),style:{color:"#fff"}})})]}):null]})})};VF.displayName="WorkflowCodeEditor";const zF=({field:t,disabled:e,readOnly:n,context:r,value:o,onChange:i,id:s})=>{const a=typeof o=="string"?o:o==null?"":JSON.stringify(o)??"",l=!!t.valueModePolicy,c=t.valueModePolicy==="EXPRESSION"||t.valueModePolicy==="BOTH",u=d=>p.jsx(VF,{...d,field:t,context:r,id:s,allowVariableInsert:c,hasModeSwitch:l});return t.valueModePolicy?p.jsx(ks,{value:a,onChange:d=>i==null?void 0:i(d),valueModePolicy:t.valueModePolicy,disabled:e,readOnly:n,placeholder:t.placeholder,renderNormalMode:u,renderExpressionMode:u,modeSwitchPosition:"top-right",encodeExpressionValue:!0}):u({value:a,onChange:d=>i==null?void 0:i(d),disabled:e,readOnly:n,placeholder:t.placeholder})};zF.displayName="WorkflowCodeFieldControl";const ite=gt(zF,{needsFormItemName:!0,supportsVariableInsert:!0}),WF=({disabled:t,readOnly:e,value:n,onChange:r,id:o})=>{const[i,s]=C.useState([]),[a,l]=C.useState(!1);C.useEffect(()=>{let d=!1;return l(!0),bm().then(h=>{d||s(Array.isArray(h)?h:[])}).catch(()=>{d||_.message.error(Y("link.flow.request_failed"))}).finally(()=>{d||l(!1)}),()=>{d=!0}},[]);const c=C.useMemo(()=>[{value:"0",label:p.jsx(Oe.FormattedMessage,{id:"link.flow.do_not_use"})},...i.map(d=>({value:String(d.id),label:d.group_name||String(d.id)}))],[i]),u=n==null||n===""?"0":String(n);return p.jsx(_.Select,{id:o,className:"proxy_id_select",value:u,options:c,loading:a,disabled:t||e,dropdownStyle:{zIndex:99999999999},onChange:d=>r==null?void 0:r(String(d)),style:{width:"100%"}})};WF.displayName="WorkflowProxyFieldControl";const ste=gt(WF,{needsFormItemName:!0,supportsVariableInsert:!0}),ate=[{type:we.CODE,definition:ite},{type:we.PROXY,definition:ste}];function lte({children:t}){const e=jt(),n=C.useMemo(()=>{var o;const r=(((o=e.canvas.registerComponents)==null?void 0:o.form)??[]).map(i=>{const s=i.component;return{type:i.name,definition:{component:a=>p.jsx(s,{config:a.field,disabled:a.disabled,nodeId:a.context.nodeId,mcpMode:a.context.mcpMode,value:a.value,onChange:a.onChange}),meta:{needsFormItemName:!0,supportsVariableInsert:!0,supportsAiFillable:!0}}}});return[...ate,...r]},[e.canvas.registerComponents]);return p.jsx(KS,{additionalRegistrations:n,children:t})}function su(){const{event$:t}=C.useContext(jo),e=og();return C.useCallback(n=>{var o;const r=document.activeElement;if(r&&r!==document.body&&r.contains(n.target)){const i=n.target;if(!["INPUT","TEXTAREA","SELECT"].includes((i==null?void 0:i.tagName)??""))return}(o=t==null?void 0:t.emit)==null||o.call(t,{type:"setCurrentInputId",currentInputId:""}),e==null||e.deactivateField()},[t,e])}const cte=[Ee.TEXT,Ee.PASSWORD,Ee.SELECT,Ee.EXTEND_OBJ,Ee.DATE,Ee.TIME,Ee.DATETIME,Ee.TEXTAREA,Ee.FIXED_OBJ,Ee.JSON],ute="[workflow:schema-render]",dte=/^\{\{([^.{}]+)\.(.+)\}\}$/,hte=async t=>{if(t!==hF)return[];const e=await Cm();return((e==null?void 0:e.items)??[]).map(r=>({label:r.display_name||r.name,value:r.name}))},fte=t=>{switch(t.page_control){case Ee.SELECT:case Ee.API_SELECT:return t.multi_valued?[]:null;case Ee.EXTEND_OBJ:return{};case Ee.HIDDEN:return"";case Ee.TEXT:return"";case Ee.PASSWORD:return"";case Ee.LABEL:return"";case Ee.DATE:return null;case Ee.TIME:return null;case Ee.DATETIME:return null;case Ee.TEXTAREA:return"";case Ee.FIXED_OBJ:return{};case Ee.MultiRowAIExtractConfig:return[];case Ee.JSON:return""}},jF=(t,e,n,r,o)=>{const i=t.display_name,s=()=>{var a,l,c;switch(t.page_control){case Ee.SELECT:return p.jsx(Kee,{options:xv(t.option_value_objects??t.option_values),multiple:t.multi_valued});case Ee.API_SELECT:return p.jsx($ee,{options:xv(t.option_value_objects??t.option_values)});case Ee.EXTEND_OBJ:return p.jsx(Wee,{valueType:t.value_type});case Ee.HIDDEN:return p.jsx(jee,{});case Ee.TEXT:return p.jsx(rr,{valueType:t.value_type,nodeId:e});case Ee.PASSWORD:return p.jsx(Gee,{valueType:t.value_type});case Ee.LABEL:return(a=r==null?void 0:r.webhookField)!=null&&a.enabled&&t.name==="hookUrl"&&r.webhookField.form?p.jsx(Zee,{form:r.webhookField.form,configList:r.webhookField.configList,disabled:r.webhookField.disabled}):p.jsx(IF,{});case Ee.DATE:return p.jsx(Hee,{});case Ee.TIME:return p.jsx(Yee,{});case Ee.DATETIME:return p.jsx(Vee,{});case Ee.TEXTAREA:return p.jsx(rr,{valueType:t.value_type,textAreaMode:!0,nodeId:e});case Ee.FIXED_OBJ:return p.jsx(_.Input.TextArea,{});case Ee.JSON:return p.jsx(rr,{valueType:t.value_type,nodeId:e});case Ee.MultiRowAIExtractConfig:return p.jsx(qee,{valueType:t.value_type});case Ee.MULTI_SELECT_LIST:return p.jsx(zee,{selectType:"KNOWLEDGE_BASE"});case Ee.SYNC_HOUR_MINUTE:return p.jsx(Uee,{});case Ee.AUTH_TOKEN:return p.jsx(Nee,{disabled:(l=r==null?void 0:r.webhookField)==null?void 0:l.disabled});case Ee.SECRET_KEY:return p.jsx(Bee,{});case Ee.SELECT_CLIENT:return p.jsx(Pee,{});default:{const u=(c=o==null?void 0:o.form)==null?void 0:c.find(d=>d.name===t.page_control);return u?p.jsx(u.component,{config:t,configList:r==null?void 0:r.configList,disabled:r==null?void 0:r.disabled,form:r==null?void 0:r.form,mcpMode:n,nodeId:e}):(console.warn(`unknown form item: page_control:${t.page_control}`),null)}}};return n&&cte.includes(t.page_control)?p.jsx("div",{children:p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:t.page_control===Ee.SELECT?Y("link.flow.please_select")+t.display_name:Y("link.flow.please_enter")+t.display_name}],label:i,name:t.name,children:p.jsx(Lee,{children:s()})})},t.ui_id):p.jsx(_.Form.Item,{required:t.required,style:t.page_control===Ee.HIDDEN?{display:"none"}:{},rules:[{required:t.required,message:t.page_control===Ee.SELECT?Y("link.flow.please_select")+t.display_name:Y("link.flow.please_enter")+t.display_name},{validator(a,l,c){if(t.page_control===Ee.MultiRowAIExtractConfig)if(Array.isArray(l)&&t.required){const u=l.some(d=>!d.field||!d.dataType||!d.desc||d.required==null);c(u?"请填写完整配置":void 0)}else c(void 0);else c(void 0)}}],label:i,name:t.name,children:s()},t.ui_id)},pte=t=>(t.child_conditions??[]).map(e=>e.left).filter(e=>!!e),mte=(t,e)=>{if(!t.is_child)return!0;const n=t.child_conditions??[];return n.length?n.some(({left:r,operator:o,right:i})=>{const s=e==null?void 0:e[r];return o==="EQUALS"?s===i:s!==i}):!0},gte=C.forwardRef((t,e)=>{var me,ue;const{action:n,connector:r,nodeId:o,account_id:i,mcpMode:s,nodeType:a}=t,l=jt(),c=ne.useStoreApi(),u=su(),d=It.useReactive({proxyId:"0"}),{config_schema:h,proxy_id:f,protocol:m,account_schema_id:g}=n;a??n.node_type??n.type;const v=n.action_key||n.nodeKey,w=n.action_ver??n.nodeVersion,b=Array.isArray(h==null?void 0:h.sub_params),y=ii(n),k=C.useMemo(()=>!y||!v?null:`${v}@${w??"latest"}`,[y,v,w]),D=k?`${o}:${k}`:o,S=n.account_id??i,x=C.useMemo(()=>k?js(v,w):null,[k,v,w]),[E,T]=C.useState(()=>k&&x?{identity:k,schema:x,loading:!1,finished:!0}:null),A=(E==null?void 0:E.identity)===k?E:null,O=(A==null?void 0:A.schema)??null,B=_v((O==null?void 0:O.credentials)??[]),M=!!(y&&v&&!O&&((A==null?void 0:A.loading)??!(A!=null&&A.finished))),I=tte(O);C.useEffect(()=>{!E||E.identity},[k,E,o,v,w]),C.useEffect(()=>{f&&(d.proxyId=f)},[f,d]);const[N]=_.Form.useForm(),[P,F]=C.useState(S);C.useEffect(()=>{F(S)},[D,S,F]);const H=C.useMemo(()=>{var le;return b?(le=h.sub_params)==null?void 0:le.reduce((Se,ce)=>{let Ie=ce.value;return ce.page_control===Ee.EXTEND_OBJ&&(Ie=uee(Ie)),Se[ce.name]=Ie??fte(ce),Se},{}):{}},[h==null?void 0:h.sub_params,b]);C.useEffect(()=>{b&&(N.resetFields(),N.setFieldsValue({...H}))},[H,N,b,o]);const V=C.useRef(null),q=C.useRef(null);C.useEffect(()=>{if(!k||!v){T(null);return}const le=js(v,w);if(le){T({identity:k,schema:le,loading:!1,finished:!0});return}let Se=!1;return T({identity:k,schema:null,loading:!0,finished:!1}),Zu(v,w).then(ce=>{Se||T({identity:k,schema:ce,loading:!1,finished:!0})}).catch(ce=>{Se||(T({identity:k,schema:null,loading:!1,finished:!0}),console.error(`${ute} classic renderer next schema load failed`,{nodeId:o,nodeKey:v,nodeVersion:w,err:ce}))}),()=>{Se=!0}},[k,o,v,w]);const Q=C.useMemo(()=>{var le;return(le=O==null?void 0:O.input_fields)!=null&&le.length?d5(TF(O.input_fields),O.key):null},[O]),te=!!(y&&(Q||I||O)),$=C.useMemo(()=>{const le=n.properties?Ol(n.properties):h&&y?Ol(h):n.params?Ol(n.params):{},Se=rte(le,O,f);return Yu(v)?yl(Se).properties:Se},[n,h,y,O,v,f]),U=C.useMemo(()=>JSON.stringify($??{}),[$]);C.useEffect(()=>{!y||!te||(N.resetFields(),N.setFieldsValue($))},[D,N,y,$,U,te]);const R=C.useRef(null);C.useEffect(()=>{R.current=null},[D]),C.useEffect(()=>{Yu(v)&&(R.current=JSON.stringify(yl($).branches.map(le=>[le.id,le.name])))},[$,v]);const ee=C.useCallback(le=>{const Se=le.trim().match(dte);if(!Se)return null;const ce=Se[1],Ie=Se[2];if(ce==="global")return null;const je=ce.startsWith("N")?ce.slice(1):ce,Ue=c.getState().nodes.find(Re=>Re.id===je);return Ue?{fieldPath:Ie,node:Ue,variableNodeId:ce}:null},[c]),se=C.useCallback(le=>{var Se;return((Se=ee(le))==null?void 0:Se.fieldPath)??le.replace(/^\{\{|\}\}$/g,"")},[ee]),he=C.useCallback(le=>{var Ue;const Se=ee(le);if(!Se)return le;const ce=(Ue=Se.node)==null?void 0:Ue.data,Ie=(ce==null?void 0:ce.label)||(ce==null?void 0:ce.name)||(ce==null?void 0:ce.action_name)||Se.variableNodeId,je=ce!=null&&ce.note?` (${ce.note})`:"";return`${Ie}${je}.${Se.fieldPath}`},[ee]),[j,K]=C.useState(!1),W=(le,Se)=>(K(!0),N.validateFields().then(async ce=>{var je,Ue,Re,xt,xe;if(te){Se&&((Ue=(je=V==null?void 0:V.current)==null?void 0:je.onIgnoreNodeStart)==null||Ue.call(je));const{properties:Ce,proxyId:$e}=ote(ce,O);return t.onSubmit({properties:Ce,account_id:P,proxy_id:$e},le)}const Ie=Kt.cloneDeep(n.config_schema);return Ie.sub_params.forEach(Ce=>{let $e=ce[Ce.name];Ce.page_control===Ee.EXTEND_OBJ&&$e!=="{{$fromAI}}"&&($e=Ev($e)),Ce.value=$e??null}),Se&&((xt=(Re=V==null?void 0:V.current)==null?void 0:Re.onIgnoreNodeStart)==null||xt.call(Re)),!i&&m==="HTTP"&&(r==null?void 0:r.deployment_type)!=="SaasApp"&&(Ie.proxy_id=(xe=q.current)==null?void 0:xe.getProxyId()),t.onSubmit(Ie,le)}).catch(ce=>(console.log("err",ce),_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>K(!1)));C.useImperativeHandle(e,()=>({saveConfig:le=>W(le,!1)}));const X=zt(),re={form:N,configList:(h==null?void 0:h.sub_params)??[],disabled:!X,...m==="WEBHOOK"?{webhookField:{enabled:!0,form:N,configList:(h==null?void 0:h.sub_params)??[],disabled:!X}}:{}},Z=le=>{const Se=le.page_control!==Ee.HIDDEN?p.jsx("p",{className:"field-desc",children:le.description}):null;if(!le.is_child)return p.jsxs("div",{children:[jF(le,o,s,re,l.canvas.registerComponents),Se]},le.ui_id);const ce=pte(le);return p.jsx(_.Form.Item,{noStyle:!0,shouldUpdate:(Ie={},je={})=>le.is_child?ce.length?ce.some(Ue=>(Ie==null?void 0:Ie[Ue])!==(je==null?void 0:je[Ue])):!0:!1,children:()=>{const Ie=N.getFieldsValue(!0);return mte(le,Ie)?p.jsxs("div",{children:[jF(le,o,s,re,l.canvas.registerComponents),Se]}):null}},le.ui_id)};if(y&&M)return p.jsx("div",{style:{textAlign:"center",padding:40},children:p.jsx(_.Spin,{})});const ae=!t.preRender&&(((me=n.config_schema)==null?void 0:me.sub_params)??[]).length<1,be=p.jsx("div",{style:{padding:16,color:"#999",textAlign:"center"},children:"该节点暂无配置项"});if(te){const le=p.jsxs(p.Fragment,{children:[t.preRender,I?p.jsx(BF,{credentialRequirements:B,value:P,onChange:F,linkApp:r,disabled:!X}):null]});return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:u,children:[p.jsx("div",{className:"workflow-node-form-scroll",children:Q?p.jsx(lte,{children:p.jsx(yv,{schema:Q,form:N,optionsLoader:hte,initialValues:$,showSubmit:!1,showReset:!1,nodeId:o,mcpMode:s,renderVariableTag:se,renderVariableTooltip:he,customTheme:Ru,preRender:le},D)}):be}),p.jsx("div",{className:"workflow-node-form-footer",children:X&&p.jsx(_.Button,{type:"primary",disabled:!X,loading:j,className:"workflow-node-form-save",onClick:()=>W(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:u,children:[p.jsxs(_.Form,{form:N,disabled:!X,layout:"vertical",className:`${ete.configFormContainer} workflow-config-form workflow-node-form-scroll`,children:[t.preRender,(r==null?void 0:r.id)&&n.config_schema&&((ue=h==null?void 0:h.sub_params)==null?void 0:ue.map(le=>Z(le))),!i&&m==="HTTP"&&(r==null?void 0:r.deployment_type)!=="SaasApp"?p.jsx(Cv,{proxyId:d.proxyId,ref:q}):null,ae&&be]}),p.jsx("div",{className:"workflow-node-form-footer",children:X&&p.jsx(_.Button,{type:"primary",disabled:!X,loading:j,className:"workflow-node-form-save",onClick:()=>W(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}),wte=C.memo(C.forwardRef((t,e)=>{const{nodeId:n,data:r}=t,{account_id:o,account_schema_id:i}=r,s=It.useReactive({account_id:o}),a=C.useRef(null);C.useImperativeHandle(e,()=>({saveConfig:f=>{var m;return(m=a.current)==null?void 0:m.saveConfig(f)}}));const l=C.useMemo(()=>({id:t.data.connector_id,name:t.data.connector_name,deployment_type:t.data.deployment_type}),[t.data.connector_id,t.data.connector_name,t.data.deployment_type]),c=ii(t.data),u=(f,m)=>{if(c){const g=Ol(f),w=Object.hasOwn(f??{},"account_id")?f.account_id??null:s.account_id;return t.onSubmit({properties:g,account_id:w,proxy_id:(f==null?void 0:f.proxy_id)??(g==null?void 0:g.proxy_id)},m)}return t.onSubmit({properties:f,account_id:s.account_id,proxy_id:f.proxy_id},m)},d=C.useCallback(f=>{s.account_id=f??null},[]);let h=null;return i&&!c&&(h=p.jsx(BF,{onChange:d,actionAccountSchemaId:i,value:s.account_id,linkApp:l})),p.jsx("div",{className:"workflow-action-node-config",children:p.jsx(gte,{ref:a,action:t.data,nodeType:t.data.node_type||t.data.type,connector:l,account_id:o,nodeId:n,onSubmit:u,preRender:h})})}),(t,e)=>t.nodeId===e.nodeId&&t.nodeType===e.nodeType&&Kt.isEqual(Kt.omit(t.data,["isHovered"]),Kt.omit(e.data,["isHovered"])));var ir=(t=>(t.IDLE="idle",t.SAVING="saving",t.SAVED="saved",t.ERROR="error",t))(ir||{}),cp=(t=>(t.SELECTION="selection",t.ALL="all",t))(cp||{}),Dr=(t=>(t.UNPUBLISHED="UNPUBLISHED",t.ONLINE="ONLINE",t.OFFLINE="OFFLINE",t.ON_WARN="ON_WARN",t.OFF_WARN="OFF_WARN",t.ONLINE_ING="ONLINE_ING",t))(Dr||{}),ot=(t=>(t.eq="eq",t.ne="ne",t.sw="sw",t.nsw="nsw",t.ew="ew",t.ewn="ewn",t.gt="gt",t.ge="ge",t.lt="lt",t.le="le",t.co="co",t.nco="nco",t.in="in",t.nin="nin",t.is_null="is_null",t.is_not_null="is_not_null",t))(ot||{});const UF=[{operator:ot.eq,label:Y("common.eq")},{operator:ot.ne,label:Y("common.ne")},{operator:ot.sw,label:Y("common.sw")},{operator:ot.nsw,label:Y("common.nsw")},{operator:ot.ew,label:Y("common.ew")},{operator:ot.ewn,label:Y("common.ewn")},{operator:ot.gt,label:Y("common.gt")},{operator:ot.ge,label:Y("common.ge")},{operator:ot.lt,label:Y("common.lt")},{operator:ot.le,label:Y("common.le")},{operator:ot.co,label:Y("common.co")},{operator:ot.nco,label:Y("common.nco")},{operator:ot.in,label:Y("common.in")},{operator:ot.nin,label:Y("common.nin")},{operator:ot.is_null,label:Y("common.is_null")},{operator:ot.is_not_null,label:Y("common.is_not_null")}];ot.eq+"",Y("common.eq"),ot.ne+"",Y("common.ne"),ot.sw+"",Y("common.sw"),ot.nsw+"",Y("common.nsw"),ot.ew+"",Y("common.ew"),ot.ewn+"",Y("common.ewn"),ot.gt+"",Y("common.gt"),ot.lt+"",Y("common.lt"),ot.ge+"",Y("common.ge"),ot.co+"",Y("common.co"),ot.nco+"",Y("common.nco"),ot.le+"",Y("common.le"),ot.in+"",Y("common.in"),ot.nin+"",Y("common.nin"),ot.is_null+"",Y("common.is_null"),ot.is_not_null+"",Y("common.is_not_null");const Ov=t=>t===ot.is_null||t===ot.is_not_null,bte=(t,e="")=>Ov(t)?"":e,{Option:vte}=_.Select,yte=C.forwardRef((t,e)=>{const{config_schema:n}=t,[r]=_.Form.useForm(),o=su(),s=(d=>d!=null&&d.or_list?{or_list:d.or_list.map(f=>({and_list:f.and_list.map(m=>({query:m.query||"",operator:m.operator||"",value:m.value||""}))}))}:{or_list:[{and_list:[{query:"",operator:"",value:""}]}]})(n),[a,l]=C.useState(!1),c=(d,h,f="")=>(l(!0),r.validateFields().then(async m=>t.onSubmit({properties:m},d)).catch(()=>(_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>l(!1)));C.useImperativeHandle(e,()=>({saveConfig:d=>c(d)}));const u=zt();return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:o,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsx(_.Form,{disabled:!u,form:r,initialValues:s,layout:"vertical",autoComplete:"off",children:p.jsx(_.Form.List,{name:"or_list",children:(d,{add:h,remove:f})=>p.jsxs(p.Fragment,{children:[d.map((m,g)=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"form-block",children:p.jsxs("div",{style:{padding:12,width:"100%",boxSizing:"border-box"},children:[g>0&&u&&p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsx(_.Button,{type:"link",style:{color:"red"},icon:p.jsx(ie.MinusCircleOutlined,{style:{color:"red"}}),onClick:()=>f(m.name),children:p.jsx(Oe.FormattedMessage,{id:"link.flow.remove"})})}),p.jsx(_.Form.List,{name:[m.name,"and_list"],children:(v,{add:w,remove:b})=>p.jsx(p.Fragment,{children:v.map((y,k)=>p.jsxs(_.Space,{direction:"vertical",style:{width:"100%",rowGap:0},children:[p.jsxs(_.Space,{align:"center",className:`form-item-row ${k>0?"opt":""}`,children:[p.jsx(_.Form.Item,{style:{minWidth:150},name:[y.name,"query"],label:Y("app.common.word.variable-name"),rules:[{required:!0,message:Y("link.flow.please_enter_variable_name")}],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.variable_name"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})}),p.jsx(_.Form.Item,{name:[y.name,"operator"],label:Y("app.common.word.condition"),rules:[{required:!0,message:Y("link.flow.please_select_condition")}],children:p.jsx(_.Select,{style:{minWidth:140},placeholder:Y("link.flow.select_condition"),getPopupContainer:D=>D.parentNode,children:UF.map(D=>p.jsx(vte,{value:D.operator,children:D.label},D.operator))})}),p.jsx(_.Form.Item,{noStyle:!0,shouldUpdate:!0,children:()=>{const D=r.getFieldValue(["or_list",m.name,"and_list",y.name,"operator"]);return Ov(D)?null:p.jsx(_.Form.Item,{style:{minWidth:150},name:[y.name,"value"],label:Y("app.common.word.value"),rules:[],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.value"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})})}}),k>0&&p.jsx(_.Button,{type:"link",icon:p.jsx(ie.MinusCircleOutlined,{}),onClick:()=>b(y.name)})]}),k<v.length-1&&p.jsx(_.Divider,{plain:!0,children:p.jsx(_.Tag,{color:"#999999",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.and"})})}),k===v.length-1&&p.jsx(_.Button,{type:"link",disabled:!u,icon:p.jsx(Kr,{size:16}),className:"small",onClick:()=>w({query:"",operator:"",value:""}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-new-and"})})]},y.key))})})]})},m.key),g<d.length-1&&p.jsxs("div",{className:"test",style:{textAlign:"center"},children:[" ",p.jsx(_.Divider,{style:{color:"orange"},dashed:!0,children:p.jsx(_.Tag,{color:"#1890ff",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.or"})})})]})]})),p.jsx(_.Form.Item,{style:{display:"flex",justifyContent:"flex-end",marginBlock:10},children:p.jsx(_.Button,{type:"default",icon:p.jsx(Kr,{size:16}),disabled:!u,onClick:()=>h({and_list:[{query:"",operator:"",value:""}]}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-or"})})})]})})})}),p.jsx("div",{className:"workflow-node-form-footer",children:u&&p.jsx(_.Button,{type:"primary",disabled:!u,loading:a,className:"workflow-node-form-save",onClick:()=>c(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})});var Cte=["isArray","start","level","className","render"];function Ra(t){var{isArray:e=!1,start:n=!1,level:r,className:o,render:i}=t,s=Qn(t,Cte),a=e?"[]":"{}",l="w-rjv-"+(e?"brackets":"curlybraces")+"-"+(n?"start":"end")+" "+(o||""),c="var(--w-rjv-"+(e?"brackets":"curlybraces")+"-color, #236a7c)";if(i){var u=i(Qe({isArray:e,level:r,className:l,style:{color:c},children:n?a.charAt(0):a.charAt(1)},s));if(u)return u}return p.jsx(Oi,Qe({color:c,className:l},s,{children:n?a.charAt(0):a.charAt(1)}))}Ra.displayName="JVR.Meta";var kte=["children","style","text","onCopied","render","show"];function Nv(t){var{style:e,text:n="",onCopied:r,render:o,show:i}=t,s=Qn(t,kte);if(!i)return null;var[a,l]=C.useState(!1),c=h=>{h.stopPropagation();var f=JSON.stringify(n||"",(m,g)=>typeof g=="bigint"?g.toString():g,2);n===1/0&&(f=1/0),navigator.clipboard.writeText(f).then(()=>{r&&r(f,n),l(!0);var m=setTimeout(()=>{l(!1),clearTimeout(m)},3e3)}).catch(m=>{})},u=Qe({},e,{cursor:"pointer",verticalAlign:"middle",marginLeft:5}),d=Qe({height:"1em",width:"1em",fill:"var(--w-rjv-copied-color, currentColor)",onClick:c,style:u,className:"w-rjv-copied"},s);return o?o(Qe({},t,d)):a?p.jsx("svg",Qe({viewBox:"0 0 32 36"},d,{fill:"var(--w-rjv-copied-success-color, #28a745)",children:p.jsx("path",{d:"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z"})})):p.jsx("svg",Qe({viewBox:"0 0 32 36"},d,{children:p.jsx("path",{d:"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z"})}))}Nv.displayName="JVR.Copied";var Ste=["children","style"],xte=["children","length","style"],Ete=["color","style","isURL","href","children"],Dte=["value","parentValue","setValue","countInfo","data","keyName","indentWidth","isSet","namespace","renderKey","components","quotes","level","enableClipboard","displayObjectSize","displayDataTypes","shortenTextAfterLength"],Ate=["children","color","fontSize","opacity","paddingRight","style"],Ti=t=>p.jsx("div",Qe({},t));Ti.displayName="JVR.Line";var _te=t=>Number(t)===t&&t%1!==0||isNaN(t),au={string:{color:"var(--w-rjv-type-string-color, #cb4b16)",label:"string"},number:{color:"var(--w-rjv-type-int-color, #268bd2)",label:"int"},float:{color:"var(--w-rjv-type-float-color, #859900)",label:"float"},bigint:{color:"var(--w-rjv-type-bigint-color, #268bd2)",label:"bigint"},boolean:{color:"var(--w-rjv-type-boolean-color, #2aa198)",label:"bool"},date:{color:"var(--w-rjv-type-date-color, #586e75)",label:"date"},url:{color:"var(--w-rjv-type-url-color, #0969da)",label:"url"},null:{color:"var(--w-rjv-type-null-color, #d33682)",label:"null"},Set:{color:"var(--w-rjv-type-set-color, #268bd2)",label:"Set"},Map:{color:"var(--w-rjv-type-map-color, #268bd2)",label:"Map"},NaN:{color:"var(--w-rjv-type-nan-color, #859900)",label:"NaN"},undefined:{color:"var(--w-rjv-type-undefined-color, #586e75)",label:"undefined"}},up=t=>{var{children:e=":",style:n}=t,r=Qn(t,Ste);return p.jsx("span",Qe({className:"w-rjv-colon",style:Qe({paddingRight:3},n,{color:"var(--w-rjv-colon-color, var(--w-rjv-color))"})},r,{children:e}))};up.displayName="JVR.Colon";function Tte(t){var e=typeof t,n="";typeof t=="number"&&(e=_te(t)?"float":"number",n=t.toString(),isNaN(t)&&(e="NaN",n="NaN")),typeof t=="boolean"&&(e="boolean",n=t.toString()),typeof t=="object"&&t instanceof Date&&(e="date",n=t.toString()),t===null&&(e="null",n=(""+t).toLocaleUpperCase()),t===void 0&&(e="undefined",n=String(t)),typeof t=="bigint"&&(e="bigint",n=t+"n");var r=t instanceof URL;return r&&(e="url",n='"'+t.href+'"'),typeof t=="string"&&(n='"'+t+'"'),{type:e,content:n}}var RF=t=>{var{children:e,length:n,style:r}=t,o=Qn(t,xte),i=e,[s,a]=C.useState(n&&i.length>=n);C.useEffect(()=>a(n&&i.length>=n),[n]);var l=()=>a(!s),c=s?i.slice(0,n)+"...":i;return p.jsx(Mv,Qe({},o,{style:Qe({},r,{cursor:"pointer"}),onClick:l,children:c}))};RF.displayName="JVR.RenderShortenTextValue";var Mv=t=>{var{color:e,style:n,isURL:r,href:o,children:i}=t,s=Qn(t,Ete);return p.jsxs(Oi,Qe({color:e,style:n},s,{className:"w-rjv-value",children:[r&&p.jsx("a",{href:o,style:{color:e},target:"_blank",rel:"noopener noreferrer",children:i}),!r&&i]}))};Mv.displayName="JVR.RenderStringValue";function qF(t){var e,{value:n,parentValue:r,setValue:o,countInfo:i,data:s,keyName:a,indentWidth:l,namespace:c,renderKey:u,components:d={},quotes:h,enableClipboard:f,displayDataTypes:m,shortenTextAfterLength:g}=t,v=Qn(t,Dte),w="",b={},{type:y,content:k}=Tte(n),D=p.jsx(dp,{type:y});n===null&&(D=p.jsx(C.Fragment,{}),b={fontWeight:"bold"}),(n===void 0||y.toLocaleLowerCase()==="nan"||!m)&&(D=p.jsx(C.Fragment,{}));var S=n instanceof URL;w=((e=au[y])==null?void 0:e.color)||"";var[x,E]=C.useState(!1),T=C.useMemo(()=>f&&x&&p.jsx(Nv,{show:x,text:n}),[f,x,n]),A={className:"w-rjv-line",style:{paddingLeft:l}};if(f&&(A.onMouseEnter=()=>E(!0),A.onMouseLeave=()=>E(!1)),k&&typeof k=="string"){var O=d.value&&d.value({className:"w-rjv-value",style:Qe({color:w},b),type:y,value:n,setValue:o,data:s,parentValue:r,quotes:h,keyName:a,namespace:c,visible:x,content:k,children:k}),B=g&&y==="string"?p.jsx(RF,{color:w,href:S?n.href:"",style:b,isURL:S,length:g,children:k}):p.jsx(Mv,{color:w,href:S?n.href:"",style:b,isURL:S,children:k});return p.jsx(Ti,Qe({},A,{children:p.jsxs(Oi,Qe({},v,{ref:null,children:[u,p.jsx(up,{}),D,O||B,T]}))}))}var M=p.jsxs(C.Fragment,{children:[p.jsx(Ra,{render:d.braces,start:!0,isArray:Array.isArray(n)}),p.jsx(Ra,{render:d.braces,isArray:Array.isArray(n)}),i]});return p.jsx(Ti,Qe({},A,{children:p.jsxs(Oi,Qe({},v,{ref:null,children:[u,p.jsx(up,{}),D,M,T]}))}))}qF.displayName="JVR.ValueView";var Oi=C.forwardRef((t,e)=>{var{children:n,color:r,fontSize:o,opacity:i,paddingRight:s,style:a}=t,l=Qn(t,Ate);return p.jsx("span",Qe({style:Qe({color:r,fontSize:o,opacity:i,paddingRight:s},a)},l,{ref:e,children:n}))});Oi.displayName="JVR.Label";var dp=t=>{var e,n,{type:r}=t,o=(e=au[r])==null?void 0:e.color,i=(n=au[r])==null?void 0:n.label;if(o&&i)return p.jsx(Oi,{color:o,fontSize:11,opacity:.8,paddingRight:4,className:"w-rjv-type","data-type":r,children:i})};dp.displayName="JVR.Type";var Ote=["style"];function GF(t){var{style:e}=t,n=Qn(t,Ote),r=Qe({cursor:"pointer",height:"1em",width:"1em"},e);return p.jsx("svg",Qe({viewBox:"0 0 24 24",fill:"var(--w-rjv-arrow-color, currentColor)",style:r},n,{children:p.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})}))}GF.displayName="JVR.TriangleArrow";var lu={},cu=[],KF={collapse(t){lu=Qe({},lu,{[t]:!1}),YF()},expand(t){lu=Qe({},lu,{[t]:!0}),YF()}};function Nte(){return lu}function Mte(t){return cu=[...cu,t],()=>{cu=cu.filter(e=>e!==t)}}function YF(){for(var t of cu)t()}function Bte(){var t=C.useSyncExternalStore(Mte,Nte);return t}var Fte=["children","render","color","value","className","keyName","highlightUpdates","quotes","style","namespace","parentName"];function Ite(t){var e=C.useRef();return C.useEffect(()=>{e.current=t}),e.current}function Pte(t){var{value:e,highlightUpdates:n,highlightContainer:r}=t,o=Ite(e),i=C.useMemo(()=>!n||o===void 0?!1:typeof e!=typeof o?!0:typeof e=="number"?isNaN(e)&&isNaN(o)?!1:e!==o:Array.isArray(e)!==Array.isArray(o)?!0:typeof e=="object"||typeof e=="function"?!1:e!==o,[n,e]);C.useEffect(()=>{r&&r.current&&i&&"animate"in r.current&&r.current.animate([{backgroundColor:"var(--w-rjv-update-color, #ebcb8b)"},{backgroundColor:""}],{duration:1e3,easing:"ease-in"})},[i,e,r])}var Bv=t=>{var{render:e,color:n,value:r,className:o="w-rjv-object-key",keyName:i,highlightUpdates:s,quotes:a,style:l,namespace:c,parentName:u}=t,d=Qn(t,Fte),h=C.useRef(null),f=typeof i=="string"?""+a+i+a:i;return e?e(Qe({className:o},d,{value:r,namespace:c,style:Qe({},l,{color:n}),parentName:u,keyName:i,quotes:a,label:i,children:f})):(Pte({value:r,highlightUpdates:s,highlightContainer:h}),p.jsx(Oi,Qe({className:o,color:n},d,{ref:h,children:f})))};Bv.displayName="JSR.Semicolon";var Lte=["style","render","count","level"],XF=t=>{var{style:e,render:n,count:r,level:o}=t,i=Qn(t,Lte),s=Qe({cursor:"pointer"},e),a="w-rjv-ellipsis "+(i.className||"");return n?n(Qe({style:s,count:r,level:o},i,{className:a})):p.jsx("span",Qe({className:a,style:s},i,{children:"..."}))};XF.displayName="JVR.Ellipsis";var $te=["value","keyName","className","displayDataTypes","components","displayObjectSize","enableClipboard","highlightUpdates","objectSortKeys","indentWidth","shortenTextAfterLength","collapsed","level","keyid","quotes","namespace","isSet","isMap","onCopied","onExpand","parentValue","setParentValue"];function Hte(t){try{return Object.keys(t).length}catch{return-1}}var Fv=t=>{var{children:e}=t;return p.jsxs(Oi,{style:{paddingLeft:4,fontStyle:"italic"},color:"var(--w-rjv-info-color, #0000004d)",className:"w-rjv-object-size",children:[e," items"]})};Fv.displayName="JVR.CountInfo";var hp=C.forwardRef((t,e)=>{var n,{value:r={},keyName:o,className:i,displayDataTypes:s=!0,components:a={},displayObjectSize:l=!0,enableClipboard:c=!0,highlightUpdates:u=!0,objectSortKeys:d=!1,indentWidth:h=15,shortenTextAfterLength:f=30,collapsed:m,level:g=1,keyid:v="root",quotes:w='"',namespace:b=[],isSet:y=!1,isMap:k=!1,onCopied:D,onExpand:S,parentValue:x,setParentValue:E}=t,T=Qn(t,$te),A=Array.isArray(r),O=C.useId(),B=Bte(),M=(n=B[v])!=null?n:typeof m=="boolean"?m:typeof m=="number"?g<=m:!0,I=()=>{S&&typeof S=="function"&&S({expand:!M,keyid:v,keyName:o,value:r}),M?KF.collapse(v):KF.expand(v)},[N,P]=C.useState(r),F={components:a,indentWidth:h,displayDataTypes:s,displayObjectSize:l,enableClipboard:c,highlightUpdates:u,onCopied:D,onExpand:S,collapsed:m,parentValue:r,setParentValue:P,quotes:w,level:g+1,style:{paddingLeft:h}},H={displayDataTypes:s,displayObjectSize:l,enableClipboard:c,shortenTextAfterLength:f,level:g+1,parentValue:r,indentWidth:h,data:N,quotes:w,setValue:P},V={transform:"rotate("+(M?"0":"-90")+"deg)",transition:"all 0.3s"},q=a.arrow?C.cloneElement(a.arrow,{style:V,"data-expand":M,className:"w-rjv-arrow"}):p.jsx(GF,{style:V,className:"w-rjv-arrow"}),[Q,te]=C.useState(!1),$={};c&&($.onMouseEnter=()=>te(!0),$.onMouseLeave=()=>te(!1)),C.useEffect(()=>P(r),[r]);var U=A?Object.keys(N).map(he=>Number(he)):Object.keys(N),R=A?Object.entries(N).map(he=>[Number(he[0]),he[1]]):Object.entries(N);d&&(R=d===!0?R.sort((he,j)=>{var[K]=he,[W]=j;return typeof K=="string"&&typeof W=="string"?K.localeCompare(W):0}):R.sort((he,j)=>{var[K]=he,[W]=j;return typeof K=="string"&&typeof W=="string"?d(K,W):0}));var ee=p.jsx(Fv,{children:U.length});a.countInfo&&(ee=a.countInfo({count:U.length,level:g,visible:M})||ee),l||(ee=null);var se=a.countInfoExtra&&a.countInfoExtra({count:U.length,level:g,showTools:Q,keyName:o,visible:M,value:N,namespace:[...b],parentValue:x,setParentValue:E,setValue:P});return p.jsxs("div",Qe({ref:e},T,{className:i+" w-rjv-inner"},$,{children:[p.jsxs(Ti,{style:{display:"inline-flex",alignItems:"center"},onClick:I,children:[q,(typeof o=="string"||typeof o=="number")&&p.jsxs(C.Fragment,{children:[p.jsx(Bv,{value:N,quotes:w,"data-keys":v,namespace:[...b],render:a.objectKey,keyName:o,parentName:o,color:typeof o=="number"?au.number.color:""}),p.jsx(up,{})]}),y&&p.jsx(dp,{type:"Set"}),k&&p.jsx(dp,{type:"Map"}),p.jsx(Ra,{start:!0,isArray:A,level:g,render:a.braces}),!M&&p.jsx(XF,{render:a.ellipsis,count:U.length,level:g}),!M&&p.jsx(Ra,{isArray:A,level:g,render:a.braces}),ee,se,c&&p.jsx(Nv,{show:Q,text:N,onCopied:D,render:a==null?void 0:a.copied})]}),M&&p.jsx(Ti,{className:"w-rjv-content",style:{borderLeft:"var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)",marginLeft:6},children:R.length>0&&[...R].map((he,j)=>{var[K,W]=he,X=W,re=X instanceof Set,Z=X instanceof Map,ae=re?Array.from(X):Z?Object.fromEntries(X):X,be=Array.isArray(ae)&&ae.length===0||typeof ae=="object"&&ae&&!(ae instanceof Date)&&Object.keys(ae).length===0;if((Array.isArray(ae)||re||Z)&&!be){var me=A?j:K;return p.jsx(Ti,{className:"w-rjv-wrap",children:p.jsx(hp,Qe({value:ae,isSet:re,isMap:Z,namespace:[...b,me],keyName:me,keyid:v+O+me},F))},me+j)}if(typeof ae=="object"&&ae&&!(ae instanceof Date)&&!be)return p.jsx(Ti,{className:"w-rjv-wrap",children:p.jsx(hp,Qe({value:ae,namespace:[...b,K],keyName:K,keyid:v+O+K},F))},K+""+j);if(typeof ae!="function"){var ue=p.jsx(Bv,{value:ae,"data-keys":v,quotes:w,namespace:[...b,K],parentName:o,highlightUpdates:u,render:a.objectKey,color:typeof K=="number"?au.number.color:"",keyName:K}),le=Array.isArray(ae)?ae.length:Hte(ae);return ee=p.jsx(Fv,{children:le}),a.countInfo&&(ee=a.countInfo({count:le,level:g,visible:M})||ee),p.jsx(qF,Qe({components:a,namespace:[...b,K]},H,{countInfo:ee,renderKey:ue,keyName:K,isSet:y,value:ae}),j)}})}),M&&p.jsx(Ti,{style:{paddingLeft:2},children:p.jsx(Ra,{render:a.braces,isArray:A,level:g,style:{paddingLeft:2,display:"inline-block"}})})]}))});hp.displayName="JVR.RootNode";var Vte=["value","style","className"],JF=C.forwardRef((t,e)=>{var{value:n,style:r,className:o}=t,i=Qn(t,Vte),s=Qe({lineHeight:1.4,fontFamily:"var(--w-rjv-font-family, Menlo, monospace)",color:"var(--w-rjv-color, #002b36)",backgroundColor:"var(--w-rjv-background-color, #00000000)",fontSize:13},r),a="w-json-view-container w-rjv "+(o||""),l=C.useId();return p.jsx(hp,Qe({className:a,value:n},i,{ref:e,keyid:l,style:s}))});JF.displayName="JVR.JsonView";var zte={"--w-rjv-font-family":"monospace","--w-rjv-color":"#0184a6","--w-rjv-background-color":"#202020","--w-rjv-line-color":"#323232","--w-rjv-arrow-color":"var(--w-rjv-color)","--w-rjv-edit-color":"var(--w-rjv-color)","--w-rjv-info-color":"#656565","--w-rjv-update-color":"#ebcb8b","--w-rjv-copied-color":"#0184a6","--w-rjv-copied-success-color":"#28a745","--w-rjv-curlybraces-color":"#1896b6","--w-rjv-brackets-color":"#1896b6","--w-rjv-type-string-color":"#cb4b16","--w-rjv-type-int-color":"#268bd2","--w-rjv-type-float-color":"#859900","--w-rjv-type-bigint-color":"#268bd2","--w-rjv-type-boolean-color":"#2aa198","--w-rjv-type-date-color":"#586e75","--w-rjv-type-url-color":"#649bd8","--w-rjv-type-null-color":"#d33682","--w-rjv-type-nan-color":"#076678","--w-rjv-type-undefined-color":"#586e75"};const{Title:Wte}=_.Typography,QF=({status:t,result:e="",progress:n=60,runningAction:r="run",showAlert:o=!0,canEdit:i=!0,disabledReason:s="当前节点不支持手动测试",editing:a=!1,editableValue:l="",onEditableValueChange:c,onRun:u,onIgnore:d,onReset:h,onToggleEdit:f,onDismissAlert:m,className:g,onClose:v,onExpandPanel:w})=>{const b=t==="running",y=t==="failure",k=t==="ignored",D=t==="success"||k,S=t==="disabled",[x,E]=C.useState(!1),[T,A]=C.useState(!0),O=a?l:e,B=C.useMemo(()=>{if(a)return null;try{const N=JSON.parse(e);return A(!0),N!==null&&typeof N=="object"?N:null}catch{return null}},[a,e]),M=C.useCallback(()=>{const N=new Blob([O],{type:"application/json"}),P=URL.createObjectURL(N),F=document.createElement("a");F.href=P,F.download="data.json",document.body.appendChild(F),F.click(),F.remove(),URL.revokeObjectURL(P)},[O]),I=x?450:300;return p.jsxs("section",{className:["node-test-container","ai-flow-node-test-panel",g].filter(Boolean).join(" "),"aria-label":"AI FLOW 节点测试",children:[p.jsx("div",{className:"node-test-header",children:p.jsxs("div",{className:"header-title",children:[p.jsx("span",{className:"common-icon title-icon"}),p.jsx(Wte,{level:4,children:"节点测试"}),p.jsx(_.Button,{ghost:!0,className:"close-btn",onClick:v,children:p.jsx(Ds,{size:16})})]})}),p.jsxs("div",{className:"test-content",children:[i&&!S?p.jsxs("div",{className:"action-buttons",children:[p.jsx(_.Button,{type:"primary",disabled:S,onClick:u,loading:b&&r==="run",className:"test-button",children:b?"测试中...":"开始测试"}),p.jsx(_.Button,{type:"default",disabled:S||b&&r==="run",onClick:d,loading:b&&r==="ignore",className:"ignore-button",children:"忽略调试"})]}):null,i&&e?p.jsx("div",{className:"action-buttons",children:p.jsx(_.Button,{onClick:h,className:"reset-button",children:"重置"})}):null,b?p.jsxs(p.Fragment,{children:[p.jsx(_.Progress,{percent:n,status:"active",className:"test-progress"}),p.jsx(_.Skeleton,{active:!0,className:"result-skeleton"})]}):p.jsxs(p.Fragment,{children:[y&&o?p.jsx(_.Alert,{className:"error-alert small",showIcon:!0,message:"测试未通过",description:"请检查节点配置和接口返回后重试",type:"error",closable:!1,onClose:m}):null,D&&o?p.jsx(_.Alert,{className:"success-alert small",showIcon:!0,message:k?"忽略调试成功":"测试成功",description:k?"已将样本数据设为当前节点输出":"节点运行正常,可在下方查看返回结果",type:"success",closable:!1,onClose:m}):null,e?p.jsxs(_.Card,{styles:{body:{padding:0}},title:p.jsxs("div",{className:"result-header",children:[p.jsx("div",{className:"result-title",children:y?p.jsxs(p.Fragment,{children:[p.jsx(ie.CloseCircleFilled,{className:"error-icon"})," 错误数据"]}):p.jsxs(p.Fragment,{children:[k?p.jsx(ie.ExperimentFilled,{className:"success-icon"}):p.jsx(ie.CheckCircleFilled,{className:"success-icon"}),k?"样本数据":"测试结果"]})}),p.jsxs("div",{style:{display:"inline-flex",gap:8},children:[p.jsx(_.Button,{size:"small",type:"default",variant:"solid",onClick:M,className:"edit-button",children:"下载JSON"}),i&&f?p.jsx(_.Button,{size:"small",type:"default",variant:"solid",onClick:()=>{if(a&&!T){_.message.error("测试结果必须是json格式!");return}f()},className:"edit-button",children:a?"完成":"编辑"}):null,w&&p.jsx(_.Button,{size:"small",type:x?"primary":"default",variant:"solid",className:"edit-button",onClick:()=>{const N=!x;w(N),E(N)},children:x?p.jsx(iQ,{size:16}):p.jsx(oQ,{size:16})})]})]}),variant:"borderless",className:`result-card ${y?"error-result":"success-result"}`,children:[a&&p.jsx(Hc,{value:l,editable:!0,maxWidth:"100%",height:`${I}px`,theme:bh,extensions:[Sv(),Fe.lineWrapping],onChange:N=>{try{JSON.parse(N),A(!0)}catch{A(!1)}c==null||c(N)},basicSetup:{lineNumbers:!1,foldGutter:!1}}),!a&&(B?p.jsx(JF,{displayDataTypes:!1,displayObjectSize:!1,collapsed:!0,value:B,style:{...zte,height:I,overflowY:"auto"}}):p.jsx("pre",{className:"result-raw",style:{height:I},children:O}))]}):p.jsx(_.Card,{variant:"borderless",className:"empty-result",children:p.jsx(_.Result,{icon:p.jsx("span",{className:"common-icon"}),title:S?"不可测试":"等待测试",subTitle:S?s:"点击“开始测试”按钮运行当前节点"})})]})]})]})},jte=new Set([He.AI_LANGUAGE_MODEL,He.AI_MEMORY,He.BUILTIN_MCP,He.MCP_SERVER]),Ute=new Set([]),Rte=({canEdit:t,nodeType:e,protocol:n})=>t?n&&jte.has(n)?{disabled:!0,reason:"当前协议节点由所属 AI 或 MCP 运行上下文统一测试"}:e&&Ute.has(e)?{disabled:!0,reason:"当前节点类型不支持独立手动测试"}:{disabled:!1}:{disabled:!0,reason:"只读或预览模式下不能执行节点测试"},qte=t=>typeof t=="string"?t.trim().length>0:t!=null,Gte=t=>typeof t=="string"&&t.trim().toLowerCase()==="success",Kte=t=>{if(!t||typeof t!="object")return!1;const e=t;return e.result===!0?!1:e.result===!1?!0:e.error==="0"&&qte(e.error_description)&&!Gte(e.error_description)},Yte=t=>Kte(t)?ge.FAILED:ge.SUCCESS,Xte=t=>{if(typeof t=="object")return JSON.stringify(t,null,2);if(typeof t=="string")try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch{return t}return String(t)};JSON.stringify({result:"示例数据",data:{id:"123",name:"示例"}},null,2);const Jte=C.forwardRef((t,e)=>{var T,A,O,B;const{nodeId:n,beforeHook:r,onClose:o,onExpandPanel:i}=t,s=jt(),{handleNodeDataUpdate:a}=Gs(),l=(A=(T=s.nodeConfigPanel)==null?void 0:T.testArea)==null?void 0:A.defaultTestResult,[c,u]=C.useState(()=>{if(l==null)return"";if(typeof l=="string")return l;try{return JSON.stringify(l,null,2)}catch{return String(l)}}),d=ne.useInternalNode(n),h=It.useReactive({testProgress:0,sampleText:"",isError:!1,showErrorAlert:!1,testing:!1,successShown:!1,sampleMode:!1,sampleSaving:!1,sampleError:"",isIgnoreSuccess:!1,ignoring:!1,editable:!1}),{refreshFlow:f}=Qo();(O=d==null?void 0:d.data)==null||O.outputSource,C.useEffect(()=>{if(d!=null&&d.data.output&&(d.data.status===ge.SUCCESS||d.data.status===ge.RUNNABLE)){const M=typeof d.data.output=="string"?d.data.output:JSON.stringify(d.data.output,null,2);u(M),h.successShown=!0,h.isError=!1,h.showErrorAlert=!1}else if(d!=null&&d.data.output&&d.data.status===ge.FAILED){const M=typeof d.data.output=="string"?d.data.output:JSON.stringify(d.data.output,null,2);u(M),h.isError=!0,h.showErrorAlert=!0,h.successShown=!1}},[d,h]);const m=C.useCallback(()=>{if(!n){console.error("节点ID不能为空");return}h.testing=!0,h.testProgress=60,h.successShown=!1,h.isError=!1,h.showErrorAlert=!1,h.sampleMode=!1,mk(n).then(M=>{const I=M,N=Yte(I),P=N===ge.FAILED;h.isError=P,h.successShown=!P,h.showErrorAlert=h.isError;let F="";try{F=Xte(I)}catch(H){console.error("格式化测试结果出错:",H),F=`测试结果格式化失败: ${String(H)}`}h.testProgress=100,u(F),a({id:n,data:{status:N,output:F,outputSource:"test"}})}).catch(M=>{var P;console.error("测试失败:",M),h.testProgress=0,h.isError=!0,h.showErrorAlert=!0,h.successShown=!1;let I="测试执行失败";(P=M==null?void 0:M.response)!=null&&P.data?I=JSON.stringify(M.response.data,null,2):M!=null&&M.message&&(I=M.message);const N=JSON.stringify({error:I},null,2);u(N),a({id:n,data:{status:ge.FAILED,output:N,outputSource:"test"}})}).finally(()=>{setTimeout(()=>{h.testProgress=0,h.testing=!1},500)})},[a,n,h]),g=()=>{h.testProgress=0,h.testing=!1,h.sampleSaving=!1,h.sampleMode=!1,h.successShown=!0,h.isError=!1,h.showErrorAlert=!1},v=()=>{r&&(h.testing=!0,h.ignoring=!0,h.testProgress=60,r(!0,!0,h.sampleText))},w=()=>{h.sampleSaving=!1,h.ignoring=!1,h.successShown=!0,h.isError=!1,h.showErrorAlert=!1,h.isIgnoreSuccess=!0},b=()=>{h.testProgress=0,h.testing=!1,h.ignoring=!1,h.isIgnoreSuccess=!0};C.useImperativeHandle(e,()=>({onTestNode:m,finishSampleTest:g,abortSampleTest:w,finishNodeTest:b}));const y=()=>{h.sampleMode=!1,r?r(!0):m()},k=()=>{u(""),h.sampleText="",h.sampleMode=!1,h.sampleError="",h.successShown=!1},D=zt(),S=C.useMemo(()=>{var M;return Rte({canEdit:D,nodeType:d==null?void 0:d.type,protocol:(M=d==null?void 0:d.data)==null?void 0:M.protocol})},[D,(B=d==null?void 0:d.data)==null?void 0:B.protocol,d==null?void 0:d.type]),x=S.disabled?"disabled":h.testing?"running":h.isError?"failure":h.successShown?h.isIgnoreSuccess?"ignored":"success":"waiting",E=()=>{if(h.editable){h.editable=!1;try{const M=JSON.parse(h.sampleText),I=JSON.stringify(M,null,2);u(I),a({id:n,data:{output:I}})}catch{u(h.sampleText)}return}h.sampleText=c,h.editable=!0};return p.jsx(QF,{status:x,result:c,progress:h.testProgress||60,runningAction:h.ignoring?"ignore":"run",showAlert:h.isError?h.showErrorAlert:h.successShown,canEdit:D,disabledReason:S.reason,editing:h.editable,editableValue:h.sampleText,onEditableValueChange:M=>{h.sampleText=M},onRun:y,onIgnore:v,onReset:k,onToggleEdit:E,onDismissAlert:()=>{h.showErrorAlert=!1,h.successShown=!1},onClose:o,onExpandPanel:i})});var Ar=(t=>(t.Array="ARRAY",t.Boolean="BOOLEAN",t.Null="NULL",t.Number="NUMBER",t.Object="OBJECT",t.String="STRING",t))(Ar||{});const Iv={ARRAY:"purple",BOOLEAN:"green",NULL:"default",NUMBER:"blue",OBJECT:"cyan",STRING:"orange"},Qte={ARRAY:"Arr",BOOLEAN:"Bool",NULL:"Null",NUMBER:"Num",OBJECT:"Obj",STRING:"Str"},Pv=(t,e=!1)=>{const n=String(t||"STRING").toUpperCase(),r=Qte[n]||n.slice(0,4);return e?`${r}[]`:r},ZF=t=>{t!=null&&t.length&&t.forEach(e=>{e.label||(e.label=e.name),Array.isArray(e.sub_params)?ZF(e.sub_params):e.sub_params=[]})},Zte=t=>{const e=t==null?void 0:t.map(r=>(r.output.label=`${r.seq}-${r.connector_name} : ${r.action_name}`,r.note&&(r.output.label+=`(${r.note})`),{...r,label:`${r.connector_name}-${r.action_name}`,sub_params:[r.output]})),n=Kt.cloneDeep(e);return ZF(n),n};var e2=(t=>(t.TEXT="TEXT",t.NUMBER="NUMBER",t.JSON="JSON",t))(e2||{});const ene=t=>({TEXT:"STRING",NUMBER:"NUMBER",JSON:"OBJECT"})[t]||"STRING",tne=t=>{const{nodeId:e,flowId:n,enabled:r=!0,includeGlobalVariables:o=!0}=t,i=ne.useStoreApi(),[s,a]=C.useState([]),[l,c]=C.useState([]),[u,d]=C.useState(!1),[h,f]=C.useState(null),[m,g]=C.useState(0),[v,w]=C.useState(!1),[b,y]=C.useState(null),[k,D]=C.useState(0),S=C.useCallback(()=>{g(O=>O+1)},[]),x=C.useCallback(()=>{D(O=>O+1)},[]),E=C.useCallback(()=>{g(O=>O+1),D(O=>O+1)},[]);return C.useEffect(()=>{if(!r||!o){o||a([]),d(!1),f(null);return}let O=!1;return(async()=>{d(!0),f(null);try{const M=await Cm();if(O)return;const I=((M==null?void 0:M.items)||[]).map(N=>({...N,mappedType:ene(N.var_type)}));a(N=>Kt.isEqual(N,I)?N:I)}catch(M){console.error("Failed to fetch global variables:",M),O||f(M instanceof Error?M:new Error("无法获取全局变量数据"))}finally{O||d(!1)}})(),()=>{O=!0}},[r,o,m]),C.useEffect(()=>{if(!r||!n){w(!1),y(null);return}let O=!1;return(async()=>{w(!0),y(null);try{const{edges:M,nodes:I}=i.getState(),N=await bk(n,{nodeId:e,edges:M});if(O)return;const P=new Map(I.map(V=>[V.id,V])),H=(Zte(N)||[]).map(V=>{var $,U;const q=($=V.node_id)!=null&&$.startsWith("N")?V.node_id.slice(1):V.node_id,Q=q?P.get(q):void 0,te=typeof((U=Q==null?void 0:Q.data)==null?void 0:U.icon)=="string"?Q.data.icon:void 0;return{...V,nodeIcon:te,isValid:!!Q}});c(V=>Kt.isEqual(V,H)?V:H)}catch(M){console.error("Failed to fetch node variables:",M),O||y(M instanceof Error?M:new Error("无法获取节点变量数据"))}finally{O||w(!1)}})(),()=>{O=!0}},[n,e,r,k,i]),{globalVariables:s,nodeVariables:l,isLoading:u||v,isGlobalLoading:u,isNodeLoading:v,error:h||b,globalError:h,nodeError:b,refresh:E,refreshGlobal:S,refreshNode:x}},lt={container:"_container_xdcms_5",header:"_header_xdcms_29",headerIcon:"_headerIcon_xdcms_37",headerTitle:"_headerTitle_xdcms_41",body:"_body_xdcms_46",section:"_section_xdcms_61",sectionLabel:"_sectionLabel_xdcms_65",sectionIcon:"_sectionIcon_xdcms_79",typeTag:"_typeTag_xdcms_88",varItem:"_varItem_xdcms_97",varName:"_varName_xdcms_115",varValue:"_varValue_xdcms_121",nodeTitle:"_nodeTitle_xdcms_129",nodeIcon:"_nodeIcon_xdcms_134",nodeLabelFirst:"_nodeLabelFirst_xdcms_139",nodeLabel:"_nodeLabel_xdcms_139",leafTitle:"_leafTitle_xdcms_151",leafLabel:"_leafLabel_xdcms_156",leafValue:"_leafValue_xdcms_162",empty:"_empty_xdcms_172",loadingState:"_loadingState_xdcms_175",errorState:"_errorState_xdcms_184",invalidVariable:"_invalidVariable_xdcms_188",nodeIconWrapper:"_nodeIconWrapper_xdcms_197",defaultNodeIcon:"_defaultNodeIcon_xdcms_210"},Lv={VariableModalTitle:p.jsx(Oe.FormattedMessage,{id:"app.common.word.select-variable"}),NoTestDataDesc:p.jsx(Oe.FormattedMessage,{id:"common.no-process-variables-yet"})},nne=t=>{if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},rne=(t,e)=>{const n=t.trim(),r=n.startsWith("N")?n:`N${n}`,o=e.slice(1).join(".");return o?`{{${r}.${o}}}`:`{{${r}}}`},t2=C.forwardRef((t,e)=>{const n=iu(),{nodeId:r,showGlobalVariables:o=!0}=t,{event$:i}=C.useContext(jo),{globalVariables:s,nodeVariables:a,isGlobalLoading:l,isNodeLoading:c,globalError:u,nodeError:d,refreshGlobal:h,refreshNode:f}=tne({nodeId:r,flowId:n,enabled:t.open,includeGlobalVariables:o}),m=It.useReactive({currentInputId:"",visible:!0});i.useSubscription(w=>{switch(w.type){case"visible":m.visible||(h(),f()),m.visible=w.visible;break;case"setCurrentInputId":m.currentInputId=w.currentInputId;break}}),C.useImperativeHandle(e,()=>({loadVariables:()=>{h(),f()}}));const g=w=>{try{const b=typeof w=="string"?JSON.parse(w):w,y=(D,S)=>{if(D==null)return{name:S,type:Ar.Null,label:S,multi_valued:!1,sub_params:[],value:String(D)};if(typeof D=="object"&&!Array.isArray(D)){const E=D;return{name:S,type:Ar.Object,label:S,multi_valued:!1,sub_params:Object.keys(E).map(T=>y(E[T],T)),value:null}}if(Array.isArray(D)){const E=D[0],T=E&&typeof E=="object"?Ar.Object:typeof E=="number"?Ar.Number:typeof E=="boolean"?Ar.Boolean:E==null?Ar.Array:Ar.String;return{name:S,type:T,label:S,multi_valued:!0,sub_params:[],value:JSON.stringify(D)}}const x=typeof D=="number"?Ar.Number:typeof D=="boolean"?Ar.Boolean:Ar.String;return{name:S,type:x,label:S,multi_valued:!1,sub_params:[],value:String(D)}},k=b&&typeof b=="object"&&!Array.isArray(b)?b:{};return Object.keys(k).map(D=>y(k[D],D))}catch{return[]}},v=(w,b,y,k,D,S=[],x="0")=>(w??[]).map((E,T)=>{var M;const A=[...S,E.name],O=`${x}-${T}`;return(M=E.sub_params)!=null&&M.length?{key:O,variablePath:A,title:p.jsxs("span",{className:`${lt.nodeTitle}${k===!1?` ${lt.invalidVariable}`:""}`,children:[b?D==="api"?p.jsx(ie.ApiOutlined,{className:lt.nodeIcon}):p.jsx("span",{className:lt.nodeIconWrapper,children:y?p.jsx("img",{src:y,alt:""}):p.jsx("span",{className:lt.defaultNodeIcon,children:"N"})}):p.jsx(_.Tag,{color:Iv[E.type]||"gray",className:`${lt.typeTag} workflow-variable-panel__type`,children:Pv(E.type,E.multi_valued)}),p.jsx("span",{className:`${b?lt.nodeLabelFirst:lt.nodeLabel} workflow-variable-panel__label`,children:E.label})]}),children:v(E.sub_params,!1,y,k,D,A,O)}:{key:O,variablePath:A,title:p.jsxs("span",{className:`${lt.leafTitle}${k===!1?` ${lt.invalidVariable}`:""}`,title:`${E.label}:${E.value}`,children:[p.jsx(_.Tag,{color:Iv[E.type]||"gray",className:`${lt.typeTag} workflow-variable-panel__type`,children:Pv(E.type,E.multi_valued)}),p.jsx("span",{className:`${lt.leafLabel} workflow-variable-panel__label`,children:E.label}),E.value?p.jsx("span",{className:lt.leafValue,children:E.value}):null]})}});return p.jsxs("div",{className:`${lt.container} workflow-variable-panel`,children:[p.jsxs("div",{className:`${lt.header} workflow-variable-panel__header`,children:[p.jsx(rQ,{size:16,className:`${lt.headerIcon} workflow-variable-panel__header-icon`}),p.jsx("span",{className:`${lt.headerTitle} workflow-variable-panel__title`,children:Lv.VariableModalTitle})]}),p.jsxs("div",{className:`${lt.body} workflow-variable-panel__body`,children:[o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:`${lt.sectionLabel} workflow-variable-panel__section-label`,children:[p.jsx(ie.GlobalOutlined,{className:lt.sectionIcon,size:32}),p.jsx("span",{children:"全局变量"})]}),p.jsx("div",{className:`variable-panel-group ${!l&&!u&&s.length<1?"empty":""}`,children:p.jsxs("div",{className:lt.section,children:[s.map(w=>{if(w.var_type===e2.JSON){const k=g(w.var_value??{}),D=[{name:w.name,type:Ar.Object,label:w.display_name||w.name,multi_valued:!1,sub_params:k,value:null}],S=v(D,!0,void 0,!0,"api");return p.jsx(_.Tree,{defaultExpandAll:!0,showLine:!0,onSelect:(x,E)=>{const T=E.node.variablePath;i.emit({type:"insert",currentInputId:m.currentInputId,expression:`{{global.${T.join(".")}}}`})},switcherIcon:p.jsx(ie.CaretDownOutlined,{}),treeData:S},w.id)}const b=nne(w.var_value),y=b.length>28?`${b.substring(0,28)}...`:b;return p.jsxs("button",{type:"button",className:`${lt.varItem} workflow-variable-panel__item`,onClick:()=>{i.emit({type:"insert",currentInputId:m.currentInputId,expression:`{{global.${w.name}}}`})},children:[p.jsx(_.Tag,{color:Iv[w.mappedType],className:`${lt.typeTag} workflow-variable-panel__type`,children:Pv(w.mappedType)}),p.jsx("span",{className:`${lt.varName} workflow-variable-panel__label`,children:w.display_name||w.name}),y?p.jsx("span",{className:lt.varValue,children:y}):null]},w.id)}),!l&&!u&&s.length<1&&p.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:Lv.NoTestDataDesc,className:lt.empty}),l?p.jsxs("div",{className:lt.loadingState,children:[p.jsx(_.Spin,{size:"small"}),p.jsx("span",{children:"正在加载全局变量"})]}):u?p.jsx(_.Alert,{className:lt.errorState,type:"error",showIcon:!0,message:"全局变量加载失败",description:u.message,action:p.jsx(_.Button,{size:"small",onClick:h,children:"重试"})}):null]})})]}):null,p.jsxs("div",{className:`${lt.sectionLabel} workflow-variable-panel__section-label`,children:[p.jsx(ie.ApiOutlined,{className:lt.sectionIcon}),p.jsx("span",{children:"节点变量"})]}),p.jsx("div",{className:`variable-panel-group ${!c&&!d&&a.length<1?"empty":""}`,children:p.jsxs("div",{className:lt.section,children:[a.map(w=>p.jsx("div",{children:p.jsx(_.Tree,{defaultExpandAll:!0,showLine:!0,onSelect:(b,y)=>{const k=y.node.variablePath;if(k.length<=1)return!1;i.emit({type:"insert",currentInputId:m.currentInputId,expression:rne(w.node_id,k)})},switcherIcon:p.jsx(ie.CaretDownOutlined,{}),treeData:v(w.sub_params,!0,w.nodeIcon,w.isValid,"node")})},`${w.node_id}-${w.seq}`)),!c&&!d&&a.length<1&&p.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:Lv.NoTestDataDesc,className:lt.empty}),c?p.jsxs("div",{className:lt.loadingState,children:[p.jsx(_.Spin,{size:"small"}),p.jsx("span",{children:"正在加载节点变量"})]}):d?p.jsx(_.Alert,{className:lt.errorState,type:"error",showIcon:!0,message:"节点变量加载失败",description:d.message,action:p.jsx(_.Button,{size:"small",onClick:f,children:"重试"})}):null]})})]})]})}),{Option:Ni}=_.Select,one=C.forwardRef(({onSubmit:t,config_schema:e,nodeId:n},r)=>{const[o]=_.Form.useForm(),i=su(),s=_.Form.useWatch("type",o);It.useMount(()=>{e&&Object.hasOwn(e,"asc")&&o.setFieldsValue(e)});const[a,l]=C.useState(!1),c=(d,h,f="")=>(l(!0),o.validateFields().then(async m=>s&&s==="NUMBER"&&m.start>m.end?_.message.warning(Y("link.flow.loop_start_end_check")):t({properties:m},d)).catch(()=>(_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>l(!1)));C.useImperativeHandle(r,()=>({saveConfig:d=>c(d)}));const u=zt();return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:i,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsxs(_.Form,{disabled:!u,form:o,layout:"vertical",children:[p.jsxs(_.Row,{children:[p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{name:"type",label:Y("app.common.word.loop-data-type"),rules:[{required:!0,message:Y("link.flow.please_select_data_type")}],children:p.jsxs(_.Select,{children:[p.jsx(Ni,{value:"ARRAY",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.array"})}),p.jsx(Ni,{value:"NUMBER",children:p.jsx(Oe.FormattedMessage,{id:"common.number"})}),p.jsx(Ni,{value:"CONDITION",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.condition_expression"})})]})})}),s&&s==="NUMBER"&&p.jsx(_.Col,{sm:24,lg:12,children:p.jsxs(_.Form.Item,{required:!0,label:Y("link.flow.loop_start_end"),style:{display:"flex"},children:[p.jsx(_.Form.Item,{name:"start",noStyle:!0,rules:[{required:!0,message:Y("link.flow.please_select_data_type")}],children:p.jsx(_.InputNumber,{min:1,style:{marginRight:20}})}),p.jsx(_.Form.Item,{name:"end",noStyle:!0,rules:[{required:!0,message:Y("link.flow.please_select_data_type")}],children:p.jsx(_.InputNumber,{min:1})})]})}),s&&s!=="NUMBER"&&p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{rules:[{required:!0,message:Y("link.flow.please_enter_loop_expression")}],label:Y("link.flow.loop_expression"),name:"expression",children:p.jsx(rr,{nodeId:n,borrow:!0,valueType:"JS_EXP",placeholder:Y("link.flow.please_enter_loop_expression")})})}),!s&&p.jsx(_.Col,{})]}),p.jsxs(_.Row,{children:[p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{name:"asc",label:Y("app.common.word.circulation-direction"),rules:[{required:!0,message:Y("link.flow.please_select_loop_direction")}],children:p.jsxs(_.Select,{children:[p.jsx(Ni,{value:!0,children:p.jsx(Oe.FormattedMessage,{id:"link.flow.loop_head_to_tail"})}),p.jsx(Ni,{value:!1,children:p.jsx(Oe.FormattedMessage,{id:"link.flow.loop_tail_to_head"})})]})})}),p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{name:"errorExec",label:Y("link.flow.loop_processing"),rules:[{required:!0,message:Y("link.flow.please_select_loop_processing")}],children:p.jsxs(_.Select,{children:[p.jsx(Ni,{value:"END",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.terminate_process"})}),p.jsx(Ni,{value:"CONTINUE",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.continue_loop"})}),p.jsx(Ni,{value:"BREAK",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.break_loop"})})]})})})]})]})}),p.jsx("div",{className:"workflow-node-form-footer",children:u&&p.jsx(_.Button,{type:"primary",disabled:!u,loading:a,className:"workflow-node-form-save",onClick:()=>c(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}),fp=()=>`branch_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,{Option:ine}=_.Select,sne=C.forwardRef((t,e)=>{const{config_schema:n,nodeId:r}=t,[o]=_.Form.useForm(),i=su(),{handleNodeDataUpdate:s}=Gs(),[a,l]=C.useState(null),[c,u]=C.useState(""),h=(x=>!(x!=null&&x.branches)||x.branches.length===0?{branches:[{id:fp(),name:Y("link.flow.switch.condition_one"),or_list:[{and_list:[{query:"",operator:"",value:""}]}]},{id:fp(),name:Y("link.flow.switch.condition_two"),or_list:[{and_list:[{query:"",operator:"",value:""}]}]}]}:{branches:x.branches.map((T,A)=>{var O;return{id:T.id||fp(),name:T.name||Y("link.flow.switch.condition_n",{n:A+1}),or_list:((O=T.or_list)==null?void 0:O.map(B=>{var M;return{and_list:((M=B.and_list)==null?void 0:M.map(I=>({query:I.query||"",operator:I.operator||"",value:I.value||""})))||[{query:"",operator:"",value:""}]}}))||[{and_list:[{query:"",operator:"",value:""}]}]}})})(n),f=()=>{const x=o.getFieldValue("branches")||[];s({id:r,data:{config_schema:{branches:x}}})},m=(x,E)=>{l(x),u(E)},g=()=>{l(null),u("")},v=x=>{const E=Kt.cloneDeep(o.getFieldValue("branches"))||[],T=c.trim();if(!T){_.message.error(Y("link.flow.switch.branch_name_cannot_be_empty"));return}if(E.some((O,B)=>B!==x&&O.name===T)){_.message.error(Y("link.flow.switch.branch_name_duplicate"));return}E[x].name=T,o.setFieldValue("branches",E),l(null),u(""),f()},w=(x,E)=>{const T=o.getFieldValue("branches")||[];if(E<0||E>=T.length)return;const A=[...T],[O]=A.splice(x,1);A.splice(E,0,O),o.setFieldValue("branches",A),f()},[b,y]=C.useState(!1),k=x=>(y(!0),o.validateFields().then(async E=>{if(!E.branches.some(O=>O.or_list.some(B=>B.and_list.some(M=>M.query&&M.operator)))){_.message.error(Y("link.flow.switch.at_least_one_valid_branch"));return}const A=Kt.cloneDeep(E);return A.branches.forEach(O=>{O.or_list.forEach(B=>{B.and_list.forEach(M=>{M.value=bte(M.operator,M.value)})})}),t.onSubmit({properties:A},x)}).catch(()=>(_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>y(!1)));C.useImperativeHandle(e,()=>({saveConfig:x=>k(x)}));const D=zt(),S=(x,E,T,A)=>{const B=(o.getFieldValue("branches")||[])[E],M=a===E;return p.jsxs(_.Card,{style:{marginBottom:20,borderRadius:8,border:"1px solid #d9d9d9"},styles:{body:{padding:10}},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:12},children:[p.jsx("div",{style:{display:"flex",alignItems:"center",flex:1},children:M?p.jsxs(_.Space,{children:[p.jsx(_.Input,{value:c,onChange:I=>u(I.target.value),style:{width:200},placeholder:Y("link.flow.switch.enter_branch_name"),onPressEnter:()=>v(E)}),p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.CheckOutlined,{style:{color:"#52c41a"}}),onClick:()=>v(E)}),p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.CloseOutlined,{}),onClick:g})]}):p.jsxs(_.Space,{children:[p.jsx("span",{style:{fontSize:13,fontWeight:400},children:(B==null?void 0:B.name)||Y("link.flow.switch.condition_n",{n:E+1})}),D&&p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.EditOutlined,{}),onClick:()=>m(E,(B==null?void 0:B.name)||"")})]})}),D&&p.jsxs(_.Space,{className:"actions",children:[p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_to_top"),children:p.jsx(_.Button,{type:"text",size:"small",disabled:E===0,onClick:()=>w(E,0),children:"置顶"})}),p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_up"),children:p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.ArrowUpOutlined,{}),disabled:E===0,onClick:()=>w(E,E-1)})}),p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_down"),children:p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.ArrowDownOutlined,{}),disabled:E===T-1,onClick:()=>w(E,E+1)})}),p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_to_bottom"),children:p.jsx(_.Button,{type:"text",size:"small",disabled:E===T-1,onClick:()=>w(E,T-1),children:"置底"})}),p.jsx(_.Tooltip,{title:Y("common.delete"),children:p.jsx(_.Button,{type:"text",size:"small",disabled:T<=1,onClick:()=>{if(T<=1){_.message.warning(Y("link.flow.switch.at_least_one_branch"));return}A(x.name),setTimeout(()=>{f()},0)},children:"删除"})})]})]}),p.jsx(_.Form.Item,{name:[x.name,"name"],hidden:!0,children:p.jsx(_.Input,{})}),p.jsx(_.Form.List,{name:[x.name,"or_list"],children:(I,{add:N,remove:P})=>p.jsx(p.Fragment,{children:I.map((F,H)=>{const V=H===I.length-1;return p.jsx(p.Fragment,{children:p.jsxs("div",{className:"switch-rule",children:[I.length>1&&D&&p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsxs(_.Button,{type:"link",icon:p.jsx(ie.MinusCircleOutlined,{}),onClick:()=>P(F.name),children:[p.jsx(Oe.FormattedMessage,{id:"link.flow.remove"})," OR"]})}),p.jsx(_.Form.List,{name:[F.name,"and_list"],children:(q,{add:Q,remove:te})=>p.jsx(p.Fragment,{children:q.map(($,U)=>{const R=U===q.length-1;return p.jsxs(_.Space,{direction:"vertical",style:{width:"100%"},children:[p.jsxs(_.Space,{align:"center",className:"switch-rule-item",children:[p.jsx(_.Form.Item,{style:{minWidth:150,marginBottom:0},name:[$.name,"query"],label:Y("app.common.word.variable-name"),rules:[{required:!0,message:Y("link.flow.please_enter_variable_name")}],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.variable_name"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})}),p.jsx(_.Form.Item,{style:{marginBottom:0},name:[$.name,"operator"],label:Y("app.common.word.condition"),rules:[{required:!0,message:Y("link.flow.please_select_condition")}],children:p.jsx(_.Select,{style:{minWidth:140},placeholder:Y("link.flow.select_condition"),getPopupContainer:()=>document.body,children:UF.map(ee=>p.jsx(ine,{value:ee.operator,children:ee.label},ee.operator))})}),p.jsx(_.Form.Item,{noStyle:!0,shouldUpdate:!0,children:()=>{const ee=o.getFieldValue(["branches",x.name,"or_list",F.name,"and_list",$.name,"operator"]);return Ov(ee)?null:p.jsx(_.Form.Item,{style:{minWidth:150,marginBottom:0},name:[$.name,"value"],label:Y("app.common.word.value"),rules:[],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.value"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})})}}),U===0&&p.jsx("div",{style:{width:30}}),U>0&&D&&p.jsx(_.Button,{type:"link",icon:p.jsx(ie.MinusCircleOutlined,{}),onClick:()=>te($.name)})]}),U<q.length-1&&p.jsx(_.Divider,{plain:!0,style:{margin:"8px 0"},children:p.jsx(_.Tag,{color:"#999999",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.and"})})}),p.jsxs("div",{className:`rule-opt-actions ${R?"last-and-rule":""}`,children:[U===q.length-1&&p.jsx(_.Button,{type:"link",disabled:!D,icon:p.jsx(Kr,{size:14}),onClick:()=>Q({query:"",operator:"",value:""}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-new-and"})}),V&&p.jsx(_.Button,{type:"link",icon:p.jsx(Kr,{size:14}),disabled:!D,onClick:()=>N({and_list:[{query:"",operator:"",value:""}]}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-or"})})]})]},$.key)})})}),!V&&p.jsx("div",{style:{textAlign:"center"},children:p.jsx(_.Divider,{style:{color:"orange"},dashed:!0,children:p.jsx(_.Tag,{color:"#1890ff",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.or"})})})})]},F.key)})})})})]},x.key)};return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:i,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsx(_.Form,{disabled:!D,form:o,initialValues:h,layout:"vertical",autoComplete:"off",children:p.jsx(_.Form.List,{name:"branches",children:(x,{add:E,remove:T})=>p.jsxs(p.Fragment,{children:[x.map((A,O)=>S(A,O,x.length,T)),x.length<10&&p.jsx("div",{style:{display:"flex",justifyContent:"flex-end",width:"100%"},children:p.jsx(_.Button,{type:"default",icon:p.jsx(Kr,{size:14}),disabled:!D,onClick:()=>{const A=x.length+1;E({id:fp(),name:Y("link.flow.switch.condition_n",{n:A}),or_list:[{and_list:[{query:"",operator:"",value:""}]}]}),setTimeout(()=>{f()},0)},children:p.jsx(Oe.FormattedMessage,{id:"link.flow.switch.add_branch"})})}),x.length>=10&&p.jsx("div",{style:{textAlign:"center",color:"#999",marginBottom:20},children:p.jsx(Oe.FormattedMessage,{id:"link.flow.switch.max_branches_reached"})})]})})})}),p.jsx("div",{className:"workflow-node-form-footer",children:D&&p.jsx(_.Button,{type:"primary",disabled:!D,loading:b,className:"workflow-node-form-save",onClick:()=>k(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}),ane=({nodeId:t,onSubmit:e,data:n})=>{const[r]=_.Form.useForm(),o=su(),i=zt(),{refreshFlow:s}=Qo(),{setNodes:a}=ne.useReactFlow(),l=C.useCallback((u,d)=>{a(h=>h.map(f=>!d&&f.id!==t?f:{...f,data:{...f.data,error_handler:u}}))},[t,a]);C.useEffect(()=>{const u=(n==null?void 0:n.error_handler)||{};r.setFieldsValue({retryEnabled:u.retry||!1,retryCount:u.retry_times||3,retryInterval:u.retry_interval||5,stepFactor:u.step_factor||1.5,maxRetryInterval:u.max_retry_interval||60,alertEnabled:u.warn_type===1,webhookUrl:u.notify_url||"",errorHandling:u.process_type===2?"ignore":"interrupt",applyToAllNodes:!!u.apply_all})},[t,r,n==null?void 0:n.error_handler]);const c=async u=>{try{const d={retry:u.retryEnabled,retry_times:u.retryEnabled?u.retryCount:void 0,retry_interval:u.retryEnabled?u.retryInterval:void 0,step_factor:u.retryEnabled?u.stepFactor:void 0,max_retry_interval:u.retryEnabled?u.maxRetryInterval:void 0,warn_type:u.alertEnabled?1:0,notify_url:u.alertEnabled?u.webhookUrl:void 0,process_type:u.errorHandling==="interrupt"?1:2,apply_all:u.applyToAllNodes};await Wu(t,{error_handler:d}),l(d,u.applyToAllNodes),u.applyToAllNodes&&s(),e()}catch{_.message.error(Y("common.save_failed"))}};return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:o,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsxs(cr.ProForm,{form:r,layout:"vertical",disabled:!i,submitter:!1,onFinish:c,children:[p.jsx(cr.ProFormSwitch,{name:"retryEnabled",label:Y("app.common.word.enable-retry")}),p.jsx(cr.ProFormDependency,{name:["retryEnabled"],children:({retryEnabled:u})=>u?p.jsxs(p.Fragment,{children:[p.jsx(cr.ProFormDigit,{name:"retryCount",label:Y("app.common.word.retry-count"),tooltip:Y("app.common.word.retry-count-tooltip"),width:"xl",fieldProps:{min:1,max:10,precision:0,style:{width:"100%"}},rules:[{required:u,message:Y("app.common.word.please-enter-retry-count")}]}),p.jsx(cr.ProFormDigit,{name:"retryInterval",label:Y("app.common.word.retry-interval"),tooltip:Y("app.common.word.retry-interval-tooltip"),fieldProps:{min:1,max:60,precision:0,style:{width:"100%"},addonAfter:"s"},rules:[{required:u,message:Y("app.common.word.please-enter-retry-interval")}]}),p.jsx(cr.ProFormDigit,{name:"stepFactor",label:Y("app.common.word.step-factor"),tooltip:Y("app.common.word.step-factor-tooltip"),width:"xl",fieldProps:{min:1,max:5,precision:1,style:{width:"100%"}},rules:[{required:u,message:Y("app.common.word.please-enter-step-factor")}]}),p.jsx(cr.ProFormDigit,{name:"maxRetryInterval",label:Y("app.common.word.max-retry-interval"),tooltip:Y("app.common.word.max-retry-interval-tooltip"),width:"xl",fieldProps:{min:1,max:300,precision:0,style:{width:"100%"},addonAfter:"s"},rules:[{required:u,message:Y("app.common.word.please-enter-max-retry-interval")}]})]}):null}),p.jsx(cr.ProFormSwitch,{name:"alertEnabled",label:Y("app.common.word.enable-alert")}),p.jsx(cr.ProFormDependency,{name:["alertEnabled"],children:({alertEnabled:u})=>u?p.jsx(cr.ProFormText,{name:"webhookUrl",label:Y("app.common.word.webhook-url"),placeholder:Y("app.common.word.enter-webhook-url"),width:"xl",fieldProps:{style:{width:"100%"}},rules:[{required:u,message:Y("app.common.word.enter-webhook-url")}]}):null}),p.jsx(cr.ProFormSelect,{name:"errorHandling",label:Y("app.common.word.error-handling"),width:"xl",fieldProps:{style:{width:"100%"}},rules:[{required:!0,message:Y("app.common.word.select-error-handling")}],options:[{label:Y("app.common.word.interrupt-flow"),value:"interrupt"},{label:Y("app.common.word.ignore-error"),value:"ignore"}]}),p.jsx(cr.ProFormSwitch,{name:"applyToAllNodes",label:Y("app.common.word.apply-to-all-nodes")})]})}),p.jsx("div",{className:"workflow-node-form-footer",children:p.jsx(_.Button,{type:"primary",disabled:!i,onClick:()=>r.submit(),className:"workflow-node-form-save",children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})},n2="[workflow:schema-render]",lne=()=>{const{event$:t}=C.useContext(jo),e=og();return t.useSubscription(n=>{var r;n.type==="insert"&&n.expression&&(r=e==null?void 0:e.getActiveFieldId)!=null&&r.call(e)&&e.insertVariableToActiveField(n.expression,!1)}),null},cne=({children:t})=>{const{event$:e}=C.useContext(jo),n=ig(),[r,o]=C.useState("");e.useSubscription(a=>{a.type==="setCurrentInputId"&&o(a.currentInputId??"")});const i=(n==null?void 0:n.activeFieldId)??r,s=C.useMemo(()=>({activeInputId:i}),[i]);return p.jsx(YO.Provider,{value:s,children:t})},une=t=>{const{icon:e,fallbackIcon:n}=t;return p.jsxs("div",{className:"node-config-title",style:{display:"flex",alignItems:"center"},children:[p.jsx("div",{className:"node-config-icon",style:{backgroundImage:`url(${n?"none":e??"https://digitalsee-image.digitalsee.cn/flow/0.png"})`},children:n}),p.jsxs("div",{className:"node-config-meta",children:[p.jsx("div",{className:"node-config-title-name",style:{fontSize:16,fontWeight:600,marginLeft:10},children:t.name}),p.jsx("div",{className:"node-config-title-description",style:{fontSize:12,color:"gray",marginLeft:10},children:t.description})]})]})},dne=C.memo(({visible:t,onClose:e,data:n,nodeType:r=pe.ACTION,nodeId:o=""})=>{var O,B;const i=It.useEventEmitter(),{setNodeConfigVisible:s}=Qo(),a=C.useRef(null),l=C.useRef(null),c=C.useRef(null),u=C.useRef(null),d=C.useRef(null),h=C.useRef(null),f=ne.useStoreApi(),m=jt(),g=((B=(O=m.nodeConfigPanel)==null?void 0:O.testArea)==null?void 0:B.allowManualTest)!==!1,v=It.useReactive({output:"",ignore:!1,expandTestPanel:!1}),w=C.useMemo(()=>m.nodeConfigPanel.showSettings&&![pe.TRIGGER,pe.AI_SUB_NODE].includes(r),[r,m.nodeConfigPanel.showSettings]),b=(n==null?void 0:n.action_id)??(n==null?void 0:n.id),y=b!==null&&typeof b<"u"&&b!==""&&Number.isFinite(Number(b))?b:null,k=ii(n),D=n==null?void 0:n.nodeKey,S=(n==null?void 0:n.nodeVersion)??(n==null?void 0:n.action_ver),{handleNodeDataUpdate:x}=Gs();C.useEffect(()=>{var I,N;if(!t)return;const M=y!==null&&Number(y)<=0;D&&M&&!k&&!((I=n==null?void 0:n.config_schema)!=null&&I.sub_params)&&!((N=n==null?void 0:n.properties)!=null&&N.sub_params)&&console.warn(`${n2} possible nodepackage schema route mismatch`,{nodeId:o,nodeType:r,actionId:y,nodePackageKey:D,nodePackageVersion:S,reason:"keyed node with non-positive action_id and no classic sub_params was rejected by the nodePackage-compatible node check"})},[y,n==null?void 0:n.config_schema,n==null?void 0:n.properties,n==null?void 0:n.params,n==null?void 0:n.action_key,n==null?void 0:n.action_ver,n==null?void 0:n.nodeKey,n==null?void 0:n.nodeVersion,k,D,S,o,r,t]);const E=C.useCallback(async(M,I)=>{var P,F,H;const N=m.flowId;try{const V=f.getState().nodes.find(U=>U.id===o),q=k?g8(M):M.properties,Q=k?w8(M):M.account_id??null,te=k?{flow_id:N,properties:q,position:V==null?void 0:V.position,action_id:y,account_id:Q,proxy_id:M.proxy_id,mcp_tool_description:M.mcp_tool_description,action_key:D,action_ver:S}:{flow_id:N,...M,position:V==null?void 0:V.position,action_id:y};console.info(`${n2} save node config`,{nodeId:o,nodeType:r,actionId:y,isNodepackageNode:k,nodePackageKey:D,nodePackageVersion:S,valueKeys:Object.keys(M||{}),paramsKeys:Object.keys((M==null?void 0:M.params)||{}),propertiesKeys:Object.keys((M==null?void 0:M.properties)||{}),ignoreDebugResult:v.ignore});const $=v.ignore?await wk(o,"","","",q,v.output):await Wu(o,te);if($)if(v.ignore)(P=h.current)==null||P.finishSampleTest(),x({id:o,data:{status:ge.SUCCESS,output:v.output,outputSource:"sample"}}),_.message.success("已使用样本数据完成调试");else{_.message.success("节点配置已保存");const U={params:void 0,properties:q,account_id:Q,mcp_tool_description:M.mcp_tool_description,action_key:D,action_ver:S,nodeKey:D,nodeVersion:S,isNodePackage:k};x({id:o,data:{config_schema:q,account_id:M.account_id,...U,position:V==null?void 0:V.position,status:$.status}})}return I&&!v.ignore&&((F=h.current)==null||F.onTestNode()),v.ignore=!1,v.output="",!0}catch{return v.ignore&&((H=h.current)==null||H.abortSampleTest(),x({id:o,data:{status:ge.FAILED}})),!1}},[y,m.flowId,n==null?void 0:n.action_key,n==null?void 0:n.action_ver,n==null?void 0:n.nodeKey,n==null?void 0:n.nodeVersion,x,k,D,S,o,r,v,f]);C.useCallback(M=>{!k||r!==pe.SWITCH||x({id:o,data:{config_schema:M,properties:M}})},[x,k,o,r]);const T=M=>{var I,N,P,F,H;return k?(I=l.current)==null?void 0:I.saveConfig(M):r===pe.LOOP?(N=d.current)==null?void 0:N.saveConfig(M):r===pe.CONDITION?(P=c.current)==null?void 0:P.saveConfig(M):r===pe.SWITCH?(F=u.current)==null?void 0:F.saveConfig(M):(H=l.current)==null?void 0:H.saveConfig(M)},A=async(M,I,N)=>{var P;if(I){v.ignore=!0,v.output=N||"",await T(M),(P=h.current)==null||P.finishNodeTest();return}if(M)try{_.message.loading("正在保存节点配置...",0),await T(M),_.message.success("节点配置已保存"),_.message.destroy()}catch(F){_.message.destroy(),console.error("节点配置保存失败:",F),_.message.error("节点配置保存失败,无法执行测试")}};return p.jsx(_.Modal,{open:t,footer:null,closeIcon:null,maskClosable:!0,onCancel:()=>{s(null)},centered:!0,width:"max(85vw, 850px)",className:"nodes-config-modal",styles:{mask:{backgroundColor:"rgba(0, 0, 0, 0.45)"},content:{padding:0,overflow:"hidden"}},children:p.jsx(jo.Provider,{value:{event$:i},children:p.jsxs(HS,{children:[p.jsx(lne,{}),p.jsx(cne,{children:p.jsx("div",{className:"nodes-config-container",children:p.jsx("div",{className:"nodes-config-content",children:p.jsxs("div",{className:"config-row",children:[p.jsx("div",{className:"left-section",children:p.jsx("div",{className:"variables-section",children:p.jsx(t2,{ref:a,nodeId:o,onInsert:()=>{},open:t})})}),p.jsx("div",{className:"middle-section",children:p.jsxs("div",{className:"config-container",children:[p.jsx(une,{icon:n==null?void 0:n.icon,fallbackIcon:n==null?void 0:n.fallbackIcon,name:(n==null?void 0:n.action_name)||(n==null?void 0:n.label),description:n==null?void 0:n.description}),p.jsx(_.Tabs,{style:{height:"100%"},items:[{key:"property",label:"参数配置",children:p.jsxs(p.Fragment,{children:[k||![pe.CONDITION,pe.SWITCH,pe.LOOP].includes(r)?p.jsx(wte,{ref:l,nodeId:o,nodeType:r,data:n,onSubmit:E}):null,r===pe.CONDITION&&!k?p.jsx(yte,{ref:c,nodeId:o,config_schema:n.config_schema,onSubmit:E}):null,r===pe.SWITCH&&!k?p.jsx(sne,{ref:u,nodeId:o,config_schema:n.config_schema,onSubmit:E}):null,r===pe.LOOP&&!k?p.jsx(one,{ref:d,nodeId:o,config_schema:n.config_schema,onSubmit:E}):null]})},{key:"setting",label:"设置",children:p.jsx(ane,{data:n,nodeId:o,onSubmit:()=>{_.message.success("保存成功")}})}].slice(0,w?2:1)})]})}),p.jsx("div",{className:`right-section ${v.expandTestPanel?"expand":""}`,children:g&&p.jsx("div",{className:"test-section",children:p.jsx(Jte,{ref:h,nodeId:o,beforeHook:A,onClose:e,onExpandPanel:M=>{v.expandTestPanel=M}})})})]})})})})]})})})},(t,e)=>Kt.isEqual(Kt.omit(t,["data","isHovered"]),Kt.omit(e,["data","isHovered"]))),r2=[],hne=(t,e)=>{if(r2.length===0)return[];const n=new Set(e);return t.some(o=>n.has(o.id)&&eg(o)&&r2.some(i=>{var s;return((s=o.data)==null?void 0:s.action_key)===i}))?t.filter(o=>!n.has(o.id)).map(o=>o.id):[]},fne=[pe.AGENT,pe.BROWSER],$v=()=>{const t=ne.useStoreApi(),e=C.useCallback((s,a)=>{const{nodes:l,setNodes:c}=t.getState(),u=Tl(l,d=>{const h=d.find(f=>f.id===a.id);h.data?h.data.isHovered=!0:h.data={isHovered:!0}});c(u)},[]),n=C.useCallback((s,a)=>{const{nodes:l,setNodes:c}=t.getState(),u=Tl(l,d=>{const h=d.find(f=>f.id===a.id);h.data?h.data.isHovered=!1:h.data={isHovered:!1}});c(u)},[]),r=C.useCallback(s=>{const{nodes:a,setNodes:l}=t.getState(),c=Tl(a,u=>{s.forEach(d=>{d.type==="select"&&(u.find(h=>h.id===d.id).selected=d.selected)})});l(c)},[t]),o=C.useCallback((s,a,l=new Set)=>(a.filter(u=>u.source===s?u.sourceHandle!==ze.OUTPUT&&u.sourceHandle!==ze.DONE&&u.sourceHandle!==ze.LOOP&&u.sourceHandle!==ze.TRUE&&u.sourceHandle!==ze.FALSE:u.target===s&&Lm(u.targetHandle)).forEach(u=>{const d=u.source===s?u.target:u.source;l.has(d)||(l.add(d),o(d,a,l))}),l),[]),i=C.useCallback((s,a)=>{const{nodes:l,edges:c,setNodes:u,setEdges:d,onNodesChange:h,onEdgesChange:f}=t.getState(),m=new Set(s);fne.includes(a)&&s.forEach(w=>{o(w,c).forEach(y=>{m.add(y)})}),hne(l,s).forEach(w=>m.add(w));const g=Array.from(m),v=c.filter(w=>m.has(w.source)||m.has(w.target)).map(w=>w.id);if(h){const w=g.map(b=>({type:"remove",id:b}));h(w)}else u(l.filter(w=>!g.includes(w.id)));if(v.length)if(f){const w=v.map(b=>({type:"remove",id:b}));f(w)}else d(c.filter(w=>!v.includes(w.id)))},[t,o]);return{onNodeMouseEnter:e,onNodeMouseLeave:n,handleNodesChange:r,handleNodesDelete:i}};function pne(t){const{color:e,visible:n}=t;return p.jsx("div",{style:{display:n?"inline-flex":"none",justifyContent:"center",alignItems:"center",position:"absolute",zIndex:1e3,top:"calc(50% - 8px)",left:-10,padding:1,borderRadius:"100%",background:"#FFFFFF",width:20,height:20},children:p.jsx("span",{style:{width:16,height:16,borderRadius:10,backgroundColor:e,border:`1px solid ${e}`,display:"inline-flex",justifyContent:"center",alignItems:"center"},children:p.jsx(lQ,{size:8,color:"#FFFFFF"})})})}const Mi={info:{normal:"#007FFF",lighter:"rgba(0, 127, 255, 0.48)"},success:{normal:"#98D7A9",lighter:"rgba(0, 176, 66, 0.48)"},warning:{normal:"#F7CD8F",lighter:"rgba(255, 146, 0, 0.48)"},error:{normal:"#F3B096",lighter:"rgba(255, 82, 25, 0.48)"},disabled:{normal:"#C7CCD1",lighter:"rgba(199, 204, 209, 0.48)"}},o2=({id:t,type:e=pe.ACTION,selected:n=!1,fallbackIcon:r,iconUri:o,inputs:i=[],outputs:s=[],showToolbar:a=!0,width:l,height:c,className:u="",status:d=ge.IDLE,onTestNode:h,data:f,contentRender:m,showNodeDescription:g=!0,onToggleNodeDisabled:v})=>{const{currentNodeConfigVisibleId:w,setNodeConfigVisible:b}=Qo(),{handleNodeDataUpdate:y}=Gs(),{handleNodesDelete:k}=$v(),D=jt(),S=vl(),x=$=>{y({id:t,data:{note:$}})},E=C.useCallback(()=>{b(null)},[]),T=(f==null?void 0:f.isHovered)||!1,A=C.useMemo(()=>e===pe.TRIGGER,[e]),O=()=>{b(t)},B=C.useMemo(()=>(f==null?void 0:f.closed)==="1",[f==null?void 0:f.closed,e]),M=C.useMemo(()=>typeof l=="number"&&l>0?l:"auto",[l]),I=($="node")=>{if(B)return`workflow-${$}-disabled`;switch(d){case ge.INVALID:return`workflow-${$}-warning`;case ge.FAILED:return`workflow-${$}-failed`;case ge.SUCCESS:case ge.RUNNABLE:case ge.ACTIVE:return`workflow-${$}-success`;case ge.RUNNING:return`workflow-${$}-running`;case ge.WARNING:return`workflow-${$}-warning`;case ge.DEACTIVATED:return`workflow-${$}-disabled`;case ge.IDLE:return`workflow-${$}-idle`;default:return""}},N=()=>{if(B)return Mi.disabled;switch(d){case ge.INVALID:return Mi.warning;case ge.FAILED:return Mi.error;case ge.SUCCESS:case ge.RUNNABLE:case ge.ACTIVE:return Mi.success;case ge.RUNNING:return Mi.info;case ge.WARNING:return Mi.warning;case ge.DEACTIVATED:return Mi.disabled;default:return Mi.info}},P=($="normal")=>N()[$],F=()=>{const $=i.length,U=new Map;return i.forEach(R=>{const ee=R.position,se=U.has(ee)?U.get(ee)+1:1;U.set(ee,se)}),i.map((R,ee)=>p.jsx(bS,{nodeId:t,id:R.id,position:R.position,type:R.type||Dn.TARGET,category:R.category,connectionLimit:R.maxConnections,label:R.label,nodeStatus:d,protocol:R.protocol,portSchema:R.portSchema,shape:R.shape,style:R.style,index:[ee,$,U.get(R.position)]},`${t}-${R.id}`))},H=async()=>{var R,ee;const $=((R=D.canvas.fixedNodes)==null?void 0:R.triggerIds)||[],U=((ee=D.nodeTypes.fixed)==null?void 0:ee.triggers)||[];if($.includes(t)||U.includes(e)){_.message.warning("当前触发节点已被配置为不可删除");return}await ym(t),k([t],e)},V=C.useMemo(()=>{const $=s.length,U=new Map;return s.forEach(R=>{const ee=R.position,se=U.has(ee)?U.get(ee)+1:1;U.set(ee,se)}),s.map((R,ee)=>p.jsx(bS,{nodeId:t,connectionLimit:R.maxConnections,id:R.id,style:R.style,position:R.position,protocol:R.protocol,portSchema:R.portSchema,type:R.type,label:R.label,shape:R.shape,nodeStatus:d,index:[ee,$,U.get(R.position)]},`${t}-${R.id}`))},[t,s,d]),q=()=>p.jsx($S,{status:d,disabled:B}),Q=()=>{switch(d){case ge.INVALID:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-warning-icon",children:p.jsx(ie.WarningFilled,{style:{color:P()},size:12})});case ge.FAILED:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-failed-icon",children:p.jsx(ie.CloseCircleFilled,{style:{color:P()},size:12})});case ge.SUCCESS:case ge.RUNNABLE:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-success-icon",children:p.jsx(ie.CheckCircleFilled,{style:{color:P()},size:12})});case ge.RUNNING:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-running-icon",children:p.jsx(ie.LoadingOutlined,{style:{color:P()},size:12})});default:return null}},te=()=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"workflow-node-icon-wrapper",children:p.jsx("div",{className:"workflow-node-icon",style:{backgroundImage:`url(${r?"none":o??"https://digitalsee-image.digitalsee.cn/flow/0.png"})`},children:r??null})}),g&&p.jsx(Z5,{title:f==null?void 0:f.connector_name,nodeId:t,note:(f==null?void 0:f.note)||"",statusIcon:Q(),onNoteChange:x,description:f.action_name,className:"workflow-node-text"})]});return p.jsxs(C.Fragment,{children:[p.jsxs("div",{style:{width:M,height:c||"auto"},onDoubleClick:O,className:`${u}
124
+ `})]}):C.isValidElement(t)?C.cloneElement(t,{value:e,onChange:n,...t.props}):t;return p.jsxs(p.Fragment,{children:[!r&&p.jsx("div",{style:{marginBottom:6,textAlign:"right"},children:p.jsxs(_.Button,{size:"small",type:"primary",onClick:i,style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"none",borderRadius:"14px",padding:"0 10px",height:"24px",fontSize:"11px",fontWeight:"500",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"4px",lineHeight:1},onMouseEnter:a=>{a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow="0 4px 12px rgba(102, 126, 234, 0.5)"},onMouseLeave:a=>{a.currentTarget.style.transform="translateY(0)",a.currentTarget.style.boxShadow="0 2px 8px rgba(102, 126, 234, 0.3)"},children:[p.jsx(ie.RobotOutlined,{style:{fontSize:"11px"}}),"由AI生成"]})}),s()]})},$ee=t=>{var n;const e=nr();return p.jsx(_.Select,{id:e,style:{borderRadius:6},...t,getPopupContainer:r=>r.parentNode,children:(n=t==null?void 0:t.options)==null?void 0:n.map(r=>p.jsx(_.Select.Option,{label:r.label,value:r.value,children:r.label},r.value))})},Hee=t=>p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",value:t.value?Qt(t.value):null,onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD")))}}),Vee=t=>p.jsx(C.Fragment,{children:p.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",showTime:!0,value:t.value?Qt(t.value):null,onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD hh:mm:ss")))}})}),zee=({value:t=[],onChange:e,selectType:n="KNOWLEDGE_BASE",placeholder:r="请选择"})=>{const o=It.useReactive({items:[]}),[i,s]=C.useState([]),[a,l]=C.useState(!1);C.useEffect(()=>{n&&(l(!0),Dk(n).then(f=>{f&&Array.isArray(f)&&s(f)}).catch(f=>{console.error("获取选项失败:",f),s([])}).finally(()=>{l(!1)}))},[n]),C.useEffect(()=>{const f=Array.isArray(t)?t:[];o.items=f.map(m=>({...m,id:m.id??nr()}))},[t]);const c=zt(),u=f=>{const m=o.items.filter(g=>g.id!==f);e==null||e(m)},d=()=>{e([...o.items,{value:"",id:nr()}])},h=(f,m)=>{e(o.items.map((g,v)=>v===f?{...g,value:m}:g))};return p.jsxs("div",{children:[o.items.length?o.items.map((f,m)=>p.jsxs(_.Space,{size:"small",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[p.jsx(_.Select,{value:f.value||void 0,onChange:g=>h(m,g),placeholder:r,style:{width:300},disabled:!c||a,loading:a,options:i,showSearch:!0,filterOption:(g,v)=>((v==null?void 0:v.label)??"").toLowerCase().includes(g.toLowerCase()),getPopupContainer:g=>g.parentNode}),c&&p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{u(f.id)}})]},f.id)):null,c&&p.jsx(_.Button,{type:"default",onClick:d,block:!0,icon:p.jsx(Kr,{size:16}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})})]})},Wee=({value:t=[],onChange:e,valueType:n})=>{const r=u=>{let d=[...o.items];d=d.filter(h=>h.id!==u),e==null||e(d)},o=It.useReactive({items:[]}),i=u=>{const d=u.which||u.keyCode;(d===37||d===229)&&u.preventDefault()};C.useEffect(()=>{const u=Array.isArray(t)?t:[];o.items=u.map(d=>({...d,id:d.id??nr()}))},[t]);const s=()=>{e==null||e([...o.items,{key:"",value:"",id:nr()}])},a=(u,d)=>{e==null||e(o.items.map(h=>h.id===u?{...h,key:d}:h))},l=(u,d)=>{e==null||e(o.items.map(h=>h.id===u?{...h,value:d}:h))},c=zt();return p.jsxs("div",{className:"workflow-extend-object",children:[o.items.length?o.items.map((u,d)=>p.jsxs(_.Space,{size:"small",className:"workflow-extend-object__row",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[p.jsx(_.Input,{defaultValue:u.key,onKeyDown:i,onChange:h=>{var f;a(u.id,(f=h.target.value)==null?void 0:f.replace(/'/g,""))},placeholder:"Key"}),p.jsx("span",{className:"workflow-extend-object__value",style:{display:"inline-block",transform:"translateY(2px)",width:300},children:p.jsx(rr,{borrow:!0,disableIDE:!0,placeholder:"Value",style:{width:300},value:u.value,onChange:h=>l(u.id,h),valueType:n,nodeId:""})}),c&&p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{r(u.id)}})]},u.id)):null,p.jsxs(_.Button,{type:"default",onClick:s,block:!0,children:[p.jsx(Kr,{size:16})," ",p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})]})]})},jee=t=>null,Uee=t=>p.jsx(_.TimePicker,{style:{width:"100%"},use12Hours:!1,format:"HH:mm",value:t.value?Qt(t.value,"HH:mm"):null,onChange:e=>{const n=Qt(e).format("HH:mm:00");t.onChange&&(t==null||t.onChange(n))}}),{Text:Ree}=_.Typography,IF=t=>p.jsx("div",{className:"ce-tag_input label-field",children:p.jsx("p",{children:p.jsx(_.Tooltip,{title:t.value,color:"cyan",placement:"topLeft",children:p.jsx(Ree,{ellipsis:!0,copyable:{text:t.value},children:t.value})})})}),qee=({value:t=[],onChange:e,...n})=>{const[r,o]=C.useState([]);C.useEffect(()=>{const h=Array.isArray(t)?t:[];o(h.map(f=>({...f,id:f.id??nr()})))},[t]);const i=zt(),s=h=>{const f=r.filter(m=>m.id!==h);o(f),e==null||e(f)},a=()=>{const h={field:"",dataType:"string",desc:"",required:!1,id:nr()},f=[...r,h];o(f),e(f)},l=(h,f)=>{const m=r.map(g=>g.id===h?{...g,field:f}:g);o(m),e(m)},c=(h,f)=>{const m=r.map(g=>g.id===h?{...g,dataType:f}:g);o(m),e(m)},u=(h,f)=>{const m=r.map(g=>g.id===h?{...g,desc:f}:g);o(m),e(m)},d=(h,f)=>{const m=r.map(g=>g.id===h?{...g,required:f}:g);o(m),e(m)};return p.jsxs("div",{className:"workflow-multi-row-extract",children:[r.length?r.map(h=>p.jsxs(_.Space,{size:"small",className:"workflow-multi-row-extract__row",style:{display:"flex",marginBottom:8,width:"100%"},align:"start",children:[p.jsx(_.Input,{value:h.field,onChange:f=>l(h.id,f.target.value),placeholder:"字段名称",status:"",style:{width:130},disabled:!i}),p.jsx(_.Select,{value:h.dataType,onChange:f=>c(h.id,f),placeholder:"数据类型",style:{width:100},disabled:!i,options:[{label:"字符串",value:"string"},{label:"数字",value:"number"},{label:"日期",value:"date"},{label:"布尔",value:"boolean"}]}),p.jsx(_.Input,{value:h.desc,onChange:f=>u(h.id,f.target.value),placeholder:"字段描述",status:"",style:{width:200},disabled:!i}),p.jsx(_.Select,{value:h.required,onChange:f=>d(h.id,f),placeholder:"是否必填",style:{width:100},disabled:!i,options:[{label:"是",value:!0},{label:"否",value:!1}]}),i&&p.jsx(_.Button,{icon:p.jsx(Ds,{size:16}),onClick:()=>{s(h.id)}})]},h.id)):null,i&&p.jsx(_.Button,{type:"default",onClick:a,block:!0,icon:p.jsx(Kr,{size:16}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-field"})})]})},Gee=t=>{const e=C.useMemo(()=>nr(),[]),{event$:n}=C.useContext(jo),r=kb(e),[o,i]=C.useState("");n.useSubscription(a=>{var l;if(a.type==="insert"&&a.currentInputId===e){const c=(o??"")+(t.valueType==="FIX_VALUE"?a.expression.slice(2,-2):a.expression);i(c),(l=t.onChange)==null||l.call(t,c)}}),C.useEffect(()=>{i(t.value)},[t.value]);const s=a=>{var l;i(a.target.value),(l=t.onChange)==null||l.call(t,a.target.value)};return p.jsxs(_.Space.Compact,{block:!0,className:`workflow-password-field${r?` ${xf}`:""}`,children:[p.jsx("span",{className:"workflow-password-field__prefix",children:Y("link.flow.cipherText")}),p.jsx(_.Input.Password,{id:e,onFocus:()=>{(t.valueType==="JS_EXP"||t.valueType==="FIX_VALUE"||t.valueType==="PLAIN_TEXT"||t.valueType==="PLAIN_CODE")&&(n.emit({type:"visible",visible:!0}),n.emit({type:"setCurrentInputId",currentInputId:e}))},value:o,onChange:s})]})},Kee=t=>{var o;const e=nr(),{multiple:n,...r}=t;return p.jsx(_.Select,{id:e,style:{borderRadius:6},mode:n?"multiple":void 0,...r,getPopupContainer:i=>i.parentNode,children:(o=t==null?void 0:t.options)==null?void 0:o.map(i=>p.jsx(_.Select.Option,{label:i.label,value:i.value,children:i.label},i.value))})},Yee=t=>p.jsx(_.TimePicker,{style:{width:"100%"},value:t.value?Qt(t.value,"HH:mm:ss"):null,onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("HH:mm:ss")))}}),iu=()=>jt().flowId,Xee=["sample","test","payload","body"],Jee=["测试","样本","sample","test","payload","body"],PF=t=>{var n,r,o;return[Ee.JSON,Ee.TEXTAREA,Ee.FIXED_OBJ].includes(t.page_control)?!0:((o=(r=(n=t.value_type)==null?void 0:n.toLowerCase)==null?void 0:r.call(n))==null?void 0:o.includes("json"))??!1},LF=(t,e)=>{if(!t)return!1;const n=t.toLowerCase();return e.some(r=>n.includes(r))},Qee=t=>{if(t==null)return;const e=(t==null?void 0:t.data)!==void 0?t.data:t;if(typeof e=="string")try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return}},Zee=t=>{const{form:e,configList:n=[],disabled:r,...o}=t;jk();const[i,s]=C.useState(!1),[a,l]=C.useState(0),c=C.useRef(void 0),u=iu(),d=C.useMemo(()=>{const m=n.find(g=>PF(g)&&(LF(g.name,Xee)||LF(g.display_name,Jee)));return m||n.find(g=>PF(g))},[n]),h=C.useCallback(()=>{c.current&&(clearInterval(c.current),c.current=void 0)},[]);C.useEffect(()=>()=>{h()},[h]);const f=C.useCallback(async()=>{if(!u){_.message.warning("缺少连接流ID,无法监听Webhook");return}if(!(d!=null&&d.name)){_.message.warning("未找到测试数据字段,无法填充监听结果");return}if(!i){s(!0),l(10),c.current=setInterval(()=>{l(m=>m<=1?(h(),0):m-1)},1e3);try{const m=await gk(u,{timeout_seconds:10}),g=Qee(m);g?(e.setFieldsValue({[d.name]:g}),_.message.success("已捕获Webhook推送数据并填充测试样例")):_.message.info("监听结束,暂无新的推送数据")}catch(m){console.error("监听Webhook失败:",m),_.message.error("监听失败,请稍后重试")}finally{h(),s(!1),l(0)}}},[u,e,i,d==null?void 0:d.name,h]);return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},className:"web-hook",children:[p.jsx("div",{style:{flex:1},className:"web-hook-input",children:p.jsx(IF,{...o})}),p.jsx(_.Button,{size:"small",type:"primary",ghost:!0,onClick:f,disabled:r||!(d!=null&&d.name),loading:i,style:{height:32,minWidth:110,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:i?`监听中${a?`(${a}s)`:""}`:"监听"})]})},ete={configFormContainer:"_configFormContainer_1frpl_1"};function tte(t){return Cee(t==null?void 0:t.credentials)}const nte=t=>String(t.type).toUpperCase();function $F(t){var e,n;return(n=(e=t==null?void 0:t.input_fields)==null?void 0:e.find(r=>nte(r)==="PROXY"))==null?void 0:n.key}function HF(t){return t==null||t===""?"0":String(t)}function rte(t,e,n){const r=$F(e);return r?{...t,[r]:HF(n??t[r])}:t}function ote(t,e){const n=$F(e);if(!n)return{properties:t};const r={...t},o=HF(r[n]);return delete r[n],{properties:r,proxyId:o}}const VF=({field:t,disabled:e,readOnly:n,context:r,value:o="",onChange:i,id:s,allowVariableInsert:a,hasModeSwitch:l})=>{const c=qS(),u=C.useId(),d=s||`workflow-code-${u}`,h=C.useRef(null),[f,m]=C.useState(0),g=!e&&!n,v=C.useCallback(D=>{var E;if(!a)return;const S=(E=h.current)==null?void 0:E.view,x=S==null?void 0:S.state.selection.main;if(!S||!x){i==null||i(`${o}${D}`);return}S.dispatch({changes:{from:x.from,to:x.to,insert:D},selection:{anchor:x.from+D.length}}),S.focus()},[a,i,o]),w=VS(d,D=>v(D),()=>{var D,S;return(S=(D=h.current)==null?void 0:D.view)==null?void 0:S.focus()}),b=ig(),y=(b==null?void 0:b.activeFieldId)===d,k=C.useCallback(()=>{if(g)try{i==null||i(JSON.stringify(JSON.parse(o),null,2))}catch{_.message.warning(Y("link.flow.format_json_failed"))}},[g,i,o]);return p.jsx(ex,{id:d,canEditInEditor:g,openEditorNumber:f,nodeId:c.nodeId||r.nodeId||"",value:o,language:"json",showVariableSidebar:a,onFinish:i,children:p.jsxs("div",{style:{position:"relative"},className:y?xf:void 0,children:[p.jsx(Hc,{id:d,ref:h,value:o,readOnly:!g,height:"220px",placeholder:t.placeholder,theme:bh,extensions:[Sv()],onFocus:()=>{g&&a&&w.activate()},onChange:i}),g?p.jsxs(_.Space,{size:4,style:{position:"absolute",right:8,top:6,zIndex:2},children:[p.jsx(_.Tooltip,{title:Y("link.flow.format_json"),children:p.jsx(_.Button,{type:"text",size:"small","aria-label":Y("link.flow.format_json"),icon:p.jsx(ie.FormatPainterOutlined,{}),onClick:k,style:{color:"#fff"}})}),p.jsx(_.Tooltip,{title:Y("link.flow.open_code_editor"),children:p.jsx(_.Button,{type:"text",size:"small","aria-label":Y("link.flow.open_code_editor"),icon:p.jsx(ie.FullscreenOutlined,{}),onClick:()=>m(D=>D+1),style:{color:"#fff"}})})]}):null]})})};VF.displayName="WorkflowCodeEditor";const zF=({field:t,disabled:e,readOnly:n,context:r,value:o,onChange:i,id:s})=>{const a=typeof o=="string"?o:o==null?"":JSON.stringify(o)??"",l=!!t.valueModePolicy,c=t.valueModePolicy==="EXPRESSION"||t.valueModePolicy==="BOTH",u=d=>p.jsx(VF,{...d,field:t,context:r,id:s,allowVariableInsert:c,hasModeSwitch:l});return t.valueModePolicy?p.jsx(ks,{value:a,onChange:d=>i==null?void 0:i(d),valueModePolicy:t.valueModePolicy,disabled:e,readOnly:n,placeholder:t.placeholder,renderNormalMode:u,renderExpressionMode:u,modeSwitchPosition:"top-right",encodeExpressionValue:!0}):u({value:a,onChange:d=>i==null?void 0:i(d),disabled:e,readOnly:n,placeholder:t.placeholder})};zF.displayName="WorkflowCodeFieldControl";const ite=gt(zF,{needsFormItemName:!0,supportsVariableInsert:!0}),WF=({disabled:t,readOnly:e,value:n,onChange:r,id:o})=>{const[i,s]=C.useState([]),[a,l]=C.useState(!1);C.useEffect(()=>{let d=!1;return l(!0),bm().then(h=>{d||s(Array.isArray(h)?h:[])}).catch(()=>{d||_.message.error(Y("link.flow.request_failed"))}).finally(()=>{d||l(!1)}),()=>{d=!0}},[]);const c=C.useMemo(()=>[{value:"0",label:p.jsx(Oe.FormattedMessage,{id:"link.flow.do_not_use"})},...i.map(d=>({value:String(d.id),label:d.group_name||String(d.id)}))],[i]),u=n==null||n===""?"0":String(n);return p.jsx(_.Select,{id:o,className:"proxy_id_select",value:u,options:c,loading:a,disabled:t||e,dropdownStyle:{zIndex:99999999999},onChange:d=>r==null?void 0:r(String(d)),style:{width:"100%"}})};WF.displayName="WorkflowProxyFieldControl";const ste=gt(WF,{needsFormItemName:!0,supportsVariableInsert:!0}),ate=[{type:we.CODE,definition:ite},{type:we.PROXY,definition:ste}];function lte({children:t}){const e=jt(),n=C.useMemo(()=>{var o;const r=(((o=e.canvas.registerComponents)==null?void 0:o.form)??[]).map(i=>{const s=i.component;return{type:i.name,definition:{component:a=>p.jsx(s,{config:a.field,disabled:a.disabled,nodeId:a.context.nodeId,mcpMode:a.context.mcpMode,value:a.value,onChange:a.onChange}),meta:{needsFormItemName:!0,supportsVariableInsert:!0,supportsAiFillable:!0}}}});return[...ate,...r]},[e.canvas.registerComponents]);return p.jsx(KS,{additionalRegistrations:n,children:t})}function su(){const{event$:t}=C.useContext(jo),e=og();return C.useCallback(n=>{var o;const r=document.activeElement;if(r&&r!==document.body&&r.contains(n.target)){const i=n.target;if(!["INPUT","TEXTAREA","SELECT"].includes((i==null?void 0:i.tagName)??""))return}(o=t==null?void 0:t.emit)==null||o.call(t,{type:"setCurrentInputId",currentInputId:""}),e==null||e.deactivateField()},[t,e])}const cte=[Ee.TEXT,Ee.PASSWORD,Ee.SELECT,Ee.EXTEND_OBJ,Ee.DATE,Ee.TIME,Ee.DATETIME,Ee.TEXTAREA,Ee.FIXED_OBJ,Ee.JSON],ute="[workflow:schema-render]",dte=/^\{\{([^.{}]+)\.(.+)\}\}$/,hte=async t=>{if(t!==hF)return[];const e=await Cm({allowFlowUpdate:1});return((e==null?void 0:e.items)??[]).filter(r=>r.allow_flow_update===1).map(r=>({label:r.display_name?`${r.display_name}(${r.name})`:r.name,value:r.name}))},fte=t=>{switch(t.page_control){case Ee.SELECT:case Ee.API_SELECT:return t.multi_valued?[]:null;case Ee.EXTEND_OBJ:return{};case Ee.HIDDEN:return"";case Ee.TEXT:return"";case Ee.PASSWORD:return"";case Ee.LABEL:return"";case Ee.DATE:return null;case Ee.TIME:return null;case Ee.DATETIME:return null;case Ee.TEXTAREA:return"";case Ee.FIXED_OBJ:return{};case Ee.MultiRowAIExtractConfig:return[];case Ee.JSON:return""}},jF=(t,e,n,r,o)=>{const i=t.display_name,s=()=>{var a,l,c;switch(t.page_control){case Ee.SELECT:return p.jsx(Kee,{options:xv(t.option_value_objects??t.option_values),multiple:t.multi_valued});case Ee.API_SELECT:return p.jsx($ee,{options:xv(t.option_value_objects??t.option_values)});case Ee.EXTEND_OBJ:return p.jsx(Wee,{valueType:t.value_type});case Ee.HIDDEN:return p.jsx(jee,{});case Ee.TEXT:return p.jsx(rr,{valueType:t.value_type,nodeId:e});case Ee.PASSWORD:return p.jsx(Gee,{valueType:t.value_type});case Ee.LABEL:return(a=r==null?void 0:r.webhookField)!=null&&a.enabled&&t.name==="hookUrl"&&r.webhookField.form?p.jsx(Zee,{form:r.webhookField.form,configList:r.webhookField.configList,disabled:r.webhookField.disabled}):p.jsx(IF,{});case Ee.DATE:return p.jsx(Hee,{});case Ee.TIME:return p.jsx(Yee,{});case Ee.DATETIME:return p.jsx(Vee,{});case Ee.TEXTAREA:return p.jsx(rr,{valueType:t.value_type,textAreaMode:!0,nodeId:e});case Ee.FIXED_OBJ:return p.jsx(_.Input.TextArea,{});case Ee.JSON:return p.jsx(rr,{valueType:t.value_type,nodeId:e});case Ee.MultiRowAIExtractConfig:return p.jsx(qee,{valueType:t.value_type});case Ee.MULTI_SELECT_LIST:return p.jsx(zee,{selectType:"KNOWLEDGE_BASE"});case Ee.SYNC_HOUR_MINUTE:return p.jsx(Uee,{});case Ee.AUTH_TOKEN:return p.jsx(Nee,{disabled:(l=r==null?void 0:r.webhookField)==null?void 0:l.disabled});case Ee.SECRET_KEY:return p.jsx(Bee,{});case Ee.SELECT_CLIENT:return p.jsx(Pee,{});default:{const u=(c=o==null?void 0:o.form)==null?void 0:c.find(d=>d.name===t.page_control);return u?p.jsx(u.component,{config:t,configList:r==null?void 0:r.configList,disabled:r==null?void 0:r.disabled,form:r==null?void 0:r.form,mcpMode:n,nodeId:e}):(console.warn(`unknown form item: page_control:${t.page_control}`),null)}}};return n&&cte.includes(t.page_control)?p.jsx("div",{children:p.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:t.page_control===Ee.SELECT?Y("link.flow.please_select")+t.display_name:Y("link.flow.please_enter")+t.display_name}],label:i,name:t.name,children:p.jsx(Lee,{children:s()})})},t.ui_id):p.jsx(_.Form.Item,{required:t.required,style:t.page_control===Ee.HIDDEN?{display:"none"}:{},rules:[{required:t.required,message:t.page_control===Ee.SELECT?Y("link.flow.please_select")+t.display_name:Y("link.flow.please_enter")+t.display_name},{validator(a,l,c){if(t.page_control===Ee.MultiRowAIExtractConfig)if(Array.isArray(l)&&t.required){const u=l.some(d=>!d.field||!d.dataType||!d.desc||d.required==null);c(u?"请填写完整配置":void 0)}else c(void 0);else c(void 0)}}],label:i,name:t.name,children:s()},t.ui_id)},pte=t=>(t.child_conditions??[]).map(e=>e.left).filter(e=>!!e),mte=(t,e)=>{if(!t.is_child)return!0;const n=t.child_conditions??[];return n.length?n.some(({left:r,operator:o,right:i})=>{const s=e==null?void 0:e[r];return o==="EQUALS"?s===i:s!==i}):!0},gte=C.forwardRef((t,e)=>{var me,ue;const{action:n,connector:r,nodeId:o,account_id:i,mcpMode:s,nodeType:a}=t,l=jt(),c=ne.useStoreApi(),u=su(),d=It.useReactive({proxyId:"0"}),{config_schema:h,proxy_id:f,protocol:m,account_schema_id:g}=n;a??n.node_type??n.type;const v=n.action_key||n.nodeKey,w=n.action_ver??n.nodeVersion,b=Array.isArray(h==null?void 0:h.sub_params),y=ii(n),k=C.useMemo(()=>!y||!v?null:`${v}@${w??"latest"}`,[y,v,w]),D=k?`${o}:${k}`:o,S=n.account_id??i,x=C.useMemo(()=>k?js(v,w):null,[k,v,w]),[E,T]=C.useState(()=>k&&x?{identity:k,schema:x,loading:!1,finished:!0}:null),A=(E==null?void 0:E.identity)===k?E:null,O=(A==null?void 0:A.schema)??null,B=_v((O==null?void 0:O.credentials)??[]),M=!!(y&&v&&!O&&((A==null?void 0:A.loading)??!(A!=null&&A.finished))),I=tte(O);C.useEffect(()=>{!E||E.identity},[k,E,o,v,w]),C.useEffect(()=>{f&&(d.proxyId=f)},[f,d]);const[N]=_.Form.useForm(),[P,F]=C.useState(S);C.useEffect(()=>{F(S)},[D,S,F]);const H=C.useMemo(()=>{var le;return b?(le=h.sub_params)==null?void 0:le.reduce((Se,ce)=>{let Ie=ce.value;return ce.page_control===Ee.EXTEND_OBJ&&(Ie=uee(Ie)),Se[ce.name]=Ie??fte(ce),Se},{}):{}},[h==null?void 0:h.sub_params,b]);C.useEffect(()=>{b&&(N.resetFields(),N.setFieldsValue({...H}))},[H,N,b,o]);const V=C.useRef(null),q=C.useRef(null);C.useEffect(()=>{if(!k||!v){T(null);return}const le=js(v,w);if(le){T({identity:k,schema:le,loading:!1,finished:!0});return}let Se=!1;return T({identity:k,schema:null,loading:!0,finished:!1}),Zu(v,w).then(ce=>{Se||T({identity:k,schema:ce,loading:!1,finished:!0})}).catch(ce=>{Se||(T({identity:k,schema:null,loading:!1,finished:!0}),console.error(`${ute} classic renderer next schema load failed`,{nodeId:o,nodeKey:v,nodeVersion:w,err:ce}))}),()=>{Se=!0}},[k,o,v,w]);const Q=C.useMemo(()=>{var le;return(le=O==null?void 0:O.input_fields)!=null&&le.length?d5(TF(O.input_fields),O.key):null},[O]),te=!!(y&&(Q||I||O)),$=C.useMemo(()=>{const le=n.properties?Ol(n.properties):h&&y?Ol(h):n.params?Ol(n.params):{},Se=rte(le,O,f);return Yu(v)?yl(Se).properties:Se},[n,h,y,O,v,f]),U=C.useMemo(()=>JSON.stringify($??{}),[$]);C.useEffect(()=>{!y||!te||(N.resetFields(),N.setFieldsValue($))},[D,N,y,$,U,te]);const R=C.useRef(null);C.useEffect(()=>{R.current=null},[D]),C.useEffect(()=>{Yu(v)&&(R.current=JSON.stringify(yl($).branches.map(le=>[le.id,le.name])))},[$,v]);const ee=C.useCallback(le=>{const Se=le.trim().match(dte);if(!Se)return null;const ce=Se[1],Ie=Se[2];if(ce==="global")return null;const je=ce.startsWith("N")?ce.slice(1):ce,Ue=c.getState().nodes.find(Re=>Re.id===je);return Ue?{fieldPath:Ie,node:Ue,variableNodeId:ce}:null},[c]),se=C.useCallback(le=>{var Se;return((Se=ee(le))==null?void 0:Se.fieldPath)??le.replace(/^\{\{|\}\}$/g,"")},[ee]),he=C.useCallback(le=>{var Ue;const Se=ee(le);if(!Se)return le;const ce=(Ue=Se.node)==null?void 0:Ue.data,Ie=(ce==null?void 0:ce.label)||(ce==null?void 0:ce.name)||(ce==null?void 0:ce.action_name)||Se.variableNodeId,je=ce!=null&&ce.note?` (${ce.note})`:"";return`${Ie}${je}.${Se.fieldPath}`},[ee]),[j,K]=C.useState(!1),W=(le,Se)=>(K(!0),N.validateFields().then(async ce=>{var je,Ue,Re,xt,xe;if(te){Se&&((Ue=(je=V==null?void 0:V.current)==null?void 0:je.onIgnoreNodeStart)==null||Ue.call(je));const{properties:Ce,proxyId:$e}=ote(ce,O);return t.onSubmit({properties:Ce,account_id:P,proxy_id:$e},le)}const Ie=Kt.cloneDeep(n.config_schema);return Ie.sub_params.forEach(Ce=>{let $e=ce[Ce.name];Ce.page_control===Ee.EXTEND_OBJ&&$e!=="{{$fromAI}}"&&($e=Ev($e)),Ce.value=$e??null}),Se&&((xt=(Re=V==null?void 0:V.current)==null?void 0:Re.onIgnoreNodeStart)==null||xt.call(Re)),!i&&m==="HTTP"&&(r==null?void 0:r.deployment_type)!=="SaasApp"&&(Ie.proxy_id=(xe=q.current)==null?void 0:xe.getProxyId()),t.onSubmit(Ie,le)}).catch(ce=>(console.log("err",ce),_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>K(!1)));C.useImperativeHandle(e,()=>({saveConfig:le=>W(le,!1)}));const X=zt(),re={form:N,configList:(h==null?void 0:h.sub_params)??[],disabled:!X,...m==="WEBHOOK"?{webhookField:{enabled:!0,form:N,configList:(h==null?void 0:h.sub_params)??[],disabled:!X}}:{}},Z=le=>{const Se=le.page_control!==Ee.HIDDEN?p.jsx("p",{className:"field-desc",children:le.description}):null;if(!le.is_child)return p.jsxs("div",{children:[jF(le,o,s,re,l.canvas.registerComponents),Se]},le.ui_id);const ce=pte(le);return p.jsx(_.Form.Item,{noStyle:!0,shouldUpdate:(Ie={},je={})=>le.is_child?ce.length?ce.some(Ue=>(Ie==null?void 0:Ie[Ue])!==(je==null?void 0:je[Ue])):!0:!1,children:()=>{const Ie=N.getFieldsValue(!0);return mte(le,Ie)?p.jsxs("div",{children:[jF(le,o,s,re,l.canvas.registerComponents),Se]}):null}},le.ui_id)};if(y&&M)return p.jsx("div",{style:{textAlign:"center",padding:40},children:p.jsx(_.Spin,{})});const ae=!t.preRender&&(((me=n.config_schema)==null?void 0:me.sub_params)??[]).length<1,be=p.jsx("div",{style:{padding:16,color:"#999",textAlign:"center"},children:"该节点暂无配置项"});if(te){const le=p.jsxs(p.Fragment,{children:[t.preRender,I?p.jsx(BF,{credentialRequirements:B,value:P,onChange:F,linkApp:r,disabled:!X}):null]});return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:u,children:[p.jsx("div",{className:"workflow-node-form-scroll",children:Q?p.jsx(lte,{children:p.jsx(yv,{schema:Q,form:N,optionsLoader:hte,initialValues:$,showSubmit:!1,showReset:!1,nodeId:o,mcpMode:s,renderVariableTag:se,renderVariableTooltip:he,customTheme:Ru,preRender:le},D)}):be}),p.jsx("div",{className:"workflow-node-form-footer",children:X&&p.jsx(_.Button,{type:"primary",disabled:!X,loading:j,className:"workflow-node-form-save",onClick:()=>W(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:u,children:[p.jsxs(_.Form,{form:N,disabled:!X,layout:"vertical",className:`${ete.configFormContainer} workflow-config-form workflow-node-form-scroll`,children:[t.preRender,(r==null?void 0:r.id)&&n.config_schema&&((ue=h==null?void 0:h.sub_params)==null?void 0:ue.map(le=>Z(le))),!i&&m==="HTTP"&&(r==null?void 0:r.deployment_type)!=="SaasApp"?p.jsx(Cv,{proxyId:d.proxyId,ref:q}):null,ae&&be]}),p.jsx("div",{className:"workflow-node-form-footer",children:X&&p.jsx(_.Button,{type:"primary",disabled:!X,loading:j,className:"workflow-node-form-save",onClick:()=>W(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}),wte=C.memo(C.forwardRef((t,e)=>{const{nodeId:n,data:r}=t,{account_id:o,account_schema_id:i}=r,s=It.useReactive({account_id:o}),a=C.useRef(null);C.useImperativeHandle(e,()=>({saveConfig:f=>{var m;return(m=a.current)==null?void 0:m.saveConfig(f)}}));const l=C.useMemo(()=>({id:t.data.connector_id,name:t.data.connector_name,deployment_type:t.data.deployment_type}),[t.data.connector_id,t.data.connector_name,t.data.deployment_type]),c=ii(t.data),u=(f,m)=>{if(c){const g=Ol(f),w=Object.hasOwn(f??{},"account_id")?f.account_id??null:s.account_id;return t.onSubmit({properties:g,account_id:w,proxy_id:(f==null?void 0:f.proxy_id)??(g==null?void 0:g.proxy_id)},m)}return t.onSubmit({properties:f,account_id:s.account_id,proxy_id:f.proxy_id},m)},d=C.useCallback(f=>{s.account_id=f??null},[]);let h=null;return i&&!c&&(h=p.jsx(BF,{onChange:d,actionAccountSchemaId:i,value:s.account_id,linkApp:l})),p.jsx("div",{className:"workflow-action-node-config",children:p.jsx(gte,{ref:a,action:t.data,nodeType:t.data.node_type||t.data.type,connector:l,account_id:o,nodeId:n,onSubmit:u,preRender:h})})}),(t,e)=>t.nodeId===e.nodeId&&t.nodeType===e.nodeType&&Kt.isEqual(Kt.omit(t.data,["isHovered"]),Kt.omit(e.data,["isHovered"])));var ir=(t=>(t.IDLE="idle",t.SAVING="saving",t.SAVED="saved",t.ERROR="error",t))(ir||{}),cp=(t=>(t.SELECTION="selection",t.ALL="all",t))(cp||{}),Dr=(t=>(t.UNPUBLISHED="UNPUBLISHED",t.ONLINE="ONLINE",t.OFFLINE="OFFLINE",t.ON_WARN="ON_WARN",t.OFF_WARN="OFF_WARN",t.ONLINE_ING="ONLINE_ING",t))(Dr||{}),ot=(t=>(t.eq="eq",t.ne="ne",t.sw="sw",t.nsw="nsw",t.ew="ew",t.ewn="ewn",t.gt="gt",t.ge="ge",t.lt="lt",t.le="le",t.co="co",t.nco="nco",t.in="in",t.nin="nin",t.is_null="is_null",t.is_not_null="is_not_null",t))(ot||{});const UF=[{operator:ot.eq,label:Y("common.eq")},{operator:ot.ne,label:Y("common.ne")},{operator:ot.sw,label:Y("common.sw")},{operator:ot.nsw,label:Y("common.nsw")},{operator:ot.ew,label:Y("common.ew")},{operator:ot.ewn,label:Y("common.ewn")},{operator:ot.gt,label:Y("common.gt")},{operator:ot.ge,label:Y("common.ge")},{operator:ot.lt,label:Y("common.lt")},{operator:ot.le,label:Y("common.le")},{operator:ot.co,label:Y("common.co")},{operator:ot.nco,label:Y("common.nco")},{operator:ot.in,label:Y("common.in")},{operator:ot.nin,label:Y("common.nin")},{operator:ot.is_null,label:Y("common.is_null")},{operator:ot.is_not_null,label:Y("common.is_not_null")}];ot.eq+"",Y("common.eq"),ot.ne+"",Y("common.ne"),ot.sw+"",Y("common.sw"),ot.nsw+"",Y("common.nsw"),ot.ew+"",Y("common.ew"),ot.ewn+"",Y("common.ewn"),ot.gt+"",Y("common.gt"),ot.lt+"",Y("common.lt"),ot.ge+"",Y("common.ge"),ot.co+"",Y("common.co"),ot.nco+"",Y("common.nco"),ot.le+"",Y("common.le"),ot.in+"",Y("common.in"),ot.nin+"",Y("common.nin"),ot.is_null+"",Y("common.is_null"),ot.is_not_null+"",Y("common.is_not_null");const Ov=t=>t===ot.is_null||t===ot.is_not_null,bte=(t,e="")=>Ov(t)?"":e,{Option:vte}=_.Select,yte=C.forwardRef((t,e)=>{const{config_schema:n}=t,[r]=_.Form.useForm(),o=su(),s=(d=>d!=null&&d.or_list?{or_list:d.or_list.map(f=>({and_list:f.and_list.map(m=>({query:m.query||"",operator:m.operator||"",value:m.value||""}))}))}:{or_list:[{and_list:[{query:"",operator:"",value:""}]}]})(n),[a,l]=C.useState(!1),c=(d,h,f="")=>(l(!0),r.validateFields().then(async m=>t.onSubmit({properties:m},d)).catch(()=>(_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>l(!1)));C.useImperativeHandle(e,()=>({saveConfig:d=>c(d)}));const u=zt();return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:o,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsx(_.Form,{disabled:!u,form:r,initialValues:s,layout:"vertical",autoComplete:"off",children:p.jsx(_.Form.List,{name:"or_list",children:(d,{add:h,remove:f})=>p.jsxs(p.Fragment,{children:[d.map((m,g)=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"form-block",children:p.jsxs("div",{style:{padding:12,width:"100%",boxSizing:"border-box"},children:[g>0&&u&&p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsx(_.Button,{type:"link",style:{color:"red"},icon:p.jsx(ie.MinusCircleOutlined,{style:{color:"red"}}),onClick:()=>f(m.name),children:p.jsx(Oe.FormattedMessage,{id:"link.flow.remove"})})}),p.jsx(_.Form.List,{name:[m.name,"and_list"],children:(v,{add:w,remove:b})=>p.jsx(p.Fragment,{children:v.map((y,k)=>p.jsxs(_.Space,{direction:"vertical",style:{width:"100%",rowGap:0},children:[p.jsxs(_.Space,{align:"center",className:`form-item-row ${k>0?"opt":""}`,children:[p.jsx(_.Form.Item,{style:{minWidth:150},name:[y.name,"query"],label:Y("app.common.word.variable-name"),rules:[{required:!0,message:Y("link.flow.please_enter_variable_name")}],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.variable_name"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})}),p.jsx(_.Form.Item,{name:[y.name,"operator"],label:Y("app.common.word.condition"),rules:[{required:!0,message:Y("link.flow.please_select_condition")}],children:p.jsx(_.Select,{style:{minWidth:140},placeholder:Y("link.flow.select_condition"),getPopupContainer:D=>D.parentNode,children:UF.map(D=>p.jsx(vte,{value:D.operator,children:D.label},D.operator))})}),p.jsx(_.Form.Item,{noStyle:!0,shouldUpdate:!0,children:()=>{const D=r.getFieldValue(["or_list",m.name,"and_list",y.name,"operator"]);return Ov(D)?null:p.jsx(_.Form.Item,{style:{minWidth:150},name:[y.name,"value"],label:Y("app.common.word.value"),rules:[],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.value"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})})}}),k>0&&p.jsx(_.Button,{type:"link",icon:p.jsx(ie.MinusCircleOutlined,{}),onClick:()=>b(y.name)})]}),k<v.length-1&&p.jsx(_.Divider,{plain:!0,children:p.jsx(_.Tag,{color:"#999999",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.and"})})}),k===v.length-1&&p.jsx(_.Button,{type:"link",disabled:!u,icon:p.jsx(Kr,{size:16}),className:"small",onClick:()=>w({query:"",operator:"",value:""}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-new-and"})})]},y.key))})})]})},m.key),g<d.length-1&&p.jsxs("div",{className:"test",style:{textAlign:"center"},children:[" ",p.jsx(_.Divider,{style:{color:"orange"},dashed:!0,children:p.jsx(_.Tag,{color:"#1890ff",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.or"})})})]})]})),p.jsx(_.Form.Item,{style:{display:"flex",justifyContent:"flex-end",marginBlock:10},children:p.jsx(_.Button,{type:"default",icon:p.jsx(Kr,{size:16}),disabled:!u,onClick:()=>h({and_list:[{query:"",operator:"",value:""}]}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-or"})})})]})})})}),p.jsx("div",{className:"workflow-node-form-footer",children:u&&p.jsx(_.Button,{type:"primary",disabled:!u,loading:a,className:"workflow-node-form-save",onClick:()=>c(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})});var Cte=["isArray","start","level","className","render"];function Ra(t){var{isArray:e=!1,start:n=!1,level:r,className:o,render:i}=t,s=Qn(t,Cte),a=e?"[]":"{}",l="w-rjv-"+(e?"brackets":"curlybraces")+"-"+(n?"start":"end")+" "+(o||""),c="var(--w-rjv-"+(e?"brackets":"curlybraces")+"-color, #236a7c)";if(i){var u=i(Qe({isArray:e,level:r,className:l,style:{color:c},children:n?a.charAt(0):a.charAt(1)},s));if(u)return u}return p.jsx(Oi,Qe({color:c,className:l},s,{children:n?a.charAt(0):a.charAt(1)}))}Ra.displayName="JVR.Meta";var kte=["children","style","text","onCopied","render","show"];function Nv(t){var{style:e,text:n="",onCopied:r,render:o,show:i}=t,s=Qn(t,kte);if(!i)return null;var[a,l]=C.useState(!1),c=h=>{h.stopPropagation();var f=JSON.stringify(n||"",(m,g)=>typeof g=="bigint"?g.toString():g,2);n===1/0&&(f=1/0),navigator.clipboard.writeText(f).then(()=>{r&&r(f,n),l(!0);var m=setTimeout(()=>{l(!1),clearTimeout(m)},3e3)}).catch(m=>{})},u=Qe({},e,{cursor:"pointer",verticalAlign:"middle",marginLeft:5}),d=Qe({height:"1em",width:"1em",fill:"var(--w-rjv-copied-color, currentColor)",onClick:c,style:u,className:"w-rjv-copied"},s);return o?o(Qe({},t,d)):a?p.jsx("svg",Qe({viewBox:"0 0 32 36"},d,{fill:"var(--w-rjv-copied-success-color, #28a745)",children:p.jsx("path",{d:"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z"})})):p.jsx("svg",Qe({viewBox:"0 0 32 36"},d,{children:p.jsx("path",{d:"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z"})}))}Nv.displayName="JVR.Copied";var Ste=["children","style"],xte=["children","length","style"],Ete=["color","style","isURL","href","children"],Dte=["value","parentValue","setValue","countInfo","data","keyName","indentWidth","isSet","namespace","renderKey","components","quotes","level","enableClipboard","displayObjectSize","displayDataTypes","shortenTextAfterLength"],Ate=["children","color","fontSize","opacity","paddingRight","style"],Ti=t=>p.jsx("div",Qe({},t));Ti.displayName="JVR.Line";var _te=t=>Number(t)===t&&t%1!==0||isNaN(t),au={string:{color:"var(--w-rjv-type-string-color, #cb4b16)",label:"string"},number:{color:"var(--w-rjv-type-int-color, #268bd2)",label:"int"},float:{color:"var(--w-rjv-type-float-color, #859900)",label:"float"},bigint:{color:"var(--w-rjv-type-bigint-color, #268bd2)",label:"bigint"},boolean:{color:"var(--w-rjv-type-boolean-color, #2aa198)",label:"bool"},date:{color:"var(--w-rjv-type-date-color, #586e75)",label:"date"},url:{color:"var(--w-rjv-type-url-color, #0969da)",label:"url"},null:{color:"var(--w-rjv-type-null-color, #d33682)",label:"null"},Set:{color:"var(--w-rjv-type-set-color, #268bd2)",label:"Set"},Map:{color:"var(--w-rjv-type-map-color, #268bd2)",label:"Map"},NaN:{color:"var(--w-rjv-type-nan-color, #859900)",label:"NaN"},undefined:{color:"var(--w-rjv-type-undefined-color, #586e75)",label:"undefined"}},up=t=>{var{children:e=":",style:n}=t,r=Qn(t,Ste);return p.jsx("span",Qe({className:"w-rjv-colon",style:Qe({paddingRight:3},n,{color:"var(--w-rjv-colon-color, var(--w-rjv-color))"})},r,{children:e}))};up.displayName="JVR.Colon";function Tte(t){var e=typeof t,n="";typeof t=="number"&&(e=_te(t)?"float":"number",n=t.toString(),isNaN(t)&&(e="NaN",n="NaN")),typeof t=="boolean"&&(e="boolean",n=t.toString()),typeof t=="object"&&t instanceof Date&&(e="date",n=t.toString()),t===null&&(e="null",n=(""+t).toLocaleUpperCase()),t===void 0&&(e="undefined",n=String(t)),typeof t=="bigint"&&(e="bigint",n=t+"n");var r=t instanceof URL;return r&&(e="url",n='"'+t.href+'"'),typeof t=="string"&&(n='"'+t+'"'),{type:e,content:n}}var RF=t=>{var{children:e,length:n,style:r}=t,o=Qn(t,xte),i=e,[s,a]=C.useState(n&&i.length>=n);C.useEffect(()=>a(n&&i.length>=n),[n]);var l=()=>a(!s),c=s?i.slice(0,n)+"...":i;return p.jsx(Mv,Qe({},o,{style:Qe({},r,{cursor:"pointer"}),onClick:l,children:c}))};RF.displayName="JVR.RenderShortenTextValue";var Mv=t=>{var{color:e,style:n,isURL:r,href:o,children:i}=t,s=Qn(t,Ete);return p.jsxs(Oi,Qe({color:e,style:n},s,{className:"w-rjv-value",children:[r&&p.jsx("a",{href:o,style:{color:e},target:"_blank",rel:"noopener noreferrer",children:i}),!r&&i]}))};Mv.displayName="JVR.RenderStringValue";function qF(t){var e,{value:n,parentValue:r,setValue:o,countInfo:i,data:s,keyName:a,indentWidth:l,namespace:c,renderKey:u,components:d={},quotes:h,enableClipboard:f,displayDataTypes:m,shortenTextAfterLength:g}=t,v=Qn(t,Dte),w="",b={},{type:y,content:k}=Tte(n),D=p.jsx(dp,{type:y});n===null&&(D=p.jsx(C.Fragment,{}),b={fontWeight:"bold"}),(n===void 0||y.toLocaleLowerCase()==="nan"||!m)&&(D=p.jsx(C.Fragment,{}));var S=n instanceof URL;w=((e=au[y])==null?void 0:e.color)||"";var[x,E]=C.useState(!1),T=C.useMemo(()=>f&&x&&p.jsx(Nv,{show:x,text:n}),[f,x,n]),A={className:"w-rjv-line",style:{paddingLeft:l}};if(f&&(A.onMouseEnter=()=>E(!0),A.onMouseLeave=()=>E(!1)),k&&typeof k=="string"){var O=d.value&&d.value({className:"w-rjv-value",style:Qe({color:w},b),type:y,value:n,setValue:o,data:s,parentValue:r,quotes:h,keyName:a,namespace:c,visible:x,content:k,children:k}),B=g&&y==="string"?p.jsx(RF,{color:w,href:S?n.href:"",style:b,isURL:S,length:g,children:k}):p.jsx(Mv,{color:w,href:S?n.href:"",style:b,isURL:S,children:k});return p.jsx(Ti,Qe({},A,{children:p.jsxs(Oi,Qe({},v,{ref:null,children:[u,p.jsx(up,{}),D,O||B,T]}))}))}var M=p.jsxs(C.Fragment,{children:[p.jsx(Ra,{render:d.braces,start:!0,isArray:Array.isArray(n)}),p.jsx(Ra,{render:d.braces,isArray:Array.isArray(n)}),i]});return p.jsx(Ti,Qe({},A,{children:p.jsxs(Oi,Qe({},v,{ref:null,children:[u,p.jsx(up,{}),D,M,T]}))}))}qF.displayName="JVR.ValueView";var Oi=C.forwardRef((t,e)=>{var{children:n,color:r,fontSize:o,opacity:i,paddingRight:s,style:a}=t,l=Qn(t,Ate);return p.jsx("span",Qe({style:Qe({color:r,fontSize:o,opacity:i,paddingRight:s},a)},l,{ref:e,children:n}))});Oi.displayName="JVR.Label";var dp=t=>{var e,n,{type:r}=t,o=(e=au[r])==null?void 0:e.color,i=(n=au[r])==null?void 0:n.label;if(o&&i)return p.jsx(Oi,{color:o,fontSize:11,opacity:.8,paddingRight:4,className:"w-rjv-type","data-type":r,children:i})};dp.displayName="JVR.Type";var Ote=["style"];function GF(t){var{style:e}=t,n=Qn(t,Ote),r=Qe({cursor:"pointer",height:"1em",width:"1em"},e);return p.jsx("svg",Qe({viewBox:"0 0 24 24",fill:"var(--w-rjv-arrow-color, currentColor)",style:r},n,{children:p.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})}))}GF.displayName="JVR.TriangleArrow";var lu={},cu=[],KF={collapse(t){lu=Qe({},lu,{[t]:!1}),YF()},expand(t){lu=Qe({},lu,{[t]:!0}),YF()}};function Nte(){return lu}function Mte(t){return cu=[...cu,t],()=>{cu=cu.filter(e=>e!==t)}}function YF(){for(var t of cu)t()}function Bte(){var t=C.useSyncExternalStore(Mte,Nte);return t}var Fte=["children","render","color","value","className","keyName","highlightUpdates","quotes","style","namespace","parentName"];function Ite(t){var e=C.useRef();return C.useEffect(()=>{e.current=t}),e.current}function Pte(t){var{value:e,highlightUpdates:n,highlightContainer:r}=t,o=Ite(e),i=C.useMemo(()=>!n||o===void 0?!1:typeof e!=typeof o?!0:typeof e=="number"?isNaN(e)&&isNaN(o)?!1:e!==o:Array.isArray(e)!==Array.isArray(o)?!0:typeof e=="object"||typeof e=="function"?!1:e!==o,[n,e]);C.useEffect(()=>{r&&r.current&&i&&"animate"in r.current&&r.current.animate([{backgroundColor:"var(--w-rjv-update-color, #ebcb8b)"},{backgroundColor:""}],{duration:1e3,easing:"ease-in"})},[i,e,r])}var Bv=t=>{var{render:e,color:n,value:r,className:o="w-rjv-object-key",keyName:i,highlightUpdates:s,quotes:a,style:l,namespace:c,parentName:u}=t,d=Qn(t,Fte),h=C.useRef(null),f=typeof i=="string"?""+a+i+a:i;return e?e(Qe({className:o},d,{value:r,namespace:c,style:Qe({},l,{color:n}),parentName:u,keyName:i,quotes:a,label:i,children:f})):(Pte({value:r,highlightUpdates:s,highlightContainer:h}),p.jsx(Oi,Qe({className:o,color:n},d,{ref:h,children:f})))};Bv.displayName="JSR.Semicolon";var Lte=["style","render","count","level"],XF=t=>{var{style:e,render:n,count:r,level:o}=t,i=Qn(t,Lte),s=Qe({cursor:"pointer"},e),a="w-rjv-ellipsis "+(i.className||"");return n?n(Qe({style:s,count:r,level:o},i,{className:a})):p.jsx("span",Qe({className:a,style:s},i,{children:"..."}))};XF.displayName="JVR.Ellipsis";var $te=["value","keyName","className","displayDataTypes","components","displayObjectSize","enableClipboard","highlightUpdates","objectSortKeys","indentWidth","shortenTextAfterLength","collapsed","level","keyid","quotes","namespace","isSet","isMap","onCopied","onExpand","parentValue","setParentValue"];function Hte(t){try{return Object.keys(t).length}catch{return-1}}var Fv=t=>{var{children:e}=t;return p.jsxs(Oi,{style:{paddingLeft:4,fontStyle:"italic"},color:"var(--w-rjv-info-color, #0000004d)",className:"w-rjv-object-size",children:[e," items"]})};Fv.displayName="JVR.CountInfo";var hp=C.forwardRef((t,e)=>{var n,{value:r={},keyName:o,className:i,displayDataTypes:s=!0,components:a={},displayObjectSize:l=!0,enableClipboard:c=!0,highlightUpdates:u=!0,objectSortKeys:d=!1,indentWidth:h=15,shortenTextAfterLength:f=30,collapsed:m,level:g=1,keyid:v="root",quotes:w='"',namespace:b=[],isSet:y=!1,isMap:k=!1,onCopied:D,onExpand:S,parentValue:x,setParentValue:E}=t,T=Qn(t,$te),A=Array.isArray(r),O=C.useId(),B=Bte(),M=(n=B[v])!=null?n:typeof m=="boolean"?m:typeof m=="number"?g<=m:!0,I=()=>{S&&typeof S=="function"&&S({expand:!M,keyid:v,keyName:o,value:r}),M?KF.collapse(v):KF.expand(v)},[N,P]=C.useState(r),F={components:a,indentWidth:h,displayDataTypes:s,displayObjectSize:l,enableClipboard:c,highlightUpdates:u,onCopied:D,onExpand:S,collapsed:m,parentValue:r,setParentValue:P,quotes:w,level:g+1,style:{paddingLeft:h}},H={displayDataTypes:s,displayObjectSize:l,enableClipboard:c,shortenTextAfterLength:f,level:g+1,parentValue:r,indentWidth:h,data:N,quotes:w,setValue:P},V={transform:"rotate("+(M?"0":"-90")+"deg)",transition:"all 0.3s"},q=a.arrow?C.cloneElement(a.arrow,{style:V,"data-expand":M,className:"w-rjv-arrow"}):p.jsx(GF,{style:V,className:"w-rjv-arrow"}),[Q,te]=C.useState(!1),$={};c&&($.onMouseEnter=()=>te(!0),$.onMouseLeave=()=>te(!1)),C.useEffect(()=>P(r),[r]);var U=A?Object.keys(N).map(he=>Number(he)):Object.keys(N),R=A?Object.entries(N).map(he=>[Number(he[0]),he[1]]):Object.entries(N);d&&(R=d===!0?R.sort((he,j)=>{var[K]=he,[W]=j;return typeof K=="string"&&typeof W=="string"?K.localeCompare(W):0}):R.sort((he,j)=>{var[K]=he,[W]=j;return typeof K=="string"&&typeof W=="string"?d(K,W):0}));var ee=p.jsx(Fv,{children:U.length});a.countInfo&&(ee=a.countInfo({count:U.length,level:g,visible:M})||ee),l||(ee=null);var se=a.countInfoExtra&&a.countInfoExtra({count:U.length,level:g,showTools:Q,keyName:o,visible:M,value:N,namespace:[...b],parentValue:x,setParentValue:E,setValue:P});return p.jsxs("div",Qe({ref:e},T,{className:i+" w-rjv-inner"},$,{children:[p.jsxs(Ti,{style:{display:"inline-flex",alignItems:"center"},onClick:I,children:[q,(typeof o=="string"||typeof o=="number")&&p.jsxs(C.Fragment,{children:[p.jsx(Bv,{value:N,quotes:w,"data-keys":v,namespace:[...b],render:a.objectKey,keyName:o,parentName:o,color:typeof o=="number"?au.number.color:""}),p.jsx(up,{})]}),y&&p.jsx(dp,{type:"Set"}),k&&p.jsx(dp,{type:"Map"}),p.jsx(Ra,{start:!0,isArray:A,level:g,render:a.braces}),!M&&p.jsx(XF,{render:a.ellipsis,count:U.length,level:g}),!M&&p.jsx(Ra,{isArray:A,level:g,render:a.braces}),ee,se,c&&p.jsx(Nv,{show:Q,text:N,onCopied:D,render:a==null?void 0:a.copied})]}),M&&p.jsx(Ti,{className:"w-rjv-content",style:{borderLeft:"var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)",marginLeft:6},children:R.length>0&&[...R].map((he,j)=>{var[K,W]=he,X=W,re=X instanceof Set,Z=X instanceof Map,ae=re?Array.from(X):Z?Object.fromEntries(X):X,be=Array.isArray(ae)&&ae.length===0||typeof ae=="object"&&ae&&!(ae instanceof Date)&&Object.keys(ae).length===0;if((Array.isArray(ae)||re||Z)&&!be){var me=A?j:K;return p.jsx(Ti,{className:"w-rjv-wrap",children:p.jsx(hp,Qe({value:ae,isSet:re,isMap:Z,namespace:[...b,me],keyName:me,keyid:v+O+me},F))},me+j)}if(typeof ae=="object"&&ae&&!(ae instanceof Date)&&!be)return p.jsx(Ti,{className:"w-rjv-wrap",children:p.jsx(hp,Qe({value:ae,namespace:[...b,K],keyName:K,keyid:v+O+K},F))},K+""+j);if(typeof ae!="function"){var ue=p.jsx(Bv,{value:ae,"data-keys":v,quotes:w,namespace:[...b,K],parentName:o,highlightUpdates:u,render:a.objectKey,color:typeof K=="number"?au.number.color:"",keyName:K}),le=Array.isArray(ae)?ae.length:Hte(ae);return ee=p.jsx(Fv,{children:le}),a.countInfo&&(ee=a.countInfo({count:le,level:g,visible:M})||ee),p.jsx(qF,Qe({components:a,namespace:[...b,K]},H,{countInfo:ee,renderKey:ue,keyName:K,isSet:y,value:ae}),j)}})}),M&&p.jsx(Ti,{style:{paddingLeft:2},children:p.jsx(Ra,{render:a.braces,isArray:A,level:g,style:{paddingLeft:2,display:"inline-block"}})})]}))});hp.displayName="JVR.RootNode";var Vte=["value","style","className"],JF=C.forwardRef((t,e)=>{var{value:n,style:r,className:o}=t,i=Qn(t,Vte),s=Qe({lineHeight:1.4,fontFamily:"var(--w-rjv-font-family, Menlo, monospace)",color:"var(--w-rjv-color, #002b36)",backgroundColor:"var(--w-rjv-background-color, #00000000)",fontSize:13},r),a="w-json-view-container w-rjv "+(o||""),l=C.useId();return p.jsx(hp,Qe({className:a,value:n},i,{ref:e,keyid:l,style:s}))});JF.displayName="JVR.JsonView";var zte={"--w-rjv-font-family":"monospace","--w-rjv-color":"#0184a6","--w-rjv-background-color":"#202020","--w-rjv-line-color":"#323232","--w-rjv-arrow-color":"var(--w-rjv-color)","--w-rjv-edit-color":"var(--w-rjv-color)","--w-rjv-info-color":"#656565","--w-rjv-update-color":"#ebcb8b","--w-rjv-copied-color":"#0184a6","--w-rjv-copied-success-color":"#28a745","--w-rjv-curlybraces-color":"#1896b6","--w-rjv-brackets-color":"#1896b6","--w-rjv-type-string-color":"#cb4b16","--w-rjv-type-int-color":"#268bd2","--w-rjv-type-float-color":"#859900","--w-rjv-type-bigint-color":"#268bd2","--w-rjv-type-boolean-color":"#2aa198","--w-rjv-type-date-color":"#586e75","--w-rjv-type-url-color":"#649bd8","--w-rjv-type-null-color":"#d33682","--w-rjv-type-nan-color":"#076678","--w-rjv-type-undefined-color":"#586e75"};const{Title:Wte}=_.Typography,QF=({status:t,result:e="",progress:n=60,runningAction:r="run",showAlert:o=!0,canEdit:i=!0,disabledReason:s="当前节点不支持手动测试",editing:a=!1,editableValue:l="",onEditableValueChange:c,onRun:u,onIgnore:d,onReset:h,onToggleEdit:f,onDismissAlert:m,className:g,onClose:v,onExpandPanel:w})=>{const b=t==="running",y=t==="failure",k=t==="ignored",D=t==="success"||k,S=t==="disabled",[x,E]=C.useState(!1),[T,A]=C.useState(!0),O=a?l:e,B=C.useMemo(()=>{if(a)return null;try{const N=JSON.parse(e);return A(!0),N!==null&&typeof N=="object"?N:null}catch{return null}},[a,e]),M=C.useCallback(()=>{const N=new Blob([O],{type:"application/json"}),P=URL.createObjectURL(N),F=document.createElement("a");F.href=P,F.download="data.json",document.body.appendChild(F),F.click(),F.remove(),URL.revokeObjectURL(P)},[O]),I=x?450:300;return p.jsxs("section",{className:["node-test-container","ai-flow-node-test-panel",g].filter(Boolean).join(" "),"aria-label":"AI FLOW 节点测试",children:[p.jsx("div",{className:"node-test-header",children:p.jsxs("div",{className:"header-title",children:[p.jsx("span",{className:"common-icon title-icon"}),p.jsx(Wte,{level:4,children:"节点测试"}),p.jsx(_.Button,{ghost:!0,className:"close-btn",onClick:v,children:p.jsx(Ds,{size:16})})]})}),p.jsxs("div",{className:"test-content",children:[i&&!S?p.jsxs("div",{className:"action-buttons",children:[p.jsx(_.Button,{type:"primary",disabled:S,onClick:u,loading:b&&r==="run",className:"test-button",children:b?"测试中...":"开始测试"}),p.jsx(_.Button,{type:"default",disabled:S||b&&r==="run",onClick:d,loading:b&&r==="ignore",className:"ignore-button",children:"忽略调试"})]}):null,i&&e?p.jsx("div",{className:"action-buttons",children:p.jsx(_.Button,{onClick:h,className:"reset-button",children:"重置"})}):null,b?p.jsxs(p.Fragment,{children:[p.jsx(_.Progress,{percent:n,status:"active",className:"test-progress"}),p.jsx(_.Skeleton,{active:!0,className:"result-skeleton"})]}):p.jsxs(p.Fragment,{children:[y&&o?p.jsx(_.Alert,{className:"error-alert small",showIcon:!0,message:"测试未通过",description:"请检查节点配置和接口返回后重试",type:"error",closable:!1,onClose:m}):null,D&&o?p.jsx(_.Alert,{className:"success-alert small",showIcon:!0,message:k?"忽略调试成功":"测试成功",description:k?"已将样本数据设为当前节点输出":"节点运行正常,可在下方查看返回结果",type:"success",closable:!1,onClose:m}):null,e?p.jsxs(_.Card,{styles:{body:{padding:0}},title:p.jsxs("div",{className:"result-header",children:[p.jsx("div",{className:"result-title",children:y?p.jsxs(p.Fragment,{children:[p.jsx(ie.CloseCircleFilled,{className:"error-icon"})," 错误数据"]}):p.jsxs(p.Fragment,{children:[k?p.jsx(ie.ExperimentFilled,{className:"success-icon"}):p.jsx(ie.CheckCircleFilled,{className:"success-icon"}),k?"样本数据":"测试结果"]})}),p.jsxs("div",{style:{display:"inline-flex",gap:8},children:[p.jsx(_.Button,{size:"small",type:"default",variant:"solid",onClick:M,className:"edit-button",children:"下载JSON"}),i&&f?p.jsx(_.Button,{size:"small",type:"default",variant:"solid",onClick:()=>{if(a&&!T){_.message.error("测试结果必须是json格式!");return}f()},className:"edit-button",children:a?"完成":"编辑"}):null,w&&p.jsx(_.Button,{size:"small",type:x?"primary":"default",variant:"solid",className:"edit-button",onClick:()=>{const N=!x;w(N),E(N)},children:x?p.jsx(iQ,{size:16}):p.jsx(oQ,{size:16})})]})]}),variant:"borderless",className:`result-card ${y?"error-result":"success-result"}`,children:[a&&p.jsx(Hc,{value:l,editable:!0,maxWidth:"100%",height:`${I}px`,theme:bh,extensions:[Sv(),Fe.lineWrapping],onChange:N=>{try{JSON.parse(N),A(!0)}catch{A(!1)}c==null||c(N)},basicSetup:{lineNumbers:!1,foldGutter:!1}}),!a&&(B?p.jsx(JF,{displayDataTypes:!1,displayObjectSize:!1,collapsed:!0,value:B,style:{...zte,height:I,overflowY:"auto"}}):p.jsx("pre",{className:"result-raw",style:{height:I},children:O}))]}):p.jsx(_.Card,{variant:"borderless",className:"empty-result",children:p.jsx(_.Result,{icon:p.jsx("span",{className:"common-icon"}),title:S?"不可测试":"等待测试",subTitle:S?s:"点击“开始测试”按钮运行当前节点"})})]})]})]})},jte=new Set([He.AI_LANGUAGE_MODEL,He.AI_MEMORY,He.BUILTIN_MCP,He.MCP_SERVER]),Ute=new Set([]),Rte=({canEdit:t,nodeType:e,protocol:n})=>t?n&&jte.has(n)?{disabled:!0,reason:"当前协议节点由所属 AI 或 MCP 运行上下文统一测试"}:e&&Ute.has(e)?{disabled:!0,reason:"当前节点类型不支持独立手动测试"}:{disabled:!1}:{disabled:!0,reason:"只读或预览模式下不能执行节点测试"},qte=t=>typeof t=="string"?t.trim().length>0:t!=null,Gte=t=>typeof t=="string"&&t.trim().toLowerCase()==="success",Kte=t=>{if(!t||typeof t!="object")return!1;const e=t;return e.result===!0?!1:e.result===!1?!0:e.error==="0"&&qte(e.error_description)&&!Gte(e.error_description)},Yte=t=>Kte(t)?ge.FAILED:ge.SUCCESS,Xte=t=>{if(typeof t=="object")return JSON.stringify(t,null,2);if(typeof t=="string")try{const e=JSON.parse(t);return JSON.stringify(e,null,2)}catch{return t}return String(t)};JSON.stringify({result:"示例数据",data:{id:"123",name:"示例"}},null,2);const Jte=C.forwardRef((t,e)=>{var T,A,O,B;const{nodeId:n,beforeHook:r,onClose:o,onExpandPanel:i}=t,s=jt(),{handleNodeDataUpdate:a}=Gs(),l=(A=(T=s.nodeConfigPanel)==null?void 0:T.testArea)==null?void 0:A.defaultTestResult,[c,u]=C.useState(()=>{if(l==null)return"";if(typeof l=="string")return l;try{return JSON.stringify(l,null,2)}catch{return String(l)}}),d=ne.useInternalNode(n),h=It.useReactive({testProgress:0,sampleText:"",isError:!1,showErrorAlert:!1,testing:!1,successShown:!1,sampleMode:!1,sampleSaving:!1,sampleError:"",isIgnoreSuccess:!1,ignoring:!1,editable:!1}),{refreshFlow:f}=Qo();(O=d==null?void 0:d.data)==null||O.outputSource,C.useEffect(()=>{if(d!=null&&d.data.output&&(d.data.status===ge.SUCCESS||d.data.status===ge.RUNNABLE)){const M=typeof d.data.output=="string"?d.data.output:JSON.stringify(d.data.output,null,2);u(M),h.successShown=!0,h.isError=!1,h.showErrorAlert=!1}else if(d!=null&&d.data.output&&d.data.status===ge.FAILED){const M=typeof d.data.output=="string"?d.data.output:JSON.stringify(d.data.output,null,2);u(M),h.isError=!0,h.showErrorAlert=!0,h.successShown=!1}},[d,h]);const m=C.useCallback(()=>{if(!n){console.error("节点ID不能为空");return}h.testing=!0,h.testProgress=60,h.successShown=!1,h.isError=!1,h.showErrorAlert=!1,h.sampleMode=!1,mk(n).then(M=>{const I=M,N=Yte(I),P=N===ge.FAILED;h.isError=P,h.successShown=!P,h.showErrorAlert=h.isError;let F="";try{F=Xte(I)}catch(H){console.error("格式化测试结果出错:",H),F=`测试结果格式化失败: ${String(H)}`}h.testProgress=100,u(F),a({id:n,data:{status:N,output:F,outputSource:"test"}})}).catch(M=>{var P;console.error("测试失败:",M),h.testProgress=0,h.isError=!0,h.showErrorAlert=!0,h.successShown=!1;let I="测试执行失败";(P=M==null?void 0:M.response)!=null&&P.data?I=JSON.stringify(M.response.data,null,2):M!=null&&M.message&&(I=M.message);const N=JSON.stringify({error:I},null,2);u(N),a({id:n,data:{status:ge.FAILED,output:N,outputSource:"test"}})}).finally(()=>{setTimeout(()=>{h.testProgress=0,h.testing=!1},500)})},[a,n,h]),g=()=>{h.testProgress=0,h.testing=!1,h.sampleSaving=!1,h.sampleMode=!1,h.successShown=!0,h.isError=!1,h.showErrorAlert=!1},v=()=>{r&&(h.testing=!0,h.ignoring=!0,h.testProgress=60,r(!0,!0,h.sampleText))},w=()=>{h.sampleSaving=!1,h.ignoring=!1,h.successShown=!0,h.isError=!1,h.showErrorAlert=!1,h.isIgnoreSuccess=!0},b=()=>{h.testProgress=0,h.testing=!1,h.ignoring=!1,h.isIgnoreSuccess=!0};C.useImperativeHandle(e,()=>({onTestNode:m,finishSampleTest:g,abortSampleTest:w,finishNodeTest:b}));const y=()=>{h.sampleMode=!1,r?r(!0):m()},k=()=>{u(""),h.sampleText="",h.sampleMode=!1,h.sampleError="",h.successShown=!1},D=zt(),S=C.useMemo(()=>{var M;return Rte({canEdit:D,nodeType:d==null?void 0:d.type,protocol:(M=d==null?void 0:d.data)==null?void 0:M.protocol})},[D,(B=d==null?void 0:d.data)==null?void 0:B.protocol,d==null?void 0:d.type]),x=S.disabled?"disabled":h.testing?"running":h.isError?"failure":h.successShown?h.isIgnoreSuccess?"ignored":"success":"waiting",E=()=>{if(h.editable){h.editable=!1;try{const M=JSON.parse(h.sampleText),I=JSON.stringify(M,null,2);u(I),a({id:n,data:{output:I}})}catch{u(h.sampleText)}return}h.sampleText=c,h.editable=!0};return p.jsx(QF,{status:x,result:c,progress:h.testProgress||60,runningAction:h.ignoring?"ignore":"run",showAlert:h.isError?h.showErrorAlert:h.successShown,canEdit:D,disabledReason:S.reason,editing:h.editable,editableValue:h.sampleText,onEditableValueChange:M=>{h.sampleText=M},onRun:y,onIgnore:v,onReset:k,onToggleEdit:E,onDismissAlert:()=>{h.showErrorAlert=!1,h.successShown=!1},onClose:o,onExpandPanel:i})});var Ar=(t=>(t.Array="ARRAY",t.Boolean="BOOLEAN",t.Null="NULL",t.Number="NUMBER",t.Object="OBJECT",t.String="STRING",t))(Ar||{});const Iv={ARRAY:"purple",BOOLEAN:"green",NULL:"default",NUMBER:"blue",OBJECT:"cyan",STRING:"orange"},Qte={ARRAY:"Arr",BOOLEAN:"Bool",NULL:"Null",NUMBER:"Num",OBJECT:"Obj",STRING:"Str"},Pv=(t,e=!1)=>{const n=String(t||"STRING").toUpperCase(),r=Qte[n]||n.slice(0,4);return e?`${r}[]`:r},ZF=t=>{t!=null&&t.length&&t.forEach(e=>{e.label||(e.label=e.name),Array.isArray(e.sub_params)?ZF(e.sub_params):e.sub_params=[]})},Zte=t=>{const e=t==null?void 0:t.map(r=>(r.output.label=`${r.seq}-${r.connector_name} : ${r.action_name}`,r.note&&(r.output.label+=`(${r.note})`),{...r,label:`${r.connector_name}-${r.action_name}`,sub_params:[r.output]})),n=Kt.cloneDeep(e);return ZF(n),n};var e2=(t=>(t.TEXT="TEXT",t.NUMBER="NUMBER",t.JSON="JSON",t))(e2||{});const ene=t=>({TEXT:"STRING",NUMBER:"NUMBER",JSON:"OBJECT"})[t]||"STRING",tne=t=>{const{nodeId:e,flowId:n,enabled:r=!0,includeGlobalVariables:o=!0}=t,i=ne.useStoreApi(),[s,a]=C.useState([]),[l,c]=C.useState([]),[u,d]=C.useState(!1),[h,f]=C.useState(null),[m,g]=C.useState(0),[v,w]=C.useState(!1),[b,y]=C.useState(null),[k,D]=C.useState(0),S=C.useCallback(()=>{g(O=>O+1)},[]),x=C.useCallback(()=>{D(O=>O+1)},[]),E=C.useCallback(()=>{g(O=>O+1),D(O=>O+1)},[]);return C.useEffect(()=>{if(!r||!o){o||a([]),d(!1),f(null);return}let O=!1;return(async()=>{d(!0),f(null);try{const M=await Cm();if(O)return;const I=((M==null?void 0:M.items)||[]).map(N=>({...N,mappedType:ene(N.var_type)}));a(N=>Kt.isEqual(N,I)?N:I)}catch(M){console.error("Failed to fetch global variables:",M),O||f(M instanceof Error?M:new Error("无法获取全局变量数据"))}finally{O||d(!1)}})(),()=>{O=!0}},[r,o,m]),C.useEffect(()=>{if(!r||!n){w(!1),y(null);return}let O=!1;return(async()=>{w(!0),y(null);try{const{edges:M,nodes:I}=i.getState(),N=await bk(n,{nodeId:e,edges:M});if(O)return;const P=new Map(I.map(V=>[V.id,V])),H=(Zte(N)||[]).map(V=>{var $,U;const q=($=V.node_id)!=null&&$.startsWith("N")?V.node_id.slice(1):V.node_id,Q=q?P.get(q):void 0,te=typeof((U=Q==null?void 0:Q.data)==null?void 0:U.icon)=="string"?Q.data.icon:void 0;return{...V,nodeIcon:te,isValid:!!Q}});c(V=>Kt.isEqual(V,H)?V:H)}catch(M){console.error("Failed to fetch node variables:",M),O||y(M instanceof Error?M:new Error("无法获取节点变量数据"))}finally{O||w(!1)}})(),()=>{O=!0}},[n,e,r,k,i]),{globalVariables:s,nodeVariables:l,isLoading:u||v,isGlobalLoading:u,isNodeLoading:v,error:h||b,globalError:h,nodeError:b,refresh:E,refreshGlobal:S,refreshNode:x}},lt={container:"_container_xdcms_5",header:"_header_xdcms_29",headerIcon:"_headerIcon_xdcms_37",headerTitle:"_headerTitle_xdcms_41",body:"_body_xdcms_46",section:"_section_xdcms_61",sectionLabel:"_sectionLabel_xdcms_65",sectionIcon:"_sectionIcon_xdcms_79",typeTag:"_typeTag_xdcms_88",varItem:"_varItem_xdcms_97",varName:"_varName_xdcms_115",varValue:"_varValue_xdcms_121",nodeTitle:"_nodeTitle_xdcms_129",nodeIcon:"_nodeIcon_xdcms_134",nodeLabelFirst:"_nodeLabelFirst_xdcms_139",nodeLabel:"_nodeLabel_xdcms_139",leafTitle:"_leafTitle_xdcms_151",leafLabel:"_leafLabel_xdcms_156",leafValue:"_leafValue_xdcms_162",empty:"_empty_xdcms_172",loadingState:"_loadingState_xdcms_175",errorState:"_errorState_xdcms_184",invalidVariable:"_invalidVariable_xdcms_188",nodeIconWrapper:"_nodeIconWrapper_xdcms_197",defaultNodeIcon:"_defaultNodeIcon_xdcms_210"},Lv={VariableModalTitle:p.jsx(Oe.FormattedMessage,{id:"app.common.word.select-variable"}),NoTestDataDesc:p.jsx(Oe.FormattedMessage,{id:"common.no-process-variables-yet"})},nne=t=>{if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},rne=(t,e)=>{const n=t.trim(),r=n.startsWith("N")?n:`N${n}`,o=e.slice(1).join(".");return o?`{{${r}.${o}}}`:`{{${r}}}`},t2=C.forwardRef((t,e)=>{const n=iu(),{nodeId:r,showGlobalVariables:o=!0}=t,{event$:i}=C.useContext(jo),{globalVariables:s,nodeVariables:a,isGlobalLoading:l,isNodeLoading:c,globalError:u,nodeError:d,refreshGlobal:h,refreshNode:f}=tne({nodeId:r,flowId:n,enabled:t.open,includeGlobalVariables:o}),m=It.useReactive({currentInputId:"",visible:!0});i.useSubscription(w=>{switch(w.type){case"visible":m.visible||(h(),f()),m.visible=w.visible;break;case"setCurrentInputId":m.currentInputId=w.currentInputId;break}}),C.useImperativeHandle(e,()=>({loadVariables:()=>{h(),f()}}));const g=w=>{try{const b=typeof w=="string"?JSON.parse(w):w,y=(D,S)=>{if(D==null)return{name:S,type:Ar.Null,label:S,multi_valued:!1,sub_params:[],value:String(D)};if(typeof D=="object"&&!Array.isArray(D)){const E=D;return{name:S,type:Ar.Object,label:S,multi_valued:!1,sub_params:Object.keys(E).map(T=>y(E[T],T)),value:null}}if(Array.isArray(D)){const E=D[0],T=E&&typeof E=="object"?Ar.Object:typeof E=="number"?Ar.Number:typeof E=="boolean"?Ar.Boolean:E==null?Ar.Array:Ar.String;return{name:S,type:T,label:S,multi_valued:!0,sub_params:[],value:JSON.stringify(D)}}const x=typeof D=="number"?Ar.Number:typeof D=="boolean"?Ar.Boolean:Ar.String;return{name:S,type:x,label:S,multi_valued:!1,sub_params:[],value:String(D)}},k=b&&typeof b=="object"&&!Array.isArray(b)?b:{};return Object.keys(k).map(D=>y(k[D],D))}catch{return[]}},v=(w,b,y,k,D,S=[],x="0")=>(w??[]).map((E,T)=>{var M;const A=[...S,E.name],O=`${x}-${T}`;return(M=E.sub_params)!=null&&M.length?{key:O,variablePath:A,title:p.jsxs("span",{className:`${lt.nodeTitle}${k===!1?` ${lt.invalidVariable}`:""}`,children:[b?D==="api"?p.jsx(ie.ApiOutlined,{className:lt.nodeIcon}):p.jsx("span",{className:lt.nodeIconWrapper,children:y?p.jsx("img",{src:y,alt:""}):p.jsx("span",{className:lt.defaultNodeIcon,children:"N"})}):p.jsx(_.Tag,{color:Iv[E.type]||"gray",className:`${lt.typeTag} workflow-variable-panel__type`,children:Pv(E.type,E.multi_valued)}),p.jsx("span",{className:`${b?lt.nodeLabelFirst:lt.nodeLabel} workflow-variable-panel__label`,children:E.label})]}),children:v(E.sub_params,!1,y,k,D,A,O)}:{key:O,variablePath:A,title:p.jsxs("span",{className:`${lt.leafTitle}${k===!1?` ${lt.invalidVariable}`:""}`,title:`${E.label}:${E.value}`,children:[p.jsx(_.Tag,{color:Iv[E.type]||"gray",className:`${lt.typeTag} workflow-variable-panel__type`,children:Pv(E.type,E.multi_valued)}),p.jsx("span",{className:`${lt.leafLabel} workflow-variable-panel__label`,children:E.label}),E.value?p.jsx("span",{className:lt.leafValue,children:E.value}):null]})}});return p.jsxs("div",{className:`${lt.container} workflow-variable-panel`,children:[p.jsxs("div",{className:`${lt.header} workflow-variable-panel__header`,children:[p.jsx(rQ,{size:16,className:`${lt.headerIcon} workflow-variable-panel__header-icon`}),p.jsx("span",{className:`${lt.headerTitle} workflow-variable-panel__title`,children:Lv.VariableModalTitle})]}),p.jsxs("div",{className:`${lt.body} workflow-variable-panel__body`,children:[o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:`${lt.sectionLabel} workflow-variable-panel__section-label`,children:[p.jsx(ie.GlobalOutlined,{className:lt.sectionIcon,size:32}),p.jsx("span",{children:"全局变量"})]}),p.jsx("div",{className:`variable-panel-group ${!l&&!u&&s.length<1?"empty":""}`,children:p.jsxs("div",{className:lt.section,children:[s.map(w=>{if(w.var_type===e2.JSON){const k=g(w.var_value??{}),D=[{name:w.name,type:Ar.Object,label:w.display_name||w.name,multi_valued:!1,sub_params:k,value:null}],S=v(D,!0,void 0,!0,"api");return p.jsx(_.Tree,{defaultExpandAll:!0,showLine:!0,onSelect:(x,E)=>{const T=E.node.variablePath;i.emit({type:"insert",currentInputId:m.currentInputId,expression:`{{global.${T.join(".")}}}`})},switcherIcon:p.jsx(ie.CaretDownOutlined,{}),treeData:S},w.id)}const b=nne(w.var_value),y=b.length>28?`${b.substring(0,28)}...`:b;return p.jsxs("button",{type:"button",className:`${lt.varItem} workflow-variable-panel__item`,onClick:()=>{i.emit({type:"insert",currentInputId:m.currentInputId,expression:`{{global.${w.name}}}`})},children:[p.jsx(_.Tag,{color:Iv[w.mappedType],className:`${lt.typeTag} workflow-variable-panel__type`,children:Pv(w.mappedType)}),p.jsx("span",{className:`${lt.varName} workflow-variable-panel__label`,children:w.display_name||w.name}),y?p.jsx("span",{className:lt.varValue,children:y}):null]},w.id)}),!l&&!u&&s.length<1&&p.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:Lv.NoTestDataDesc,className:lt.empty}),l?p.jsxs("div",{className:lt.loadingState,children:[p.jsx(_.Spin,{size:"small"}),p.jsx("span",{children:"正在加载全局变量"})]}):u?p.jsx(_.Alert,{className:lt.errorState,type:"error",showIcon:!0,message:"全局变量加载失败",description:u.message,action:p.jsx(_.Button,{size:"small",onClick:h,children:"重试"})}):null]})})]}):null,p.jsxs("div",{className:`${lt.sectionLabel} workflow-variable-panel__section-label`,children:[p.jsx(ie.ApiOutlined,{className:lt.sectionIcon}),p.jsx("span",{children:"节点变量"})]}),p.jsx("div",{className:`variable-panel-group ${!c&&!d&&a.length<1?"empty":""}`,children:p.jsxs("div",{className:lt.section,children:[a.map(w=>p.jsx("div",{children:p.jsx(_.Tree,{defaultExpandAll:!0,showLine:!0,onSelect:(b,y)=>{const k=y.node.variablePath;if(k.length<=1)return!1;i.emit({type:"insert",currentInputId:m.currentInputId,expression:rne(w.node_id,k)})},switcherIcon:p.jsx(ie.CaretDownOutlined,{}),treeData:v(w.sub_params,!0,w.nodeIcon,w.isValid,"node")})},`${w.node_id}-${w.seq}`)),!c&&!d&&a.length<1&&p.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:Lv.NoTestDataDesc,className:lt.empty}),c?p.jsxs("div",{className:lt.loadingState,children:[p.jsx(_.Spin,{size:"small"}),p.jsx("span",{children:"正在加载节点变量"})]}):d?p.jsx(_.Alert,{className:lt.errorState,type:"error",showIcon:!0,message:"节点变量加载失败",description:d.message,action:p.jsx(_.Button,{size:"small",onClick:f,children:"重试"})}):null]})})]})]})}),{Option:Ni}=_.Select,one=C.forwardRef(({onSubmit:t,config_schema:e,nodeId:n},r)=>{const[o]=_.Form.useForm(),i=su(),s=_.Form.useWatch("type",o);It.useMount(()=>{e&&Object.hasOwn(e,"asc")&&o.setFieldsValue(e)});const[a,l]=C.useState(!1),c=(d,h,f="")=>(l(!0),o.validateFields().then(async m=>s&&s==="NUMBER"&&m.start>m.end?_.message.warning(Y("link.flow.loop_start_end_check")):t({properties:m},d)).catch(()=>(_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>l(!1)));C.useImperativeHandle(r,()=>({saveConfig:d=>c(d)}));const u=zt();return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:i,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsxs(_.Form,{disabled:!u,form:o,layout:"vertical",children:[p.jsxs(_.Row,{children:[p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{name:"type",label:Y("app.common.word.loop-data-type"),rules:[{required:!0,message:Y("link.flow.please_select_data_type")}],children:p.jsxs(_.Select,{children:[p.jsx(Ni,{value:"ARRAY",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.array"})}),p.jsx(Ni,{value:"NUMBER",children:p.jsx(Oe.FormattedMessage,{id:"common.number"})}),p.jsx(Ni,{value:"CONDITION",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.condition_expression"})})]})})}),s&&s==="NUMBER"&&p.jsx(_.Col,{sm:24,lg:12,children:p.jsxs(_.Form.Item,{required:!0,label:Y("link.flow.loop_start_end"),style:{display:"flex"},children:[p.jsx(_.Form.Item,{name:"start",noStyle:!0,rules:[{required:!0,message:Y("link.flow.please_select_data_type")}],children:p.jsx(_.InputNumber,{min:1,style:{marginRight:20}})}),p.jsx(_.Form.Item,{name:"end",noStyle:!0,rules:[{required:!0,message:Y("link.flow.please_select_data_type")}],children:p.jsx(_.InputNumber,{min:1})})]})}),s&&s!=="NUMBER"&&p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{rules:[{required:!0,message:Y("link.flow.please_enter_loop_expression")}],label:Y("link.flow.loop_expression"),name:"expression",children:p.jsx(rr,{nodeId:n,borrow:!0,valueType:"JS_EXP",placeholder:Y("link.flow.please_enter_loop_expression")})})}),!s&&p.jsx(_.Col,{})]}),p.jsxs(_.Row,{children:[p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{name:"asc",label:Y("app.common.word.circulation-direction"),rules:[{required:!0,message:Y("link.flow.please_select_loop_direction")}],children:p.jsxs(_.Select,{children:[p.jsx(Ni,{value:!0,children:p.jsx(Oe.FormattedMessage,{id:"link.flow.loop_head_to_tail"})}),p.jsx(Ni,{value:!1,children:p.jsx(Oe.FormattedMessage,{id:"link.flow.loop_tail_to_head"})})]})})}),p.jsx(_.Col,{sm:24,lg:12,children:p.jsx(_.Form.Item,{name:"errorExec",label:Y("link.flow.loop_processing"),rules:[{required:!0,message:Y("link.flow.please_select_loop_processing")}],children:p.jsxs(_.Select,{children:[p.jsx(Ni,{value:"END",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.terminate_process"})}),p.jsx(Ni,{value:"CONTINUE",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.continue_loop"})}),p.jsx(Ni,{value:"BREAK",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.break_loop"})})]})})})]})]})}),p.jsx("div",{className:"workflow-node-form-footer",children:u&&p.jsx(_.Button,{type:"primary",disabled:!u,loading:a,className:"workflow-node-form-save",onClick:()=>c(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}),fp=()=>`branch_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,{Option:ine}=_.Select,sne=C.forwardRef((t,e)=>{const{config_schema:n,nodeId:r}=t,[o]=_.Form.useForm(),i=su(),{handleNodeDataUpdate:s}=Gs(),[a,l]=C.useState(null),[c,u]=C.useState(""),h=(x=>!(x!=null&&x.branches)||x.branches.length===0?{branches:[{id:fp(),name:Y("link.flow.switch.condition_one"),or_list:[{and_list:[{query:"",operator:"",value:""}]}]},{id:fp(),name:Y("link.flow.switch.condition_two"),or_list:[{and_list:[{query:"",operator:"",value:""}]}]}]}:{branches:x.branches.map((T,A)=>{var O;return{id:T.id||fp(),name:T.name||Y("link.flow.switch.condition_n",{n:A+1}),or_list:((O=T.or_list)==null?void 0:O.map(B=>{var M;return{and_list:((M=B.and_list)==null?void 0:M.map(I=>({query:I.query||"",operator:I.operator||"",value:I.value||""})))||[{query:"",operator:"",value:""}]}}))||[{and_list:[{query:"",operator:"",value:""}]}]}})})(n),f=()=>{const x=o.getFieldValue("branches")||[];s({id:r,data:{config_schema:{branches:x}}})},m=(x,E)=>{l(x),u(E)},g=()=>{l(null),u("")},v=x=>{const E=Kt.cloneDeep(o.getFieldValue("branches"))||[],T=c.trim();if(!T){_.message.error(Y("link.flow.switch.branch_name_cannot_be_empty"));return}if(E.some((O,B)=>B!==x&&O.name===T)){_.message.error(Y("link.flow.switch.branch_name_duplicate"));return}E[x].name=T,o.setFieldValue("branches",E),l(null),u(""),f()},w=(x,E)=>{const T=o.getFieldValue("branches")||[];if(E<0||E>=T.length)return;const A=[...T],[O]=A.splice(x,1);A.splice(E,0,O),o.setFieldValue("branches",A),f()},[b,y]=C.useState(!1),k=x=>(y(!0),o.validateFields().then(async E=>{if(!E.branches.some(O=>O.or_list.some(B=>B.and_list.some(M=>M.query&&M.operator)))){_.message.error(Y("link.flow.switch.at_least_one_valid_branch"));return}const A=Kt.cloneDeep(E);return A.branches.forEach(O=>{O.or_list.forEach(B=>{B.and_list.forEach(M=>{M.value=bte(M.operator,M.value)})})}),t.onSubmit({properties:A},x)}).catch(()=>(_.message.warning(Y("link.flow.missing_configuration")),!1)).finally(()=>y(!1)));C.useImperativeHandle(e,()=>({saveConfig:x=>k(x)}));const D=zt(),S=(x,E,T,A)=>{const B=(o.getFieldValue("branches")||[])[E],M=a===E;return p.jsxs(_.Card,{style:{marginBottom:20,borderRadius:8,border:"1px solid #d9d9d9"},styles:{body:{padding:10}},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:12},children:[p.jsx("div",{style:{display:"flex",alignItems:"center",flex:1},children:M?p.jsxs(_.Space,{children:[p.jsx(_.Input,{value:c,onChange:I=>u(I.target.value),style:{width:200},placeholder:Y("link.flow.switch.enter_branch_name"),onPressEnter:()=>v(E)}),p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.CheckOutlined,{style:{color:"#52c41a"}}),onClick:()=>v(E)}),p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.CloseOutlined,{}),onClick:g})]}):p.jsxs(_.Space,{children:[p.jsx("span",{style:{fontSize:13,fontWeight:400},children:(B==null?void 0:B.name)||Y("link.flow.switch.condition_n",{n:E+1})}),D&&p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.EditOutlined,{}),onClick:()=>m(E,(B==null?void 0:B.name)||"")})]})}),D&&p.jsxs(_.Space,{className:"actions",children:[p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_to_top"),children:p.jsx(_.Button,{type:"text",size:"small",disabled:E===0,onClick:()=>w(E,0),children:"置顶"})}),p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_up"),children:p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.ArrowUpOutlined,{}),disabled:E===0,onClick:()=>w(E,E-1)})}),p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_down"),children:p.jsx(_.Button,{type:"text",size:"small",icon:p.jsx(ie.ArrowDownOutlined,{}),disabled:E===T-1,onClick:()=>w(E,E+1)})}),p.jsx(_.Tooltip,{title:Y("link.flow.switch.move_to_bottom"),children:p.jsx(_.Button,{type:"text",size:"small",disabled:E===T-1,onClick:()=>w(E,T-1),children:"置底"})}),p.jsx(_.Tooltip,{title:Y("common.delete"),children:p.jsx(_.Button,{type:"text",size:"small",disabled:T<=1,onClick:()=>{if(T<=1){_.message.warning(Y("link.flow.switch.at_least_one_branch"));return}A(x.name),setTimeout(()=>{f()},0)},children:"删除"})})]})]}),p.jsx(_.Form.Item,{name:[x.name,"name"],hidden:!0,children:p.jsx(_.Input,{})}),p.jsx(_.Form.List,{name:[x.name,"or_list"],children:(I,{add:N,remove:P})=>p.jsx(p.Fragment,{children:I.map((F,H)=>{const V=H===I.length-1;return p.jsx(p.Fragment,{children:p.jsxs("div",{className:"switch-rule",children:[I.length>1&&D&&p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsxs(_.Button,{type:"link",icon:p.jsx(ie.MinusCircleOutlined,{}),onClick:()=>P(F.name),children:[p.jsx(Oe.FormattedMessage,{id:"link.flow.remove"})," OR"]})}),p.jsx(_.Form.List,{name:[F.name,"and_list"],children:(q,{add:Q,remove:te})=>p.jsx(p.Fragment,{children:q.map(($,U)=>{const R=U===q.length-1;return p.jsxs(_.Space,{direction:"vertical",style:{width:"100%"},children:[p.jsxs(_.Space,{align:"center",className:"switch-rule-item",children:[p.jsx(_.Form.Item,{style:{minWidth:150,marginBottom:0},name:[$.name,"query"],label:Y("app.common.word.variable-name"),rules:[{required:!0,message:Y("link.flow.please_enter_variable_name")}],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.variable_name"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})}),p.jsx(_.Form.Item,{style:{marginBottom:0},name:[$.name,"operator"],label:Y("app.common.word.condition"),rules:[{required:!0,message:Y("link.flow.please_select_condition")}],children:p.jsx(_.Select,{style:{minWidth:140},placeholder:Y("link.flow.select_condition"),getPopupContainer:()=>document.body,children:UF.map(ee=>p.jsx(ine,{value:ee.operator,children:ee.label},ee.operator))})}),p.jsx(_.Form.Item,{noStyle:!0,shouldUpdate:!0,children:()=>{const ee=o.getFieldValue(["branches",x.name,"or_list",F.name,"and_list",$.name,"operator"]);return Ov(ee)?null:p.jsx(_.Form.Item,{style:{minWidth:150,marginBottom:0},name:[$.name,"value"],label:Y("app.common.word.value"),rules:[],children:p.jsx(rr,{nodeId:t.nodeId,placeholder:Y("link.flow.value"),borrow:!0,disableIDE:!0,valueType:"JS_EXP"})})}}),U===0&&p.jsx("div",{style:{width:30}}),U>0&&D&&p.jsx(_.Button,{type:"link",icon:p.jsx(ie.MinusCircleOutlined,{}),onClick:()=>te($.name)})]}),U<q.length-1&&p.jsx(_.Divider,{plain:!0,style:{margin:"8px 0"},children:p.jsx(_.Tag,{color:"#999999",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.and"})})}),p.jsxs("div",{className:`rule-opt-actions ${R?"last-and-rule":""}`,children:[U===q.length-1&&p.jsx(_.Button,{type:"link",disabled:!D,icon:p.jsx(Kr,{size:14}),onClick:()=>Q({query:"",operator:"",value:""}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-new-and"})}),V&&p.jsx(_.Button,{type:"link",icon:p.jsx(Kr,{size:14}),disabled:!D,onClick:()=>N({and_list:[{query:"",operator:"",value:""}]}),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.add-or"})})]})]},$.key)})})}),!V&&p.jsx("div",{style:{textAlign:"center"},children:p.jsx(_.Divider,{style:{color:"orange"},dashed:!0,children:p.jsx(_.Tag,{color:"#1890ff",children:p.jsx(Oe.FormattedMessage,{id:"link.flow.or"})})})})]},F.key)})})})})]},x.key)};return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:i,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsx(_.Form,{disabled:!D,form:o,initialValues:h,layout:"vertical",autoComplete:"off",children:p.jsx(_.Form.List,{name:"branches",children:(x,{add:E,remove:T})=>p.jsxs(p.Fragment,{children:[x.map((A,O)=>S(A,O,x.length,T)),x.length<10&&p.jsx("div",{style:{display:"flex",justifyContent:"flex-end",width:"100%"},children:p.jsx(_.Button,{type:"default",icon:p.jsx(Kr,{size:14}),disabled:!D,onClick:()=>{const A=x.length+1;E({id:fp(),name:Y("link.flow.switch.condition_n",{n:A}),or_list:[{and_list:[{query:"",operator:"",value:""}]}]}),setTimeout(()=>{f()},0)},children:p.jsx(Oe.FormattedMessage,{id:"link.flow.switch.add_branch"})})}),x.length>=10&&p.jsx("div",{style:{textAlign:"center",color:"#999",marginBottom:20},children:p.jsx(Oe.FormattedMessage,{id:"link.flow.switch.max_branches_reached"})})]})})})}),p.jsx("div",{className:"workflow-node-form-footer",children:D&&p.jsx(_.Button,{type:"primary",disabled:!D,loading:b,className:"workflow-node-form-save",onClick:()=>k(),children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})}),ane=({nodeId:t,onSubmit:e,data:n})=>{const[r]=_.Form.useForm(),o=su(),i=zt(),{refreshFlow:s}=Qo(),{setNodes:a}=ne.useReactFlow(),l=C.useCallback((u,d)=>{a(h=>h.map(f=>!d&&f.id!==t?f:{...f,data:{...f.data,error_handler:u}}))},[t,a]);C.useEffect(()=>{const u=(n==null?void 0:n.error_handler)||{};r.setFieldsValue({retryEnabled:u.retry||!1,retryCount:u.retry_times||3,retryInterval:u.retry_interval||5,stepFactor:u.step_factor||1.5,maxRetryInterval:u.max_retry_interval||60,alertEnabled:u.warn_type===1,webhookUrl:u.notify_url||"",errorHandling:u.process_type===2?"ignore":"interrupt",applyToAllNodes:!!u.apply_all})},[t,r,n==null?void 0:n.error_handler]);const c=async u=>{try{const d={retry:u.retryEnabled,retry_times:u.retryEnabled?u.retryCount:void 0,retry_interval:u.retryEnabled?u.retryInterval:void 0,step_factor:u.retryEnabled?u.stepFactor:void 0,max_retry_interval:u.retryEnabled?u.maxRetryInterval:void 0,warn_type:u.alertEnabled?1:0,notify_url:u.alertEnabled?u.webhookUrl:void 0,process_type:u.errorHandling==="interrupt"?1:2,apply_all:u.applyToAllNodes};await Wu(t,{error_handler:d}),l(d,u.applyToAllNodes),u.applyToAllNodes&&s(),e()}catch{_.message.error(Y("common.save_failed"))}};return p.jsxs("div",{className:"workflow-node-form-shell",onMouseDownCapture:o,children:[p.jsx("div",{className:"workflow-node-form-scroll grayBeautifyScrollbar",children:p.jsxs(cr.ProForm,{form:r,layout:"vertical",disabled:!i,submitter:!1,onFinish:c,children:[p.jsx(cr.ProFormSwitch,{name:"retryEnabled",label:Y("app.common.word.enable-retry")}),p.jsx(cr.ProFormDependency,{name:["retryEnabled"],children:({retryEnabled:u})=>u?p.jsxs(p.Fragment,{children:[p.jsx(cr.ProFormDigit,{name:"retryCount",label:Y("app.common.word.retry-count"),tooltip:Y("app.common.word.retry-count-tooltip"),width:"xl",fieldProps:{min:1,max:10,precision:0,style:{width:"100%"}},rules:[{required:u,message:Y("app.common.word.please-enter-retry-count")}]}),p.jsx(cr.ProFormDigit,{name:"retryInterval",label:Y("app.common.word.retry-interval"),tooltip:Y("app.common.word.retry-interval-tooltip"),fieldProps:{min:1,max:60,precision:0,style:{width:"100%"},addonAfter:"s"},rules:[{required:u,message:Y("app.common.word.please-enter-retry-interval")}]}),p.jsx(cr.ProFormDigit,{name:"stepFactor",label:Y("app.common.word.step-factor"),tooltip:Y("app.common.word.step-factor-tooltip"),width:"xl",fieldProps:{min:1,max:5,precision:1,style:{width:"100%"}},rules:[{required:u,message:Y("app.common.word.please-enter-step-factor")}]}),p.jsx(cr.ProFormDigit,{name:"maxRetryInterval",label:Y("app.common.word.max-retry-interval"),tooltip:Y("app.common.word.max-retry-interval-tooltip"),width:"xl",fieldProps:{min:1,max:300,precision:0,style:{width:"100%"},addonAfter:"s"},rules:[{required:u,message:Y("app.common.word.please-enter-max-retry-interval")}]})]}):null}),p.jsx(cr.ProFormSwitch,{name:"alertEnabled",label:Y("app.common.word.enable-alert")}),p.jsx(cr.ProFormDependency,{name:["alertEnabled"],children:({alertEnabled:u})=>u?p.jsx(cr.ProFormText,{name:"webhookUrl",label:Y("app.common.word.webhook-url"),placeholder:Y("app.common.word.enter-webhook-url"),width:"xl",fieldProps:{style:{width:"100%"}},rules:[{required:u,message:Y("app.common.word.enter-webhook-url")}]}):null}),p.jsx(cr.ProFormSelect,{name:"errorHandling",label:Y("app.common.word.error-handling"),width:"xl",fieldProps:{style:{width:"100%"}},rules:[{required:!0,message:Y("app.common.word.select-error-handling")}],options:[{label:Y("app.common.word.interrupt-flow"),value:"interrupt"},{label:Y("app.common.word.ignore-error"),value:"ignore"}]}),p.jsx(cr.ProFormSwitch,{name:"applyToAllNodes",label:Y("app.common.word.apply-to-all-nodes")})]})}),p.jsx("div",{className:"workflow-node-form-footer",children:p.jsx(_.Button,{type:"primary",disabled:!i,onClick:()=>r.submit(),className:"workflow-node-form-save",children:p.jsx(Oe.FormattedMessage,{id:"app.common.word.save"})})})]})},n2="[workflow:schema-render]",lne=()=>{const{event$:t}=C.useContext(jo),e=og();return t.useSubscription(n=>{var r;n.type==="insert"&&n.expression&&(r=e==null?void 0:e.getActiveFieldId)!=null&&r.call(e)&&e.insertVariableToActiveField(n.expression,!1)}),null},cne=({children:t})=>{const{event$:e}=C.useContext(jo),n=ig(),[r,o]=C.useState("");e.useSubscription(a=>{a.type==="setCurrentInputId"&&o(a.currentInputId??"")});const i=(n==null?void 0:n.activeFieldId)??r,s=C.useMemo(()=>({activeInputId:i}),[i]);return p.jsx(YO.Provider,{value:s,children:t})},une=t=>{const{icon:e,fallbackIcon:n}=t;return p.jsxs("div",{className:"node-config-title",style:{display:"flex",alignItems:"center"},children:[p.jsx("div",{className:"node-config-icon",style:{backgroundImage:`url(${n?"none":e??"https://digitalsee-image.digitalsee.cn/flow/0.png"})`},children:n}),p.jsxs("div",{className:"node-config-meta",children:[p.jsx("div",{className:"node-config-title-name",style:{fontSize:16,fontWeight:600,marginLeft:10},children:t.name}),p.jsx("div",{className:"node-config-title-description",style:{fontSize:12,color:"gray",marginLeft:10},children:t.description})]})]})},dne=C.memo(({visible:t,onClose:e,data:n,nodeType:r=pe.ACTION,nodeId:o=""})=>{var O,B;const i=It.useEventEmitter(),{setNodeConfigVisible:s}=Qo(),a=C.useRef(null),l=C.useRef(null),c=C.useRef(null),u=C.useRef(null),d=C.useRef(null),h=C.useRef(null),f=ne.useStoreApi(),m=jt(),g=((B=(O=m.nodeConfigPanel)==null?void 0:O.testArea)==null?void 0:B.allowManualTest)!==!1,v=It.useReactive({output:"",ignore:!1,expandTestPanel:!1}),w=C.useMemo(()=>m.nodeConfigPanel.showSettings&&![pe.TRIGGER,pe.AI_SUB_NODE].includes(r),[r,m.nodeConfigPanel.showSettings]),b=(n==null?void 0:n.action_id)??(n==null?void 0:n.id),y=b!==null&&typeof b<"u"&&b!==""&&Number.isFinite(Number(b))?b:null,k=ii(n),D=n==null?void 0:n.nodeKey,S=(n==null?void 0:n.nodeVersion)??(n==null?void 0:n.action_ver),{handleNodeDataUpdate:x}=Gs();C.useEffect(()=>{var I,N;if(!t)return;const M=y!==null&&Number(y)<=0;D&&M&&!k&&!((I=n==null?void 0:n.config_schema)!=null&&I.sub_params)&&!((N=n==null?void 0:n.properties)!=null&&N.sub_params)&&console.warn(`${n2} possible nodepackage schema route mismatch`,{nodeId:o,nodeType:r,actionId:y,nodePackageKey:D,nodePackageVersion:S,reason:"keyed node with non-positive action_id and no classic sub_params was rejected by the nodePackage-compatible node check"})},[y,n==null?void 0:n.config_schema,n==null?void 0:n.properties,n==null?void 0:n.params,n==null?void 0:n.action_key,n==null?void 0:n.action_ver,n==null?void 0:n.nodeKey,n==null?void 0:n.nodeVersion,k,D,S,o,r,t]);const E=C.useCallback(async(M,I)=>{var P,F,H;const N=m.flowId;try{const V=f.getState().nodes.find(U=>U.id===o),q=k?g8(M):M.properties,Q=k?w8(M):M.account_id??null,te=k?{flow_id:N,properties:q,position:V==null?void 0:V.position,action_id:y,account_id:Q,proxy_id:M.proxy_id,mcp_tool_description:M.mcp_tool_description,action_key:D,action_ver:S}:{flow_id:N,...M,position:V==null?void 0:V.position,action_id:y};console.info(`${n2} save node config`,{nodeId:o,nodeType:r,actionId:y,isNodepackageNode:k,nodePackageKey:D,nodePackageVersion:S,valueKeys:Object.keys(M||{}),paramsKeys:Object.keys((M==null?void 0:M.params)||{}),propertiesKeys:Object.keys((M==null?void 0:M.properties)||{}),ignoreDebugResult:v.ignore});const $=v.ignore?await wk(o,"","","",q,v.output):await Wu(o,te);if($)if(v.ignore)(P=h.current)==null||P.finishSampleTest(),x({id:o,data:{status:ge.SUCCESS,output:v.output,outputSource:"sample"}}),_.message.success("已使用样本数据完成调试");else{_.message.success("节点配置已保存");const U={params:void 0,properties:q,account_id:Q,mcp_tool_description:M.mcp_tool_description,action_key:D,action_ver:S,nodeKey:D,nodeVersion:S,isNodePackage:k};x({id:o,data:{config_schema:q,account_id:M.account_id,...U,position:V==null?void 0:V.position,status:$.status}})}return I&&!v.ignore&&((F=h.current)==null||F.onTestNode()),v.ignore=!1,v.output="",!0}catch{return v.ignore&&((H=h.current)==null||H.abortSampleTest(),x({id:o,data:{status:ge.FAILED}})),!1}},[y,m.flowId,n==null?void 0:n.action_key,n==null?void 0:n.action_ver,n==null?void 0:n.nodeKey,n==null?void 0:n.nodeVersion,x,k,D,S,o,r,v,f]);C.useCallback(M=>{!k||r!==pe.SWITCH||x({id:o,data:{config_schema:M,properties:M}})},[x,k,o,r]);const T=M=>{var I,N,P,F,H;return k?(I=l.current)==null?void 0:I.saveConfig(M):r===pe.LOOP?(N=d.current)==null?void 0:N.saveConfig(M):r===pe.CONDITION?(P=c.current)==null?void 0:P.saveConfig(M):r===pe.SWITCH?(F=u.current)==null?void 0:F.saveConfig(M):(H=l.current)==null?void 0:H.saveConfig(M)},A=async(M,I,N)=>{var P;if(I){v.ignore=!0,v.output=N||"",await T(M),(P=h.current)==null||P.finishNodeTest();return}if(M)try{_.message.loading("正在保存节点配置...",0),await T(M),_.message.success("节点配置已保存"),_.message.destroy()}catch(F){_.message.destroy(),console.error("节点配置保存失败:",F),_.message.error("节点配置保存失败,无法执行测试")}};return p.jsx(_.Modal,{open:t,footer:null,closeIcon:null,maskClosable:!0,onCancel:()=>{s(null)},centered:!0,width:"max(85vw, 850px)",className:"nodes-config-modal",styles:{mask:{backgroundColor:"rgba(0, 0, 0, 0.45)"},content:{padding:0,overflow:"hidden"}},children:p.jsx(jo.Provider,{value:{event$:i},children:p.jsxs(HS,{children:[p.jsx(lne,{}),p.jsx(cne,{children:p.jsx("div",{className:"nodes-config-container",children:p.jsx("div",{className:"nodes-config-content",children:p.jsxs("div",{className:"config-row",children:[p.jsx("div",{className:"left-section",children:p.jsx("div",{className:"variables-section",children:p.jsx(t2,{ref:a,nodeId:o,onInsert:()=>{},open:t})})}),p.jsx("div",{className:"middle-section",children:p.jsxs("div",{className:"config-container",children:[p.jsx(une,{icon:n==null?void 0:n.icon,fallbackIcon:n==null?void 0:n.fallbackIcon,name:(n==null?void 0:n.action_name)||(n==null?void 0:n.label),description:n==null?void 0:n.description}),p.jsx(_.Tabs,{style:{height:"100%"},items:[{key:"property",label:"参数配置",children:p.jsxs(p.Fragment,{children:[k||![pe.CONDITION,pe.SWITCH,pe.LOOP].includes(r)?p.jsx(wte,{ref:l,nodeId:o,nodeType:r,data:n,onSubmit:E}):null,r===pe.CONDITION&&!k?p.jsx(yte,{ref:c,nodeId:o,config_schema:n.config_schema,onSubmit:E}):null,r===pe.SWITCH&&!k?p.jsx(sne,{ref:u,nodeId:o,config_schema:n.config_schema,onSubmit:E}):null,r===pe.LOOP&&!k?p.jsx(one,{ref:d,nodeId:o,config_schema:n.config_schema,onSubmit:E}):null]})},{key:"setting",label:"设置",children:p.jsx(ane,{data:n,nodeId:o,onSubmit:()=>{_.message.success("保存成功")}})}].slice(0,w?2:1)})]})}),p.jsx("div",{className:`right-section ${v.expandTestPanel?"expand":""}`,children:g&&p.jsx("div",{className:"test-section",children:p.jsx(Jte,{ref:h,nodeId:o,beforeHook:A,onClose:e,onExpandPanel:M=>{v.expandTestPanel=M}})})})]})})})})]})})})},(t,e)=>Kt.isEqual(Kt.omit(t,["data","isHovered"]),Kt.omit(e,["data","isHovered"]))),r2=[],hne=(t,e)=>{if(r2.length===0)return[];const n=new Set(e);return t.some(o=>n.has(o.id)&&eg(o)&&r2.some(i=>{var s;return((s=o.data)==null?void 0:s.action_key)===i}))?t.filter(o=>!n.has(o.id)).map(o=>o.id):[]},fne=[pe.AGENT,pe.BROWSER],$v=()=>{const t=ne.useStoreApi(),e=C.useCallback((s,a)=>{const{nodes:l,setNodes:c}=t.getState(),u=Tl(l,d=>{const h=d.find(f=>f.id===a.id);h.data?h.data.isHovered=!0:h.data={isHovered:!0}});c(u)},[]),n=C.useCallback((s,a)=>{const{nodes:l,setNodes:c}=t.getState(),u=Tl(l,d=>{const h=d.find(f=>f.id===a.id);h.data?h.data.isHovered=!1:h.data={isHovered:!1}});c(u)},[]),r=C.useCallback(s=>{const{nodes:a,setNodes:l}=t.getState(),c=Tl(a,u=>{s.forEach(d=>{d.type==="select"&&(u.find(h=>h.id===d.id).selected=d.selected)})});l(c)},[t]),o=C.useCallback((s,a,l=new Set)=>(a.filter(u=>u.source===s?u.sourceHandle!==ze.OUTPUT&&u.sourceHandle!==ze.DONE&&u.sourceHandle!==ze.LOOP&&u.sourceHandle!==ze.TRUE&&u.sourceHandle!==ze.FALSE:u.target===s&&Lm(u.targetHandle)).forEach(u=>{const d=u.source===s?u.target:u.source;l.has(d)||(l.add(d),o(d,a,l))}),l),[]),i=C.useCallback((s,a)=>{const{nodes:l,edges:c,setNodes:u,setEdges:d,onNodesChange:h,onEdgesChange:f}=t.getState(),m=new Set(s);fne.includes(a)&&s.forEach(w=>{o(w,c).forEach(y=>{m.add(y)})}),hne(l,s).forEach(w=>m.add(w));const g=Array.from(m),v=c.filter(w=>m.has(w.source)||m.has(w.target)).map(w=>w.id);if(h){const w=g.map(b=>({type:"remove",id:b}));h(w)}else u(l.filter(w=>!g.includes(w.id)));if(v.length)if(f){const w=v.map(b=>({type:"remove",id:b}));f(w)}else d(c.filter(w=>!v.includes(w.id)))},[t,o]);return{onNodeMouseEnter:e,onNodeMouseLeave:n,handleNodesChange:r,handleNodesDelete:i}};function pne(t){const{color:e,visible:n}=t;return p.jsx("div",{style:{display:n?"inline-flex":"none",justifyContent:"center",alignItems:"center",position:"absolute",zIndex:1e3,top:"calc(50% - 8px)",left:-10,padding:1,borderRadius:"100%",background:"#FFFFFF",width:20,height:20},children:p.jsx("span",{style:{width:16,height:16,borderRadius:10,backgroundColor:e,border:`1px solid ${e}`,display:"inline-flex",justifyContent:"center",alignItems:"center"},children:p.jsx(lQ,{size:8,color:"#FFFFFF"})})})}const Mi={info:{normal:"#007FFF",lighter:"rgba(0, 127, 255, 0.48)"},success:{normal:"#98D7A9",lighter:"rgba(0, 176, 66, 0.48)"},warning:{normal:"#F7CD8F",lighter:"rgba(255, 146, 0, 0.48)"},error:{normal:"#F3B096",lighter:"rgba(255, 82, 25, 0.48)"},disabled:{normal:"#C7CCD1",lighter:"rgba(199, 204, 209, 0.48)"}},o2=({id:t,type:e=pe.ACTION,selected:n=!1,fallbackIcon:r,iconUri:o,inputs:i=[],outputs:s=[],showToolbar:a=!0,width:l,height:c,className:u="",status:d=ge.IDLE,onTestNode:h,data:f,contentRender:m,showNodeDescription:g=!0,onToggleNodeDisabled:v})=>{const{currentNodeConfigVisibleId:w,setNodeConfigVisible:b}=Qo(),{handleNodeDataUpdate:y}=Gs(),{handleNodesDelete:k}=$v(),D=jt(),S=vl(),x=$=>{y({id:t,data:{note:$}})},E=C.useCallback(()=>{b(null)},[]),T=(f==null?void 0:f.isHovered)||!1,A=C.useMemo(()=>e===pe.TRIGGER,[e]),O=()=>{b(t)},B=C.useMemo(()=>(f==null?void 0:f.closed)==="1",[f==null?void 0:f.closed,e]),M=C.useMemo(()=>typeof l=="number"&&l>0?l:"auto",[l]),I=($="node")=>{if(B)return`workflow-${$}-disabled`;switch(d){case ge.INVALID:return`workflow-${$}-warning`;case ge.FAILED:return`workflow-${$}-failed`;case ge.SUCCESS:case ge.RUNNABLE:case ge.ACTIVE:return`workflow-${$}-success`;case ge.RUNNING:return`workflow-${$}-running`;case ge.WARNING:return`workflow-${$}-warning`;case ge.DEACTIVATED:return`workflow-${$}-disabled`;case ge.IDLE:return`workflow-${$}-idle`;default:return""}},N=()=>{if(B)return Mi.disabled;switch(d){case ge.INVALID:return Mi.warning;case ge.FAILED:return Mi.error;case ge.SUCCESS:case ge.RUNNABLE:case ge.ACTIVE:return Mi.success;case ge.RUNNING:return Mi.info;case ge.WARNING:return Mi.warning;case ge.DEACTIVATED:return Mi.disabled;default:return Mi.info}},P=($="normal")=>N()[$],F=()=>{const $=i.length,U=new Map;return i.forEach(R=>{const ee=R.position,se=U.has(ee)?U.get(ee)+1:1;U.set(ee,se)}),i.map((R,ee)=>p.jsx(bS,{nodeId:t,id:R.id,position:R.position,type:R.type||Dn.TARGET,category:R.category,connectionLimit:R.maxConnections,label:R.label,nodeStatus:d,protocol:R.protocol,portSchema:R.portSchema,shape:R.shape,style:R.style,index:[ee,$,U.get(R.position)]},`${t}-${R.id}`))},H=async()=>{var R,ee;const $=((R=D.canvas.fixedNodes)==null?void 0:R.triggerIds)||[],U=((ee=D.nodeTypes.fixed)==null?void 0:ee.triggers)||[];if($.includes(t)||U.includes(e)){_.message.warning("当前触发节点已被配置为不可删除");return}await ym(t),k([t],e)},V=C.useMemo(()=>{const $=s.length,U=new Map;return s.forEach(R=>{const ee=R.position,se=U.has(ee)?U.get(ee)+1:1;U.set(ee,se)}),s.map((R,ee)=>p.jsx(bS,{nodeId:t,connectionLimit:R.maxConnections,id:R.id,style:R.style,position:R.position,protocol:R.protocol,portSchema:R.portSchema,type:R.type,label:R.label,shape:R.shape,nodeStatus:d,index:[ee,$,U.get(R.position)]},`${t}-${R.id}`))},[t,s,d]),q=()=>p.jsx($S,{status:d,disabled:B}),Q=()=>{switch(d){case ge.INVALID:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-warning-icon",children:p.jsx(ie.WarningFilled,{style:{color:P()},size:12})});case ge.FAILED:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-failed-icon",children:p.jsx(ie.CloseCircleFilled,{style:{color:P()},size:12})});case ge.SUCCESS:case ge.RUNNABLE:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-success-icon",children:p.jsx(ie.CheckCircleFilled,{style:{color:P()},size:12})});case ge.RUNNING:return p.jsx("div",{className:"workflow-node-status-icon workflow-node-running-icon",children:p.jsx(ie.LoadingOutlined,{style:{color:P()},size:12})});default:return null}},te=()=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"workflow-node-icon-wrapper",children:p.jsx("div",{className:"workflow-node-icon",style:{backgroundImage:`url(${r?"none":o??"https://digitalsee-image.digitalsee.cn/flow/0.png"})`},children:r??null})}),g&&p.jsx(Z5,{title:f==null?void 0:f.connector_name,nodeId:t,note:(f==null?void 0:f.note)||"",statusIcon:Q(),onNoteChange:x,description:f.action_name,className:"workflow-node-text"})]});return p.jsxs(C.Fragment,{children:[p.jsxs("div",{style:{width:M,height:c||"auto"},onDoubleClick:O,className:`${u}
125
125
  ${I("container")}`,children:[p.jsx(pne,{color:P("lighter"),visible:A}),p.jsxs("div",{className:`workflow-node ${n?"workflow-node-selected":""}`,style:{"--status-color":P(),"--status-color-tint":P("lighter"),...B?{opacity:.4}:{}},children:[B&&p.jsx("div",{className:"workflow-node-deactivated-line"}),p.jsx("div",{className:"workflow-node-toolbar",style:{display:a&&!Zm(S)&&T?"block":"none"},children:p.jsx(S8,{nodeId:t,type:e,isDisabled:B,handleViewConfig:O,onTest:h,onToggleDisabled:v,onDelete:H})}),m?m(f,q()):p.jsx("div",{className:"workflow-node-content",children:te()}),F(),V]})]}),t===w&&p.jsx(dne,{visible:!0,onClose:E,nodeType:e,data:f,nodeId:t})]})},Hv="main",mne=["action_key","actionKey","nodeKey","node_key"],pp=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"&&!!e.trim()):void 0,Vv=t=>({...t,displayName:t.displayName??t.display_name,type:typeof t.type=="string"&&t.type.trim()?t.type.trim():Hv,maxConnections:Object.hasOwn(t,"maxConnections")?t.maxConnections:t.max_connections,allowedSourceNodeKeys:pp(t.allowedSourceNodeKeys??t.allowed_source_node_keys),allowedTargetNodeKeys:pp(t.allowedTargetNodeKeys??t.allowed_target_node_keys),deniedSourceNodeKeys:pp(t.deniedSourceNodeKeys??t.denied_source_node_keys),deniedTargetNodeKeys:pp(t.deniedTargetNodeKeys??t.denied_target_node_keys),position:t.position}),i2=t=>{var e;for(const n of mne){const r=(e=t==null?void 0:t.data)==null?void 0:e[n];if(typeof r=="string"&&r.trim())return r.trim()}return null},sr=(t,e,n,r,o)=>({valid:t,code:e,reason:n,sourcePort:r,targetPort:o}),zv=(t,e,n)=>t?n!=null&&n.allowLegacyMainHandleAliases&&(e==="source"&&t==="output"||e==="target"&&t==="input")?Hv:t:null,s2=(t,e,n,r)=>{const o=zv(e,n,r);if(!o)return null;const i=t==null?void 0:t.find(s=>s.name===o);return i?Vv(i):null},Wv=(t,e)=>!!(e&&(t!=null&&t.includes(e))),a2=(t,e)=>!!(t!=null&&t.length&&!Wv(t,e)),l2=(t,e,n,r,o)=>t.filter(i=>r==="source"?i.source===e&&zv(i.sourceHandle,"source",o)===n:i.target===e&&zv(i.targetHandle,"target",o)===n&&i.source!==i.target).length,c2=(t,e)=>{if(t.maxConnections==null||!Number.isFinite(t.maxConnections))return!1;const n=Math.max(0,Math.trunc(t.maxConnections));return e>=n},u2=t=>t||"(未指定)",gne=({sourceNode:t,targetNode:e,sourceHandle:n,targetHandle:r,sourcePorts:o,targetPorts:i,edges:s=[],options:a})=>{if(!t)return sr(!1,"SOURCE_NODE_NOT_FOUND","源节点不存在",null,null);if(!e)return sr(!1,"TARGET_NODE_NOT_FOUND","目标节点不存在",null,null);const l=s2(o,n,"source",a);if(!l)return sr(!1,"SOURCE_PORT_NOT_FOUND",`源节点不存在输出端口 ${u2(n)}`,null,null);const c=s2(i,r,"target",a);if(!c)return sr(!1,"TARGET_PORT_NOT_FOUND",`目标节点不存在输入端口 ${u2(r)}`,l,null);if(l.type!==c.type)return sr(!1,"PORT_TYPE_MISMATCH",`端口类型不匹配:${l.type} 输出不能连接到 ${c.type} 输入`,l,c);const u=i2(t),d=i2(e);if(Wv(c.deniedSourceNodeKeys,u))return sr(!1,"SOURCE_NODE_DENIED",`目标输入端口禁止源节点 ${u}`,l,c);if(Wv(l.deniedTargetNodeKeys,d))return sr(!1,"TARGET_NODE_DENIED",`源输出端口禁止目标节点 ${d}`,l,c);if(a2(c.allowedSourceNodeKeys,u))return sr(!1,"SOURCE_NODE_NOT_ALLOWED",`源节点 ${u||"(未声明 node key)"} 不在目标输入端口白名单中`,l,c);if(a2(l.allowedTargetNodeKeys,d))return sr(!1,"TARGET_NODE_NOT_ALLOWED",`目标节点 ${d||"(未声明 node key)"} 不在源输出端口白名单中`,l,c);const h=s??[],f=l2(h,t.id,l.name,"source",a);if(c2(l,f))return sr(!1,"SOURCE_MAX_CONNECTIONS_REACHED",`源输出端口 ${l.name} 最多只能连接 ${l.maxConnections} 个节点`,l,c);const m=l2(h,e.id,c.name,"target",a);return c2(c,m)?sr(!1,"TARGET_MAX_CONNECTIONS_REACHED",`目标输入端口 ${c.name} 最多只能连接 ${c.maxConnections} 个节点`,l,c):t.id===e.id?sr(!1,"SELF_CONNECTION_NOT_ALLOWED","节点不能连接到自身",l,c):sr(!0,"VALID","",l,c)},jv=72,Uv=6,Rv=12,d2=24,wne=16,bne=320,h2="main";function vne(t){const e=Math.max(0,Math.floor(t));if(e<=Uv)return{height:jv,compact:!1};if(e<=Rv)return{height:jv+(e-Uv)*d2,compact:!1};const n=jv+(Rv-Uv)*d2;return{height:Math.min(n+(e-Rv)*wne,bne),compact:!0}}function yne(t){const e=t.inputs??[],n=t.outputs??[],{height:r,compact:o}=vne(Math.max(e.length,n.length));return{inputs:e.map((i,s)=>f2(i,s,e.length,Dn.TARGET,o)),outputs:n.map((i,s)=>f2(i,s,n.length,Dn.SOURCE,o)),height:r,compact:o}}function f2(t,e,n,r,o){const i=Vv(t),s=i.type||h2,a=i.displayName||i.name,l=Cne(i.position)??(r===Dn.TARGET?ne.Position.Left:ne.Position.Right);return{id:i.name,position:l,type:r,isMain:i.name===h2,label:a?p.jsx(Sne,{compact:o,label:a}):void 0,maxConnections:typeof i.maxConnections=="number"?i.maxConnections:void 0,connectionType:s,portSchema:i,style:kne(e,n)}}function Cne(t){if(t)switch(t){case"left":return ne.Position.Left;case"top":return ne.Position.Top;case"right":return ne.Position.Right;case"bottom":return ne.Position.Bottom;default:return}}function kne(t,e){return{top:`${(t+1)/(e+1)*100}%`}}function Sne({compact:t,label:e}){return p.jsx(_.Tooltip,{title:e,children:p.jsx("span",{"data-nodepackage-port-label":!0,title:e,style:{display:"inline-block",maxWidth:t?72:112,overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"middle",whiteSpace:"nowrap"},children:e})})}function xne({nodeType:t,data:e,legacyInputs:n,legacyOutputs:r,resolvePortSchema:o,overrideNodeKey:i,overrideNodeVersion:s}){var y,k;const a=jt(),l=i??Ene(t,e),c=s!==void 0?s:Dne(e),u=l?js(l,c):null,d=((k=(y=a.nodeSelector)==null?void 0:y.connectable)==null?void 0:k.enabled)===!0&&ii(e),h=`${l}@${c??"latest"}`,[f,m]=C.useState(null);C.useEffect(()=>{if(!d||!l)return;if(u){m({identity:h,schema:u,failed:!1});return}let D=!1;return Zu(l,c).then(S=>{D||m({identity:h,schema:S,failed:!S})}).catch(()=>{D||m({identity:h,schema:null,failed:!0})}),()=>{D=!0}},[u,h,d,l,c]);const g=(f==null?void 0:f.identity)===h?f.schema:null,v=d?u??g:null,w=C.useMemo(()=>v&&o?o(v):v,[o,v]),b=C.useMemo(()=>w?yne(w):null,[w]);return d?b?{inputs:b.inputs,outputs:b.outputs,height:b.height,status:"ready",isNodePackage:!0,schema:v}:!l||(f==null?void 0:f.identity)===h&&f.failed?{inputs:[],outputs:[],height:72,status:"error",isNodePackage:!0,schema:null}:{inputs:[],outputs:[],height:72,status:"loading",isNodePackage:!0,schema:null}:{inputs:n,outputs:r,status:"legacy",isNodePackage:!1,schema:null}}function Ene(t,e){const n=e.nodeKey??e.action_key;return typeof n=="string"?n:""}function Dne(t){const e=t.nodeVersion??t.action_ver;if(e==null||e==="")return;const n=Number(e);return Number.isFinite(n)?n:void 0}const qv="MCP_TRIGGER",p2="mcp_trigger",m2=200,Ane=10;He.MCP_SERVER;const mp="dip.core.trigger.mcp-server";function gp(t){return t===ne.Position.Left?ne.Position.Top:t===ne.Position.Right?ne.Position.Bottom:t}function g2(t){for(const e of t){const n=typeof e.type=="string"?e.type:"",r=e.data&&typeof e.data.action_key=="string"?e.data.action_key:"";if(n.startsWith(`${mp}@`)||r===mp)return!0}return!1}const _ne=["action_key","actionKey","nodeKey","node_key"],Tne=["action_ver","nodeVersion","node_version"],One=new Set(["left","top","right","bottom"]);function Nne(t){if(!t)return"";for(const e of _ne){const n=t[e];if(typeof n=="string"&&n.trim())return n.trim()}return""}function Mne(t){if(t)for(const e of Tne){const n=t[e];if(n==null||n==="")continue;const r=Number(n);if(Number.isFinite(r)&&r>=0)return r}}function Bne(t){if(t)switch(t){case"left":return ne.Position.Left;case"top":return ne.Position.Top;case"right":return ne.Position.Right;case"bottom":return ne.Position.Bottom;default:return One.has(t),void 0}}function w2(t){return!t||t.length===0?[]:t.map(e=>e.position)}function Fne(t){const e=Nne(t.data);if(!e)return Us(t.type)?js(t.type):null;const n=Mne(t.data);return js(e,n)}function Ine(t){if(!t)return{sources:[],targets:[]};const e=[];for(const r of t.outputs??[])e.push(b2(r,ne.Position.Right));const n=[];for(const r of t.inputs??[])n.push(b2(r,ne.Position.Left));return{sources:e,targets:n}}function b2(t,e){const n=Vv(t);return Bne(n.position)??e}function Pne(t){try{const e=Ws(t.type,t.data??void 0);return{sources:w2(e.outputs),targets:w2(e.inputs)}}catch{return null}}function v2(t,e){return e?{sources:t.sources.map(gp),targets:t.targets.map(gp)}:t}function qa(t,e){if(!t)return{sources:[],targets:[]};const n=t.data,r=ii(n??null)||Us(t.type),o=(e==null?void 0:e.isMcpServerCanvas)===!0;if(r){const s=Fne(t),a=Ine(s);if(a.sources.length>0||a.targets.length>0)return v2(a,o)}const i=Pne(t);return i&&(i.sources.length>0||i.targets.length>0)?v2(i,o):{sources:[],targets:[]}}function uu(t){return t===ne.Position.Top||t===ne.Position.Bottom}function Gv(t){return t===ne.Position.Left||t===ne.Position.Right}function Lne(t,e){const n=qa(t,e);return n.sources.some(uu)||n.targets.some(uu)}function $ne(t,e){const n=qa(t,e);return n.sources.some(Gv)||n.targets.some(Gv)}function Hne(t,e,n,r){if(n){const o=qa(n,r),i=y2(o.targets,t.targetHandle,n,"target",r);if(i)return uu(i)?"vertical":"horizontal"}if(e){const o=qa(e,r),i=y2(o.sources,t.sourceHandle,e,"source",r);if(i)return uu(i)?"vertical":"horizontal"}return null}function y2(t,e,n,r,o){if(!e)return t[0];const s=(r==="source"?Vne(n):zne(n)).find(a=>a.id===e);return s?o!=null&&o.isMcpServerCanvas?gp(s.position):s.position:t[0]}function Vne(t){try{return Ws(t.type,t.data??void 0).outputs}catch{return[]}}function zne(t){try{return Ws(t.type,t.data??void 0).inputs}catch{return[]}}function Wne(t,e){return qa(t,e).sources.includes(ne.Position.Top)}function C2(t){if(g2(t))return"vertical";let n=0,r=0;for(const o of t){const i=qa(o);i.sources.some(uu)&&(n+=1),i.sources.some(Gv)&&(r+=1)}return n===0&&r===0?"horizontal":n>r?"vertical":"horizontal"}const k2=30,Kv=72,S2=2;function x2(t){const e=gp(t.position);if(e===t.position)return t;const n=t.style;if(!n||typeof n!="object")return{...t,position:e};const r={...n},o=t.position===ne.Position.Left||t.position===ne.Position.Right,i=e===ne.Position.Top||e===ne.Position.Bottom;return o&&i&&r.top!==void 0&&(r.left=r.top,delete r.top),{...t,position:e,style:r}}function jne(t){if(!t||typeof t!="string"||!t.includes("@"))return{baseNodeType:t};const e=t.split("@");if(e.length===2){const[n,r]=e;return r?{baseNodeType:n,nodeKey:r}:{baseNodeType:t}}if(e.length===3){const[n,r,o]=e,i=Number(o);return Number.isFinite(i)?{baseNodeType:n,nodeKey:r,nodeVersion:i}:(console.warn("[workflow:node-types] malformed descriptor version, falling back to base type",{type:t}),{baseNodeType:t})}return console.warn("[workflow:node-types] malformed descriptor key, falling back to base type",{type:t}),{baseNodeType:t}}const E2=C.memo(t=>{const{id:e,data:n,selected:r,type:o}=t,i=n,{isMcpServerCanvas:s}=Gu(),a=C.useMemo(()=>jne(o),[o]),l=a.baseNodeType,c=Im(o),u=ne.useInternalNode(e),d=(u==null?void 0:u.data)??n,h=Ws(o,d),f=h.inputs,m=c.type===pe.SWITCH?$5(d):h.outputs,g=C.useCallback(()=>uS(d),[d]),v=xne({nodeType:l,data:d,legacyInputs:f,legacyOutputs:m,...a.nodeKey?{overrideNodeKey:a.nodeKey}:{},...a.nodeVersion!==void 0?{overrideNodeVersion:a.nodeVersion}:{},...c.useNodePackagePorts&&c.type===pe.SWITCH?{resolvePortSchema:E=>Tm(E,g())}:{}}),w=c.useNodePackagePorts?v.outputs:m,b=c.useNodePackagePorts?v.inputs:f,y=s?w.map(x2):w,k=s?b.map(x2):b,D=c.type===pe.SWITCH?Math.max(v.height??0,y.length>S2?y.length*k2:Kv):v.height,S=i.status??ge.IDLE,x=i!=null&&i.icon?void 0:c.fallbackIcon;return p.jsx(o2,{id:e,data:n,selected:r,type:l,status:S,className:c.className,iconUri:i.icon,fallbackIcon:x,inputs:k,outputs:y,height:D})});E2.displayName="DeclaredNode";function Une(t){if(t)switch(t){case"left":return ne.Position.Left;case"top":return ne.Position.Top;case"right":return ne.Position.Right;case"bottom":return ne.Position.Bottom;default:return}}function Rne(t){return t===ne.Position.Top||t===ne.Position.Bottom}function D2(t,e,n){let r;n?r=e===Dn.TARGET?ne.Position.Top:ne.Position.Bottom:r=Une(t)??(e===Dn.TARGET?ne.Position.Left:ne.Position.Right);const o=Rne(r)?ne.Position.Left:ne.Position.Top;return{position:r,styleAxis:o}}const Yv=C.memo(t=>{const{id:e,data:n,selected:r,type:o}=t,{isMcpServerCanvas:i}=Gu(),s=n,a=hS(o),l=s.node_type==="SwitchNode",c=l&&a?Tm(a,uS(s)):a,u=((c==null?void 0:c.inputs)||[]).length,d=((c==null?void 0:c.inputs)||[]).map((b,y)=>{const{display_name:k,name:D,type:S,max_connections:x}=b,{position:E,styleAxis:T}=D2(b.position,Dn.TARGET,i);return{id:D,label:k,position:E,type:Dn.TARGET,protocol:S,maxConnections:x,isMain:S==="main",style:{[T]:`${10+80/(u+1)*(y+1)}%`}}}),h=((c==null?void 0:c.outputs)||[]).length,f=((c==null?void 0:c.outputs)||[]).map((b,y)=>{const{display_name:k,name:D,type:S,max_connections:x}=b,{position:E,styleAxis:T}=D2(b.position,Dn.SOURCE,i);return{id:D,label:k,position:E,type:Dn.SOURCE,protocol:S,maxConnections:x,isMain:S==="main",style:{[T]:`${10+80/(h+1)*(y+1)}%`}}}),m=Im(o),g=s.status??ge.IDLE,v=s!=null&&s.icon?void 0:m.fallbackIcon,w=l?Math.max(Kv,f.length>S2?f.length*k2:Kv):void 0;return p.jsx(o2,{id:e,data:n,selected:r,type:pe.DYNAMIC,status:g,className:`${m.className} node-package react-flow__node-${n.saveType??""}`,iconUri:s.icon,fallbackIcon:v,inputs:d,outputs:f,height:w})});Yv.displayName="NodePackageNode";function A2(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(e);for(;o!==-1;)r++,o=n.indexOf(e,o+e.length);return r}function Uhe(){}const du=bp(/[A-Za-z]/),Xv=bp(/[\dA-Za-z]/);function qne(t){return t!==null&&(t<32||t===127)}function Ga(t){return t!==null&&t<-2}function Gn(t){return t!==null&&(t<0||t===32)}function Yo(t){return t===-2||t===-1||t===32}const wp=bp(new RegExp("\\p{P}|\\p{S}","u")),Ts=bp(/\s/);function bp(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Gne(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const vp=(function(t){if(t==null)return Jne;if(typeof t=="function")return yp(t);if(typeof t=="object")return Array.isArray(t)?Kne(t):Yne(t);if(typeof t=="string")return Xne(t);throw new Error("Expected function, string, or object as test")});function Kne(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=vp(t[n]);return yp(r);function r(...o){let i=-1;for(;++i<e.length;)if(e[i].apply(this,o))return!0;return!1}}function Yne(t){const e=t;return yp(n);function n(r){const o=r;let i;for(i in t)if(o[i]!==e[i])return!1;return!0}}function Xne(t){return yp(e);function e(n){return n&&n.type===t}}function yp(t){return e;function e(n,r,o){return!!(Qne(n)&&t.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function Jne(){return!0}function Qne(t){return t!==null&&typeof t=="object"&&"type"in t}function Rhe(t){return t}const _2=[],Zne=!0,Jv=!1,ere="skip";function T2(t,e,n,r){let o;typeof e=="function"&&typeof n!="function"?(r=n,n=e):o=e;const i=vp(o),s=r?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=_2,m,g,v;if((!e||i(l,c,u[u.length-1]||void 0))&&(f=tre(n(l,u)),f[0]===Jv))return f;if("children"in l&&l.children){const w=l;if(w.children&&f[0]!==ere)for(g=(r?w.children.length:-1)+s,v=u.concat(w);g>-1&&g<w.children.length;){const b=w.children[g];if(m=a(b,g,v)(),m[0]===Jv)return m;g=typeof m[1]=="number"?m[1]:g+s}}return f}}}function tre(t){return Array.isArray(t)?t:typeof t=="number"?[Zne,t]:t==null?_2:[t]}function nre(t,e,n){const o=vp((n||{}).ignore||[]),i=rre(e);let s=-1;for(;++s<i.length;)T2(t,"text",a);function a(c,u){let d=-1,h;for(;++d<u.length;){const f=u[d],m=h?h.children:void 0;if(o(f,m?m.indexOf(f):void 0,h))return;h=f}if(h)return l(c,u)}function l(c,u){const d=u[u.length-1],h=i[s][0],f=i[s][1];let m=0;const v=d.children.indexOf(c);let w=!1,b=[];h.lastIndex=0;let y=h.exec(c.value);for(;y;){const k=y.index,D={index:y.index,input:y.input,stack:[...u,c]};let S=f(...y,D);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=k+1:(m!==k&&b.push({type:"text",value:c.value.slice(m,k)}),Array.isArray(S)?b.push(...S):S&&b.push(S),m=k+y[0].length,w=!0),!h.global)break;y=h.exec(c.value)}return w?(m<c.value.length&&b.push({type:"text",value:c.value.slice(m)}),d.children.splice(v,1,...b)):b=[c],v+b.length}}function rre(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const o=n[r];e.push([ore(o[0]),ire(o[1])])}return e}function ore(t){return typeof t=="string"?new RegExp(Gne(t),"g"):t}function ire(t){return typeof t=="function"?t:function(){return t}}const Qv="phrasing",Zv=["autolink","link","image","label"];function sre(){return{transforms:[fre],enter:{literalAutolink:lre,literalAutolinkEmail:ey,literalAutolinkHttp:ey,literalAutolinkWww:ey},exit:{literalAutolink:hre,literalAutolinkEmail:dre,literalAutolinkHttp:cre,literalAutolinkWww:ure}}}function are(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qv,notInConstruct:Zv},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qv,notInConstruct:Zv},{character:":",before:"[ps]",after:"\\/",inConstruct:Qv,notInConstruct:Zv}]}}function lre(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function ey(t){this.config.enter.autolinkProtocol.call(this,t)}function cre(t){this.config.exit.autolinkProtocol.call(this,t)}function ure(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function dre(t){this.config.exit.autolinkEmail.call(this,t)}function hre(t){this.exit(t)}function fre(t){nre(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pre],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),mre]],{ignore:["link","linkReference"]})}function pre(t,e,n,r,o){let i="";if(!O2(o)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!gre(n)))return!1;const s=wre(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:i+e+s[0],children:[{type:"text",value:e+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function mre(t,e,n,r){return!O2(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function gre(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function wre(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const o=A2(t,"(");let i=A2(t,")");for(;r!==-1&&o>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function O2(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Ts(n)||wp(n))&&(!e||n!==47)}function hu(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}N2.peek=Dre;function bre(){this.buffer()}function vre(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function yre(){this.buffer()}function Cre(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function kre(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hu(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Sre(t){this.exit(t)}function xre(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hu(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Ere(t){this.exit(t)}function Dre(){return"["}function N2(t,e,n,r){const o=n.createTracker(r);let i=o.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return i+=o.move(n.safe(n.associationId(t),{after:"]",before:i})),a(),s(),i+=o.move("]"),i}function Are(){return{enter:{gfmFootnoteCallString:bre,gfmFootnoteCall:vre,gfmFootnoteDefinitionLabelString:yre,gfmFootnoteDefinition:Cre},exit:{gfmFootnoteCallString:kre,gfmFootnoteCall:Sre,gfmFootnoteDefinitionLabelString:xre,gfmFootnoteDefinition:Ere}}}function _re(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:N2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,i,s){const a=i.createTracker(s);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
126
126
  `:" ")+i.indentLines(i.containerFlow(r,a.current()),e?M2:Tre))),c(),l}}function Tre(t,e,n){return e===0?t:M2(t,e,n)}function M2(t,e,n){return(n?"":" ")+t}const Ore=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];B2.peek=Ire;function Nre(){return{canContainEols:["delete"],enter:{strikethrough:Bre},exit:{strikethrough:Fre}}}function Mre(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ore}],handlers:{delete:B2}}}function Bre(t){this.enter({type:"delete",children:[]},t)}function Fre(t){this.exit(t)}function B2(t,e,n,r){const o=n.createTracker(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=n.containerPhrasing(t,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function Ire(){return"~"}function Pre(t){return t.length}function Lre(t,e){const n=e||{},r=(n.align||[]).concat(),o=n.stringLength||Pre,i=[],s=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const g=[],v=[];let w=-1;for(t[u].length>c&&(c=t[u].length);++w<t[u].length;){const b=$re(t[u][w]);if(n.alignDelimiters!==!1){const y=o(b);v[w]=y,(l[w]===void 0||y>l[w])&&(l[w]=y)}g.push(b)}s[u]=g,a[u]=v}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=F2(r[d]);else{const g=F2(r);for(;++d<c;)i[d]=g}d=-1;const h=[],f=[];for(;++d<c;){const g=i[d];let v="",w="";g===99?(v=":",w=":"):g===108?v=":":g===114&&(w=":");let b=n.alignDelimiters===!1?1:Math.max(1,l[d]-v.length-w.length);const y=v+"-".repeat(b)+w;n.alignDelimiters!==!1&&(b=v.length+b+w.length,b>l[d]&&(l[d]=b),f[d]=b),h[d]=y}s.splice(1,0,h),a.splice(1,0,f),u=-1;const m=[];for(;++u<s.length;){const g=s[u],v=a[u];d=-1;const w=[];for(;++d<c;){const b=g[d]||"";let y="",k="";if(n.alignDelimiters!==!1){const D=l[d]-(v[d]||0),S=i[d];S===114?y=" ".repeat(D):S===99?D%2?(y=" ".repeat(D/2+.5),k=" ".repeat(D/2-.5)):(y=" ".repeat(D/2),k=y):k=" ".repeat(D)}n.delimiterStart!==!1&&!d&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&b==="")&&(n.delimiterStart!==!1||d)&&w.push(" "),n.alignDelimiters!==!1&&w.push(y),w.push(b),n.alignDelimiters!==!1&&w.push(k),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&w.push("|")}m.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return m.join(`
127
127
  `)}function $re(t){return t==null?"":String(t)}function F2(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function Hre(t,e,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(t,i.current()),Vre);return o(),s}function Vre(t,e,n){return">"+(n?"":" ")+t}function zre(t,e){return I2(t,e.inConstruct,!0)&&!I2(t,e.notInConstruct,!1)}function I2(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function P2(t,e,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`