(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,495187,e=>{"use strict";var t=e.i(824627),n=e.i(736893),s=e.i(875555);e.s(["useDebounce",0,function(e,a){var l=(0,t.__read)((0,n.useState)(e),2),i=l[0],r=l[1],o=(0,s.default)(function(){r(e)},a).run;return(0,n.useEffect)(function(){o()},[e]),i}],495187)},508110,e=>{"use strict";var t=e.i(340801);e.s(["Mcp",()=>t.default])},931576,776388,70486,e=>{"use strict";var t=e.i(835240),n=e.i(736893);e.i(942394);var s=e.i(84411),a=e.i(21151),l=e.i(935139),i=e.i(944911),r=e.i(568349),o=e.i(664826),c=e.i(632717),d=e.i(869931),u=e.i(151094),m=e.i(324935),p=e.i(95085),g=e.i(220365),h=e.i(339548);let v=(0,h.createContext)({emit:g.noop,useSubscribe:g.noop});function f(e){return(0,h.useContextSelector)(v,e)}e.s(["MittContext",0,v,"useMittContextSelector",0,f],776388);var x=e.i(157644),b=e.i(745754),y=e.i(21693);e.i(36860);var C=e.i(438270);let k=n.memo(()=>{let{t:e}=(0,s.useTranslation)();return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.default,{className:"shrink-0",checked:!1,disabled:!0}),(0,t.jsxs)("div",{className:"hover-bg-components-panel-on-panel-item-bg relative grow rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg p-4 pb-3 shadow-xs",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsxs)("div",{className:"relative flex h-10 w-10 items-center justify-center gap-2 rounded-[10px] border-[0.5px] border-state-destructive-border bg-state-destructive-hover p-1 backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"flex h-5 w-5 items-center justify-center",children:(0,t.jsx)(C.Group,{className:"text-text-quaternary"})}),(0,t.jsx)("div",{className:"absolute bottom-[-4px] right-[-4px] rounded-full border-[2px] border-components-panel-bg bg-state-destructive-solid",children:(0,t.jsx)(d.RiCloseLine,{className:"h-3 w-3 text-text-primary-on-surface"})})]}),(0,t.jsxs)("div",{className:"ml-3 grow",children:[(0,t.jsx)("div",{className:"system-md-semibold flex h-5 items-center text-text-destructive",children:e("installModal.pluginLoadError",{ns:"plugin"})}),(0,t.jsx)("div",{className:"system-xs-regular mt-0.5 text-text-tertiary",children:e("installModal.pluginLoadErrorDesc",{ns:"plugin"})})]})]}),(0,t.jsx)(y.LoadingPlaceholder,{className:"mt-3 w-[420px]"})]})]})}),j=n.memo(()=>(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.default,{className:"shrink-0",checked:!1,disabled:!0}),(0,t.jsx)("div",{className:"hover-bg-components-panel-on-panel-item-bg relative grow rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg p-4 pb-3 shadow-xs",children:(0,t.jsx)(y.default,{wrapClassName:"w-full"})})]}));var w=e.i(228403),E=e.i(925521),I=e.i(365181),N=e.i(222573),T=e.i(292005),S=e.i(494268),_=e.i(547682);function F(e,t){if(t.plugin_installation_permission.restrict_to_marketplace_only&&("github"===e.from||"package"===e.from))return{canInstall:!1};if(t.plugin_installation_permission.plugin_installation_scope===_.InstallationScope.ALL)return{canInstall:!0};if(t.plugin_installation_permission.plugin_installation_scope===_.InstallationScope.NONE)return{canInstall:!1};let n=e.verification||{};return(e.verification&&e.verification.authorized_category||(n.authorized_category="langgenius"),t.plugin_installation_permission.plugin_installation_scope===_.InstallationScope.OFFICIAL_ONLY)?{canInstall:"langgenius"===n.authorized_category}:t.plugin_installation_permission.plugin_installation_scope===_.InstallationScope.OFFICIAL_AND_PARTNER?{canInstall:"langgenius"===n.authorized_category||"partner"===n.authorized_category}:{canInstall:!0}}function L(e){return F(e,(0,S.useGlobalPublicStore)(e=>e.systemFeatures))}let P=n.memo(e=>{let{checked:n,onCheckedChange:s,payload:a,isFromMarketPlace:l,versionInfo:i}=e,{getIconUrl:r}=(0,N.default)(),o={...i,toInstallVersion:a.version},{canInstall:c}=L(a);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.default,{disabled:!c,className:"shrink-0",checked:n,onCheck:()=>s(a)}),(0,t.jsx)(I.default,{className:"grow",payload:{...a,icon:l?`${E.MARKETPLACE_API_PREFIX}/plugins/${a.org}/${a.name}/icon`:r(a.icon)},titleLeft:a.version?(0,t.jsx)(T.default,{...o}):null,limitedInstall:!c})]})}),M=n.memo(e=>{let{checked:s,onCheckedChange:a,dependency:l,versionInfo:i,onFetchedPayload:r,onFetchError:o}=e,c=l.value,{data:d,error:u}=(0,x.useUploadGitHub)({repo:c.repo,version:c.release||c.version,package:c.packages||c.package}),[m,p]=n.useState(null);return((0,n.useEffect)(()=>{if(d){let e={...(0,w.pluginManifestToCardPluginProps)(d.manifest),plugin_id:d.unique_identifier};r(e),p({...e,from:l.type})}},[d]),(0,n.useEffect)(()=>{u&&o()},[u]),m)?(0,t.jsx)(P,{payload:m,versionInfo:i,checked:s,onCheckedChange:a}):(0,t.jsx)(j,{})}),A=n.memo(e=>{let{checked:n,onCheckedChange:s,payload:a,version:l,versionInfo:i}=e;return a?(0,t.jsx)(P,{checked:n,onCheckedChange:s,payload:{...a,version:l},isFromMarketPlace:!0,versionInfo:i}):(0,t.jsx)(j,{})}),R=n.memo(e=>{let{payload:n,checked:s,onCheckedChange:a,isFromMarketPlace:l,versionInfo:i}=e;if(!n.value?.manifest)return(0,t.jsx)(k,{});let r=(0,w.pluginManifestToCardPluginProps)(n.value.manifest);return(0,t.jsx)(P,{payload:{...r,from:n.type},checked:s,onCheckedChange:a,isFromMarketPlace:l,versionInfo:i})});var $=e.i(99649);function V(e){return`${e?.org||e?.author}/${e?.name}`}let q=e=>{let{allPlugins:s,selectedPlugins:a,onSelect:l,onSelectAll:i,onDeSelectAll:r,onLoadedAllPlugin:o,isFromMarketPlace:c,ref:d}=e,{plugins:u,errorIndexes:m,handleGitHubPluginFetched:p,handleGitHubPluginFetchError:g,getVersionInfo:h,handleSelect:v,isPluginSelected:f,getInstallablePlugins:b}=function(e){let{allPlugins:t,selectedPlugins:s,onSelect:a,onLoadedAllPlugin:l}=e,i=(0,S.useGlobalPublicStore)(e=>e.systemFeatures),r=(0,n.useMemo)(()=>t.filter(e=>"marketplace"===e.type),[t]),o=(0,n.useMemo)(()=>t.reduce((e,t,n)=>("marketplace"===t.type&&e.push(n),e),[]),[t]),{marketplaceRequests:c,invalidMarketplaceIndexes:d}=(0,n.useMemo)(()=>r.reduce((e,t,n)=>{var s;let a,l=o[n];if(void 0===l)return e;let i=(a=function(e){if(!e)return null;let[t,n]=e.split("@")[0].split("/");if(!t||!n)return null;let[s,a]=n.split(":");return s?{organization:t,plugin:s,version:a}:null}((s=t.value).marketplace_plugin_unique_identifier||s.plugin_unique_identifier))||(s.organization&&s.plugin?{organization:s.organization,plugin:s.plugin,version:s.version}:null);return i?e.marketplaceRequests.push({dslIndex:l,dependency:t,info:i}):e.invalidMarketplaceIndexes.push(l),e},{marketplaceRequests:[],invalidMarketplaceIndexes:[]}),[o,r]),{isLoading:u,data:m,error:p}=(0,x.useFetchPluginsInMarketPlaceByInfo)(c.map(e=>e.info)),{marketplacePluginMap:g,marketplaceErrorIndexes:h}=(0,n.useMemo)(()=>{let e=new Map,t=new Set(d);if(!u&&m?.data.list){let n=m.data.list,s=new Map(n.map(e=>[e.plugin.plugin_id,e.plugin]));c.forEach((a,l)=>{let i=(a.dependency.value.marketplace_plugin_unique_identifier||a.dependency.value.plugin_unique_identifier)?.split(":")[0],r=(i?s.get(i):void 0)||n[l]?.plugin;r?e.set(a.dslIndex,{...r,from:a.dependency.type,version:r.version||r.latest_version}):t.add(a.dslIndex)})}return p&&o.forEach(e=>t.add(e)),{marketplacePluginMap:e,marketplaceErrorIndexes:t}},[d,u,m,p,o,c]),[v,f]=(0,n.useState)(()=>new Map),[b,y]=(0,n.useState)([]),C=(0,n.useMemo)(()=>{let e=t.some(e=>"package"===e.type)?t.map(e=>{if("package"!==e.type)return;let{manifest:t,unique_identifier:n}=e.value;return{...t,plugin_id:n}}):[],n=t.map((t,n)=>e[n]);return g.forEach((e,t)=>{n[t]=e}),v.forEach((e,t)=>{n[t]=e}),n},[t,g,v]),k=(0,n.useMemo)(()=>[...h,...b],[h,b]),j=C.filter(Boolean).length+k.length===t.length,{installedInfo:w}=(0,$.default)({pluginIds:C.filter(Boolean).map(e=>V(e))||[],enabled:j});(0,n.useEffect)(()=>{j&&w&&l(w)},[j,w]);let E=(0,n.useCallback)(e=>t=>{f(n=>new Map(n).set(e,t))},[]),I=(0,n.useCallback)(e=>()=>{y(t=>[...t,e])},[]),N=(0,n.useCallback)(e=>{let t=w?.[e];return{hasInstalled:!!t,installedVersion:t?.installedVersion,toInstallVersion:""}},[w]),T=(0,n.useCallback)(e=>()=>{let t=C.filter(e=>{let{canInstall:t}=F(e,i);return t});a(C[e],e,t.length)},[a,C,i]),_=(0,n.useCallback)(e=>!!s.find(t=>t.plugin_id===C[e]?.plugin_id),[s,C]),L=(0,n.useCallback)(()=>{let e=[],n=[];return t.forEach((t,s)=>{let a=C[s];if(!a)return;let{canInstall:l}=F(a,i);l&&(e.push(s),n.push(a))}),{selectedIndexes:e,installablePlugins:n}},[t,C,i]);return{plugins:C,errorIndexes:k,handleGitHubPluginFetched:E,handleGitHubPluginFetchError:I,getVersionInfo:N,handleSelect:T,isPluginSelected:_,getInstallablePlugins:L}}({allPlugins:s,selectedPlugins:a,onSelect:l,onLoadedAllPlugin:o});return(0,n.useImperativeHandle)(d,()=>({selectAllPlugins:()=>{let{installablePlugins:e,selectedIndexes:t}=b();i(e,t)},deSelectAllPlugins:r})),(0,t.jsx)(t.Fragment,{children:s.map((e,n)=>{if(m.includes(n))return(0,t.jsx)(k,{},n);let s=u[n],a=f(n),l=h(V(s));return"github"===e.type?(0,t.jsx)(M,{checked:a,onCheckedChange:v(n),dependency:e,onFetchedPayload:p(n),onFetchError:g(n),versionInfo:l},n):"marketplace"===e.type?(0,t.jsx)(A,{checked:a,onCheckedChange:v(n),payload:{...s,from:e.type},version:e.value.version||s?.version||"",versionInfo:l},n):(0,t.jsx)(R,{checked:a,onCheckedChange:v(n),payload:e,isFromMarketPlace:c,versionInfo:l},n)})})},U="installModal",O=n.memo(e=>{let{allPlugins:a,onStartToInstall:l,onInstalled:r,onCancel:o,isFromMarketPlace:g,isHideButton:h}=e,{t:v}=(0,s.useTranslation)(),y=f(e=>e.emit),[C,k]=n.useState([]),[j,w]=n.useState([]),E=C.length,I=(0,n.useRef)(null),{refreshPluginList:N}=(0,c.default)(),[T,S]=(0,n.useState)(!1),_=(0,n.useCallback)(()=>{T?I.current?.deSelectAllPlugins():I.current?.selectAllPlugins()},[T]),[F,L]=n.useState(!1),[P,M]=(0,n.useState)(void 0),A=(0,n.useCallback)(e=>{_(),M(e),L(!0)},[]),{check:R,stop:$}=(0,b.default)(),V=(0,n.useCallback)(()=>{$(),o()},[o,$]),{handleRefetch:O}=(0,x.usePluginTaskList)(),{mutate:z,isPending:B}=(0,x.useInstallOrUpdate)({onSuccess:async e=>{if(e.every(e=>e.status===i.TaskStatus.success||e.status===i.TaskStatus.failed)){r(C,e.map((e,t)=>({success:e.status===i.TaskStatus.success,isFromMarketPlace:"marketplace"===a[j[t]].type}))),e.some(e=>e.status===i.TaskStatus.success)&&(N(void 0,!0),y("plugin:install:success",C.map(e=>`${e.plugin_id}/${e.name}`)));return}O();let t=await Promise.all(e.map(async(e,t)=>{if(e.status!==i.TaskStatus.running)return{success:e.status===i.TaskStatus.success,isFromMarketPlace:"marketplace"===a[j[t]].type};let{status:n}=await R({taskId:e.taskId,pluginUniqueIdentifier:e.uniqueIdentifier});return{success:n===i.TaskStatus.success,isFromMarketPlace:"marketplace"===a[j[t]].type}}));r(C,t),t.some(e=>e.success)&&y("plugin:install:success",C.map(e=>`${e.plugin_id}/${e.name}`))}}),[D,H]=(0,n.useState)(!1),G=(0,n.useCallback)((e,t)=>{k(e),w(t),S(!0),H(!1)},[]),W=(0,n.useCallback)(()=>{k([]),w([]),S(!1),H(!1)},[]),K=(0,n.useCallback)((e,t,n)=>{let s,a=!!C.find(t=>t.plugin_id===e.plugin_id);k(s=a?C.filter(t=>t.plugin_id!==e.plugin_id):[...C,e]),w(a?j.filter(e=>e!==t):[...j,t]),0===s.length?(S(!1),H(!1)):s.length===n?(S(!0),H(!1)):(H(!0),S(!1))},[C,j]),{canInstallPluginFromMarketplace:X}=(0,p.useCanInstallPluginFromMarketplace)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-col items-start justify-center gap-4 self-stretch px-6 py-3",children:[(0,t.jsx)("div",{className:"system-md-regular text-text-secondary",children:(0,t.jsx)("p",{children:v(`${U}.${E>1?"readyToInstallPackages":"readyToInstallPackage"}`,{ns:"plugin",num:E})})}),(0,t.jsx)("div",{className:"w-full space-y-1 rounded-2xl bg-background-section-burn p-2",children:(0,t.jsx)(q,{ref:I,allPlugins:a,selectedPlugins:C,onSelect:K,onSelectAll:G,onDeSelectAll:W,onLoadedAllPlugin:A,isFromMarketPlace:g})})]}),!h&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 self-stretch p-6 pt-5",children:[(0,t.jsx)("div",{className:"px-2",children:F&&(0,t.jsxs)("div",{className:"flex items-center gap-x-2",onClick:_,children:[(0,t.jsx)(m.default,{checked:T,indeterminate:D}),(0,t.jsx)("p",{className:"system-sm-medium cursor-pointer text-text-secondary",children:v(T?"operation.deSelectAll":"operation.selectAll",{ns:"common"})})]})}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 self-stretch",children:[!F&&(0,t.jsx)(u.default,{variant:"secondary",className:"min-w-[72px]",onClick:V,children:v("operation.cancel",{ns:"common"})}),(0,t.jsxs)(u.default,{variant:"primary",className:"flex min-w-[72px] space-x-0.5",disabled:!F||B||0===C.length||!X,onClick:()=>{l?.(),z({payload:a.filter((e,t)=>j.includes(t)),plugin:C,installedInfo:P})},children:[B&&(0,t.jsx)(d.RiLoader2Line,{className:"h-4 w-4 animate-spin-slow"}),(0,t.jsx)("span",{children:v(`${U}.${B?"installing":"install"}`,{ns:"plugin"})})]})]})]})]})});var z=e.i(500536);let B=n.memo(e=>{let{list:n,installStatus:a,onCancel:l,isHideButton:i}=e,{t:r}=(0,s.useTranslation)(),{getIconUrl:o}=(0,N.default)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex flex-col items-start justify-center gap-4 self-stretch px-6 py-3",children:(0,t.jsx)("div",{className:"flex flex-wrap content-start items-start gap-1 space-y-1 self-stretch rounded-2xl bg-background-section-burn p-2",children:n.map((e,n)=>(0,t.jsx)(I.default,{className:"w-full",payload:{...e,icon:a[n].isFromMarketPlace?`${E.MARKETPLACE_API_PREFIX}/plugins/${e.org}/${e.name}/icon`:o(e.icon)},installed:a[n].success,installFailed:!a[n].success,titleLeft:e.version?(0,t.jsx)(z.default,{className:"mx-1",size:"s",state:z.BadgeState.Default,children:e.version}):null},e.plugin_id))})}),!i&&(0,t.jsx)("div",{className:"flex items-center justify-end gap-2 self-stretch p-6 pt-5",children:(0,t.jsx)(u.default,{variant:"primary",className:"min-w-[72px]",onClick:l,children:r("operation.close",{ns:"common"})})})]})}),D=n.memo(e=>{let{step:s,onStepChange:a,onStartToInstall:l,setIsInstalling:r,allPlugins:o,onClose:c,isFromMarketPlace:d}=e,[u,m]=(0,n.useState)([]),[p,g]=(0,n.useState)([]),h=(0,n.useCallback)((e,t)=>{g(t),m(e),a(i.InstallStep.installed),r(!1)},[a,r]);return(0,t.jsxs)(t.Fragment,{children:[s===i.InstallStep.readyToInstall&&(0,t.jsx)(O,{allPlugins:o,onCancel:c,onStartToInstall:l,onInstalled:h,isFromMarketPlace:d}),s===i.InstallStep.installed&&(0,t.jsx)(B,{list:u,installStatus:p,onCancel:c})]})});e.s(["default",0,D],70486);var H=e.i(751992),G=e.i(523614);let W="installModal",K=n.memo(e=>{let{uniqueIdentifier:a,payload:l,onCancel:r,onStartToInstall:o,onInstalled:c,onFailed:m}=e,{t:p}=(0,s.useTranslation)(),g=l.version||l.latest_version,h=l.plugin_id,{installedInfo:v,isLoading:f}=(0,$.default)({pluginIds:[h],enabled:!!h}),y=v?.[h],C=y?.installedVersion,k=!!C,{mutateAsync:j}=(0,x.useInstallPackageFromMarketPlace)(),{mutateAsync:E}=(0,x.useUpdatePackageFromMarketPlace)(),[N,S]=n.useState(!1),{check:_,stop:F}=(0,b.default)(),{handleRefetch:P}=(0,x.usePluginTaskList)(l.category);(0,n.useEffect)(()=>{k&&a===y.uniqueIdentifier&&c()},[k]);let M=async()=>{if(!N){o?.(),S(!0);try{let e,t;if(k){let{all_installed:n,task_id:s}=await E({original_plugin_unique_identifier:y.uniqueIdentifier,new_plugin_unique_identifier:a});e=s,t=n}else{let{all_installed:n,task_id:s}=await j(a);e=s,t=n}if(t)return void c();P();let{status:n,error:s}=await _({taskId:e,pluginUniqueIdentifier:a});if(n===i.TaskStatus.failed)return void m(s);c(!0)}catch(e){if("string"==typeof e)return void m(e);m()}}},{langGeniusVersionInfo:A}=(0,H.useAppContext)(),{data:R}=(0,x.usePluginDeclarationFromMarketPlace)(a),V=(0,n.useMemo)(()=>!R||!A.current_version||(0,G.isEqualOrLaterThanVersion)(A.current_version,R?.manifest.meta.minimum_dify_version??"0.0.0"),[A.current_version,R]),{canInstall:q}=L({...l,from:"marketplace"});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-col items-start justify-center gap-4 self-stretch px-6 py-3",children:[(0,t.jsxs)("div",{className:"text-text-secondary system-md-regular",children:[(0,t.jsx)("p",{children:p(`${W}.readyToInstall`,{ns:"plugin"})}),!V&&(0,t.jsx)("p",{className:"text-text-warning system-md-regular",children:p("difyVersionNotCompatible",{ns:"plugin",minimalDifyVersion:R?.manifest.meta.minimum_dify_version})})]}),(0,t.jsx)("div",{className:"flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2",children:(0,t.jsx)(I.default,{className:"w-full",payload:(0,w.pluginManifestInMarketToPluginProps)(l),titleLeft:!f&&(0,t.jsx)(T.default,{hasInstalled:k,installedVersion:C,toInstallVersion:g}),limitedInstall:!q})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 self-stretch p-6 pt-5",children:[!N&&(0,t.jsx)(u.default,{variant:"secondary",className:"min-w-[72px]",onClick:()=>{F(),r()},children:p("operation.cancel",{ns:"common"})}),(0,t.jsxs)(u.default,{variant:"primary",className:"flex min-w-[72px] space-x-0.5",disabled:N||f||!q,onClick:M,children:[N&&(0,t.jsx)(d.RiLoader2Line,{className:"h-4 w-4 animate-spin-slow"}),(0,t.jsx)("span",{children:p(`${W}.${N?"installing":"install"}`,{ns:"plugin"})})]})]})]})}),X="installModal";e.s(["default",0,e=>{let{uniqueIdentifier:d,manifest:u,isBundle:m,dependencies:p,onSuccess:g,onClose:h}=e,{t:v}=(0,s.useTranslation)(),[f,x]=(0,n.useState)(i.InstallStep.readyToInstall),[b,y]=(0,n.useState)(null),{refreshPluginList:C}=(0,c.default)(),{modalClassName:k,foldAnimInto:j,setIsInstalling:w,handleStartToInstall:E}=(0,o.default)(h),I=(0,n.useCallback)(()=>m&&f===i.InstallStep.installed?v(`${X}.installComplete`,{ns:"plugin"}):f===i.InstallStep.installed?v(`${X}.installedSuccessfully`,{ns:"plugin"}):f===i.InstallStep.installFailed?v(`${X}.installFailed`,{ns:"plugin"}):v(`${X}.installPlugin`,{ns:"plugin"}),[m,f,v]),N=(0,n.useCallback)(e=>{x(i.InstallStep.installed),e||C(u),w(!1)},[u,C,w]),T=(0,n.useCallback)(e=>{x(i.InstallStep.installFailed),w(!1),e&&y(e)},[w]);return(0,t.jsxs)(a.default,{isShow:!0,onClose:j,wrapperClassName:"z-[9999]",className:(0,l.cn)(k,"shadows-shadow-xl flex min-w-[560px] flex-col items-start rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0"),closable:!0,children:[(0,t.jsx)("div",{className:"flex items-start gap-2 self-stretch pb-3 pl-6 pr-14 pt-6",children:(0,t.jsx)("div",{className:"title-2xl-semi-bold self-stretch text-text-primary",children:I()})}),m?(0,t.jsx)(D,{step:f,onStepChange:x,onStartToInstall:E,setIsInstalling:w,onClose:h,allPlugins:p,isFromMarketPlace:!0}):(0,t.jsxs)(t.Fragment,{children:[f===i.InstallStep.readyToInstall&&(0,t.jsx)(K,{uniqueIdentifier:d,payload:u,onCancel:h,onInstalled:N,onFailed:T,onStartToInstall:E}),[i.InstallStep.installed,i.InstallStep.installFailed].includes(f)&&(0,t.jsx)(r.default,{payload:u,isMarketPayload:!0,isFailed:f===i.InstallStep.installFailed,errMsg:b,onCancel:g})]})]})}],931576)},349714,844367,e=>{"use strict";var t=e.i(736893);function n(e){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("Authorization URL must be HTTP or HTTPS")}catch(t){if(t instanceof Error&&"Authorization URL must be HTTP or HTTPS"===t.message)throw t;throw Error(`Invalid URL: ${e}`)}}e.s(["isPrivateOrLocalAddress",0,function(e){try{let t=new URL(e).hostname.toLowerCase();if("localhost"===t||"127.0.0.1"===t||"::1"===t)return!0;let n=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.exec(t);if(n){let[,e,t]=n.map(Number);if(10===e||172===e&&t>=16&&t<=31||192===e&&168===t||169===e&&254===t)return!0}return t.endsWith(".local")}catch{return!1}},"validateRedirectUrl",0,n],844367),e.s(["openOAuthPopup",0,(e,t)=>{let s=window.screenX+(window.outerWidth-600)/2,a=window.screenY+(window.outerHeight-600)/2;n(e);let l=window.open(e,"OAuth",`width=600,height=600,left=${s},top=${a},scrollbars=yes`),i=e=>{e.data?.type==="oauth_callback"&&(window.removeEventListener("message",i),t(e.data))};window.addEventListener("message",i);let r=setInterval(()=>{l?.closed&&(clearInterval(r),window.removeEventListener("message",i),t())},1e3);return l},"useOAuthCallback",0,()=>{(0,t.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get("subscription_id"),n=e.get("error"),s=e.get("error_description");if(window.opener){let e=window.opener?.origin||"*";t?window.opener.postMessage({type:"oauth_callback",success:!0,subscriptionId:t},e):n?window.opener.postMessage({type:"oauth_callback",success:!1,error:n,errorDescription:s},e):window.opener.postMessage({type:"oauth_callback"},e),window.close()}},[])}],349714)},48803,e=>{e.q("/_next/static/media/search-menu.0pm1~twu_~46o.svg")},14516,e=>{"use strict";e.s(["EventClient",0,class{#e=!0;#t;#n;#s;#a;#l;#i;#r;#o=0;#c=5;#d=!1;#u=!1;#m=null;#p=()=>{this.debugLog("Connected to event bus"),this.#l=!0,this.#d=!1,this.debugLog("Emitting queued events",this.#a),this.#a.forEach(e=>this.emitEventToBus(e)),this.#a=[],this.stopConnectLoop(),this.#n().removeEventListener("tanstack-connect-success",this.#p)};#g=()=>{if(this.#o{this.#d||(this.#d=!0,this.#n().addEventListener("tanstack-connect-success",this.#p),this.#g())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:s=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#s=t,this.debugLog(" Initializing event subscription for plugin",this.#t),this.#a=[],this.#l=!1,this.#u=!1,this.#i=null,this.#r=s}startConnectLoop(){null!==this.#i||this.#l||(this.debugLog(`Starting connect loop (every ${this.#r}ms)`),this.#i=setInterval(this.#g,this.#r))}stopConnectLoop(){this.#d=!1,null!==this.#i&&(clearInterval(this.#i),this.#i=null,this.#a=[],this.debugLog("Stopped connect loop"))}debugLog(){for(var e=arguments.length,t=Array(e),n=0;ntypeof globalThis&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if("u">typeof window&&void 0!==window.addEventListener)return this.debugLog("Using window as event target"),window;let e="u">typeof EventTarget?new EventTarget:void 0;return void 0===e||void 0===e.addEventListener?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch(e){this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch(n){this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog("Emitting event to client bus",e),this.dispatchCustomEvent("tanstack-dispatch-event",e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e)return void this.debugLog("Event bus client is disabled, not emitting event",e,t);if(this.#m&&(this.debugLog("Emitting event to internal event target",e,t),this.#m.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#u)return void this.debugLog("Previously failed to connect, not emitting to bus");if(!this.#l){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#a.push(this.createEventPayload(e,t)),"u">typeof CustomEvent&&!this.#d&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let s=n?.withEventTarget??!1,a=`${this.#t}:${e}`;if(s&&(this.#m||(this.#m=new EventTarget),this.#m.addEventListener(a,e=>{t(e.detail)})),!this.#e)return this.debugLog("Event bus client is disabled, not registering event",a),()=>{};let l=e=>{this.debugLog("Received event from bus",e.detail),t(e.detail)};return this.#n().addEventListener(a,l),this.debugLog("Registered event to bus",a),()=>{s&&this.#m?.removeEventListener(a,l),this.#n().removeEventListener(a,l)}}onAll(e){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let t=t=>{e(t.detail)};return this.#n().addEventListener("tanstack-devtools-global",t),()=>this.#n().removeEventListener("tanstack-devtools-global",t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener("tanstack-devtools-global",t),()=>this.#n().removeEventListener("tanstack-devtools-global",t)}}])},194594,e=>{"use strict";var t=e.i(14516);class n extends t.EventClient{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}let s=new n;e.s(["formEventClient",0,s])},574270,e=>{"use strict";var t=e.i(835240),n=e.i(736893),s=e.i(935139);let a=n.memo(e=>{let{isChecked:n,disabled:a=!1,onCheck:l,className:i}=e;return(0,t.jsx)("div",{role:"radio","aria-checked":n,"aria-disabled":a,className:(0,s.cn)("size-4 rounded-full",n&&!a&&"border-[5px] border-components-radio-border-checked hover:border-components-radio-border-checked-hover",!n&&!a&&"border border-components-radio-border hover:border-components-radio-border-hover",n&&a&&"border-[5px] border-components-radio-border-checked-disabled",!n&&a&&"border border-components-radio-border-disabled bg-components-radio-bg-disabled",!a&&"bg-components-radio-bg shadow-xs shadow-shadow-shadow-3 hover:bg-components-radio-bg-hover",i),onClick:e=>{a||l?.(e)}})});e.s(["default",0,a])},453284,e=>{"use strict";var t=e.i(835240),n=e.i(869931),s=e.i(736893);e.i(942394);var a=e.i(84411),l=e.i(935139);e.s(["default",0,e=>{let{placeholder:i,className:r,value:o,onChange:c,white:d}=e,{t:u}=(0,a.useTranslation)(),m=(0,s.useRef)(null),[p,g]=(0,s.useState)(!1),h=(0,s.useRef)(!1),[v,f]=(0,s.useState)("");return(0,t.jsxs)("div",{className:(0,l.cn)("group flex h-8 items-center overflow-hidden rounded-lg border-none bg-components-input-bg-normal px-2 hover:bg-components-input-bg-hover",p&&"!bg-components-input-bg-active",d&&"!border-gray-300 !bg-white shadow-xs hover:!border-gray-300 hover:!bg-white",r),children:[(0,t.jsx)("div",{className:"pointer-events-none mr-1.5 flex h-4 w-4 shrink-0 items-center justify-center",children:(0,t.jsx)(n.RiSearchLine,{className:"h-4 w-4 text-components-input-text-placeholder","aria-hidden":"true"})}),(0,t.jsx)("input",{ref:m,type:"text",name:"query",className:(0,l.cn)("system-sm-regular caret-#295EFF block h-[18px] grow appearance-none border-0 bg-transparent text-components-input-text-filled outline-none placeholder:text-components-input-text-placeholder",d&&"!bg-white placeholder:!text-gray-400 hover:!bg-white group-hover:!bg-white"),placeholder:i||u("operation.search",{ns:"common"}),value:h.current?v:o,onChange:e=>{let t=e.target.value;h.current?f(t):c(t)},onCompositionStart:()=>{h.current=!0,f(o)},onCompositionEnd:e=>{h.current=!1,f(""),c(e.currentTarget.value)},onFocus:()=>g(!0),onBlur:()=>g(!1),autoComplete:"off"}),o&&(0,t.jsx)("button",{type:"button","aria-label":u("operation.clear",{ns:"common"}),className:"group/clear flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center border-none bg-transparent p-0",onClick:()=>{c(""),m.current?.focus()},children:(0,t.jsx)(n.RiCloseCircleFill,{className:"h-4 w-4 text-text-quaternary group-hover/clear:text-text-tertiary"})})]})}])},588226,449758,566210,456721,610683,e=>{"use strict";var t=e.i(835240),n=e.i(736893);e.s([],456721);var s=e.i(622111);e.i(942394);var a=e.i(84411),l=e.i(83278),i=e.i(324935),r=e.i(453284);let o={src:e.i(48803).default,width:32,height:32,blurWidth:0,blurHeight:0};var c=e.i(935139),d=e.i(151094);let u=e=>{let{title:s="",label:u,description:m,options:p,value:g=[],onChange:h,disabled:v=!1,containerClassName:f,showSelectAll:x=!0,showCount:b=!0,showSearch:y=!0,maxHeight:C}=e,{t:k}=(0,a.useTranslation)(),[j,w]=(0,n.useState)(""),E=(0,n.useMemo)(()=>{if(!j?.trim())return p;let e=j.toLowerCase();return p.filter(t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e))},[p,j]),I=g.length,N=(0,n.useMemo)(()=>{let e=p.filter(e=>!e.disabled);return e.length>0&&e.every(e=>g.includes(e.value))},[p,g]),T=(0,n.useMemo)(()=>{let e=p.filter(e=>!e.disabled),t=e.filter(e=>g.includes(e.value)).length;return t>0&&t{if(!v)if(N)h?.([]);else{let e=p.filter(e=>!e.disabled).map(e=>e.value);h?.(e)}},[N,p,h,v]),_=(0,n.useCallback)(e=>{if(v)return;let t=g.includes(e)?g.filter(t=>t!==e):[...g,e];h?.(t)},[g,h,v]);return(0,t.jsxs)("div",{className:(0,c.cn)("flex w-full flex-col gap-1",f),children:[u&&(0,t.jsx)("div",{className:"text-text-secondary system-sm-medium",children:u}),m&&(0,t.jsx)("div",{className:"text-text-tertiary body-xs-regular",children:m}),(0,t.jsxs)("div",{className:"rounded-lg border border-components-panel-border bg-components-panel-bg",children:[(x||s||y)&&(0,t.jsxs)("div",{className:"relative flex items-center gap-2 border-b border-divider-subtle px-3 py-2",children:[!j&&x&&(0,t.jsx)(i.default,{checked:N,indeterminate:T,onCheck:S,disabled:v,id:"selectAll"}),j?(0,t.jsx)("div",{className:"flex-1 leading-6 text-text-secondary system-sm-medium-uppercase",children:E.length>0?k("operation.searchCount",{ns:"common",count:E.length,content:s}):k("operation.noSearchCount",{ns:"common",content:s})}):(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:[s&&(0,t.jsx)("span",{className:"truncate leading-5 text-text-secondary system-xs-semibold-uppercase",children:s}),b&&I>0&&(0,t.jsx)(l.default,{uppercase:!0,children:k("operation.selectCount",{ns:"common",count:I})})]}),y&&(0,t.jsx)(r.default,{value:j,onChange:w,placeholder:k("placeholder.search",{ns:"common"}),className:"w-40"})]}),(0,t.jsx)("div",{className:"p-1",style:C?{maxHeight:C,overflowY:"auto"}:{},"data-testid":"options-container",children:E.length?E.map(e=>{let n=g.includes(e.value);return(0,t.jsxs)("div",{"data-testid":"option-item",className:(0,c.cn)("flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-state-base-hover",e.disabled&&"cursor-not-allowed opacity-50"),onClick:()=>{e.disabled||v||_(e.value)},children:[(0,t.jsx)(i.default,{checked:n,onCheck:()=>{e.disabled||v||_(e.value)},disabled:e.disabled||v,id:e.value}),(0,t.jsx)("div",{className:"flex-1 truncate text-text-secondary system-sm-medium",title:e.label,children:e.label})]},e.value)}):(0,t.jsx)("div",{className:"px-3 py-6 text-center text-sm text-text-tertiary",children:j?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2",children:[(0,t.jsx)("img",{alt:"search menu",src:o.src,width:32}),(0,t.jsx)("span",{className:"text-text-secondary system-sm-regular",children:k("operation.noSearchResults",{ns:"common",content:s})}),(0,t.jsx)(d.default,{variant:"secondary-accent",size:"small",onClick:()=>w(""),children:k("operation.resetKeywords",{ns:"common"})})]}):k("noData",{ns:"common"})})})]})]})};e.s(["default",0,u],449758);var m=e.i(603135),p=e.i(291631),g=e.i(545766),h=e.i(574270),v=e.i(306101),f=e.i(421001),x=e.i(225162),b=e.i(645429);let y=()=>{let e=(0,x.useLanguage)();return t=>(0,b.renderI18nObject)(t,e)};e.s(["useRenderI18nObject",0,y],566210);var C=e.i(819114);let k=e=>{let{content:t,render:s}=e;return(0,n.isValidElement)(t)||"string"==typeof t?t:"object"==typeof t&&null!==t?s(t):""},j={[m.FormItemValidateStatusEnum.Error]:{componentClassName:"border-components-input-border-destructive focus:border-components-input-border-destructive",textClassName:"text-text-destructive",infoFieldName:"errors"},[m.FormItemValidateStatusEnum.Warning]:{componentClassName:"border-components-input-border-warning focus:border-components-input-border-warning",textClassName:"text-text-warning",infoFieldName:"warnings"},[m.FormItemValidateStatusEnum.Success]:{componentClassName:"",textClassName:"",infoFieldName:""},[m.FormItemValidateStatusEnum.Validating]:{componentClassName:"",textClassName:"",infoFieldName:""}},w=(0,n.memo)(e=>{let{fieldClassName:l,labelClassName:i,inputContainerClassName:r,inputClassName:o,formSchema:d,field:x,disabled:b,onChange:w,fieldState:E}=e,I=y(),{t:N}=(0,a.useTranslation)(),{name:T,label:S,required:_,placeholder:F,options:L,labelClassName:P,disabled:M,type:A,dynamicSelectParams:R,multiple:$=!1,tooltip:V,showCopy:q,description:U,url:O,help:z}=d,B=b||M,[D,H,G,W,K]=(0,n.useMemo)(()=>{let e=[S,F,V,U,z].map(e=>k({content:e,render:I}));return e[1]||(e[1]=N("placeholder.input",{ns:"common"})),e},[S,F,V,U,z,I]),X=(0,n.useMemo)(()=>{let e=new Set;for(let t of L||[])for(let n of t.show_on||[])e.add(n.variable);return Array.from(e)},[L]),Y=(0,s.useStore)(x.form.store,e=>{let t={};for(let n of X)t[n]=e.values[n];return t}),J=(0,n.useMemo)(()=>L?.filter(e=>!e.show_on?.length||e.show_on.every(e=>Y[e.variable]===e.value)).map(e=>({label:k({content:e.label,render:I}),value:e.value}))||[],[L,I,Y]),Q=(0,s.useStore)(x.form.store,e=>e.values[x.name]),{data:Z,isLoading:ee,error:et}=(0,C.useTriggerPluginDynamicOptions)(R||{plugin_id:"",provider:"",action:"",parameter:"",credential_id:""},A===m.FormTypeEnum.dynamicSelect),en=(0,n.useMemo)(()=>Z?.options?Z.options.map(e=>({label:k({content:e.label,render:I}),value:e.value})):[],[Z,I]),es=(0,n.useCallback)(e=>{x.handleChange(e),w?.(x.name,e)},[x,w]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,c.cn)(l),children:[(0,t.jsxs)("div",{className:(0,c.cn)(i,P),children:[D,_&&!(0,n.isValidElement)(S)&&(0,t.jsx)("span",{className:"ml-1 text-text-destructive-secondary",children:"*"}),V&&(0,t.jsx)(f.default,{triggerTestId:"base-field-tooltip-trigger",popupContent:(0,t.jsx)("div",{className:"w-[200px]",children:G}),triggerClassName:"ml-0.5 w-4 h-4"})]}),(0,t.jsxs)("div",{className:(0,c.cn)(r),children:[[m.FormTypeEnum.textInput,m.FormTypeEnum.secretInput,m.FormTypeEnum.textNumber].includes(A)&&(0,t.jsx)(p.default,{id:x.name,name:x.name,className:(0,c.cn)(o,j[E?.validateStatus]?.componentClassName),value:Q||"",onChange:e=>{es(e.target.value)},onBlur:x.handleBlur,disabled:B,placeholder:H,...(e=>{switch(e){case m.FormTypeEnum.secretInput:return{type:"password",autoComplete:"new-password"};case m.FormTypeEnum.textNumber:return{type:"number"};default:return{type:"text"}}})(A),showCopyIcon:q}),A===m.FormTypeEnum.select&&!$&&(0,t.jsx)(v.default,{value:Q,onChange:e=>es(e),disabled:B,placeholder:H,options:J,triggerPopupSameWidth:!0,popupProps:{className:"max-h-[320px] overflow-y-auto"}}),A===m.FormTypeEnum.checkbox&&(0,t.jsx)(u,{title:T,value:Q,onChange:e=>x.handleChange(e),options:J,maxHeight:"200px"}),A===m.FormTypeEnum.dynamicSelect&&(0,t.jsx)(v.default,{options:en,value:Q,onChange:x.handleChange,disabled:B||ee,placeholder:ee?N("dynamicSelect.loading",{ns:"common"}):H,...et?{popupProps:{title:N("dynamicSelect.error",{ns:"common"}),titleClassName:"text-text-destructive-secondary"}}:!en.length?{popupProps:{title:N("dynamicSelect.noData",{ns:"common"})}}:{},triggerPopupSameWidth:!0,multiple:$}),A===m.FormTypeEnum.radio&&(0,t.jsx)("div",{className:(0,c.cn)(J.length<3?"flex items-center space-x-2":"space-y-2"),"data-testid":"radio-group",children:J.map(e=>(0,t.jsxs)("div",{className:(0,c.cn)("hover:bg-components-option-card-option-hover-bg hover:border-components-option-card-option-hover-border flex h-8 flex-[1] grow cursor-pointer items-center justify-center gap-2 rounded-lg border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary system-sm-regular",Q===e.value&&"border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary shadow-xs",B&&"cursor-not-allowed opacity-50",o),onClick:()=>!B&&es(e.value),children:[d.showRadioUI&&(0,t.jsx)(h.default,{className:"mr-2",isChecked:Q===e.value}),e.label]},e.value))}),A===m.FormTypeEnum.boolean&&(0,t.jsxs)(g.default.Group,{className:"flex w-fit items-center",value:Q,onChange:e=>x.handleChange(e),children:[(0,t.jsx)(g.default,{value:!0,className:"!mr-1",children:"True"}),(0,t.jsx)(g.default,{value:!1,children:"False"})]}),E?.validateStatus&&[m.FormItemValidateStatusEnum.Error,m.FormItemValidateStatusEnum.Warning].includes(E?.validateStatus)&&(0,t.jsx)("div",{className:(0,c.cn)("mt-1 px-0 py-[2px] system-xs-regular",j[E?.validateStatus].textClassName),children:E?.[j[E?.validateStatus].infoFieldName]})]})]}),U&&(0,t.jsx)("div",{className:"mt-4 text-text-tertiary system-xs-regular",children:W}),O&&(0,t.jsxs)("a",{className:"mt-4 flex items-center text-text-accent system-xs-regular",href:O,target:"_blank",children:[(0,t.jsx)("span",{className:"break-all",children:K}),(0,t.jsx)("div",{className:"i-ri-external-link-line ml-1 h-3 w-3 shrink-0"})]})]})});var E=e.i(301293),I=e.i(734962);let N=(0,n.memo)(e=>{let{formSchemas:l=[],defaultValues:i,formClassName:r,fieldClassName:o,labelClassName:d,inputContainerClassName:u,inputClassName:p,ref:g,disabled:h,formFromProps:v,onChange:f,onSubmit:x,preventDefaultSubmit:b=!1}=e,C=(0,n.useMemo)(()=>i||l.reduce((e,t)=>(t.default&&(e[t.name]=t.default),e),{}),[i]),k=(0,E.useForm)({defaultValues:C}),j=v||k,{getFormValues:N}=((e,t)=>{let{checkValidated:s}=((e,t)=>{let{notify:s}=(0,I.useToastContext)();return{checkValidated:(0,n.useCallback)(()=>{let n=e?.getAllErrors(),a=e.state.values;if(n){let e=n.fields,l=Object.keys(e).reduce((n,s)=>{let{show_on:l=[]}=t.find(e=>e.name===s)||{},i=l.reduce((e,t)=>(e[t.variable]=a[t.variable],e),{});return[...n,...l?.every(e=>i[e.variable]===e.value)?e[s].errors:[]]},[]);if(l.length)return s({type:"error",message:l[0]}),!1}return!0},[e,s,t])}})(e,t);return{getFormValues:(0,n.useCallback)(n=>{let{needCheckValidatedValues:a=!0,needTransformWhenSecretFieldIsPristine:l}=n,i=e?.store.state.values||{};return a?s()?{values:l?((e,t)=>{let n,s=t?.store.state.values||{},a=[];for(let n=0;n{n[e]&&(n[e]="[__HIDDEN__]")}),n})(t,e):i,isCheckValidated:!0}:{values:{},isCheckValidated:!1}:{values:i,isCheckValidated:!0}},[e,s,t])}})(j,l),{getValidators:T}=(()=>{let{t:e}=(0,a.useTranslation)(),t=y(),s=(0,n.useCallback)(e=>(0,n.isValidElement)(e)?"":"string"==typeof e?e:"object"==typeof e&&null!==e?t(e):void 0,[]);return{getValidators:(0,n.useCallback)(t=>{let{name:n,validators:a,required:l,label:i}=t,r=a,o=s(i);return l&&!a&&(r={onMount:t=>{let{value:s}=t;if(!s)return e("errorMsg.fieldRequired",{ns:"common",field:o||n})},onChange:t=>{let{value:s}=t;if(!s)return e("errorMsg.fieldRequired",{ns:"common",field:o||n})},onBlur:t=>{let{value:n}=t;if(!n)return e("errorMsg.fieldRequired",{ns:"common",field:o})}}),r},[e,s])}})(),[S,_]=(0,n.useState)({}),F=(0,s.useStore)(j.store,e=>{let t={};return l.forEach(n=>{let{show_on:s}=n;s?.length&&s.forEach(n=>{t[n.variable]=e.values[n.variable]})}),t}),L=(0,n.useCallback)(e=>{let t={...S};for(let n of e){let{name:e,value:s,errors:a,warnings:l,validateStatus:i,help:r}=n;void 0!==s&&j.setFieldValue(e,s);let o=i;!o&&(a&&a.length>0?o=m.FormItemValidateStatusEnum.Error:l&&l.length>0&&(o=m.FormItemValidateStatusEnum.Warning)),t[e]={validateStatus:o,help:r,errors:a,warnings:l}}_(t)},[j,S]);(0,n.useImperativeHandle)(g,()=>({getForm:()=>j,getFormValues:e=>N(e),setFields:L}),[j,N,L]);let P=(0,n.useCallback)(e=>{let n=l?.find(t=>t.name===e.name);return n?(0,t.jsx)(w,{field:e,formSchema:n,fieldClassName:o??n.fieldClassName,labelClassName:d??n.labelClassName,inputContainerClassName:u,inputClassName:p,disabled:h,onChange:f,fieldState:S[e.name]}):null},[l,o,d,u,p,h,f,S]),M=(0,n.useCallback)(e=>{let n=T(e),{name:s,show_on:a=[]}=e;return a?.every(e=>F[e.variable]===e.value)?(0,t.jsx)(j.Field,{name:s,validators:n,children:P},s):null},[P,j,T,F]);return l?.length?(0,t.jsx)("form",{className:(0,c.cn)(r),onSubmit:e=>{b&&(e.preventDefault(),e.stopPropagation()),x?.(e)},children:l.map(M)}):null});e.s(["BaseForm",0,N],610683);let T=(0,n.memo)(e=>{let{formSchemas:n=[],defaultValues:s,ref:a,formFromProps:l,...i}=e;return(0,t.jsx)(N,{ref:a,formSchemas:n,defaultValues:s,formClassName:"space-y-4",labelClassName:"h-6 flex items-center mb-1 system-sm-medium text-text-secondary",formFromProps:l,...i})});e.s(["default",0,T],588226)}]);