@boltic/swirl 1.0.2-sit.83 → 1.0.2-sit.85
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/swirl.es.js +33 -18
- package/dist/swirl.umd.js +3 -3
- package/package.json +1 -1
package/dist/swirl.umd.js
CHANGED
|
@@ -370,7 +370,7 @@ $2`).replace(/lambda\s+([^:]+):\n/g,"lambda $1: ").replace(/[ \t]+/g," ").trim()
|
|
|
370
370
|
`).map(c=>c.trimEnd()).join(`
|
|
371
371
|
`).trim(),u},cT=(e,t)=>{const r=e.state.selection.main,n=e.state.doc,i=n.lineAt(r.from),o=n.lineAt(r.to),s=[];let a=!0;for(let l=i.number;l<=o.number;l++){const c=n.line(l).text.trim();if(c&&!c.startsWith(t)){a=!1;break}}for(let l=i.number;l<=o.number;l++){const u=n.line(l),c=u.text;if(a){const f=c.match(new RegExp(`^(\\s*)${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s?`));f&&s.push({from:u.from,to:u.from+f[0].length,insert:f[1]})}else{const f=c.match(/^\s*/)?.[0]||"";s.push({from:u.from,to:u.from+f.length,insert:f+t+" "})}}s.length>0&&e.dispatch({changes:s})},eMe=e=>{const t=e.state.doc.toString(),r=!e.state.facet(Nt.editable),n=hp(e);return[...[{label:"Format Python",action:()=>{try{const o=JFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:o},effects:Nt.announce.of("Python code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Failed to format Python code")})}},disabled:r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Comment Lines",action:()=>cT(e,"#"),disabled:r,icon:d.jsx(Ue,{src:"ic_comment"}),divider:!0}],...n]},tMe=e=>{const t=e.state.doc.toString(),r=!e.state.facet(Nt.editable),n=hp(e);return[...[{label:"Format JavaScript",action:async()=>{try{const o=await zFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:o},effects:Nt.announce.of("JavaScript code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Failed to format JavaScript code")})}},disabled:r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Comment Lines",action:()=>cT(e,"//"),disabled:r,icon:d.jsx(Ue,{src:"ic_comment"}),divider:!0}],...n]},rMe=e=>{const t=e.state.doc.toString(),r=!e.state.facet(Nt.editable),n=hp(e);return[...[{label:"Format HTML",action:()=>{try{const o=XFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:o},effects:Nt.announce.of("HTML code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Failed to format HTML code")})}},disabled:r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Comment Lines",action:()=>{const o=e.state.selection.main,s=e.state.sliceDoc(o.from,o.to);if(s){const a=s.startsWith("<!--")&&s.endsWith("-->"),l=a?s.slice(4,-3):`<!-- ${s} -->`;e.dispatch({changes:{from:o.from,to:o.to,insert:l},effects:Nt.announce.of(a?"HTML comment removed":"HTML comment added")})}},disabled:r||e.state.selection.main.from===e.state.selection.main.to,icon:d.jsx(Ue,{src:"ic_comment"}),divider:!0}],...n]},nMe=e=>{const t=e.state.doc.toString();let r=!1;try{JSON.parse(t),r=!0}catch{r=!1}const n=!e.state.facet(Nt.editable),i=hp(e);return[...[{label:"Format JSON",action:async()=>{try{const s=await qFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:s},effects:Nt.announce.of("JSON code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Invalid JSON")})}},disabled:n||!r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Minify JSON",action:()=>{try{const s=JSON.stringify(JSON.parse(t));e.dispatch({changes:{from:0,to:e.state.doc.length,insert:s}})}catch{e.dispatch({effects:Nt.announce.of("Invalid JSON")})}},disabled:n||!r,icon:d.jsx(Ue,{src:"ic_format_align_center"}),divider:!0}],...i]},iMe=e=>{const t=e.state.doc.toString(),r=!e.state.facet(Nt.editable),n=hp(e);return[...[{label:"Format XML",action:()=>{try{const o=YFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:o},effects:Nt.announce.of("XML code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Failed to format XML code")})}},disabled:r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Comment Lines",action:()=>{const o=e.state.selection.main,s=e.state.sliceDoc(o.from,o.to);if(s){const a=s.startsWith("<!--")&&s.endsWith("-->"),l=a?s.slice(4,-3):`<!-- ${s} -->`;e.dispatch({changes:{from:o.from,to:o.to,insert:l},effects:Nt.announce.of(a?"XML comment removed":"XML comment added")})}},disabled:r||e.state.selection.main.from===e.state.selection.main.to,icon:d.jsx(Ue,{src:"ic_comment"}),divider:!0}],...n]},oMe=e=>{const t=e.state.doc.toString(),r=!e.state.facet(Nt.editable),n=hp(e);return[...[{label:"Format SQL",action:()=>{try{const o=KFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:o},effects:Nt.announce.of("SQL code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Failed to format SQL code")})}},disabled:r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Comment Lines",action:()=>cT(e,"--"),disabled:r,icon:d.jsx(Ue,{src:"ic_comment"}),divider:!0}],...n]},sMe=e=>{const t=e.state.doc.toString(),r=!e.state.facet(Nt.editable),n=hp(e);return[...[{label:"Format GraphQL",action:()=>{try{const o=ZFe(t);e.dispatch({changes:{from:0,to:e.state.doc.length,insert:o},effects:Nt.announce.of("GraphQL code formatted")})}catch{e.dispatch({effects:Nt.announce.of("Failed to format GraphQL code")})}},disabled:r,icon:d.jsx(Ue,{src:"ic_format_align_justify"})},{label:"Comment Lines",action:()=>cT(e,"#"),disabled:r,icon:d.jsx(Ue,{src:"ic_comment"}),divider:!0}],...n]},qz=Er.define({combine:e=>e.length?e[0]:"plaintext",static:!0}),aMe=Wi.fromClass(class{decorations;constructor(e){this.decorations=this.buildDecorations(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=this.buildDecorations(e.view))}buildDecorations(e){const t=new jl,r=/{{\s*([^{}]+?)\s*}}/g;for(const{from:n,to:i}of e.visibleRanges){const o=e.state.doc.sliceString(n,i);let s;for(;(s=r.exec(o))!==null;){const a=n+s.index,l=a+s[0].length,u=a+2,c=l-2;t.add(a,a+2,Nr.mark({class:"cm-double-curly-bracket"})),t.add(u,c,Nr.mark({class:"cm-double-curly-content"})),t.add(c,l,Nr.mark({class:"cm-double-curly-bracket"}))}}return t.finish()}},{decorations:e=>e.decorations}),Yz=new WeakMap,lMe=(e,t)=>{Yz.set(e,t)},uMe=e=>Yz.get(e),cMe=e=>{const t=!e.state.facet(Nt.editable);return[{label:"Undo",action:()=>Lu(e),disabled:t||Nh(e.state)===0},{label:"Redo",action:()=>ja(e),disabled:t||Lh(e.state)===0},{label:"Copy",action:()=>{const r=e.state.selection.main,n=e.state.sliceDoc(r.from,r.to);hd(n.length>0?n:e.state.doc.toString()),e.dispatch({effects:Nt.announce.of("Content copied to clipboard")})},disabled:!1},{label:"Select All",action:()=>{e.dispatch({selection:{anchor:0,head:e.state.doc.length}})},disabled:!1}]},dMe=e=>{if(!e||typeof e!="string")return!1;const t=e.trim();if(!(t.startsWith("{")||t.startsWith("[")))return!1;try{const r=JSON.parse(t);return typeof r=="object"&&r!==null}catch{return!1}},fMe=e=>{if(!e||typeof e!="string")return!1;const t=e.trim();return t?[/^def\s+\w+\s*\(/m,/^class\s+\w+/m,/^import\s+\w+/m,/^from\s+\w+\s+import/m,/if\s+__name__\s*==\s*['"']__main__['"']/m,/print\s*\(/m,/^\s*#.*$/m,/:\s*$/m].some(n=>n.test(t)):!1},pMe=e=>{if(!e||typeof e!="string")return!1;const t=e.trim();return t?[/^function\s+\w+\s*\(/m,/^const\s+\w+\s*=/m,/^let\s+\w+\s*=/m,/^var\s+\w+\s*=/m,/console\.log\s*\(/m,/=>\s*\{/m,/\/\/.*$/m,/\/\*[\s\S]*?\*\//m,/\$\{.*\}/m].some(n=>n.test(t)):!1},hMe=e=>{if(!e||typeof e!="string")return!1;const t=e.trim();return t?[/^<!DOCTYPE\s+html/i,/^<html/i,/<\/?[a-z][\s\S]*>/i,/<!--[\s\S]*?-->/m,/<[a-z]+[^>]*\/?>/i,/<\/[a-z]+>/i].some(n=>n.test(t)):!1},AMe=e=>{if(!e||typeof e!="string")return!1;const t=e.trim();return t?[/^<\?xml\s+version/i,/^<[a-z_][\w:.-]*(\s+[a-z_][\w:.-]*\s*=\s*["'][^"']*["'])*\s*\/?>/i,/<\/[a-z_][\w:.-]*>/i,/<!--[\s\S]*?-->/m,/<!\[CDATA\[[\s\S]*?\]\]>/m,/xmlns\s*[:=]/i,/^<[a-z_][\w:.-]*\s*\/>/i].some(n=>n.test(t)):!1},mMe=e=>{if(!e||typeof e!="string")return!1;const t=e.trim();return t?[/^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|ALTER|DROP|TRUNCATE|GRANT|REVOKE)\s+/i,/\b(FROM|WHERE|JOIN|INNER|LEFT|RIGHT|OUTER|ON|GROUP BY|ORDER BY|HAVING)\b/i,/\b(TABLE|DATABASE|INDEX|VIEW|PROCEDURE|FUNCTION|TRIGGER)\b/i,/\b(INT|VARCHAR|CHAR|TEXT|BOOLEAN|DATETIME|TIMESTAMP|DECIMAL|FLOAT)\b/i,/--.*$/m,/\/\*[\s\S]*?\*\//m,/\bCOUNT\s*\(|\bSUM\s*\(|\bAVG\s*\(|\bMAX\s*\(|\bMIN\s*\(/i].some(n=>n.test(t)):!1},gMe=e=>{const t=e.state.facet(qz),r=e.state.doc.toString(),n=dMe(r),i=fMe(r),o=pMe(r),s=hMe(r),a=AMe(r),l=mMe(r);return t==="json"||t==="plaintext"&&n?nMe(e):t==="python"||t==="plaintext"&&i?eMe(e):t==="javascript"||t==="plaintext"&&o?tMe(e):t==="html"||t==="plaintext"&&s?rMe(e):t==="xml"||t==="plaintext"&&a?iMe(e):t==="sql"||t==="plaintext"&&l?oMe(e):t==="graphql"?sMe(e):cMe(e)},EMe=Nt.domEventHandlers({contextmenu:(e,t)=>{e.preventDefault();const r=uMe(t);if(!r)return!0;const n=gMe(t);return n.length>0&&r(n,{x:e.clientX,y:e.clientY}),!0}}),OMe=(e,t,r,n,i,o)=>{const a=i&&["md","lg","xl","xxl"].includes(i)?'"Fira Code", "Source Code Pro", "Cascadia Code", "JetBrains Mono", "Monaco", "Menlo", "Courier New", monospace':'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';return{"&":{fontSize:"14px",fontFamily:a,backgroundColor:e.palette.common.white,...t?.border!=="none"?{borderRadius:"8px",border:`1px solid ${r||n?e.palette.error.main:e.palette.grey[200]}`,boxShadow:e.shadows[0]}:{borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"},height:"100%",overflow:"hidden",...t},"&.cm-focused":{outline:"none !important"},".cm-context-menu":{transition:"background 0.2s ease"},".cm-context-menu:hover":{backgroundColor:e.palette.neutral.soft.bg},".cm-gutters":{borderRight:`1px solid ${e.palette.grey[200]}`,fontSize:"16px",color:e.palette.text.lineNumbers},".cm-gutter.cm-foldGutter":{width:"16px"},".cm-scroller":{...t?.border!=="none"&&{borderTopRightRadius:"8px",borderBottomRightRadius:"8px"},height:"100%",overflow:"auto",fontFamily:a},".cm-content":{padding:"16px 40px 16px 12px",minHeight:"100%",caretColor:e?.palette?.text?.primary,color:e.palette.text.codeEditor},".cm-double-curly-bracket":{color:e.palette.success[40]},".cm-double-curly-content":{fontWeight:500},".cm-tooltip-below":{maxWidth:"25rem",zIndex:1e4,backgroundColor:e.palette.common.white},".cm-tooltip-above":{display:"none"},".cm-tooltip-autocomplete":{maxWidth:"25rem",boxShadow:`0 0.125rem 0.25rem 0 ${e.palette.secondary.main}, 0 0.0625rem 0.125rem 0 ${e.palette.secondary.main}`,zIndex:1e4,backgroundColor:e.palette.common.white,overflow:"hidden",borderRadius:"8px",BorderColor:e.palette.grey[40]},".cm-tooltip-autocomplete ul li[aria-selected]":{background:e.palette.neutral.soft.bg,color:e.palette.text.primary},".cm-tooltip.cm-tooltip-autocomplete > ul":{gap:"4px",fontFamily:"Inter"},".cm-tooltip.cm-tooltip-autocomplete > ul > li":{padding:"4px"},".cm-completionIcon":{color:e.palette.primary.main},".cm-completionDetail":{color:e.palette.text.tertiary},".cm-completionLabel":{color:e.palette.text.primary,fontWeight:500,marginRight:"6px"},".cm-line":{padding:"0"},".cm-activeLine":{backgroundColor:"transparent"},".cm-activeLineGutter":{backgroundColor:e.palette.neutral.soft.bg},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:e.palette.neutral.soft.bg},".cm-selectionMatch":{backgroundColor:e.palette.neutral.soft.bg},".cm-tooltip":{position:"absolute !important",zIndex:1e4,backgroundColor:e.palette.common.white,transition:"none !important"},".cm-tooltip-lint":{position:"absolute !important",zIndex:1e4,backgroundColor:e.palette.common.white,width:"25rem",border:`1px solid ${e.palette.grey[200]}`,borderRadius:"8px",boxShadow:`0 0.125rem 0.25rem 0 ${e.palette.secondary.main}, 0 0.0625rem 0.125rem 0 ${e.palette.secondary.main}`},".cm-panel.cm-search label":{display:"flex !important"},...o&&{'.cm-panel.cm-search label[for*="replace"]':{display:"none !important"},'.cm-panel.cm-search input[placeholder*="Replace"], .cm-panel.cm-search input[placeholder*="replace"]':{display:"none !important"},'.cm-panel.cm-search button[name="replace"], .cm-panel.cm-search button[name="replaceAll"]':{display:"none !important"},'.cm-panel.cm-search .cm-textfield:has(input[placeholder*="Replace"]), .cm-panel.cm-search .cm-textfield:has(input[placeholder*="replace"])':{display:"none !important"},".cm-panel.cm-search":{display:"flex !important",flexWrap:"wrap !important",alignItems:"center !important",gap:"0.5rem !important","& > *":{margin:"0 !important"},'& button[name="all"]':{marginRight:"0.5rem !important"},'& .cm-search-option, & .cm-search-label:not([for*="replace"])':{marginLeft:"0 !important"}}}}},yMe=Nt.theme({".cm-completionIcon-string::before":{content:'"🔤"',display:"inline-block"},".cm-completionIcon-number::before":{content:'"🔢"',display:"inline-block"},".cm-completionIcon-object::before":{content:'"{.}"',display:"inline-block"},".cm-completionIcon-array::before":{content:'"[]"',display:"inline-block"},".cm-completionIcon-boolean::before":{content:'"✔️"',display:"inline-block"},".cm-completionIcon-null::before":{content:'"🚫"',display:"inline-block"}});var RP,Kz;function vMe(){if(Kz)return RP;Kz=1;var e="Expected a function",t="__lodash_hash_undefined__",r="[object Function]",n="[object GeneratorFunction]",i="[object Symbol]",o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/,a=/^\./,l=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,u=/[\\^$.*+?()[\]{}|]/g,c=/\\(\\)?/g,f=/^\[object .+?Constructor\]$/,p=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,h=typeof self=="object"&&self&&self.Object===Object&&self,A=p||h||Function("return this")();function g(Ie,Ve){return Ie?.[Ve]}function m(Ie){var Ve=!1;if(Ie!=null&&typeof Ie.toString!="function")try{Ve=!!(Ie+"")}catch{}return Ve}var O=Array.prototype,y=Function.prototype,T=Object.prototype,v=A["__core-js_shared__"],C=(function(){var Ie=/[^.]+$/.exec(v&&v.keys&&v.keys.IE_PROTO||"");return Ie?"Symbol(src)_1."+Ie:""})(),x=y.toString,b=T.hasOwnProperty,w=T.toString,R=RegExp("^"+x.call(b).replace(u,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),I=A.Symbol,P=O.splice,k=J(A,"Map"),N=J(Object,"create"),L=I?I.prototype:void 0,M=L?L.toString:void 0;function B(Ie){var Ve=-1,He=Ie?Ie.length:0;for(this.clear();++Ve<He;){var Ee=Ie[Ve];this.set(Ee[0],Ee[1])}}function H(){this.__data__=N?N(null):{}}function j(Ie){return this.has(Ie)&&delete this.__data__[Ie]}function X(Ie){var Ve=this.__data__;if(N){var He=Ve[Ie];return He===t?void 0:He}return b.call(Ve,Ie)?Ve[Ie]:void 0}function F(Ie){var Ve=this.__data__;return N?Ve[Ie]!==void 0:b.call(Ve,Ie)}function V(Ie,Ve){var He=this.__data__;return He[Ie]=N&&Ve===void 0?t:Ve,this}B.prototype.clear=H,B.prototype.delete=j,B.prototype.get=X,B.prototype.has=F,B.prototype.set=V;function G(Ie){var Ve=-1,He=Ie?Ie.length:0;for(this.clear();++Ve<He;){var Ee=Ie[Ve];this.set(Ee[0],Ee[1])}}function D(){this.__data__=[]}function $(Ie){var Ve=this.__data__,He=ne(Ve,Ie);if(He<0)return!1;var Ee=Ve.length-1;return He==Ee?Ve.pop():P.call(Ve,He,1),!0}function U(Ie){var Ve=this.__data__,He=ne(Ve,Ie);return He<0?void 0:Ve[He][1]}function Y(Ie){return ne(this.__data__,Ie)>-1}function z(Ie,Ve){var He=this.__data__,Ee=ne(He,Ie);return Ee<0?He.push([Ie,Ve]):He[Ee][1]=Ve,this}G.prototype.clear=D,G.prototype.delete=$,G.prototype.get=U,G.prototype.has=Y,G.prototype.set=z;function Q(Ie){var Ve=-1,He=Ie?Ie.length:0;for(this.clear();++Ve<He;){var Ee=Ie[Ve];this.set(Ee[0],Ee[1])}}function W(){this.__data__={hash:new B,map:new(k||G),string:new B}}function q(Ie){return ie(this,Ie).delete(Ie)}function Z(Ie){return ie(this,Ie).get(Ie)}function te(Ie){return ie(this,Ie).has(Ie)}function ae(Ie,Ve){return ie(this,Ie).set(Ie,Ve),this}Q.prototype.clear=W,Q.prototype.delete=q,Q.prototype.get=Z,Q.prototype.has=te,Q.prototype.set=ae;function ne(Ie,Ve){for(var He=Ie.length;He--;)if(ge(Ie[He][0],Ve))return He;return-1}function ue(Ie,Ve){Ve=K(Ve,Ie)?[Ve]:se(Ve);for(var He=0,Ee=Ve.length;Ie!=null&&He<Ee;)Ie=Ie[Ae(Ve[He++])];return He&&He==Ee?Ie:void 0}function Oe(Ie){if(!Qe(Ie)||le(Ie))return!1;var Ve=je(Ie)||m(Ie)?R:f;return Ve.test(fe(Ie))}function Te(Ie){if(typeof Ie=="string")return Ie;if(Je(Ie))return M?M.call(Ie):"";var Ve=Ie+"";return Ve=="0"&&1/Ie==-1/0?"-0":Ve}function se(Ie){return ye(Ie)?Ie:he(Ie)}function ie(Ie,Ve){var He=Ie.__data__;return re(Ve)?He[typeof Ve=="string"?"string":"hash"]:He.map}function J(Ie,Ve){var He=g(Ie,Ve);return Oe(He)?He:void 0}function K(Ie,Ve){if(ye(Ie))return!1;var He=typeof Ie;return He=="number"||He=="symbol"||He=="boolean"||Ie==null||Je(Ie)?!0:s.test(Ie)||!o.test(Ie)||Ve!=null&&Ie in Object(Ve)}function re(Ie){var Ve=typeof Ie;return Ve=="string"||Ve=="number"||Ve=="symbol"||Ve=="boolean"?Ie!=="__proto__":Ie===null}function le(Ie){return!!C&&C in Ie}var he=Se(function(Ie){Ie=rt(Ie);var Ve=[];return a.test(Ie)&&Ve.push(""),Ie.replace(l,function(He,Ee,_e,we){Ve.push(_e?we.replace(c,"$1"):Ee||He)}),Ve});function Ae(Ie){if(typeof Ie=="string"||Je(Ie))return Ie;var Ve=Ie+"";return Ve=="0"&&1/Ie==-1/0?"-0":Ve}function fe(Ie){if(Ie!=null){try{return x.call(Ie)}catch{}try{return Ie+""}catch{}}return""}function Se(Ie,Ve){if(typeof Ie!="function"||Ve&&typeof Ve!="function")throw new TypeError(e);var He=function(){var Ee=arguments,_e=Ve?Ve.apply(this,Ee):Ee[0],we=He.cache;if(we.has(_e))return we.get(_e);var ee=Ie.apply(this,Ee);return He.cache=we.set(_e,ee),ee};return He.cache=new(Se.Cache||Q),He}Se.Cache=Q;function ge(Ie,Ve){return Ie===Ve||Ie!==Ie&&Ve!==Ve}var ye=Array.isArray;function je(Ie){var Ve=Qe(Ie)?w.call(Ie):"";return Ve==r||Ve==n}function Qe(Ie){var Ve=typeof Ie;return!!Ie&&(Ve=="object"||Ve=="function")}function $e(Ie){return!!Ie&&typeof Ie=="object"}function Je(Ie){return typeof Ie=="symbol"||$e(Ie)&&w.call(Ie)==i}function rt(Ie){return Ie==null?"":Te(Ie)}function tt(Ie,Ve,He){var Ee=Ie==null?void 0:ue(Ie,Ve);return Ee===void 0?He:Ee}return RP=tt,RP}var TMe=vMe();const Ap=Un(TMe),SMe=e=>!e||typeof e!="string"?"":e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/`/g,"\\`").replace(/\$/g,"\\$").replace(/\n{3,}/g,`
|
|
372
372
|
|
|
373
|
-
`).trim(),Zz={functionActivity:{javascript:"Extract Activity Result using Activities' name, workflow_id, execution_id, global_variables from result, Use lodash methods, Use GET / POST Axios methods",python:"Extract Activity Result using Activities' name, workflow_id, execution_id, global_variables from result."},emailActivity:{placeholder:"Generate an email template with a structured layout, including a greeting, body content, and closing."},gmailActivity:{placeholder:"Create a Gmail template with formatted sections such as greetings, content, and signature."},template:{placeholder:"Generate a Nunjucks template with placeholders, loops, conditionals, and structured content based on the provided scenario."},browserbase:{placeholder:"Generate a browser-based activity to automate web interactions and data extraction."},graphql:{placeholder:"Generate GraphQL variables as a JSON object with appropriate field names and values for your query.",query:"Generate a GraphQL query with appropriate fields, arguments, and nested selections for your use case."},graphqlQuery:{placeholder:"Generate a GraphQL query with appropriate fields, arguments, and nested selections for your use case."},graphqlVariables:{placeholder:"Generate GraphQL variables as a JSON object with appropriate field names and values for your query."}},xMe=(e,t,r)=>{const n=SMe(t);switch(e){case"functionActivity":if(r==="javascript")return[{role:"system",content:"You are a professional JavaScript developer. Your job is to generate JavaScript functions. You strive for accuracy over speed, and succinct code over verbose code. When given a prompt, you only ever return code that can be run."},{role:"user",content:`You are a helpful assistant and a JavaScript expert. Your job is to write JavaScript functions and invoke them. I am a computer that runs JavaScript code. Take into account the following context and constraints:
|
|
373
|
+
`).trim(),Zz={functionActivity:{javascript:"Extract Activity Result using Activities' name, workflow_id, execution_id, global_variables from result, Use lodash methods, Use GET / POST Axios methods",python:"Extract Activity Result using Activities' name, workflow_id, execution_id, global_variables from result."},emailActivity:{placeholder:"Generate an email template with a structured layout, including a greeting, body content, and closing."},gmailActivity:{placeholder:"Create a Gmail template with formatted sections such as greetings, content, and signature."},template:{placeholder:"Generate a Nunjucks template with placeholders, loops, conditionals, and structured content based on the provided scenario."},browserbase:{placeholder:"Generate a browser-based activity to automate web interactions and data extraction."},graphql:{placeholder:"Generate GraphQL variables as a JSON object with appropriate field names and values for your query.",query:"Generate a GraphQL query with appropriate fields, arguments, and nested selections for your use case."},graphqlQuery:{placeholder:"Generate a GraphQL query with appropriate fields, arguments, and nested selections for your use case."},graphqlVariables:{placeholder:"Generate GraphQL variables as a JSON object with appropriate field names and values for your query."},FyndAIPIM:{placeholder:"Generate a Fynd AI PIM payload as a JSON object — e.g. an attribute, category, template, inbound connector, or mapper definition matching the selected operation."},FyndCommerceB2B:{placeholder:"Generate a Fynd Commerce B2B payload as a JSON object — e.g. a contract, ladder, or quotation body matching the selected operation."},FyndEngage:{placeholder:"Generate a Fynd Engage payload as a JSON object — e.g. a user, tier, wallet, or order body matching the selected operation."},FyndKonnect:{placeholder:"Generate a Fynd Konnect payload as a JSON object matching the selected operation."},FyndTMS:{placeholder:"Generate a Fynd TMS payload as a JSON object — e.g. a shipment, trip, or slot body matching the selected operation."}},xMe=(e,t,r)=>{const n=SMe(t);switch(e){case"functionActivity":if(r==="javascript")return[{role:"system",content:"You are a professional JavaScript developer. Your job is to generate JavaScript functions. You strive for accuracy over speed, and succinct code over verbose code. When given a prompt, you only ever return code that can be run."},{role:"user",content:`You are a helpful assistant and a JavaScript expert. Your job is to write JavaScript functions and invoke them. I am a computer that runs JavaScript code. Take into account the following context and constraints:
|
|
374
374
|
1. The following libraries are available and can be used if required:
|
|
375
375
|
- **lodash**: Methods can be accessed using the _ (underscore) object, e.g., _.map, _.filter.
|
|
376
376
|
- **crypto**: Methods can be accessed using the crypto object, e.g., crypto.generateKeyPairSync.
|
|
@@ -432,7 +432,7 @@ $2`).replace(/lambda\s+([^:]+):\n/g,"lambda $1: ").replace(/[ \t]+/g," ").trim()
|
|
|
432
432
|
7. Use placeholders like {{ }} from previous activity results where it makes sense for dynamic data.
|
|
433
433
|
8. Return only the JSON object without any additional explanations or formatting.`}];default:return[]}},bMe=(e,t)=>{function r(i){const o=[],s=/([a-zA-Z_$][a-zA-Z0-9_$]*)|\[(\d+)\]|\["([^"]+)"\]|\['([^']+)'\]/g;let a;for(;a=s.exec(i);){const[,l,u,c,f]=a;o.push(l??u??c??f)}return o}const n=JSON.parse(JSON.stringify(e));for(const i in n){const o=n[i];if(typeof o=="object"){delete o.canvasNodeData,delete o.canvasActivityData;for(const s in o)typeof o[s]=="object"&&(delete o[s].canvasNodeData,delete o[s].canvasActivityData)}}return i=>{const{state:o,pos:s}=i,a=o.doc.lineAt(s),l=a.text.slice(0,s-a.from),u=s>0?o.doc.sliceString(s-1,s):"";if(!u||/\s/.test(u)||u==="}")return null;const c=t==="javascript"||t==="typescript",f=l.includes("{{")&&l.lastIndexOf("{{")>l.lastIndexOf("}}");if(!f&&!c)return null;const p=f?l.match(/{{\s*([a-zA-Z0-9_.$\[\]"']+)$/):l.match(/([a-zA-Z0-9_.$\[\]"']+)$/);if(!p||!p[1])return null;const h=p[1];if(!h||h.trim().length===0)return null;const A=r(h);if(A.length===0&&!h.endsWith("."))return null;const g=h.endsWith("."),m=g?A.join("."):A.slice(0,-1).join("."),O=g?"":A[A.length-1],y=s-(O?.length||0),T=m?Ap(n,m):n;if(!T||typeof T!="object")return null;const v=Object.keys(T).map(C=>{const x=T[C],w=Array.isArray(x)?"array":typeof x;return{label:C,type:w,detail:typeof x=="object"?JSON.stringify(x,null,2):String(x),apply:C}});return{from:y,options:v,filter:!0}}},CMe=[{key:"Ctrl-z",mac:"Cmd-z",run:Lu,preventDefault:!0},{key:"Ctrl-y",mac:"Cmd-Shift-z",run:ja,preventDefault:!0},{key:"Ctrl-Shift-z",run:ja,preventDefault:!0}],Ss={InvalidSymbol:1,InvalidNumberFormat:2,PropertyNameExpected:3,ValueExpected:4,ColonExpected:5,CommaExpected:6,CloseBraceExpected:7,CloseBracketExpected:8,EndOfFileExpected:9,InvalidCommentToken:10,UnexpectedEndOfComment:11,UnexpectedEndOfString:12,UnexpectedEndOfNumber:13,InvalidUnicode:14,InvalidEscapeCharacter:15,InvalidCharacter:16},_Me=e=>{switch(e){case Ss.InvalidSymbol:return"Invalid symbol encountered while parsing";case Ss.InvalidNumberFormat:return"Number format is invalid";case Ss.PropertyNameExpected:return"Expected a property name";case Ss.ValueExpected:return"Expected a value";case Ss.ColonExpected:return"Expected a colon";case Ss.CommaExpected:return"Expected a comma";case Ss.CloseBraceExpected:return"Expected a closing brace }";case Ss.CloseBracketExpected:return"Expected a closing bracket ]";case Ss.EndOfFileExpected:return"Expected end of file";case Ss.InvalidCommentToken:return"Invalid comment token";case Ss.UnexpectedEndOfComment:return"Comment was not properly closed";case Ss.UnexpectedEndOfString:return"String was not properly closed";case Ss.UnexpectedEndOfNumber:return"Number is incomplete or malformed";case Ss.InvalidUnicode:return"Invalid Unicode sequence";case Ss.InvalidEscapeCharacter:return"Invalid escape character in string";case Ss.InvalidCharacter:return"Invalid character encountered";default:return`Unknown parse error (code: ${e})`}},wMe=e=>e?"__TEMPLATE_VAR__":'"__TEMPLATE_VAR__"',IMe=(e,t,r)=>{let n=t-1,i=r;for(;n>=0&&e[n]!=='"'&&e[n]!==`
|
|
434
434
|
`;)n--;for(;i<e.length&&e[i]!=='"'&&e[i]!==`
|
|
435
|
-
`;)i++;return n>=0&&i<e.length&&e[n]==='"'&&e[i]==='"'},Jz=e=>{const t=[],r=/\{\{[^}]*\}\}/g;let n;for(;(n=r.exec(e))!==null;){const i=n[0],o=n.index,s=n.index+i.length,a=IMe(e,o,s),l=wMe(a);t.push({start:o,end:s,content:i,replacement:l,isInsideQuotes:a})}return t},eX=(e,t)=>{let r=e,n=0;for(const i of t){const o=i.start+n,s=i.end+n;r=r.slice(0,o)+i.replacement+r.slice(s),n+=i.replacement.length-i.content.length}return r},DMe=e=>{const t=r=>{if(r.type==="object"&&r.children){const n=new Set;for(const i of r.children){const s=i.children?.[0]?.value;if(!s||typeof s!="string"||s==="__TEMPLATE_VAR__")continue;if(n.has(s))return!1;n.add(s);const a=i.children?.[1];if(a&&!t(a))return!1}}else if(r.type==="array"&&r.children){for(const n of r.children)if(!t(n))return!1}return!0};return t(e)},RMe=(e,t)=>{const r=e.trim();if(t.length!==1)return!1;const n=t[0];return r===n.content},PMe=(e,t,r=!0,n=!1,i=!1)=>e!=="json"?[]:nG(o=>{const s=o.state.doc.toString();if(s.trim()==="")return[];const a=[],l=Jz(s),u=RMe(s,l),c=eX(s,l),f=[],p=Vm(c,f);if(n){if(u)return t&&t([]),[];for(const y of l)y.isInsideQuotes||a.push({from:y.start,to:y.end,severity:"error",message:`Template variable "${y.content}" must be quoted in JSON GUI. Use "${y.content}" instead.`});const h=s.trim(),A=[],g=Vm(h,A),m=y=>!y||y.type!=="array"||!y.children?!1:y.children.every(T=>T.type==="object");((y,T)=>{if(y&&!T){if(y.type==="object")return;if(y.type==="array"){if(!i){a.push({from:0,to:s.length,severity:"error",message:'JSON GUI requires proper structure. Use format like {"key": "value"}'});return}m(y)||a.push({from:0,to:s.length,severity:"error",message:"When using an array at the root, it must be an array of objects."});return}a.push({from:0,to:s.length,severity:"error",message:'JSON GUI requires proper structure. Use format like {"key": "value"} or [{"key": "value"}].'})}else if(h&&h!=="")if(p&&(p.type==="object"||p.type==="array")){if(p.type==="object")return;if(p.type==="array"){if(!i){a.push({from:0,to:s.length,severity:"error",message:""});return}m(p)||a.push({from:0,to:s.length,severity:"error",message:"When using an array at the root, it must be an array of objects."});return}}else a.push({from:0,to:s.length,severity:"error",message:'JSON GUI requires proper key-value structure. Use format like {"key": "value"}.'})})(g,A.length>0)}for(const h of f){const A=_Me(h.error);let g=h.offset;for(const O of l){const y=O.content.length-O.replacement.length;h.offset>O.start&&(g+=y)}if(!l.some(O=>g>=O.start&&g<O.end||g+h.length>O.start&&g+h.length<=O.end||g<=O.start&&g+h.length>=O.end)){const O=o.state.doc.lineAt(g);a.push({from:g,to:g+h.length,severity:"error",message:`Syntax error: ${A} on line ${O.number}`})}}if(p&&r){const h=A=>{if(A.type==="object"&&A.children){const g=new Map;for(const m of A.children){const O=m.children?.[0],y=O?.value;if(!y||typeof y!="string"||y==="__TEMPLATE_VAR__")continue;if(g.has(y)){let v=O.offset+1;for(const x of l){const b=x.content.length-x.replacement.length;O.offset>x.start&&(v+=b)}if(!l.some(x=>v>=x.start&&v<x.end||v+y.length>x.start&&v+y.length<=x.end||v<=x.start&&v+y.length>=x.end)){const x=o.state.doc.lineAt(v);a.push({from:v,to:v+y.length,severity:"error",message:`Duplicate key "${y}" found on line ${x.number}. This may corrupt the JSON GUI data.`})}}else g.set(y,O);const T=m.children?.[1];T&&h(T)}}else if(A.type==="array"&&A.children)for(const g of A.children)h(g)};h(p)}return t&&t(a),a}),NMe=[],tX={json:KH(),javascript:aD({jsx:!0,typescript:!0}),html:qH(),xml:MV(),plaintext:[],sql:_D(),python:AV(),graphql:NMe},LMe=e=>{const t=E.useTheme(),{showMenu:r,contextMenuElement:n}=QFe(),{value:i,onChange:o,onFocus:s,onBlur:a,language:l="plaintext",height:u="150px",suggestionsData:c={},placeholder:f,viewOnly:p=!1,className:h,error:A,errorMsg:g,codeEditorStyles:m={},showSuggestions:O,noDuplicateKeys:y=!0,enableJsonGuiValidation:T=!1,handleValidate:v,loading:C=!1,suggestionLabel:x,allowArrayAtRoot:b=!1,...w}=e,R=_.useMemo(()=>c&&typeof c=="object"&&Object.keys(c).length>0?c:{},[JSON.stringify(c)]),[I,P]=_.useState(null),k=_.useRef(null),N=_.useRef(null),L=ct.useDispatch(),M=_.useRef(null),B=_.useRef(null),[H,j]=_.useState(!1),X=Rt.useNodes(),{canvasWorkflow:F,activityExecutionData:V}=ct.useSelector(Ae=>Ae.canvas),{WORKFLOW_URLS:G,ENTITY_ID:D="",analytics:$,openAddonModal:U,currentSubscription:Y}=bi(),{VORTEX_MAIN_URL:z}=G,Q=xo(),W=xn(Q),Z=xn(Dr.VERSION)||W,{setNodes:te,getEdges:ae}=Rt.useReactFlow(),{MCP_INTEGRATION_FORM:ne}=aa(),ue=Ae=>{try{if(l!=="json")return!0;const fe=Jz(Ae);if(T&&fe.length===1&&Ae.trim()===fe[0].content)return!0;const Se=eX(Ae,fe),ge=[],ye=Vm(Se,ge);return ye?ge.length>0?!1:y?DMe(ye):!0:!0}catch{return!1}};_.useEffect(()=>{if(B.current&&i!==B.current.state.doc.toString()){const Ae=B.current.hasFocus;B.current.dispatch({changes:{from:0,to:B.current.state.doc.length,insert:i}}),Ae&&requestAnimationFrame(()=>{B.current?.focus()})}},[i]),_.useEffect(()=>{if(!M.current)return;const Ae=Nt.theme({...OMe(t,m,A,g,e.size,p)}),fe=Nt.updateListener.of($e=>{try{if($e.docChanged&&!p){const Je=$e.state.doc.toString();(ue(Je)||!T)&&o?.(Je)}if(($e.docChanged||$e.selectionSet)&&!p)try{const Je=$e.state.doc.toString(),rt=$e.state.selection.main.head;if(Je.slice(0,rt).endsWith("")){const Ie=M.current,Ve=Ie?.querySelector(".cm-cursor"),He=document.getElementById("suggestion-popover"),_e=!!Ie?.closest('[data-testid$="-full-mode"]'),we=He&&He.isConnected;if(Ve&&I===null&&O&&!we)if(_e){const ee=new CustomEvent("suggestions-about-to-open",{detail:{shouldShift:!0}});window.dispatchEvent(ee);const de=()=>{const be=Ie?.querySelector(".cm-cursor"),Ge=document.getElementById("suggestion-popover");be&&!Ge&&I===null&&P(be),window.removeEventListener("dialog-reposition-complete",de)};window.addEventListener("dialog-reposition-complete",de),setTimeout(()=>{window.removeEventListener("dialog-reposition-complete",de);const be=Ie?.querySelector(".cm-cursor"),Ge=document.getElementById("suggestion-popover");be&&!Ge&&I===null&&P(be)},400)}else P(Ve)}else P(null)}catch{}}catch{}}),Se=Nt.domEventHandlers({focus:()=>{try{const $e=B.current?.state.doc.toString()||"";if((ue($e)||!T)&&s?.($e),I===null&&O&&Object.keys(R).length>0){const Je=M.current,rt=Je?.querySelector(".cm-cursor"),tt=document.getElementById("suggestion-popover"),Ve=!!Je?.closest('[data-testid$="-full-mode"]');if(rt&&!tt)if(Ve){const He=new CustomEvent("suggestions-about-to-open",{detail:{shouldShift:!0}});window.dispatchEvent(He);const Ee=()=>{const _e=Je?.querySelector(".cm-cursor"),we=document.getElementById("suggestion-popover");_e&&!we&&I===null&&P(_e),window.removeEventListener("dialog-reposition-complete",Ee)};window.addEventListener("dialog-reposition-complete",Ee),setTimeout(()=>{window.removeEventListener("dialog-reposition-complete",Ee);const _e=Je?.querySelector(".cm-cursor"),we=document.getElementById("suggestion-popover");_e&&!we&&I===null&&P(_e)},400)}else P(rt)}}catch{}return!1},blur:()=>{try{const $e=B.current?.state.doc.toString()||"";try{(ue($e)||!T)&&a?.($e)}catch{}}catch{}return!1}}),ge=tX[l]||tX.plaintext;let ye=null;try{ye=bMe(R,l)}catch{ye=()=>null}const je=Dn.create({doc:i,extensions:[QD,ge,qz.of(l),U2({newGroupDelay:500}),Uf.of(CMe),qy({maxRenderedOptions:100,defaultKeymap:!0,icons:!0}),Dn.languageData.of(()=>[{...Object.keys(R).length>0&&O&&{autocomplete:ye}}]),aMe,Ae,l==="json"?[PMe(l,v,y,T,b)]:[],EMe,fe,yMe,Nt.lineWrapping,XI(f||"Enter text here"),Se,Dn.readOnly.of(!!p),Nt.editable.of(!p),...p?[Nt.contentAttributes.of({tabindex:"0"}),Nt.domEventHandlers({paste:$e=>($e.preventDefault(),!0)}),Uf.of([{key:"Ctrl-v",mac:"Cmd-v",run:()=>!0,preventDefault:!0},{key:"Ctrl-x",mac:"Cmd-x",run:()=>!0,preventDefault:!0}])]:[],GV({top:!0})]}),Qe=new Nt({state:je,parent:M.current});return B.current=Qe,lMe(Qe,r),()=>Qe.destroy()},[R,l]),_.useEffect(()=>()=>{N.current&&clearTimeout(N.current),B?.current?.dispatch({changes:{from:0,to:B.current.state.doc.length,insert:""}}),B.current?.destroy()},[]);const Oe=async Ae=>{const fe=[...Array.isArray(X)?X:[]],Se={nodes:[hc({...Ae})],result:G0(F,X,V,Ae?.id,ae())};j(!0);const{success:ge,isError:ye,data:je}=await V0(Ae,L,z,D,fe,X,Se,N,$,Z,U,Y);return ge&&!ye?(j(!1),wa(te,Ae,{...Ae.data.blt_node_states,test:"completed",node:"completed"}),ge):(ye&&(delete je.singleRunFailure,wa(te,Ae,{...Ae.data.blt_node_states,test:"error",node:"failed"}),Object.keys(je).forEach($e=>{WO(je[$e]).forEach(rt=>{L({type:Qr,payload:{open:!0,title:typeof rt!="string"?JSON.stringify(rt):rt,type:"error",width:"30rem",duration:3e3}})})})),j(!1),!1)},Te=async Ae=>{const fe=X?.find(Se=>Se?.id===Ae);fe&&await Oe(fe)},se=Ae=>{L({type:cu,payload:{id:Ae}})},ie=async({label:Ae})=>{const fe=B.current;if(!fe)return;const Se=fe.state.doc.length,ge=fe.state.selection.main,ye=Math.min(ge.from,Se),je=Math.min(ge.to,Se),Qe=["javascript","typescript","python"].includes(l)?`${Ae}`:`{{${Ae}}}`;fe.dispatch({changes:{from:ye,to:je,insert:Qe},selection:{anchor:ye+Qe.length},scrollIntoView:!0}),setTimeout(()=>{fe.focus()},100)},J=_.useCallback(()=>{const Ae=B.current;Ae&&!p&&(Lu(Ae),Ae.focus())},[p]),K=_.useCallback(()=>{const Ae=B.current;Ae&&!p&&(ja(Ae),Ae.focus())},[p]),re=_.useCallback(()=>{const Ae=B.current;return!Ae||p?!1:Nh(Ae.state)>0},[p]),le=_.useCallback(()=>{const Ae=B.current;return!Ae||p?!1:Lh(Ae.state)>0},[p]),he=_.useMemo(()=>d.jsx(E.Typography,{variant:"mdBold",children:x?`Insert data for ${x}`:"Insert data"}),[x]);return _.useImperativeHandle(w.ref,()=>({undo:J,redo:K,canUndo:re,canRedo:le,focus:()=>B.current?.focus(),getContent:()=>B.current?.state.doc.toString()||""}),[J,K,re,le]),d.jsxs(E.Stack,{style:{width:"100%"},ref:k,spacing:2,...w,children:[C?d.jsx(E.Stack,{justifyContent:"center",alignItems:"center",sx:{height:u,border:"1px solid",borderColor:t.palette.grey[300],borderRadius:2,backgroundColor:t.palette.background.default},children:d.jsx(hi,{size:24})}):d.jsx(E.Stack,{ref:M,className:`rounded-lg overflow-hidden ${h}`,style:{height:u,width:"100%",position:"relative"},children:!ne&&d.jsx($w,{title:x?he:"",anchorEl:I,suggestionsData:c,setAnchorEl:()=>P(null),ref:k,handleSuggestionClick:ie,runActivity:Te,handleCompleteSetup:se,isLoading:H})}),n]})};function kMe(e,t){const r=e.value===t.value&&e.language===t.language&&e.viewOnly===t.viewOnly&&e.height===t.height&&e.className===t.className&&e.error===t.error&&e.errorMsg===t.errorMsg&&e.showSuggestions===t.showSuggestions,n=e.suggestionsData,i=t.suggestionsData,o=n==null&&i==null||(typeof n=="object"&&typeof i=="object"?Object.keys(n).length===Object.keys(i).length&&Object.keys(n).every(s=>JSON.stringify(n[s])===JSON.stringify(i[s])):n===i);return r&&o}const PP=_.memo(LMe,kMe),rX={xs:{height:"36px"},sm:{height:"64px"},md:{height:"218px"},lg:{height:"320px"},xl:{height:"440px"},xxl:{height:"560px"}},FMe={xs:{height:"16",width:"16",padding:"2px !important"},sm:{height:"16",width:"16",padding:"4px !important"},md:{height:"20",width:"20",padding:"6px !important"},lg:{height:"20",width:"20",padding:"6px !important"},xl:{height:"20",width:"20",padding:"6px !important"},xxl:{height:"20",width:"20",padding:"6px !important"}},MMe={xs:{right:"40px",top:"6px"},sm:{right:"40px",top:"6px"},md:{right:"48px",top:"15px"},lg:{right:"48px",top:"15px"},xl:{right:"48px",top:"15px"},xxl:{right:"48px",top:"15px"}},BMe=({copied:e,theme:t,size:r})=>{const{padding:n,height:i,width:o}=FMe[r];return d.jsx(E.Button,{variant:"text",type:"button",sx:{position:"relative",minWidth:0,right:8,top:0,p:n,border:1,borderRadius:1,backgroundColor:t.palette.common.white,"&:hover":{backgroundColor:t.palette.common.white}},children:d.jsx("svg",{width:o,height:i,focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",children:e?d.jsx("path",{fill:t.palette.primary.main,d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.24 11.28L9.69 11.2c-.38-.39-.38-1.01 0-1.4.39-.39 1.02-.39 1.41 0l1.36 1.37 4.42-4.46c.39-.39 1.02-.39 1.41 0 .38.39.38 1.01 0 1.4l-5.13 5.17c-.37.4-1.01.4-1.4 0zM3 6c-.55 0-1 .45-1 1v13c0 1.1.9 2 2 2h13c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1-.45-1-1V7c0-.55-.45-1-1-1z"}):d.jsx("path",{fill:t.palette.common.black,d:"M15 20H5V7c0-.55-.45-1-1-1s-1 .45-1 1v13c0 1.1.9 2 2 2h10c.55 0 1-.45 1-1s-.45-1-1-1zm5-4V4c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2zm-2 0H9V4h9v12z"})})})},jMe=_.forwardRef(({activityType:e,language:t="javascript",value:r="",enableAskAI:n=!1,handleChange:i,handleFocus:o=()=>{},handleBlur:s=()=>{},height:a="",showExpandOption:l=!1,showHtmlPreview:u=!1,showCopyToClipboard:c=!1,VORTEX_MAIN_URL:f,ENTITY_ID:p,suggestionsData:h={},loading:A=!1,size:g="xs",label:m="",rightLabel:O=null,required:y=!1,rightLabelAlignment:T="center",placeholder:v="",helperText:C="",errorMsg:x="",error:b=!1,showSuggestions:w=!0,id:R="",viewOnly:I=!1,readOnly:P=!1,enableJsonGuiValidation:k=!1,handleValidate:N,sx:L={},codeEditorStyles:M={},suggestionLabel:B="",options:H,...j},X)=>{const F=ct.useDispatch(),V=E.useTheme(),[G,D]=_.useState(!1),[$,U]=_.useState(!1),[Y,z]=_.useState(!1),[Q,W]=_.useState(!1),[q,Z]=_.useState(""),[te,ae]=_.useState(!1),[ne,ue]=_.useState(""),[Oe,Te]=_.useState(!1),[se,ie]=_.useState(!1),[J,K]=_.useState(!1);_.useEffect(()=>{G||K(!1)},[G]),_.useEffect(()=>{if(!G)return;let ge=J,ye=null,je=!1,Qe=!1;const $e=()=>{const _e=window.innerWidth,de=500+32,be=60,Ge=_e>=1200?800:0,Ne=_e-de;if(_e<600)return"75%";if(_e<960){const mt=Math.min(Ne,_e*.55)/_e*100,St=Math.max(mt,be),De=_e*St/100;return`${(Ge>0?Math.max(De,Ge):De)/_e*100}%`}else{const mt=Math.min(Ne,_e*.45)/_e*100;let St=mt;mt<be&&_e*be/100+de<=_e&&(St=be);const De=_e*St/100;return`${(Ge>0?Math.max(De,Ge):De)/_e*100}%`}},Je=()=>window.innerWidth>=1200?"800px":"",rt=(_e=!1)=>{ye&&clearTimeout(ye),ye=setTimeout(()=>{const we=document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper"),ee=we?.closest(".MuiDialog-container");if(we&&ee){we.style.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",ee.style.transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)";const de=document.getElementById("suggestion-popover"),be=de!==null&&window.getComputedStyle(de).display!=="none"&&window.getComputedStyle(de).visibility!=="hidden";if(be!==je||be!==ge){je=be,be&&!ge&&(ge=!0,K(!0));const Ge=window.innerWidth;if((ge||be)&&Ge>=1200){const Ne=$e();we.style.width=Ne,we.style.maxWidth=Ne,we.style.minWidth=Je(),ee.style.justifyContent="flex-end",_e&&de&&!be&&(Qe=!0,de.style.visibility="hidden",de.style.opacity="0",we.addEventListener("transitionend",()=>{if(de){de.style.visibility="",de.style.opacity="";const Me=new Event("resize");window.dispatchEvent(Me)}Qe=!1},{once:!0}))}else Ge<1200?be&&!ge&&(ge=!0,K(!0)):(we.style.width="",we.style.maxWidth="",ee.style.justifyContent="")}}},50)},tt=()=>{if(window.innerWidth<1200){ge||(ge=!0,K(!0));const we=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(we);return}if(ge){const we=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(we)}else{const we=document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper"),ee=we?.closest(".MuiDialog-container");if(we&&ee){we.style.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",ee.style.transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)";const de=$e();we.style.width=de,we.style.maxWidth=de,we.style.minWidth=Je(),ee.style.justifyContent="flex-end",ge=!0,K(!0);const be=Ge=>{const Ne=Ge;if((Ne.target===we||Ne.target===ee)&&(Ne.propertyName==="width"||Ne.propertyName==="max-width"||Ne.propertyName==="justify-content")){const Me=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(Me),we.removeEventListener("transitionend",be),ee.removeEventListener("transitionend",be)}};we.addEventListener("transitionend",be),ee.addEventListener("transitionend",be),setTimeout(()=>{const Ge=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(Ge),we.removeEventListener("transitionend",be),ee.removeEventListener("transitionend",be)},350)}}};window.addEventListener("suggestions-about-to-open",tt);const Ie=setTimeout(()=>{requestAnimationFrame(()=>{const _e=document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper"),we=_e?.closest(".MuiDialog-container");_e&&we&&(_e.style.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",we.style.transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)"),rt()})},0),Ve=new MutationObserver(_e=>{if(_e.some(ee=>{const de=ee.target;return de.id==="suggestion-popover"||de.closest("#suggestion-popover")!==null||ee.type==="childList"&&(Array.from(ee.addedNodes).some(be=>be.id==="suggestion-popover")||Array.from(ee.removedNodes).some(be=>be.id==="suggestion-popover"))})&&!Qe){const Ge=(document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper")?.closest(".MuiDialog-container")?.style.justifyContent||"")!=="flex-end"&&!ge;rt(Ge)}});Ve.observe(document.body,{childList:!0,subtree:!1,attributes:!1});const He=setInterval(()=>{document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper")&&!Qe&&rt()},500),Ee=()=>{(J||ge)&&rt()};return window.addEventListener("resize",Ee),()=>{clearTimeout(Ie),ye&&clearTimeout(ye),clearInterval(He),Ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("suggestions-about-to-open",tt)}},[G,J]);const re=()=>{D(!1)},le=()=>{ne!==""&&i?.(ne),D(!1)},he=()=>{z(!1)},Ae=()=>{ne!==""&&i?.(ne),Te(!1),W(!1),ue(""),Z("")},fe=()=>{Te(!1),W(!1),ue(""),Z("")},Se=async()=>{ae(!0),ie(!1),Te(!1);try{const ge=Xt(f||"",`/v1.0/${p}`,"/utility/generate"),ye=await zt.post(ge,{data:{messages:xMe(e,q,t)},headers:{"Content-Type":"application/json"}});if(ye.data.data){const je=typeof ye.data.data=="string"?ye.data.data.trim():"";je.includes("GENERATION_ERROR")?Te(!0):(Te(!1),ue(je))}}catch(ge){sr(ge,F)}finally{ie(!0),ae(!1)}};return _.useEffect(()=>{$&&setTimeout(()=>{U(!1)},2e3)},[$]),_.useEffect(()=>{(!q||q==="")&&(ue(""),Te(!1))},[se,q]),d.jsxs(E.FormControl,{fullWidth:!0,children:[(m||O||C)&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:T,children:[m&&d.jsx(gn,{label:m,description:C,required:y}),O&&d.jsx(E.Typography,{variant:V.typography["components-inputs-label-sm"],pb:"0.25rem",color:"neutral.80",children:O})]}),d.jsxs(E.Box,{sx:{position:"relative",width:"100%",height:a||rX[g].height,opacity:I&&P?.6:1,'&:has(.cm-panel.cm-search) [data-testid="button-copy-code"]':{top:"42px !important"},...L},ref:X,"data-testid":R,children:[l&&g!=="xs"&&g!=="sm"&&d.jsx(E.Tooltip,{title:"Expand",placement:"top",arrow:!0,children:d.jsx(E.Box,{onClick:()=>{D(!0)},sx:{position:"absolute",right:"16px",top:c?"48px":"16px",zIndex:6,cursor:"pointer"},"data-testid":"button-expand-editor",children:d.jsx(Ue,{src:"ic_maximize",width:"16px",height:"16px",fill:V.palette.neutral.solid.bg})})}),n&&g!=="xs"&&g!=="sm"&&d.jsx(E.Box,{onClick:()=>!I&&W(!0),sx:{position:"absolute",right:"16px",bottom:"10px",zIndex:6,cursor:"pointer",opacity:I&&P?.6:1},"data-testid":"button-ask-ai",children:d.jsx(E.Tooltip,{title:"Ask AI",children:d.jsx("img",{src:"https://cdn.pixelbin.io/v2/fyndcloud/original/icons/genai_icon.svg",width:32,height:32})})}),c&&d.jsx(E.Tooltip,{title:"Copy to clipboard",placement:"top",arrow:!0,children:d.jsx(E.Box,{onClick:()=>{U(!0),hd(r||"")},sx:{position:"absolute",right:"0px",top:g==="xs"||g==="sm"?"6px":"16px",zIndex:1e3,cursor:"pointer"},"data-testid":"button-copy-code",children:d.jsx(BMe,{copied:$,theme:V,size:g})})}),u&&d.jsx(E.Tooltip,{title:"Preview",placement:"top",arrow:!0,children:d.jsx(E.Box,{onClick:()=>z(!0),sx:{position:"absolute",zIndex:999,cursor:"pointer",...c||l?MMe[g]:{right:"12px",top:"6px"}},children:d.jsx(Ue,{src:"ic_visibility",height:"20px",width:"20px"})})}),d.jsx(PP,{language:t,value:r||"",onChange:i,onFocus:o,onBlur:ge=>s(ge||""),suggestionsData:h,showSuggestions:w,placeholder:v,height:a||rX[g].height,viewOnly:I||P||(H?.readOnly??!1),className:R,errorMsg:x,error:b,codeEditorStyles:M,enableJsonGuiValidation:k,handleValidate:N,loading:A,suggestionLabel:B,size:g,...j})]}),d.jsx(E.Stack,{children:b&&x&&d.jsx(E.FormHelperText,{component:"span",error:!0,dangerouslySetInnerHTML:{__html:ao(x)}})}),d.jsx(Co,{open:G,handleClose:()=>{le(),re()},disableBackdropClick:!0,title:"Editor",content:d.jsxs(E.Box,{sx:{width:"100%",position:"relative"},"data-testid":`${R}-full-mode`,children:[d.jsx(PP,{language:t,value:r||"",onChange:i,placeholder:v,height:"70vh",suggestionsData:h,showSuggestions:w,viewOnly:I||P||(H?.readOnly??!1),className:`${R}-full-mode`,errorMsg:x,error:b,codeEditorStyles:M,enableJsonGuiValidation:k,handleValidate:N,loading:A,size:"xl",...j}),n&&d.jsx(E.Box,{onClick:()=>!I&&W(!0),sx:{position:"absolute",right:"16px",bottom:"16px",zIndex:1e3,cursor:"pointer",opacity:I?.6:1},children:d.jsx(E.Tooltip,{title:"Ask AI",children:d.jsx("img",{src:"https://cdn.pixelbin.io/v2/fyndcloud/original/icons/genai_icon.svg",width:32,height:32})})})]})}),d.jsx(Co,{open:Q,handleClose:()=>{fe()},title:"Generate using AI",content:ne===""?d.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",width:"100%"},children:[d.jsx(E.Typography,{sx:{mb:"8px"},children:"Use AI to generate content for this step. Write a prompt below to get started. You can reference prior step data in your prompt."}),d.jsxs(E.Grid,{children:[d.jsx(E.Typography,{variant:"smBold",sx:{marginBottom:"8px",display:"block"},children:"User Prompt*"}),d.jsx(lo,{parent:"autoComplete",name:"prompt",size:"md",sx:{fontWeight:400},placeholder:t==="javascript"||t==="python"?e&&Zz[e][t]:e&&Zz[e].placeholder,fullWidth:!0,multiline:!0,rows:9,id:"message",onChange:ge=>{Z(ge.target.value)},value:q,required:!0}),Oe&&d.jsx(E.Box,{sx:{color:V.palette.primary.main,fontWeight:500},children:"OpenAI Prompt Error"})]}),d.jsxs(E.Box,{gap:2,sx:{display:"flex",p:3,pb:0,alignItems:"Center",justifyContent:"center"},children:[d.jsx(E.Button,{type:"submit",disabled:te||!q,variant:"contained",onClick:Se,sx:{fontSize:"14px",boxShadow:ge=>ge.shadows[0],padding:"2px 16px"},endIcon:te?d.jsx(E.CircularProgress,{color:"inherit",size:20}):null,"data-testid":"button-ai-generate",children:"Generate"}),d.jsx(E.Button,{variant:"outlined",color:"primary",onClick:()=>{W(!1),Z(""),ue("")},sx:{textTransform:"none"},"data-testid":"button-ai-cancel",children:"Cancel"})]})]}):d.jsxs(E.Box,{sx:{width:"100%",display:"flex",flexDirection:"column"},children:[d.jsx(E.Box,{sx:{width:"100%",position:"relative",borderRadius:"4px",border:`1px solid ${V.palette.grey[200]}`},children:d.jsx(E.Box,{sx:{p:1},"data-testid":`${R}-askAI`,children:d.jsx(PP,{language:t,value:ne||"",onChange:ge=>{ue(ge)},height:"27vh",viewOnly:!!ne||I,showSuggestions:w,className:`${R}-askAI`,errorMsg:x,error:b,codeEditorStyles:M,enableJsonGuiValidation:k,handleValidate:N,loading:A,suggestionLabel:B,size:"lg",...j})})}),Oe&&d.jsx(E.Box,{sx:{color:V.palette.primary.main,fontWeight:500},children:"OpenAI Prompt Error"}),d.jsxs(E.Grid,{container:!0,spacing:2,children:[d.jsx(E.Typography,{variant:"smMedium",sx:{marginBottom:"8px",display:"block",mt:1},children:"Request a quick adjustment..."}),d.jsxs(E.Grid,{container:!0,alignItems:"center",spacing:2,children:[d.jsx(E.Grid,{xs:10,sx:{p:0},children:d.jsx(lo,{parent:"autoComplete",name:"prompt",sx:{fontWeight:400,width:"100%"},placeholder:"Modify your prompt here",fullWidth:!0,id:"message",onChange:ge=>{Z(ge.target.value)},value:q,required:!0})}),d.jsx(E.Grid,{item:!0,xs:2,sx:{paddingTop:"0 !important"},children:d.jsx(E.Button,{disabled:te||!q,type:"submit",variant:"contained",onClick:Se,sx:{fontSize:"14px",boxShadow:ge=>ge.shadows[0],height:"36px",width:"100%"},children:"Apply"})})]})]}),d.jsxs(E.Box,{gap:2,sx:{display:"flex",p:3,pb:0,alignItems:"Center",justifyContent:"center"},children:[d.jsx(E.Button,{disabled:te,type:"submit",variant:"contained",onClick:Ae,sx:{fontSize:"14px",boxShadow:ge=>ge.shadows[0],padding:"2px 16px"},endIcon:te?d.jsx(E.CircularProgress,{color:"inherit",size:20}):null,children:"Accept"}),d.jsx(E.Button,{variant:"outlined",color:"primary",onClick:()=>{ue("")},sx:{textTransform:"none"},children:"Discard"})]})]})}),d.jsx(Co,{open:Y,handleClose:he,title:"Preview",variant:"xlarge",content:d.jsx(E.Box,{sx:{width:"100%",height:"600px",position:"relative",borderRadius:"4px",border:`1px solid ${V.palette.grey[200]}`},children:d.jsx("iframe",{title:"HTML Preview",srcDoc:r||"",sandbox:"allow-scripts",style:{width:"100%",height:"100%",border:"none"}})})})]})});function $Me(e,t){const r=e.value===t.value&&e.language===t.language&&e.viewOnly===t.viewOnly&&e.height===t.height&&e.size===t.size&&e.showCopyToClipboard===t.showCopyToClipboard&&e.showSuggestions===t.showSuggestions&&e.error===t.error&&e.errorMsg===t.errorMsg&&e.id===t.id,n=e.suggestionsData,i=t.suggestionsData,o=n==null&&i==null||(typeof n=="object"&&typeof i=="object"?Object.keys(n).length===Object.keys(i).length&&Object.keys(n).every(s=>JSON.stringify(n[s])===JSON.stringify(i[s])):n===i);return r&&o}const Fi=_.memo(vc(jMe),$Me),nX=Object.freeze(Object.defineProperty({__proto__:null,default:Fi},Symbol.toStringTag,{value:"Module"})),iX=e=>d.jsx(Ue,{...e,sx:{"&.MuiSelect-icon":{top:"auto",mr:"0.25rem",pointerEvents:"none"}},src:"ic_arrow_down",width:20,height:20}),UMe=({value:e,content:t,onChange:r,triggerHelpData:n,selectedMethod:i,setSelectedMethod:o,setSelectedLanguage:s,excludeUrlLanguage:a=!1})=>{const l=E.useTheme();return d.jsxs(E.Stack,{alignItems:"center",justifyContent:"space-between",p:1.5,direction:"row",children:[d.jsx(E.Typography,{variant:"smNormal",color:l.palette.text.secondary,children:"Use below code to trigger this workflow"}),d.jsxs(E.Stack,{direction:"row",gap:1.5,alignItems:"center",children:[d.jsx(E.Select,{labelId:"method-select-label",value:n?.methods?.includes(i)?i:"",label:"Method",onChange:u=>{const c=u.target.value;o(c);const f=Object.keys(n[c]||{});s(f[0])},IconComponent:iX,MenuProps:{PaperProps:{style:{padding:8},"& li":{p:0}}},sx:{p:0,border:"none",minHeight:0,"& fieldset":{border:"none"},boxShadow:"none",".MuiOutlinedInput-notchedOutline":{border:0},"& .MuiSelect-select":{py:0},height:"auto","& .MuiSelect-outlined":{display:"flex",gap:.5},"& .MuiStack-root > svg":{width:14,height:14},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{border:0}},children:n?.methods?.map(u=>d.jsx(E.MenuItem,{value:u,children:u.toUpperCase()},u))}),d.jsx(E.Select,{sx:{p:0,border:"none",minHeight:0,"& fieldset":{border:"none"},boxShadow:"none",".MuiOutlinedInput-notchedOutline":{border:0},"& .MuiSelect-select":{py:0},height:"auto","& .MuiSelect-outlined":{display:"flex",gap:.5},"& .MuiStack-root > svg":{width:14,height:14},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{border:0}},value:e,label:"Age",onChange:r,IconComponent:iX,MenuProps:{PaperProps:{style:{padding:8},"& li":{p:0}}},children:oce.filter(u=>!(a&&u.value==="URL")).map(u=>d.jsxs(E.MenuItem,{value:u.value,sx:{padding:"6px",marginTop:.5},children:[d.jsx(ch,{src:sce[u.label],alt:u.label,asHtmlElement:!0}),u.label]},u.value))}),d.jsx(E.Box,{width:24,height:24,onClick:u=>{u.stopPropagation(),hd(t)},sx:{"& > span":{border:`1px solid ${l.palette.grey.outlined.border}`,borderRadius:1},cursor:"pointer"},children:d.jsx(Ue,{src:"ic_copy",width:24,height:24})})]})]})},HMe=({VORTEX_MAIN_URL:e,ENTITY_ID:t,viewOnly:r=!1,excludeUrlLanguage:n=!1})=>{const i=ct.useDispatch(),o=E.useTheme(),{getNodes:s}=Rt.useReactFlow(),a=s(),{trigger_help:l,workflow:u}=ct.useSelector(C=>C.workflows),[c,f]=_.useState(""),[p,h]=_.useState("get"),[A,g]=_.useState({}),m=xn(),O=xn("version");_.useEffect(()=>{if(!Et(l)){const C={},x=[];l?.items?.forEach(R=>{x.push(R.title),R.snippets.forEach(I=>{C[R.title]||(C[R.title]={}),C[R.title][I.title]=I.value})}),g({...C,methods:x}),h(x[0]);const b=Object.keys(C[x[0]]||{}),w=n?b.find(R=>R!=="URL")??b[0]:b[0];f(w)}},[l]),_.useEffect(()=>{const C=a.find(x=>x.type===xt.TRIGGER);!Et(u)&&(C?.data?.type===Ze.WEBHOOK||C?.data?.type===Ze.HTTP)&&(O||m)&&i(Gb(O||m,e,t))},[]);const y=C=>{f(C.target.value)},T=a.find(C=>C.type===xt.TRIGGER),v=T?.data?.type===Ze.WEBHOOK||T?.data?.type===Ze.HTTP;return d.jsx(E.Box,{sx:{mt:2,"& .MuiAccordionSummary-content":{margin:0,borderRadius:2},"& .MuiButtonBase-root.MuiAccordionSummary-root":{px:1.5,py:"10.5px",borderRadius:"8px 8px 0 0",backgroundColor:o.palette.white.smoke},borderRadius:2},children:d.jsxs(E.Box,{sx:{"& > .MuiBox-root > .MuiBox-root > .MuiFormControl-root > .MuiBox-root":{border:"none",p:0},border:`1px solid ${o.palette.grey[300]}`,borderRadius:2},children:[d.jsx(UMe,{value:c,content:A?.[p]?.[c]||"",onChange:y,triggerHelpData:A,selectedMethod:p,setSelectedMethod:h,setSelectedLanguage:f,excludeUrlLanguage:n}),d.jsx(E.Box,{sx:{width:"100%"},children:d.jsx(E.Box,{sx:{minHeight:"300px",overflowX:"auto",borderTop:`1px solid ${o.palette.grey[300]}`,"& > .MuiStack-root > .MuiBox-root":{m:0},"& .monaco-editor .overflow-guard":{borderRadius:"0 0 8px 8px"}},children:d.jsx(Fi,{viewOnly:!0,readOnly:r&&v,height:"300px",language:c.toLowerCase(),value:A?.[p]?.[c]||"",handleChange:()=>{},size:"md",loading:!l,codeEditorStyles:{border:"none"},showSuggestions:!1})})})]})})},VMe=({VORTEX_MAIN_URL:e,ENTITY_ID:t})=>{const r=E.useTheme(),n=ct.useDispatch(),{trigger_help:i,workflow:o}=ct.useSelector(h=>h.workflows),s=xn(),a=xn("version"),[l,u]=_.useState(""),[c,f]=_.useState("");_.useEffect(()=>{!Et(o)&&(a||s)&&n(Gb(a||s,e,t))},[]),_.useEffect(()=>{if(!Et(i)){const h=i?.items||[];for(const A of h){const g=A.snippets?.find(m=>m.title==="URL");if(g?.value){u(g.value),f(A.title.toUpperCase());break}}}},[i]);const p=()=>{l&&navigator.clipboard.writeText(l).then(()=>{n({type:Qr,payload:{open:!0,title:"Copied to clipboard",type:"success"}})})};return d.jsxs(E.Stack,{gap:1,sx:{background:r.palette.background.paper,borderRadius:2,p:1,border:`1px solid ${r.palette.grey[300]}`},children:[d.jsxs(E.Stack,{gap:.3,children:[d.jsx(E.Typography,{variant:"smSemiBold",color:r.palette.text.primary,children:"Your webhook URL"}),d.jsx(E.Typography,{variant:"smNormal",color:r.palette.text.secondary,children:"You'll need to configure your application with this workflow's webhook URL."})]}),d.jsxs(E.Stack,{direction:"row",alignItems:"center",gap:1.5,sx:{background:r.palette.white.smoke,border:`1px solid ${r.palette.grey[300]}`,borderRadius:1,pl:1.5,pr:1,py:.75},children:[d.jsx(E.Box,{component:"img",src:"https://cdn.pixelbin.io/v2/fyndcloud/original/url.svg",alt:"webhook",sx:{width:20,height:20,flexShrink:0}}),d.jsx(E.Tooltip,{title:l||"",arrow:!0,placement:"top",disableHoverListener:!l,children:d.jsx(E.Typography,{variant:"smNormal",color:r.palette.text.secondary,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:l||"Generating webhook URL…"})}),d.jsx(E.Tooltip,{title:"Copy URL",arrow:!0,placement:"top",children:d.jsx("span",{children:d.jsx(E.IconButton,{size:"small",onClick:p,disabled:!l,sx:{"& svg path, & svg g path":{fill:r.palette.primary.main},"&:hover":{backgroundColor:`${r.palette.primary.main}14`,"& svg path, & svg g path":{fill:r.palette.primary.light}}},children:d.jsx(Ue,{src:"ic_copy",width:18,height:18})})})})]}),d.jsxs(E.Typography,{variant:"xsNormal",color:r.palette.text.tertiary,children:["We've generated a custom webhook URL for this workflow. Try this URL with"," ",c?d.jsx(E.Box,{component:"span",sx:{fontWeight:600,color:r.palette.primary.main},children:c}):"the required"," ","method to send data and trigger your workflow automatically."]})]})},GMe=["Basic","Advanced"],WMe=({type:e,name:t,ENTITY_ID:r,VORTEX_MAIN_URL:n,loading:i,activityExecutionList:o,nodeId:s,integrationSlug:a,integrationType:l,activityType:u,viewOnly:c=!1})=>{const f=E.useTheme(),[p,h]=_.useState("Basic");return e===Ze.WEBHOOK||e===Ze.HTTP?d.jsxs(E.Stack,{gap:2,children:[d.jsxs(E.Stack,{justifyContent:"center",gap:1.5,children:[d.jsx(E.Typography,{variant:"lgSemiBold",color:f.palette.text.primary,children:"Test"}),d.jsxs(E.Stack,{gap:.75,children:[d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.secondary,children:"Test your trigger"}),d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.tertiary,children:"To test/run your workflow, configure your application with the webhook URL or use the code snippet below to send a request to the workflow's trigger endpoint."})]})]}),d.jsx(ss,{variant:"normal",width:"max-content",tabs:GMe.map(A=>({title:A})),selectedTab:p,setSelectedTab:A=>h(A),sx:{width:"max-content"}}),p==="Basic"&&d.jsx(VMe,{VORTEX_MAIN_URL:n,ENTITY_ID:r}),p==="Advanced"&&d.jsx(E.Box,{sx:{"& > .MuiBox-root":{mt:0}},children:d.jsx(HMe,{ENTITY_ID:r,VORTEX_MAIN_URL:n,viewOnly:c,excludeUrlLanguage:!0})})]}):i?d.jsx(e6,{width:"100%",height:44,count:3,backgroundColor:f.palette.white.smoke}):o.length===0?d.jsxs(E.Stack,{gap:2,children:[d.jsx(E.Typography,{variant:"lgSemiBold",color:f.palette.text.secondary,children:"Test"}),d.jsx(E.Stack,{alignItems:"flex-start",sx:{border:`1px solid ${f.palette.grey.outlined.border}`,backgroundColor:f.palette.white.smoke,height:70,borderRadius:"8px",padding:1.5},children:d.jsxs(E.Stack,{direction:"row",gap:1,sx:{...vf,alignItems:"flex-start"},children:[d.jsx(Ue,{src:"ic_info_filled"}),d.jsxs(E.Stack,{gap:.75,children:[!du.includes(e)&&d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.primary,children:"No recent tests available"}),d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.tertiary,children:h4.includes(e)?"Testing is not required for triggers as they are initiated by external events or schedules.":A4.includes(e)?"Testing is not required for this step as it is a control flow or system configuration that does not support direct testing.":"Please test using the Test step button on the bottom"})]})]})})]}):d.jsxs(E.Stack,{justifyContent:"center",gap:2,children:[d.jsx(E.Typography,{variant:"lgSemiBold",color:f.palette.text.primary,children:"Test"}),d.jsx(O0e,{ENTITY_ID:r,VORTEX_MAIN_URL:n,nodeId:s,items:o,integrationSlug:a,integrationType:l,name:t,activityType:u})]})},QMe=e=>{const{ENTITY_ID:t,VORTEX_MAIN_URL:r,selectedNode:n,activityExecutionList:i,setActivityExecutionList:o,loading:s,fetchActivityExecutions:a,viewOnly:l=!1}=e,{data:{type:u,name:c},id:f}=n,p=dd(n?.data);return _.useEffect(()=>(a(),()=>{o([])}),[f,u]),d.jsx(E.Stack,{overflow:"auto",height:"calc(100vh - 212px)",children:d.jsx(E.Box,{mt:.5,children:d.jsx(WMe,{type:u,ENTITY_ID:t,VORTEX_MAIN_URL:r,loading:s,activityExecutionList:i,nodeId:f,name:c,integrationSlug:n?.data?.properties?.integration_slug||"",integrationType:u,activityType:p,viewOnly:l})})})},Kd=["resource","operation","secret","config","credential_id","slack_auth_id","mode","gmail_config_id","event","integration_slug","custom.query_params","custom.state_params","custom.headers","custom.body"],zMe=e=>{const t={"not-configured-yet":"not-configured-yet","partially-configured":"partially-configured",completed:"completed",failed:"failed",error:"error",success:"success",default:"default",skipped:"skipped"};return e in t?t[e]:"default"},oX=({value:e,onSave:t,isEditing:r,setIsEditing:n,disabled:i=!1,maxLength:o=50,placeholder:s="",showEditIcon:a=!0,variant:l="body1",textSx:u={},inputSx:c={},validate:f,error:p=null,minWidth:h=64,maxWidth:A=400,enableDoubleClick:g=!0,editIcon:m="ic_edit",autoResize:O=!0})=>{const y=E.useTheme(),[T,v]=_.useState(e||""),[C,x]=_.useState(h||64),b=_.useRef(null),w=_.useRef(null);_.useEffect(()=>{v(e||"")},[e]),_.useEffect(()=>{if(O&&b.current&&r){const L=b.current;L.textContent=T||s||"";const M=L.offsetWidth||0,B=12,H=h||64,j=A||400,F=Math.min(Math.max(M+B+40,H),j);x(F)}},[r,s,h,A,O]),_.useEffect(()=>{r&&w.current&&(w.current.focus(),w.current.select())},[r]);const R=async()=>{const L=T.trim();f&&await f(L)||L.length!==0&&(L.length>o||(t(L),n(!1)))},I=()=>{v(e),n(!1)},P=()=>{g&&!i&&(v(e),n(!0))},k=()=>{i||(v(e),n(!0))},N={cursor:g&&!i?"pointer":"default",...u};return d.jsxs(d.Fragment,{children:[O&&d.jsx("span",{ref:b,style:{position:"absolute",visibility:"hidden",whiteSpace:"nowrap",fontSize:c?.[".MuiInputBase-input"]?.fontSize||"16px",fontWeight:c?.[".MuiInputBase-input"]?.fontWeight||600,fontFamily:y?.typography?.fontFamily||"inherit",padding:"0px 8px",border:"1px solid transparent",zIndex:-1}}),r?d.jsx(E.TextField,{inputRef:w,autoFocus:!0,value:T,placeholder:s,error:!!p,helperText:p,disabled:i,onChange:L=>{const M=L.target.value.slice(0,o);v(M)},onBlur:R,onKeyDown:L=>{L.key==="Enter"?(L.preventDefault(),R()):L.key==="Escape"&&(L.preventDefault(),I())},inputProps:{maxLength:o},InputProps:{endAdornment:d.jsx(E.InputAdornment,{position:"end",children:d.jsx("span",{style:{color:y.palette.neutral.main,fontSize:12},children:`${T.length}/${o}`})})},sx:{width:O?`${C||h||64}px`:"100%",minWidth:`${h||64}px`,...c}}):d.jsxs(E.Stack,{direction:"row",alignItems:"center",onDoubleClick:P,sx:{cursor:g&&!i?"pointer":"default"},children:[d.jsx(E.Typography,{variant:l,sx:N,title:e,children:e}),a&&!i&&d.jsx(E.IconButton,{onClick:k,sx:{ml:1,p:0,"&:hover":{backgroundColor:"transparent","& .inline-svg svg path":{transition:"fill 0.2s ease"},"& svg path":{fill:`${y.palette.text.primary}`}}},title:"Edit",children:d.jsx(Ue,{width:20,height:20,src:m})})]})]})},Zd=()=>{const e=E.useTheme();return d.jsxs(E.Stack,{direction:"row",alignItems:"center",height:20,sx:{px:"6px",py:"4px",borderRadius:8,background:t=>`linear-gradient(100.41deg, ${t.palette.pro.badge.start} -5.78%, ${t.palette.pro.badge.end} 69.93%)`},children:[d.jsx(Ue,{src:"ic_crown",width:14,height:14,sx:{path:{fill:e.palette.common.black}}}),d.jsx(E.Typography,{variant:"xsNormal",sx:{ml:"4px",color:t=>t.palette.text.primary},children:"Pro"})]})},XMe=e=>{const t=e.match(/(?:-H|--header)\s+['"]?content-type:\s*([\w/-]+)/i),r=t?t[1].toLowerCase():null,n=e.match(/(?:--data(?:-raw)?|-d)\s+(['"]?)(.+?)\1/),i=n?n[2]:null;return e.match(/(?:^|\s)(?:-F|--form)(?:\s|["']|$)/)?"form-data":i?r&&r.startsWith("multipart/form-data")?"form-data":r==="application/x-www-form-urlencoded"?"x-www-form-urlencoded":r&&(r==="application/xml"||r==="text/xml")?"xml":/^\w+=([^&]+)(&\w+=([^&]+))*$/.test(i)?"x-www-form-urlencoded":/^\s*<[\s\S]*>\s*$/.test(i.trim())?"xml":"raw":"none"},qMe=(e,t)=>{let r=[];const n=!Array.isArray(t.headers);t.headers&&(r=n?{...t.headers}:[...t.headers]);let i=n?Lo(r):Lo(r)?.filter(o=>o.key!=="Content-Type");switch(e){case"none":n?delete i["Content-Type"]:i=i.filter(o=>o.key!=="Content-Type");break;case"form-data":n?i={...i,"Content-Type":"multipart/form-data"}:i.push({key:"Content-Type",value:"multipart/form-data"});break;case"x-www-form-urlencoded":n?i={...i,"Content-Type":"application/x-www-form-urlencoded"}:i.push({key:"Content-Type",value:"application/x-www-form-urlencoded"});break;case"xml":n?i={...i,"Content-Type":"application/xml"}:i.push({key:"Content-Type",value:"application/xml"});break;default:n?i={...i,"Content-Type":"application/json"}:i.push({key:"Content-Type",value:"application/json"});break}return i},En=e=>{const{children:t}=e;return d.jsxs(E.Stack,{gap:2,children:[d.jsx(E.Typography,{className:"config",variant:"lgSemiBold",children:"Configure"}),t]})},kr=vc(e=>{const{name:t,type:r="text",meta:{displayName:n="",placeholder:i="",value:o="",displayType:s="",description:a="",isDisabled:l=!1,htmlProps:{showInfoIcon:u=!1,rightLabel:c="",rightLabelAlignment:f="flex-end"}={},renderFieldValue:p=null},control:h,handleChange:A,validationRules:g,viewOnly:m=!1,size:O="xs",multiline:y=!1,...T}=e,v=typeof a=="object"?a:ao(a),C=E.useTheme(),[x,b]=_.useState(!1),w=(I,P)=>{let k=I.target.value;s==="number"&&k.trim()!==""?k=parseFloat(k)||0:s==="number"&&k.trim()===""&&(k=""),P.onChange(k),A&&A({field:t,value:k,fieldData:e})},R=I=>{r==="number"&&I.target?.blur()};return d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(pr,{name:t,control:h,rules:g,render:({field:{value:I,...P},fieldState:{error:k}})=>d.jsxs(E.Stack,{children:[(n||c||u)&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:f,children:[n&&d.jsx(gn,{label:n,description:v,required:e?.required}),c&&d.jsx(E.Typography,{variant:C.typography["components-inputs-label-sm"],pb:"0.25rem",color:"neutral.80",children:c})]}),d.jsx(lo,{...P,...T,type:e?.htmlProps?.type==="password"&&x?"text":r,placeholder:i,variant:"outlined",fullWidth:!0,errorMsg:k?.message,size:y&&O==="xs"?"sm":O,multiline:y,disabled:l||m,onChange:N=>{w(N,P)},value:p?p(I):I||o,onWheel:R})]})})})}),dT=e=>e.sort((t,r)=>{const n=t.integration_meta?.auth_type||"",i=r.integration_meta?.auth_type||"";return n.localeCompare(i)}),fT=e=>e.map(r=>{const n=Rs(r.integration_meta.auth_type.replace("_auth",""));return{...r,name:`${r.name} (${n})`}}),NP=e=>(e&&typeof e=="string"&&e.replace("(Header)","").replace("(Basic)",""),e),nA=e=>{if(e===null||typeof e!="object")return!1;const t=new Set;return Array.isArray(e)?e.some(r=>r===null?!1:nA(r)):Object.entries(e).some(([r,n])=>t.has(r)||(t.add(r),!r.trim())?!0:n===null?!1:typeof n=="object"?nA(n):!1)},LP=(e,t)=>!e||e.trim()===""||e==="{{}}"?"Key is required":Object.keys(t).includes(e)?"Duplicate key found":"",YMe=e=>{const{onClick:t,refreshTooltip:r="",refreshing:n,sx:i,...o}=e,s=E.useTheme();return d.jsx(E.Tooltip,{title:r,arrow:!0,children:d.jsx("span",{children:d.jsx(E.IconButton,{onClick:t,disabled:n,sx:{width:32,height:32,border:`1px solid ${s.palette.grey.outlined.border}`,borderRadius:1.5,...Ii(s),...i},"data-testid":"button-refresh",...o,children:n?d.jsx(E.CircularProgress,{size:14}):d.jsx(Ue,{src:"ic_refresh",width:20,height:20,sx:{path:{fill:s.palette.neutral.solid.bg}}})})})})},KMe=_.forwardRef(({name:e,type:t,required:r=!1,title:n,helperText:i="",viewOnly:o=!1,disabled:s=!1,options:a=[],errorMsg:l,children:u,endItem:c,refreshTooltip:f="",refreshOptions:p,loading:h=!1,refreshing:A=!1,aiIndicatorVisible:g=!1,...m},O)=>{const y=E.useTheme(),T=ao(i),{sx:v,...C}=m;return d.jsxs(E.FormControl,{fullWidth:!0,children:[d.jsxs(E.Stack,{alignItems:"flex-end",justifyContent:"space-between",direction:"row",children:[d.jsx(gn,{description:T,label:n,required:r}),c]}),d.jsxs(E.Stack,{gap:1,direction:"row",alignItems:"flex-end",sx:{position:"relative"},children:[g&&d.jsx(E.Box,{sx:{position:"absolute",right:p?"3.1rem":"1px",top:1,bottom:1,width:"15%",minWidth:p?56:64,maxWidth:p?76:92,pointerEvents:"none",borderTopRightRadius:6,borderBottomRightRadius:6,zIndex:0,background:`linear-gradient(90deg, ${E.alpha(y.palette.primary[5],0)} 0%, ${E.alpha(y.palette.primary[5],.35)} 62%, ${E.alpha(y.palette.primary[5],.9)} 100%)`}}),d.jsx(E.Select,{...C,fullWidth:!p,inputRef:O,error:!!l,name:e,disabled:s||o,IconComponent:x=>d.jsx(Ue,{src:"ic_arrow_down",width:"1.25rem",height:"1.25rem",sx:{"&.MuiSelect-icon":{top:"auto",mr:"0.25rem"}},...x}),"data-testid":`select-${e||"field"}`,sx:p?{width:"94%",flexShrink:0,position:"relative",zIndex:1,...g?{"& .MuiSelect-select":{pr:"4.25rem !important"}}:{},...v||{}}:{position:"relative",zIndex:1,...g?{"& .MuiSelect-select":{pr:"4.25rem !important"}}:{},...v||{}},children:u||(a.length>0?a.map(x=>d.jsx(E.MenuItem,{value:x.value,"data-testid":`option-${x.value}`,children:x.title},x.value)):d.jsx(E.MenuItem,{disabled:!0,sx:{p:"14px 16px"},"data-testid":"option-no-options",children:d.jsx(E.Typography,{variant:"smNormal",children:"No options"})}))}),g&&d.jsx(E.Box,{sx:{position:"absolute",right:p?"3.35rem":"2.45rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,width:18,height:18},children:d.jsx(Ue,{src:"ic_AI",width:18,height:18,sx:{display:"block","& svg path":{fill:`${y.palette.primary.main} !important`,fillOpacity:"1 !important"}}})}),p&&d.jsx(YMe,{refreshing:A,disabled:h||o||s,onClick:p,refreshTooltip:f})]}),!!l&&d.jsx(E.FormHelperText,{error:!0,children:l})]})}),sX=vc(KMe),ZMe=e=>{const t=E.useTheme(),{getValues:r,setValue:n}=Rr(),{isMultiple:i,options:o,selected:s=null,name:a,placeholder:l="",setMenuOpen:u,menuOpen:c,viewOnly:f=!1}=e,p=_.useRef(null),[h,A]=_.useState(!1),g=(T,v)=>{T.stopPropagation(),T.preventDefault();const C=r(a);typeof C=="object"&&Array.isArray(C)&&n(a,C.filter(x=>typeof x=="object"&&x.value?x.value!==v:x!==v),{shouldValidate:!0})},m=s!=null?o?.some(T=>T?.value===s):!1;if(typeof s=="object"&&Et(s)||typeof s=="string"&&!s&&!m)return d.jsx(E.Typography,{sx:{fontSize:"14px",color:t.palette.neutral.solid.bg,fontFamily:"inherit",":hover":{color:t.palette.neutral.main}},children:l||""});let O=(p.current?.offsetWidth||440)-95;if(i){const{visible:T,extra:v,hiddenSelections:C}=Ub(s,O);return d.jsxs(E.Stack,{direction:"row",ref:p,sx:{...di,position:"relative",width:"100%"},children:[d.jsxs(E.Box,{"data-testid":"select-chip-container",sx:{display:"flex",flexWrap:"nowrap",gap:.5,maxWidth:"calc(100% - 65px)",overflow:"hidden"},onClick:x=>{x.preventDefault(),x.stopPropagation(),u?.(!c)},children:[T.map(x=>{const{value:b,title:w}=x,R=Math.min(O,Math.max(w.length*8+50,90));return O=O-R-4,d.jsx(w7,{label:w,onDelete:I=>g(I,b),sx:{flex:"0 0 auto",minWidth:"40px","&.MuiChip-root":{maxWidth:`${R}px !important`}}},b)}),v>0&&d.jsx(Bw,{hiddenSelections:C,extra:v,handleChipDelete:g})]}),T?.length?d.jsx(E.IconButton,{disableRipple:!0,onMouseDown:x=>{x.preventDefault(),x.stopPropagation(),typeof n=="function"&&n(a,[],{shouldValidate:!0})},sx:{position:"absolute",right:0,top:"auto","&.MuiButton-root":{paddingRight:1},zIndex:1e3,"&:hover":{backgroundColor:"transparent"}},children:d.jsx(Ue,{src:"ic_close",height:16,width:16})}):null]})}const y=NP(o?.find(T=>T?.value===s)?.title);return d.jsxs(E.Stack,{direction:"row",alignItems:"center",onMouseEnter:()=>!f&&A(!0),onMouseLeave:()=>A(!1),sx:{position:"relative",width:"100%",minWidth:0,maxWidth:"100%",pr:f?0:"36px"},children:[d.jsx(E.Typography,{sx:{fontSize:"14px",color:t.palette.text.primary,fontFamily:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,maxWidth:"100%",pr:!f&&s&&h?"24px":0},children:y}),!f&&s&&h&&d.jsx(E.IconButton,{disableRipple:!0,size:"small",onMouseDown:T=>{T.preventDefault(),T.stopPropagation(),n(a,"",{shouldValidate:!0})},sx:{position:"absolute",right:"34px",top:"50%",transform:"translateY(-50%)",padding:"4px",zIndex:1e3,"&:hover":{backgroundColor:"transparent","& svg path":{fill:t.palette.text.primary}}},children:d.jsx(Ue,{src:"ic_close",height:16,width:16,sx:{path:{fill:t.palette.neutral.solid.bg}}})})]})};function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ce.apply(null,arguments)}function kP(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FP(e,t){return FP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},FP(e,t)}function pT(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,FP(e,t)}var aX=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function JMe(e,t){return!!(e===t||aX(e)&&aX(t))}function e6e(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!JMe(e[r],t[r]))return!1;return!0}function MP(e,t){t===void 0&&(t=e6e);var r,n=[],i,o=!1;function s(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&r===this&&t(a,n)||(i=e.apply(this,a),o=!0,r=this,n=a),i}return s}function _t(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var t6e=typeof performance=="object"&&typeof performance.now=="function",lX=t6e?function(){return performance.now()}:function(){return Date.now()};function uX(e){cancelAnimationFrame(e.id)}function r6e(e,t){var r=lX();function n(){lX()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var BP=-1;function cX(e){if(e===void 0&&(e=!1),BP===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),BP=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return BP}var iA=null;function dX(e){if(e===void 0&&(e=!1),iA===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?iA="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?iA="negative":iA="positive-ascending"),document.body.removeChild(t),iA}return iA}process.env.NODE_ENV;var n6e=150,i6e=function(t,r){return t},hT=null,AT=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(hT=new WeakSet,AT=new WeakSet);function o6e(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,o=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,l=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,c=e.validateProps;return t=(function(f){pT(p,f);function p(A){var g;return g=f.call(this,A)||this,g._instanceProps=l(g.props,kP(g)),g._outerRef=void 0,g._resetIsScrollingTimeoutId=null,g.state={instance:kP(g),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof g.props.initialScrollOffset=="number"?g.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},g._callOnItemsRendered=void 0,g._callOnItemsRendered=MP(function(m,O,y,T){return g.props.onItemsRendered({overscanStartIndex:m,overscanStopIndex:O,visibleStartIndex:y,visibleStopIndex:T})}),g._callOnScroll=void 0,g._callOnScroll=MP(function(m,O,y){return g.props.onScroll({scrollDirection:m,scrollOffset:O,scrollUpdateWasRequested:y})}),g._getItemStyle=void 0,g._getItemStyle=function(m){var O=g.props,y=O.direction,T=O.itemSize,v=O.layout,C=g._getItemStyleCache(u&&T,u&&v,u&&y),x;if(C.hasOwnProperty(m))x=C[m];else{var b=r(g.props,m,g._instanceProps),w=i(g.props,m,g._instanceProps),R=y==="horizontal"||v==="horizontal",I=y==="rtl",P=R?b:0;C[m]=x={position:"absolute",left:I?void 0:P,right:I?P:void 0,top:R?0:b,height:R?"100%":w,width:R?w:"100%"}}return x},g._getItemStyleCache=void 0,g._getItemStyleCache=MP(function(m,O,y){return{}}),g._onScrollHorizontal=function(m){var O=m.currentTarget,y=O.clientWidth,T=O.scrollLeft,v=O.scrollWidth;g.setState(function(C){if(C.scrollOffset===T)return null;var x=g.props.direction,b=T;if(x==="rtl")switch(dX()){case"negative":b=-T;break;case"positive-descending":b=v-y-T;break}return b=Math.max(0,Math.min(b,v-y)),{isScrolling:!0,scrollDirection:C.scrollOffset<b?"forward":"backward",scrollOffset:b,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._onScrollVertical=function(m){var O=m.currentTarget,y=O.clientHeight,T=O.scrollHeight,v=O.scrollTop;g.setState(function(C){if(C.scrollOffset===v)return null;var x=Math.max(0,Math.min(v,T-y));return{isScrolling:!0,scrollDirection:C.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._outerRefSetter=function(m){var O=g.props.outerRef;g._outerRef=m,typeof O=="function"?O(m):O!=null&&typeof O=="object"&&O.hasOwnProperty("current")&&(O.current=m)},g._resetIsScrollingDebounced=function(){g._resetIsScrollingTimeoutId!==null&&uX(g._resetIsScrollingTimeoutId),g._resetIsScrollingTimeoutId=r6e(g._resetIsScrolling,n6e)},g._resetIsScrolling=function(){g._resetIsScrollingTimeoutId=null,g.setState({isScrolling:!1},function(){g._getItemStyleCache(-1,null)})},g}p.getDerivedStateFromProps=function(g,m){return s6e(g,m),c(g),null};var h=p.prototype;return h.scrollTo=function(g){g=Math.max(0,g),this.setState(function(m){return m.scrollOffset===g?null:{scrollDirection:m.scrollOffset<g?"forward":"backward",scrollOffset:g,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},h.scrollToItem=function(g,m){m===void 0&&(m="auto");var O=this.props,y=O.itemCount,T=O.layout,v=this.state.scrollOffset;g=Math.max(0,Math.min(g,y-1));var C=0;if(this._outerRef){var x=this._outerRef;T==="vertical"?C=x.scrollWidth>x.clientWidth?cX():0:C=x.scrollHeight>x.clientHeight?cX():0}this.scrollTo(o(this.props,g,m,v,this._instanceProps,C))},h.componentDidMount=function(){var g=this.props,m=g.direction,O=g.initialScrollOffset,y=g.layout;if(typeof O=="number"&&this._outerRef!=null){var T=this._outerRef;m==="horizontal"||y==="horizontal"?T.scrollLeft=O:T.scrollTop=O}this._callPropsCallbacks()},h.componentDidUpdate=function(){var g=this.props,m=g.direction,O=g.layout,y=this.state,T=y.scrollOffset,v=y.scrollUpdateWasRequested;if(v&&this._outerRef!=null){var C=this._outerRef;if(m==="horizontal"||O==="horizontal")if(m==="rtl")switch(dX()){case"negative":C.scrollLeft=-T;break;case"positive-ascending":C.scrollLeft=T;break;default:var x=C.clientWidth,b=C.scrollWidth;C.scrollLeft=b-x-T;break}else C.scrollLeft=T;else C.scrollTop=T}this._callPropsCallbacks()},h.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&uX(this._resetIsScrollingTimeoutId)},h.render=function(){var g=this.props,m=g.children,O=g.className,y=g.direction,T=g.height,v=g.innerRef,C=g.innerElementType,x=g.innerTagName,b=g.itemCount,w=g.itemData,R=g.itemKey,I=R===void 0?i6e:R,P=g.layout,k=g.outerElementType,N=g.outerTagName,L=g.style,M=g.useIsScrolling,B=g.width,H=this.state.isScrolling,j=y==="horizontal"||P==="horizontal",X=j?this._onScrollHorizontal:this._onScrollVertical,F=this._getRangeToRender(),V=F[0],G=F[1],D=[];if(b>0)for(var $=V;$<=G;$++)D.push(_.createElement(m,{data:w,key:I($,w),index:$,isScrolling:M?H:void 0,style:this._getItemStyle($)}));var U=n(this.props,this._instanceProps);return _.createElement(k||N||"div",{className:O,onScroll:X,ref:this._outerRefSetter,style:ce({position:"relative",height:T,width:B,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:y},L)},_.createElement(C||x||"div",{children:D,ref:v,style:{height:j?"100%":U,pointerEvents:H?"none":void 0,width:j?U:"100%"}}))},h._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var g=this.props.itemCount;if(g>0){var m=this._getRangeToRender(),O=m[0],y=m[1],T=m[2],v=m[3];this._callOnItemsRendered(O,y,T,v)}}if(typeof this.props.onScroll=="function"){var C=this.state,x=C.scrollDirection,b=C.scrollOffset,w=C.scrollUpdateWasRequested;this._callOnScroll(x,b,w)}},h._getRangeToRender=function(){var g=this.props,m=g.itemCount,O=g.overscanCount,y=this.state,T=y.isScrolling,v=y.scrollDirection,C=y.scrollOffset;if(m===0)return[0,0,0,0];var x=s(this.props,C,this._instanceProps),b=a(this.props,x,C,this._instanceProps),w=!T||v==="backward"?Math.max(1,O):1,R=!T||v==="forward"?Math.max(1,O):1;return[Math.max(0,x-w),Math.max(0,Math.min(m-1,b+R)),x,b]},p})(_.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var s6e=function(t,r){var n=t.children,i=t.direction,o=t.height,s=t.layout,a=t.innerTagName,l=t.outerTagName,u=t.width,c=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||l!=null)&&AT&&!AT.has(c)&&AT.add(c);var f=i==="horizontal"||s==="horizontal";switch(i){case"horizontal":case"vertical":hT&&!hT.has(c)&&hT.add(c);break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(s){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+s+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof o!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(o===null?"null":typeof o)+'" was specified.'))}},a6e=50,oA=function(t,r,n){var i=t,o=i.itemSize,s=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var l=0;if(a>=0){var u=s[a];l=u.offset+u.size}for(var c=a+1;c<=r;c++){var f=o(c);s[c]={offset:l,size:f},l+=f}n.lastMeasuredIndex=r}return s[r]},l6e=function(t,r,n){var i=r.itemMetadataMap,o=r.lastMeasuredIndex,s=o>0?i[o].offset:0;return s>=n?fX(t,r,o,0,n):u6e(t,r,Math.max(0,o),n)},fX=function(t,r,n,i,o){for(;i<=n;){var s=i+Math.floor((n-i)/2),a=oA(t,s,r).offset;if(a===o)return s;a<o?i=s+1:a>o&&(n=s-1)}return i>0?i-1:0},u6e=function(t,r,n,i){for(var o=t.itemCount,s=1;n<o&&oA(t,n,r).offset<i;)n+=s,s*=2;return fX(t,r,Math.min(n,o-1),Math.floor(n/2),i)},pX=function(t,r){var n=t.itemCount,i=r.itemMetadataMap,o=r.estimatedItemSize,s=r.lastMeasuredIndex,a=0;if(s>=n&&(s=n-1),s>=0){var l=i[s];a=l.offset+l.size}var u=n-s-1,c=u*o;return a+c},hX=o6e({getItemOffset:function(t,r,n){return oA(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:pX,getOffsetForIndexAndAlignment:function(t,r,n,i,o,s){var a=t.direction,l=t.height,u=t.layout,c=t.width,f=a==="horizontal"||u==="horizontal",p=f?c:l,h=oA(t,r,o),A=pX(t,o),g=Math.max(0,Math.min(A-p,h.offset)),m=Math.max(0,h.offset-p+h.size+s);switch(n==="smart"&&(i>=m-p&&i<=g+p?n="auto":n="center"),n){case"start":return g;case"end":return m;case"center":return Math.round(m+(g-m)/2);default:return i>=m&&i<=g?i:i<m?m:g}},getStartIndexForOffset:function(t,r,n){return l6e(t,n,r)},getStopIndexForStartIndex:function(t,r,n,i){for(var o=t.direction,s=t.height,a=t.itemCount,l=t.layout,u=t.width,c=o==="horizontal"||l==="horizontal",f=c?u:s,p=oA(t,r,i),h=n+f,A=p.offset+p.size,g=r;g<a-1&&A<h;)g++,A+=oA(t,g,i).size;return g},initInstanceProps:function(t,r){var n=t,i=n.estimatedItemSize,o={itemMetadataMap:{},estimatedItemSize:i||a6e,lastMeasuredIndex:-1};return r.resetAfterIndex=function(s,a){a===void 0&&(a=!0),o.lastMeasuredIndex=Math.min(o.lastMeasuredIndex,s-1),r._getItemStyleCache(-1),a&&r.forceUpdate()},o},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});const AX=40,c6e=400,d6e=_.forwardRef(({options:e=[],itemHeight:t=AX,maxHeight:r=c6e,renderItem:n,headerComponent:i,footerComponent:o,emptyComponent:s,groupBy:a="",getNestedProperty:l=(h,A)=>A.split(".").reduce((g,m)=>g?g[m]:null,h),startCase:u=h=>h.replace(/([A-Z])/g," $1").replace(/_/g," ").trim().split(" ").map(A=>A.charAt(0).toUpperCase()+A.slice(1).toLowerCase()).join(" "),listWidth:c,...f},p)=>{const h=E.useTheme();if(e.length===0&&!i&&!o&&s)return d.jsx(E.MenuList,{component:"ul",...f,children:s});const A=_.useMemo(()=>{if(!a||e.length===0)return e.map(w=>({type:"item",data:w}));const x={};e.forEach(w=>{const I=l(w,a)||"Other";x[I]||(x[I]=[]),x[I].push(w)});const b=[];return Object.entries(x).forEach(([w,R])=>{b.push({type:"header",label:u(w.replace("_"," ")).replace("Auth","Authentication")}),R.forEach(I=>{b.push({type:"item",data:I})})}),b},[e,a,l,u]),g=i&&e.length>0?56:0,m=o?68:0,O=40,y=x=>{if(a&&A[x]&&A[x].type==="header")return O;const b=A[x],w=a?b.data:e[x];let R=40;const I=Math.floor((c-70)/7.3);if(w?.description){const P=Math.ceil(w.description.length/I);R+=Math.max(P,1)*26}return w?.title&&w.title.length>I&&(R+=26),R+4},T=Math.min(g+(a?A.reduce((x,b)=>x+y(A.indexOf(b)),0):e.length*(t+4))+m,r),v=Math.max(T-g-m,0),C=({index:x,style:b})=>{const w=A[x];return a&&"type"in w&&w.type==="header"?d.jsx("div",{style:b,children:d.jsx(E.ListSubheader,{component:"div",sx:{fontSize:"0.8rem",fontWeight:600,color:h.palette.text.secondary,bgcolor:h.palette.grey[300],lineHeight:"2rem",position:"sticky",top:0,zIndex:1},children:w.label})}):d.jsx("div",{style:b,children:n(a?w.data:e[x],x)})};return d.jsxs(E.MenuList,{component:"ul",ref:p,...f,children:[i||null,A.length>0&&(a?d.jsx(hX,{height:v,width:"100%",itemCount:A.length,itemSize:y,overscanCount:5,children:C}):d.jsx(hX,{height:v,width:"100%",itemCount:A.length,itemSize:y||AX,overscanCount:5,children:C})),e.length===0&&s,o]})}),f6e=_.forwardRef((e,t)=>{const r=E.useTheme(),{getNodes:n}=Rt.useReactFlow(),{selectedActivityId:i,nodes:o,aiGeneratedFieldMap:s}=ct.useSelector(ge=>ge.canvas),a=_.useCallback((ge,ye,je,Qe,$e,Je=!1)=>{const{multiple:rt,renderOption:tt,name:Ie,handleChange:Ve}=e,He=Array.isArray(ye)?ye.map(de=>de&&typeof de=="object"&&"value"in de?de.value:de):[],Ee=rt?He.includes(ge.value):ye===ge.value;if(tt){let de=null;try{tt.length>=2?de=tt(null,ge,Ee):de=tt(ge,Ee)}catch{de=null}if(de)return de}const _e=de=>{de.preventDefault();let be;rt?be=He.includes(ge.value)?He.filter(Me=>Me!==ge.value):[...He,ge.value]:be=ge.value,je({target:{value:be}}),$e?$e({field:Ie,value:be}):Ve&&Ve({field:Ie,value:be}),rt||ue(!1)},we=Je?NP(ge.title):ge.title,ee=Je?NP(ge.value):ge.value;return d.jsx(E.MenuItem,{value:ee,disabled:ge.disabled,onClick:_e,selected:Ee,"data-testid":`menu-item-${ee}`,sx:{display:"flex",justifyContent:"flex-start",mx:1,height:"auto",p:"8px !important",minHeight:"fit-content !important","&.Mui-selected":{backgroundColor:rt?r.palette.common.white:"auto","& .MuiTypography-root":{color:rt?r.palette.text.tertiary:r.palette.primary.main}}},children:rt?d.jsxs(d.Fragment,{children:[d.jsx(E.Checkbox,{sx:{p:0},icon:d.jsx(Ue,{src:"ic_unchecked",width:16,height:16,sx:{path:{fill:r.palette.common.white}}}),checkedIcon:d.jsx(Ue,{src:"ic_checked",width:16,height:16}),checked:!!Ee,"data-testid":"checkbox-"+ee}),d.jsx(E.ListItemText,{primary:we,sx:{whiteSpace:"normal"},secondary:ge.description})]}):d.jsxs(E.Stack,{gap:.5,sx:{whiteSpace:"normal"},children:[d.jsxs(E.Stack,{direction:"row",gap:1,flexWrap:"wrap",alignItems:"center",children:[d.jsxs(E.Typography,{variant:"mdNormal",color:r.palette.text.primary,sx:{whiteSpace:"normal"},children:[we,ge?.legacy&&d.jsx(E.Chip,{label:"Legacy",sx:{fontSize:11,ml:1},size:"small"},`${ee}-chip-${ge?.legacy}`)]}),!Je&&ge.chips&&Array.isArray(ge.chips)&&ge.chips.length>0&&d.jsx(E.Stack,{direction:"row",gap:.5,children:ge.chips.map((de,be)=>d.jsx(E.Chip,{sx:{fontSize:11},size:"small",label:de},`${ee}-chip-${be}`))})]}),ge.description&&!ge.chips&&d.jsx(E.Typography,{sx:{fontSize:"0.875rem",fontWeight:400,color:r.palette.text.tertiary},children:ge.description})]})},ee+Qe)},[e,r]),{name:l,control:u,meta:{options:c=[],displayName:f="",error:p={},description:h="",placeholder:A="",readOnly:g=!1,isDisabled:m=!1,displayProps:{loading:O=!1,refreshing:y=!1}={},htmlProps:{showAddNew:T=!1,onClickAddNew:v=null}={},TESSERACT_MAIN_URL:C="",FRONTEND_URL:x="",ENTITY_ID:b="",openIntegrationDrawer:w,addNewButtonText:R="",searchFieldPlaceholder:I="",authType:P="",handleSearchOptions:k=null,showSearchOnLoad:N=!1,showSearch:L=!0},handleChange:M,onFocus:B=null,validationRules:H,viewOnly:j=!1,disabled:X=!1,multiple:F=!1,renderValueUi:V=null,refreshOptions:G=null,renderFieldValue:D=null,groupBy:$="",onOpen:U=null,refreshTooltip:Y="",getSelectedValue:z=null,virtualized:Q=!1,...W}=e,[q,Z]=_.useState(c),[te,ae]=_.useState(""),[ne,ue]=_.useState(!1);_.useEffect(()=>{Z(c)},[c]);const Oe=()=>{B&&B({field:l,fieldData:e})},Te=_.useMemo(()=>_a(ge=>{if(!ge)Z(c);else{const ye=c.filter(je=>String(je.title).toLowerCase().includes(ge.toLowerCase()));Z(ye)}},300),[c]),se=_.useCallback(ge=>{ge.stopPropagation(),ge.preventDefault();const ye=ge.target.value;ae(ye),Te(ye),k&&k(ye)},[Te]),ie=ge=>D?D(ge):F||c.some(ye=>ye.value===ge)?ge:"",J=()=>{ae(""),Z(c)},[K,re]=_.useState(0),le=_.useRef(null),he=_.useMemo(()=>{const ge=String(e?.nodeId||e?.id||""),ye=typeof n=="function"?n():[],je=Array.isArray(ye)&&ye.length>0?ye:o||[],Qe=je.find(Ie=>Ie?.selected),$e=je.find(Ie=>String(Ie?.id)===ge)||je.find(Ie=>String(Ie?.id)===String(i))||Qe,Je=String($e?.id||""),tt=(s||{})[Je]||(s||{})[String(i||"")]||(s||{})[ge];return tt&&typeof tt=="object"?tt:{}},[s,n,o,e,i]),Ae=_.useCallback((ge,ye)=>{const je=String(ge||"").replace(/^properties\./,"");return!(!je||!(je in he)||ye==null||typeof ye=="string"&&ye.trim()===""||Array.isArray(ye)&&ye.length===0)},[he]),fe=()=>r?.drawer.rightMenu.replace("px","")-36;_.useEffect(()=>{const ge=()=>{if(le.current){const je=le.current.clientWidth;re(je>0?je:fe())}else re(fe())};ge();const ye=new ResizeObserver(ge);return le.current&&ye.observe(le.current),()=>{le.current&&ye.unobserve(le.current),ye.disconnect()}},[le?.current?.clientWidth]);const Se=_.useCallback((ge,ye)=>{if($){const je={};return q.forEach(Qe=>{const Je=N4(Qe,$)||"Other";je[Je]||(je[Je]=[]),je[Je].push(Qe)}),Object.entries(je).map(([Qe,$e])=>d.jsxs(_.Fragment,{children:[d.jsx(E.ListSubheader,{sx:{fontSize:"0.8rem",fontWeight:600,color:r.palette.text.secondary,bgcolor:r.palette.grey[300],lineHeight:"2rem"},children:Rs(Qe.replace("_"," ")).replace("Auth","Authentication")}),$e.map((Je,rt)=>a(Je,ge,ye,rt,M,!0))]},Qe))}return q.map((je,Qe)=>a(je,ge,ye,Qe,M,!1))},[q,$,a,r,M]);return d.jsx(pr,{name:l,control:u,rules:H,render:({field:{onChange:ge,onBlur:ye,value:je},fieldState:{error:Qe}})=>d.jsx(E.Stack,{position:"relative",ref:le,children:d.jsxs(sX,{...W,multiple:F,ref:t,title:f,disabled:m||j||X,viewOnly:j,placeholder:A||f,displayEmpty:!0,errorMsg:Qe?.message||p?.errorMsg,helperText:h,value:ie(je),refreshOptions:G,loading:O,open:ne,refreshing:y,refreshTooltip:Y,onOpen:()=>{ue(!0),U&&U()},onClose:()=>{ae(""),Z(c),ue(!1),J()},MenuProps:{PaperProps:{component:"div",sx:{boxShadow:`0 0.25rem 1rem 0 ${r.palette.secondary.main}`,marginTop:"0.5rem",maxHeight:"21.25rem",border:"1px solid",borderColor:r.palette.neutral.outlined.border,maxWidth:`${K}px`,"& .MuiList-root":{display:"flex",maxHeight:"21.25rem",flexDirection:"column",gap:.5,pt:L?0:1,mb:R||c.length===0||O?0:1,"&.MuiMenu-list .MuiListSubheader-root":{p:1},overflowY:"auto"}}},MenuListProps:Q?{component:d6e,options:q,maxHeight:340,listWidth:K,renderItem:($e,Je)=>a($e,je,ge,Je,M),groupBy:$,getNestedProperty:N4,startCase:Rs,headerComponent:L&&(N||k||c.length&&!O)&&d.jsx(E.ListSubheader,{sx:{position:"sticky",top:0,zIndex:10,bgcolor:"white","& .MuiInputBase-root":{width:"100%"},padding:0,marginBottom:1},children:d.jsx(E.OutlinedInput,{onChange:se,value:te,placeholder:I,startAdornment:d.jsx(Ue,{src:"ic_search",width:24,height:24}),onKeyDown:$e=>{$e.stopPropagation(),$e.key==="Escape"&&(ue(!1),ae(""),Z(c))},onClick:$e=>{$e.stopPropagation()},inputRef:$e=>{$e&&ne&&setTimeout(()=>$e.focus(),0)}})},"search-input"),footerComponent:d.jsxs(d.Fragment,{children:[O&&d.jsx(E.Stack,{direction:"row",justifyContent:"center",py:1,px:2,children:d.jsx(E.CircularProgress,{size:24})}),!O&&q.length===0&&d.jsx(E.MenuItem,{disabled:!0,sx:{justifyContent:"center",p:"6px 12px"},children:d.jsx(E.Typography,{variant:"smNormal",children:"No options available"})}),R&&T&&d.jsx(E.MenuItem,{"data-testid":`${f}-popup-footer-item`,selected:!1,sx:{position:"sticky",bottom:0,p:2,zIndex:1e3,height:"auto",":hover":{backgroundColor:`${r.palette.common.white}`},backgroundColor:`${r.palette.common.white}`,borderRadius:0,cursor:"auto",borderTop:`1px solid ${r.palette.neutral.outlined.border}`},disableRipple:!0,onClick:$e=>{$e.stopPropagation(),$e.preventDefault(),ue(!1)},children:d.jsx(HC,{type:P,openIntegrationDrawer:w,TESSERACT_MAIN_URL:C,FRONTEND_URL:x,ENTITY_ID:b,buttonText:R,onClick:v,setMenuOpen:ue})},`${f}-popup-footer-item`)]})}:{component:E.Box},autoFocus:!1,disableAutoFocusItem:!0},renderValue:V||($e=>{const Je=z?.($e)||$e;return d.jsx(ZMe,{isMultiple:F,name:l,placeholder:A,options:c,selected:Je,setMenuOpen:ue,menuOpen:ne,viewOnly:j})}),readOnly:g,name:l,aiIndicatorVisible:Ae(l,je),onFocus:Oe,onChange:$e=>{ge($e),M&&M({field:l,value:$e.target.value}),F||ue(!1)},onBlur:ye,error:!!Qe,children:[L&&(N||k||c.length&&!O)&&d.jsx(E.ListSubheader,{sx:{position:"sticky",top:0,zIndex:10,bgcolor:"white","& .MuiInputBase-root":{width:"100%"}},children:d.jsx(E.OutlinedInput,{onChange:se,value:te,placeholder:I,startAdornment:d.jsx(Ue,{src:"ic_search",width:24,height:24}),onKeyDown:$e=>{$e.stopPropagation(),$e.key==="Escape"&&(ue(!1),ae(""),Z(c))},onClick:$e=>{$e.stopPropagation()},inputRef:$e=>{$e&&ne&&setTimeout(()=>$e.focus(),0)}})},"search-input"),c.length&&!O&&Se(je,ge),O&&d.jsx(E.MenuItem,{disabled:!0,sx:{p:"6px 12px","&.MuiButtonBase-root.MuiMenuItem-root.Mui-disabled":{opacity:1}},children:d.jsx(E.Stack,{alignItems:"center",width:"100%",children:d.jsx(E.CircularProgress,{size:16})})}),q.length===0&&!O&&d.jsx(E.MenuItem,{disabled:!0,sx:{p:"6px 12px"},children:d.jsx(E.Typography,{variant:"smNormal",children:"No options available"})}),T&&d.jsx(E.MenuItem,{"data-testid":`${f}-popup-footer-item`,selected:!1,sx:{position:"sticky",bottom:0,p:2,zIndex:1e3,height:"auto",":hover":{backgroundColor:`${r.palette.common.white} !important`},backgroundColor:`${r.palette.common.white} !important`,borderRadius:0,cursor:"auto",borderTop:`1px solid ${r.palette.neutral.outlined.border}`},disableRipple:!0,onClick:$e=>{$e.stopPropagation()},children:d.jsx(HC,{type:P,openIntegrationDrawer:w,TESSERACT_MAIN_URL:C,FRONTEND_URL:x,ENTITY_ID:b,buttonText:R,onClick:v,setMenuOpen:ue})},`${f}-popup-footer-item`)]})})})}),Yt=vc(f6e),Ei=e=>{const{children:t,rightElement:r=null}=e;return d.jsxs(E.Stack,{gap:2,children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[d.jsx(E.Typography,{className:"setup",variant:"lgSemiBold",children:"Setup"}),r]}),t]})},p6e=e=>{const t=E.useTheme(),{meta:{className:r="",displayName:n="",htmlProps:{headerVariant:i="smSemiBold"}={},description:o=""}={},children:s,defaultExpanded:a=!1}=e,[l,u]=_.useState(a),c=(f,p)=>{u(p)};return d.jsxs(E.Stack,{sx:{width:"100%"},className:r,children:[d.jsxs(E.Accordion,{expanded:l,onChange:c,sx:{border:`1px solid ${t.palette.neutral.outlined.border}`,borderRadius:".5rem !important",overflow:"auto"},children:[d.jsx(E.AccordionSummary,{sx:{borderBottom:l?`1px solid ${t.palette.neutral.outlined.border}`:"none",p:"0.5rem 0.75rem","& .MuiAccordionSummary-content":{margin:"0 !important"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"},backgroundColor:t.palette.white.smoke},expandIcon:d.jsx(Ue,{src:"ic_arrow_down",width:"1.5rem",height:"1.5rem"}),children:d.jsx(E.Stack,{spacing:"0.25rem",justifyContent:"flex-start",children:!Et(n)&&d.jsx(E.Typography,{variant:i,children:n})})}),d.jsx(E.AccordionDetails,{sx:{p:"1rem 0.75rem"},children:s})]}),o&&d.jsx(E.FormHelperText,{children:o})]})},mT=_.forwardRef(({type:e,name:t,label:r,value:n,onChange:i,inputProps:o,errorMsg:s,required:a=!1,viewOnly:l=!1},u)=>d.jsx(lo,{ref:u,label:r,name:t,type:"number",fullWidth:!0,required:a,viewOnly:l,errorMsg:s,helperText:_n(e,t),value:n||"",onChange:c=>{const f=Number(c.target.value);i(f)},inputProps:o})),Mi=e=>{const{type:t,viewOnly:r=!1}=e,{control:n,formState:{errors:i},watch:o}=Rr();return d.jsx(p6e,{meta:{displayName:"Advanced options"},children:d.jsxs(E.Grid,{container:!0,gap:1,children:[t===Ze.PARALLEL&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{sx:{mt:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d.jsx(gn,{label:"Isolate flow failures",description:ao("All parallel flows run to completion even if one fails. Once all finish, the execution is marked as failed if any flow failed — errors are not silently swallowed. When disabled (default), the first flow failure immediately stops all remaining flows."),sx:{fontSize:14,fontWeight:400}}),d.jsx(pr,{name:"properties.isolate_flows",control:n,defaultValue:!1,render:({field:s})=>d.jsx(E.FormControlLabel,{label:s.value?"On":"Off",labelPlacement:"start",control:d.jsx(E.Switch,{...s,checked:!!s.value,disabled:r}),sx:{mr:0,ml:2},componentsProps:{typography:{variant:"smNormal"}}})})]})}),t&&![Ze.SWITCH,Ze.PARALLEL,Ze.IF,Ze.SLEEP,Ze.RESPONSE].includes(t)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{sx:{mt:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d.jsx(gn,{label:"Continue on failure",description:ao("When enabled, a failure handle appears on this node. If this node fails, workflow continues through the failure path. If disabled and this node fails, the entire workflow stops."),sx:{fontSize:14,fontWeight:400}}),d.jsx(pr,{name:"properties.continue_on_failure",control:n,defaultValue:t===Ze.API||t===Ze.GRAPHQL,render:({field:s})=>d.jsx(E.FormControlLabel,{label:s.value?"On":"Off",labelPlacement:"start",control:d.jsx(E.Switch,{...s,checked:!!s.value,disabled:r}),sx:{mr:0,ml:2},componentsProps:{typography:{variant:"smNormal"}}})})]})}),(t===Ze.API||t===Ze.SERVERLESS)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.api_timeout",control:n,render:({field:s})=>d.jsxs(E.FormControl,{fullWidth:!0,children:[d.jsx(gn,{required:!0,label:"Max Time to Wait for API Response (seconds)",description:ao(_n(t,"api_timeout"))}),d.jsx(E.Select,{...s,value:s.value/1e3,disabled:r,onChange:a=>s.onChange(Number(a.target.value)*1e3),children:[3e4,6e4,9e4,12e4].map(a=>d.jsx(E.MenuItem,{value:a/1e3,children:a/1e3},a))})]})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.maximum_timeout",control:n,rules:{min:{value:6e4,message:"Maximum timeout must be at least 60"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"maximum_timeout",label:"Maximum Activity Completion Timeout(seconds)",viewOnly:r,errorMsg:i.properties?.maximum_timeout?.message,value:o("properties.maximum_timeout")/1e3,onChange:a=>s.onChange(a*1e3),inputProps:{min:60,step:10}})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.retry_config.maximum_attempts",control:n,rules:{min:{value:1,message:"Maximum number of attempts must be at least 1"},max:{value:10,message:"Maximum number of attempts must be at most 10"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"maximum_attempts",label:"Maximum Number of Attempts",viewOnly:r,errorMsg:i.properties?.retry_config?.maximum_attempts?.message,inputProps:{min:1,max:10}})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,meta:{options:b4,displayName:"Retry Backoff Rate",searchFieldPlaceholder:"Search",description:"Constants factor by which the time delay between the retry attempts increase after the each failure",placeholder:"Select Retry Backoff Rate"},name:"properties.retry_config.backoff_coefficient",control:n,disabled:r,type:"number"})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.retry_config.initial_interval",control:n,rules:{min:{value:1,message:"Initial interval must be at least 1"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"initial_interval",label:"Wait Time Before First Retry (seconds)",viewOnly:r,errorMsg:i.properties?.retry_config?.initial_interval?.message,inputProps:{min:1,step:1},value:o("properties.retry_config.initial_interval")/1e3,onChange:a=>s.onChange(a*1e3)})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.retry_config.maximum_interval",control:n,rules:{min:{value:100,message:"Max interval must be at least 100"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"maximum_interval",label:"Maximum Wait Between Retries (seconds)",viewOnly:r,errorMsg:i.properties?.retry_config?.maximum_interval?.message,inputProps:{min:100,step:1},value:o("properties.retry_config.maximum_interval")/1e3,onChange:a=>s.onChange(a*1e3)})})})]})})},h6e=({tabs:e,selectedTab:t,setSelectedTab:r,sx:n,textTransform:i="capitalize"})=>{const o=E.useTheme(),[s,a]=_.useState(!1);return _.useEffect(()=>{JM(t)||a(t)},[t]),d.jsx(E.Tabs,{sx:{width:"100%",border:`1px solid ${o.palette.neutral.outlined.border}`,"& .MuiTab-root":{fontSize:12,lineHeight:1},...n},value:s,onChange:(l,u)=>r(u),children:e.map(l=>d.jsx(E.Tab,{sx:{textTransform:i,flex:1,"& .MuiTab-iconWrapper":{ml:0},"&.MuiButtonBase-root.MuiTab-root":{py:.5}},icon:l?.icon,label:l.title,value:l.title,disabled:l.disabled||!1,iconPosition:"end"},l.title))})},gT=(e,t)=>t.split(".").reduce((r,n)=>r?.[n],e),A6e=({id:e,type:t="",field:r,suggestionsData:n,isLoop:i=!1,showKeyValuePair:o=!0,valueTypeSelector:s=null,viewOnly:a=!1,hideLabel:l=!0,name:u,fieldName:c="JSON",excludePayloadSuggestions:f=!1})=>d.jsx(d.Fragment,{children:o?d.jsx(m6e,{id:e,name:u,valueTypeSelector:s,viewOnly:a,isLoop:i,hideLabel:l,type:t,field:r,excludePayloadSuggestions:f}):d.jsx(g6e,{name:u,viewOnly:a,type:t,isLoop:i,fieldName:c,suggestionsData:n})}),m6e=({id:e,name:t,valueTypeSelector:r=null,viewOnly:n=!1,isLoop:i,hideLabel:o=!1,type:s,field:a,excludePayloadSuggestions:l})=>{const{control:u,watch:c,setValue:f,formState:{errors:p}}=Rr(),h=c(t),A=E.useTheme(),{reserved_keywords:g}=ct.useSelector(y=>y.activities),m=()=>{!h||!Array.isArray(h)?f(t,[{key:"",value:""}]):f(t,[...h,{key:"",value:""}])},O=y=>{Array.isArray(h)&&f(t,[...h.slice(0,y),...h.slice(y+1)])};return d.jsxs(E.Box,{children:[!Et(h)&&d.jsxs(E.Box,{sx:{border:`1px solid ${A.palette.grey[300]}`,borderRadius:3},children:[d.jsxs(E.Stack,{direction:"row",sx:{backgroundColor:A.palette.white.smoke,borderRadius:"12px 12px 0 0"},children:[d.jsx(E.Box,{width:r?"29.5%":"44%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Key"})}),r&&d.jsx(E.Box,{width:"29.5%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Type"})}),d.jsx(E.Box,{width:r?"29.5%":"44%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Value"})}),d.jsx(E.Box,{width:r?"11.5%":"12%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Actions"})})]}),d.jsx(E.Stack,{children:Array.isArray(h)&&h?.map((y,T)=>d.jsxs(E.Stack,{direction:"row",flex:1,justifyContent:"normal",alignItems:"flex-start",children:[d.jsx(E.Box,{width:r?"29.5%":"44%",px:1,py:1.5,children:d.jsx(pr,{name:`${t}.${T}.key`,control:u,rules:{required:"Key is required",validate:v=>g.includes(v)?`${v} is a reserved keyword and cannot be used.`:v==null||v===""?"Key cannot be empty":!0},render:({field:v})=>d.jsx(lo,{...v,label:o?"":"Key",fullWidth:!0,id:e,viewOnly:n,showSuggestions:!1,isLoop:i,editorId:`${s}-key_${a}-${T}`,required:!0,placeholder:"Key",errorMsg:gT(p,`${t}.${T}.key`)?.message,excludePayloadSuggestions:l})})}),r,d.jsx(E.Box,{sx:{width:r?"29.5%":"44%",minWidth:0},px:1,py:1.5,children:d.jsx(pr,{name:`${t}.${T}.value`,control:u,rules:{required:"Value is required",validate:v=>g.includes(v)?`${v} is a reserved keyword and cannot be used.`:v==null||v===""?"Value cannot be empty":!0},render:({field:v})=>d.jsx(lo,{...v,showSuggestions:!0,editorId:`${s}-value_${a}-${T}`,label:o?"":"Value",isLoop:i,fullWidth:!0,viewOnly:n,type:"text",top:"6px",required:!0,id:e,placeholder:"Value",errorMsg:gT(p,`${t}.${T}.value`)?.message,excludePayloadSuggestions:l})})}),d.jsx(E.Box,{width:r?"11.5%":"12%",px:1,py:1.5,sx:{display:"flex",alignItems:"flex-start",justifyContent:"center"},children:d.jsx(E.IconButton,{sx:{top:0,p:.75,"& path":{fill:A.palette.neutral.solid.bg},"&:hover path":{fill:A.palette.error[60]},"&:hover":{backgroundColor:"transparent"}},disabled:n,color:"error",onClick:()=>O(T),children:d.jsx(Ue,{width:20,height:20,src:"ic_delete"})})})]},`bulk-edit-${T}`))})]}),d.jsx(E.Tooltip,{title:"Add value set",arrow:!0,children:d.jsx("span",{children:d.jsxs(E.IconButton,{onClick:()=>m(),sx:{mt:Et(h)?0:1.5,fontSize:"1rem","&:hover":{color:A.palette.primary[50],"& .MuiTypography-root":{color:A.palette.primary[50]},"& svg path":{fill:A.palette.primary[50]}}},disableFocusRipple:!0,disableTouchRipple:!0,disableRipple:!0,disabled:n,color:"primary",children:[d.jsx(Ue,{src:"ic_plus",width:16,height:16,sx:{path:{fill:A.palette.primary[60]}}}),d.jsx(E.Typography,{sx:{ml:.5,lineHeight:"20px"},variant:"smMedium",color:A.palette.primary[60],children:"Add"})]})})})]})},g6e=({name:e,viewOnly:t,type:r,isLoop:n,suggestionsData:i,fieldName:o})=>{const{control:s,formState:{errors:a},watch:l}=Rr(),{loopSuggestionsData:u={}}=ct.useSelector(f=>f.loopActivity),c=l("properties.body_type");return d.jsx(pr,{name:e,control:s,rules:{required:`${o} is required`,validate:f=>{if(f.indexOf("{{")!==-1&&f.lastIndexOf("}}")!==-1&&f.lastIndexOf("}}")>f.indexOf("{{"))return!0;try{JSON.parse(f)}catch{return"The provided value is not valid JSON."}return!0}},render:({field:f})=>d.jsx(Fi,{size:"md",language:c==="xml"?"xml":"json",showSuggestions:!0,viewOnly:t,id:`${r}-${f}`,suggestionsData:n?u:i,showExpandOption:!0,handleChange:p=>{f.onChange(p)},value:typeof f.value=="object"?JSON.stringify(f.value,null,2):f.value,error:!!gT(a,e)?.message,errorMsg:gT(a,e)?.message})})},Aa=Gi(A6e),E6e=e=>{const{id:t,isLoop:r,control:n,bodyTypeWatch:i,method:o,...s}=e;return i==="form-data"||i==="x-www-form-urlencoded"?d.jsx(Aa,{id:t,isLoop:r,field:"body",type:"apiActivity",title:"Body",fieldName:"Body",valueTypeSelector:i==="form-data"&&d.jsx(E.Stack,{width:"29.5%",px:1,py:1.5,children:d.jsx(E.Select,{name:"value_type",value:"text",sx:{".MuiInputBase-inputSizeSmall":{height:"auto !important"}},children:_4.length?_4.map(a=>d.jsx(E.MenuItem,{value:a.value,sx:{minHeight:"40px !important","@media (min-width: 600px)":{minHeight:"40px !important"}},children:a.title},a.value)):d.jsx(E.MenuItem,{disabled:!0,sx:{p:"14px 16px"},children:d.jsx(E.Typography,{variant:"smNormal",children:"No options"})})})}),...s}):["raw","xml"].includes(i)?d.jsx(Aa,{id:t,isLoop:r,field:"body",type:"apiActivity",title:"Body",showKeyValuePair:!1,fieldName:"Body",...s}):null},O6e=_.forwardRef((e,t)=>{const r=ct.useDispatch(),n=E.useTheme(),{type:i,lambdaUrls:o,id:s,isLoop:a=!1,VORTEX_MAIN_URL:l,ENTITY_ID:u,viewOnly:c=!1}=e,[f,p]=_.useState(""),[h,A]=_.useState(!1),[g,m]=_.useState("Query Params"),[O,y]=_.useState(!1),{setValue:T,control:v,watch:C,trigger:x}=Rr(),[b,w,R,I]=C(["properties","type","properties.body_type","properties.method"]),P=async N=>{y(!0);const L=Xt(l,`/v1.0/${u}`,"/utility/curl");try{const B=(await zt.post(L,{data:{curl:N}}))?.data?.data,H=XMe(N),j=V=>typeof V=="string"?(D=>{const $=[];return D.split("&").forEach(U=>{const[Y,z]=U.split("=");$.push({key:Y,value:z})}),$})(V):typeof V=="object"&&V!==null&&!Array.isArray(V)?qo(V):V,X=V=>H==="none"?null:H==="raw"&&V!==null?JSON.stringify(V,null,2):H==="xml"&&V!==null?typeof V=="string"?V:"":j(V),F={method:B?.method?.toLowerCase()||"",endpoint:B?.url,headers:qo(B?.headers||{}),body:X(B?.data)||{},state_params:qo(B?.state_params||{}),query_params:qo(B?.queries||{}),body_type:H};T("properties",{...b,...F}),r({type:Qr,payload:{open:!0,title:"cURL imported successfully",type:"success"}}),A(!1),p("")}catch(M){sr(M,r)}finally{y(!1)}},k=async N=>{if(!N){r({type:Qr,payload:{open:!0,title:"Please enter cURL",type:"error"}});return}P(N)};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{rightElement:w==="apiActivity"&&d.jsx(E.Button,{variant:"outlined",color:"primary",onClick:()=>{A(!0)},disabled:c,sx:{textTransform:"none","&.MuiButtonBase-root.MuiButton-root.MuiButton-outlined":{color:n.palette.primary.main,borderColor:n.palette.primary[30]}},children:"Import cURL"}),children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.method",control:v,meta:{options:QO,displayName:"Method",searchFieldPlaceholder:"Search Method",placeholder:"Select Method",description:"The HTTP Method to be used for the request"},validationRules:{required:"Method is required"},viewOnly:c,id:i})})})}),b.method&&d.jsx(E.Divider,{}),b.method&&d.jsxs(En,{children:[d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:w===Ze.SERVERLESS?d.jsx(Yt,{required:!0,name:"properties.endpoint",control:v,meta:{options:o,displayName:"Endpoint",searchFieldPlaceholder:"Search Endpoint",description:"The URL of the HTTP Request.",placeholder:"Select Endpoint"},validationRules:{required:"Endpoint is required"},viewOnly:c,id:i}):d.jsx(kr,{required:!0,id:s,name:"properties.endpoint",control:v,meta:{displayName:"Base URL",description:"The URL of the HTTP Request.",placeholder:"Enter URL"},validationRules:{required:"Base URL is required"},viewOnly:c,editorId:`${i}-base_url-${a}`,showSuggestions:!0,isLoop:a})}),d.jsx(h6e,{variant:"normal",tabs:[{title:"Query Params",icon:d.jsx(E.Tooltip,{arrow:!0,title:"Query params are key-value pairs added to a URL to filter or specify data in a request.",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})},{title:"State Params",icon:d.jsx(E.Tooltip,{arrow:!0,title:"Path params are variables embedded directly in the URL path to identify specific resources (e.g., an ID).",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})},{title:"Headers",icon:d.jsx(E.Tooltip,{arrow:!0,title:"Headers are key-value pairs sent along with the HTTP request or response to pass metadata such as authentication tokens, content type, or client information.",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})},{title:"Body",icon:d.jsx(E.Tooltip,{arrow:!0,title:"The body is the payload of the request, typically used in POST, PUT, or PATCH methods to send data to the server.",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})}],selectedTab:g,setSelectedTab:m}),g==="Query Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:s,field:"query_params",type:"apiActivity",title:"Query Params",viewOnly:c,isLoop:a,name:"properties.query_params"})}),g==="State Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:s,isLoop:a,viewOnly:c,field:"state_params",type:"apiActivity",title:"State Params",name:"properties.state_params"})}),g==="Headers"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:s,field:"headers",viewOnly:c,isLoop:a,type:"apiActivity",title:"Headers",name:"properties.headers"})}),g==="Body"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{direction:"column",container:!0,gap:1,children:[d.jsx(Yt,{required:!0,name:"properties.body_type",control:v,meta:{options:Rue,displayName:"Body Type",searchFieldPlaceholder:"Search Body type",placeholder:"Select Body type"},validationRules:{required:"Body type is required"},viewOnly:c,id:i,handleChange:N=>{const{value:L}=N;x("properties.body"),L==="none"?T("properties.body",null):L==="raw"?T("properties.body","{}"):L==="form-data"?T("properties.body",qo({})):L==="x-www-form-urlencoded"?T("properties.body",qo({})):L==="xml"&&T("properties.body",""),T("properties.headers",qMe(L,b))}}),d.jsx(E6e,{id:s,isLoop:a,viewOnly:c,name:"properties.body",control:v,method:I,bodyTypeWatch:R})]})},R),!a&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:c,type:i})})]}),d.jsx(Co,{variant:"medium",open:h,icon:d.jsx(Ue,{width:24,height:24,src:"ic_download",sx:{path:{fill:n.palette.primary.main}}}),title:"Import cURL",handleClose:()=>{A(!1)},content:d.jsxs(E.Stack,{flexDirection:"column",gap:.5,width:"100%",children:[d.jsx(E.TextField,{name:"curl",disabled:O||c,fullWidth:!0,multiline:!0,rows:10,variant:"outlined",placeholder:"Paste cURL here",value:f,onChange:N=>{p(N.target.value)}}),d.jsxs(E.Stack,{flexDirection:"row",alignItems:"center",sx:{mt:.5},children:[d.jsx(Ue,{src:"ic_info"}),d.jsx(E.Typography,{variant:"smMedium",sx:{ml:1,fontStyle:"italic"},children:"This will overwrite any changes you have already made."})]})]}),footer:d.jsx(E.Stack,{flexDirection:"row",width:"100%",justifyContent:"flex-end",alignItems:"center",children:d.jsx(E.Box,{children:d.jsx(E.Button,{variant:"contained",onClick:()=>{k(f)},disabled:c,sx:{fontSize:"14px",boxShadow:N=>N.shadows[0],padding:"2px 16px"},startIcon:O&&d.jsx(E.CircularProgress,{color:"inherit",size:16}),children:"Import"})})})})]})]})}),mX={Folder:[{name:"Created",value:"storage.folder.created"},{name:"Deleted",value:"storage.folder.deleted"}],File:[{name:"Uploaded",value:"storage.file.uploaded"},{name:"Deleted",value:"storage.file.deleted"},{name:"Made Public",value:"storage.file.public"},{name:"Made Private",value:"storage.file.private"}]},y6e=_.forwardRef((e,t)=>{const{viewOnly:r=!1}=e,{setValue:n}=Rr(),{control:i}=Rr(),o={"storage.file.uploaded":"Workflow will be triggered when a new file is uploaded to the boltic storage.","storage.file.updated":"The content or metadata of an existing file is updated.","storage.file.deleted":"A file has been permanently deleted from the storage.","storage.file.public":"A file has been made publicly accessible.","storage.file.private":"A file's public access has been revoked, making it private.","storage.folder.created":"Workflow will be triggered when a new folder is created in the boltic storage.","storage.folder.deleted":"A folder has been permanently deleted from the storage."},s=[...mX.Folder.map(a=>({title:"Folder "+a.name,value:a.value})),...mX.File.map(a=>({title:"File "+a.name,value:a.value}))];return d.jsx(En,{children:d.jsx(Yt,{name:"properties.events",control:i,meta:{options:s.map(a=>({...a,description:o[a.value]})),displayName:"Events",searchFieldPlaceholder:"Search",description:"Select Boltic storage event(s) when you want to trigger workflow",placeholder:"Select Events"},validationRules:{validate:a=>a.length===0?"Events is required":!0},multiple:!0,renderFieldValue:a=>Array.isArray(a)?a.map(l=>l?.value):[],handleChange:a=>{n(a?.field,a?.value?.map(l=>l.value?l:{value:l}))},viewOnly:r,getSelectedValue:a=>Array.isArray(a)?a?.map(l=>s.find(u=>u.value===l))?.filter(l=>l?.title):[],required:!0})})}),v6e=_.forwardRef((e,t)=>{const r=E.useTheme(),{setValue:n,control:i,watch:o}=Rr(),s=o("properties"),a={folder_name:""},l={file_content:"",file_name:"",folder_path:"",overwrite:!1,is_public:!1,is_public_permanent:!1},u={file_paths:"",ttl_seconds:""},c={file_path:""},f={folder_path:"",page_size:"",next_page_token:""},{id:p,isLoop:h=!1,viewOnly:A=!1,type:g}=e,m=y=>T=>{if(s?.event==="upload_file"){if(y==="file_name"){if(T?.trim()==="")return"File name is required";if(T?.trim()?.includes("/"))return"'/' is not allowed in file name."}return y==="file_content"&&T?.trim()===""?"File content is required":y==="expire_in"&&(T<1||T>10080)?"Expiry values between 1 to 10080 are accepted.":!0}else{if(["delete_file","make_file_public","make_file_private"].includes(s?.event))return y==="file_paths"&&T?.trim()===""?"File path is required":!0;if(s?.event==="download_file")return y==="file_path"&&T?.trim()===""?"File path is required":!0;if(s?.event==="create_folder"){if(T?.trim()==="")return"Folder name can not be empty";const v=/^[A-Za-z0-9 _-]*$/,C=/{{[^{}]+}}/g,x=T.replace(C,"");if(!Vue(T)&&!v.test(x))return"Folder name should not contain special characters [!@#$%^&*()+{}[]:;<>,.?~/]."}}return!0},O=()=>({create_folder:[{required:!0,type:"text",label:"Folder Name",fieldName:"folder_name",placeholder:""}],upload_file:[{required:!0,type:"text",label:"File Content",fieldName:"file_content",placeholder:""},{required:!0,type:"text",label:"File Name",fieldName:"file_name",placeholder:"filename.csv"},{required:!1,type:"text",label:"Folder Path",fieldName:"folder_path",placeholder:"path/to/folder"},{required:!1,type:"checkbox",label:"Overwrite existing file with same name",fieldName:"overwrite",placeholder:""},{required:!1,type:"checkbox",label:"Generate Shareable Link",fieldName:"is_public",placeholder:""},{required:!1,type:"checkbox",label:"Make file public",fieldName:"is_public_permanent",placeholder:""},{required:!1,type:"number",label:"Expires in",fieldName:"expire_in",placeholder:"Enter minute(s)",helperText:"Default is 60min"}],download_file:[{required:!0,type:"text",label:"File Path",fieldName:"file_path",placeholder:"folder/file.csv",description:"Path of the file to download. The workflow output returns Base64 file content."}],delete_file:[{required:!0,type:"text",label:"File Path(s)",fieldName:"file_paths",placeholder:"file.csv or folder/file.csv"}],make_file_public:[{required:!0,type:"text",label:"File Path(s)",fieldName:"file_paths",placeholder:"file.csv or folder/file.csv"},{required:!1,type:"number",label:"Cache TTL seconds",fieldName:"ttl_seconds",placeholder:"300"}],make_file_private:[{required:!0,type:"text",label:"File Path(s)",fieldName:"file_paths",placeholder:"file.csv or folder/file.csv"}],list_files:[{required:!1,type:"text",label:"Folder Path or File Prefix",fieldName:"folder_path",placeholder:"reports/ or report.csv",description:"Use a trailing slash to list a folder (for example, reports/). Enter a file name or prefix to search files. Leave blank for root."},{required:!1,type:"number",label:"Page Size",fieldName:"page_size",placeholder:"100"},{required:!1,type:"text",label:"Next Page Token",fieldName:"next_page_token",placeholder:"{{listFiles1.files.next_page_token}}",description:"Leave blank for the first page. To fetch the next page, pass next_page_token from the previous List Files/Folders result."}]}[s.event]||[]).map(({label:v,fieldName:C,type:x,required:b,placeholder:w,description:R})=>{if(x==="text")return d.jsx(kr,{name:`properties.${s.event}.${C}`,control:i,meta:{displayName:v,description:R||_n(g,C),placeholder:w},validationRules:{validate:m(C)},editorId:`${x}-bs-activity-${C}`,id:p,required:b,isLoop:h,viewOnly:A,showSuggestions:!0},C);if(x=="number"&&(s?.event!=="upload_file"||s?.upload_file?.is_public))return d.jsx(kr,{name:`properties.${s.event}.${C}`,control:i,meta:{displayName:v,description:_n(g,C),placeholder:w},validationRules:{validate:m(C)},editorId:`${x}-bs-activity-${C}`,id:p,fieldType:"number",required:b,isLoop:h,viewOnly:A,showSuggestions:!0},C);if(x==="checkbox")return d.jsx(E.Box,{sx:{width:"100%"},children:d.jsx(pr,{name:`properties.upload_file.${C}`,control:i,rules:{validate:m(C)},render:({field:{value:I,...P},fieldState:{error:k}})=>d.jsxs(E.FormGroup,{children:[d.jsx(E.FormControlLabel,{control:d.jsx(E.Checkbox,{...P,icon:d.jsx(Ue,{src:"ic_unchecked",width:16,height:16,sx:{path:{fill:r.palette.common.white}}}),checkedIcon:d.jsx(Ue,{src:"ic_checked",width:16,height:16}),sx:{p:0,"& .MuiSvgIcon-root":{fontSize:N=>N.typography.xlMedium.fontSize}},readOnly:A,checked:I}),label:v}),k?.message&&d.jsx(E.FormHelperText,{children:k.message})]})})},C)});return d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event",control:i,meta:{options:C4,displayName:"Event",searchFieldPlaceholder:"Search",description:"Select a event",placeholder:"Select a event"},validationRules:{required:"Event is required"},viewOnly:A,id:"event",handleChange:y=>{const{value:T}=y;T=="create_folder"?n("properties",{...s,create_folder:a,event:T}):T==="upload_file"?n("properties",{...s,upload_file:l,event:T}):T==="download_file"?n("properties",{...s,download_file:c,event:T}):T==="list_files"?n("properties",{...s,list_files:f,event:T}):n("properties",{...s,[T]:u,event:T})},renderValueUi:y=>{const T=C4.find(v=>v.value===y);return T?T.title:""}})}),O(),!h&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:A,type:g})})]})})}),jP=({type:e="",name:t,title:r,options:n,required:i,loadDataFromApi:o,loadingState:s,show:a=!1,secretType:l="",onFocus:u,TESSERACT_MAIN_URL:c="",FRONTEND_URL:f="",ENTITY_ID:p="",onTextInputChange:h,onAddButtonClick:A,buttonName:g="",viewOnly:m=!1,validationRules:O=null,control:y,handleChange:T=null,...v})=>{const[C,x]=_.useState(!1);return _.useEffect(()=>{x(!!s)},[s]),d.jsx(Yt,{required:i,name:t,control:y,renderFieldValue:b=>Array.isArray(b)?b?.length>0&&b[0]&&n.some(w=>w.id===b[0]?.id)?b[0]?.id:"":n.some(w=>w.value===b)?b:"",meta:{options:yn(n),displayProps:{loading:C},displayName:r,TESSERACT_MAIN_URL:c,FRONTEND_URL:f,ENTITY_ID:p,addNewButtonText:g,searchFieldPlaceholder:"Search",authType:l,description:_n(e,t),handleSearchOptions:b=>{h&&h(x,b)},htmlProps:{showAddNew:a,onClickAddNew:A},showSearchOnLoad:!0,placeholder:`Select ${r?.toLowerCase()}`},validationRules:O,viewOnly:m,id:t,onOpen:()=>{o&&(x(!0),o(x,""))},onFocus:u,handleChange:T,...v})},T6e=_.forwardRef((e,t)=>{const r=E.useTheme(),[n,i]=_.useState(!1),[o,s]=_.useState(!1),[a,l]=_.useState([]),[u,c]=_.useState([]),[f,p]=_.useState([]),[h,A]=_.useState([]),[g,m]=_.useState(!1),[O,y]=_.useState(!1),T=ct.useDispatch(),{ATHENA_MAIN_URL:v,FRONTEND_URL:C,ENTITY_ID:x,viewOnly:b=!1}=e,{control:w,watch:R,setValue:I,getValues:P}=Rr(),k=R("properties"),[N,L,M]=R(["properties.field","properties.events","properties.table"]),B=(D=null,$=null,U=null,Y=null)=>{const z=P("properties.database")||"";let W=(Y!==null?Y:h).find(ae=>ae.id===z);if(!W&&z&&(W={id:z,resource_id:"boltic"}),!z||!W){U&&U(!1);return}const q=Xt(v,`/list?db_id=${z}`),Z=[{field:"name",operator:"ILIKE",values:[""]},{field:"resource_id",operator:"=",values:[W.resource_id||"boltic"]},{field:"db_id",operator:"=",values:[z]}],te={data:{page:{page_no:1,page_size:999},filters:Z,sort:[{field:"created_at",direction:"desc"}]}};if(D&&Array.isArray(D)){const ae=D.find(ne=>ne.field==="name");if(ae){te.data.filters[0]=ae;const ne=D.filter(ue=>!["name","resource_id","db_id"].includes(ue.field));te.data.filters.push(...ne)}}zt.post(q,te).then(ae=>{if(l(ae?.data?.data||[]),$){$=ae?.data?.data?.filter(Te=>Te?.id===$);const ne=R("properties"),{payload:ue,...Oe}=ne||{};I("properties",{...Oe,table:$})}}).catch(ae=>{sr(ae,T)}).finally(()=>{U&&U(!1)})},H=async()=>{if(!v){m(!1);return}m(!0);const D=Xt(v,"/connectors/list");zt.post(D,{data:{page:{page_no:1,page_size:999},filters:[],sort:[]}}).then($=>{m(!1);const U=[{id:"boltic",name:"Boltic Cloud"},...$?.data?.data||[]];p(U);const z=R("properties")?.connector;if(!z&&U.length>0){const Q=U[0].id;I("properties.connector",Q),j(Q)}else z&&j(z)}).catch($=>{sr($,T),m(!1)})},j=async D=>{if(!D)return[];y(!0);try{const $={page:{page_no:1,page_size:1e3},filters:[{field:"status",operator:"=",values:["ACTIVE"]}],sort:[]},U=`${v}/databases/list?connector_id=${D}`,z=(await zt.post(U,{data:$}))?.data?.data||[];A(z);const W=R("properties")?.database;if(!W&&z.length>0){const q=z[0].id;I("properties.database",q),setTimeout(()=>{B()},100)}else W&&setTimeout(()=>{B(null,null,null,z)},100);return z}catch($){return sr($,T),[]}finally{y(!1)}},X=()=>{i(!0);const D=P("properties.database")||"",$=P("properties.connector")||"boltic";let U=h.find(W=>W.id===D);!U&&D&&(U={id:D,resource_id:"boltic"});const Y=U?.resource_id||"boltic",z={name:"Workflow Table",is_ai_generated_schema:!0},Q={};D&&(Q.db_id=D),Q.resource_id=Y,zt.post(v,{data:z,params:Q}).then(W=>{W?.data?.data?.id&&(D==""&&j($),B(null,W?.data?.data?.id)),T({type:Qr,payload:{open:!0,title:"Table created successfully",type:"success"}}),i(!1);const q=W?.data?.data?.id,Z=new URLSearchParams({connector:$,database:D,resource:Y}).toString(),te=`${C}/accounts/${x}/tables/create/${q}?${Z}`;window.open(te)}).catch(W=>{i(!1),T({type:Qr,payload:{open:!0,title:"Table creation failed",type:"error"}}),sr(W,T)})};_.useEffect(()=>{N?.length>0&&M.length>0&&V(M[0]?.id)},[]),_.useEffect(()=>{L?.some($=>$?.value==="table.button.triggered"||$?.value==="table.field.updated")&&M?.length>0&&V(M[0]?.id)},[JSON.stringify(L),JSON.stringify(M)]);const F=[...Due.Record.map(D=>({title:D.name,value:D.value,description:D.description}))],V=async D=>{const $=k?.database||"";if(!$){s(!1);return}s(!0);const U=Xt(v,`/${D}/fields/list?db_id=${$}`);try{let Y=await zt.post(U,{data:{page:{page_no:1,page_size:999},filters:[],sort:[{field:"name",direction:"desc"}]}});Y=Y.data?.data?Y.data.data:[];const z=Y.filter(Q=>!["created_at","updated_at","id","created_by","updated_by"].includes(Q.name));c(z),s(!1)}catch(Y){sr(Y,T)}finally{s(!1)}},G=_a((D,$)=>{B(D=D,null,$)},300);return _.useEffect(()=>{H()},[]),_.useEffect(()=>{if(N===null){const{field:D,...$}=R("properties");I("properties",$)}},[N]),d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.connector",control:w,meta:{options:(f||[]).map(D=>({value:D.id,title:D.name||D.id})),displayName:"Connector",searchFieldPlaceholder:"Search Connector",placeholder:"Select Connector",isLoading:g},validationRules:{required:"Connector is required"},viewOnly:b,fullWidth:!0,id:"connector",required:!0,handleChange:async D=>{const{value:$}=D;I("properties.connector",$),I("properties.database",""),I("properties.table",[]),I("properties.events",[]),I("properties.field",null),I("properties.button",[]),A([]),l([]),c([]),$&&await j($)}})})}),k?.connector&&d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.database",control:w,meta:{options:(h||[]).map(D=>({value:D.id,title:D.db_name||D.id,...k?.connector&&k.connector!=="boltic"&&D?.resource_name?{description:D.resource_name}:{}})),displayName:"Database",searchFieldPlaceholder:"Search Database",placeholder:"Select Database",isLoading:O},viewOnly:b,fullWidth:!0,id:"database",required:!0,handleChange:D=>{const{value:$}=D;I("properties.database",$),I("properties.table",[]),I("properties.events",[]),I("properties.field",null),I("properties.button",[]),l([]),c([]),$&&B()}})}),!O&&h?.length===0&&d.jsx(E.Typography,{variant:"caption",sx:{mt:.5,display:"block",color:"text.secondary"},children:"No database is present, please create your first table to create a database."})]}),(k?.database||k?.database=="")&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(jP,{type:"bolticTable",viewOnly:b,title:"Table",required:!0,onTextInputChange:async(D,$)=>{D(!0),G([{field:"name",operator:"ILIKE",values:[$]}],D)},onAddButtonClick:X,buttonName:"Create New Table",options:a,loadingState:n,loadDataFromApi:async D=>{a?.length?D(!1):B(null,null,D)},handleChange:D=>{const $=a?.find(U=>U?.id===D?.value)||null;I("properties.table",[$],{shouldValidate:!0}),(k.events||[]).map(U=>U?.value).filter(Boolean).indexOf("table.button.triggered")!==-1&&V($?.id)},name:"properties.table",control:w,validationRules:{validate:D=>!D||!Array.isArray(D)||D.length===0?"Table is required":!0},show:!0})})}),!Et(k.table)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.events",control:w,multiple:!0,renderFieldValue:D=>D?.map($=>$?.value),meta:{options:F.map(D=>{const $=(k.events||[]).map(Q=>Q?.value).filter(Boolean),U=$.includes("table.field.updated"),Y=$.includes("table.record.updated"),z=U&&D.value==="table.record.updated"||Y&&D.value==="table.field.updated";return{...D,disabled:z}}),displayName:"Events",searchFieldPlaceholder:"Search",description:"Select Boltic table event(s) when you want to trigger the workflow.",placeholder:"Select Events"},validationRules:{validate:{required:D=>!D||D.length===0?"Events is required":!0}},viewOnly:b,id:"events",handleChange:D=>{const $=[...D.value],U=$.pop();$.includes(U)?I("properties.events",$.filter(z=>z!==U).map(z=>({value:z})),{shouldValidate:!0}):I("properties.events",[...$.map(z=>({value:z})),{value:U}],{shouldValidate:!0})},renderValueUi:D=>D?.length>0&&D?.[0]?d.jsx(E.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:D.map($=>F.find(U=>U.value===$)).filter($=>$?.title).map($=>d.jsx(E.Chip,{label:$.title},$.title))}):d.jsx(E.Typography,{sx:{color:"neutral.solid.bg",fontSize:"14px",":hover":{opacity:.7}},children:"Select Events"}),renderOption:(D,$)=>d.jsxs(E.MenuItem,{value:$.value,disabled:$.disabled,sx:{p:"8px !important",mx:1,height:"auto","&.Mui-selected":{"& .MuiTypography-root":{color:U=>U.palette.primary.main}}},children:[d.jsx(E.Checkbox,{sx:{p:0},icon:d.jsx(Ue,{src:"ic_unchecked",width:16,height:16,sx:{path:{fill:r.palette.common.white}}}),checkedIcon:d.jsx(Ue,{src:"ic_checked",width:16,height:16}),checked:!!(Array.isArray(k.events)&&k.events.find(U=>$.value===U.value))}),d.jsx(E.ListItemText,{primary:$.title,secondary:$.description})]},$.value)})}),L?.map(D=>D?.value).filter(Boolean).indexOf("table.button.triggered")!==-1&&M?.[0]&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.button",control:w,renderFieldValue:D=>D?.map($=>$?.value),meta:{options:yn(u),displayProps:{loading:o},displayName:"Trigger button",value:"",searchFieldPlaceholder:"Search",renderFieldValue:D=>u?.find($=>$?.id===D?.[0]?.id)||null,placeholder:"Select Trigger Button"},renderValueUi:D=>d.jsx(E.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:D?.map($=>yn(u).find(U=>U.value===$)).filter($=>$?.title).map($=>d.jsx(E.Chip,{label:$.title},$.title))}),handleChange:D=>{const{field:$,value:U}=D;Et(U)||I($,[U],{shouldValidate:!0})},validationRules:{required:"Button is required",validate:D=>L?.some($=>$?.value==="table.button.triggered")&&(!D||D.length==0)?"Trigger button is required":!0},viewOnly:b,id:"button",renderOption:(D,$)=>d.jsxs(E.MenuItem,{value:$.value,disabled:$.disabled,sx:{p:"8px !important",mx:1,height:"auto","&.Mui-selected":{"& .MuiTypography-root":{color:U=>U.palette.primary.main}}},children:[d.jsx(E.Checkbox,{sx:{p:0},checked:!!(Array.isArray(k.button)&&k.events.find(U=>$.value===U.value))}),d.jsx(E.ListItemText,{primary:$.title,secondary:$.description})]},$.value)})}),L?.map(D=>D?.value).filter(Boolean).indexOf("table.field.updated")!==-1&&M?.[0]&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.field",control:w,meta:{options:yn(u),displayName:"Trigger field",searchFieldPlaceholder:"Search for authentication type",displayProps:{loading:o},description:"Choose a field to trigger the workflow when it changes.",placeholder:"Select Trigger Field"},renderFieldValue:D=>D?.length>0&&u?.some($=>$?.id===D[0]?.id)?D[0]?.id:"",validationRules:{validate:D=>L?.some($=>$?.value==="table.field.updated")&&(!D||D.length==0)?"Field is required":!0},viewOnly:b,id:"field",required:!0,handleChange:D=>{const{field:$,value:U}=D,Y=u?.find(z=>z?.id===U)||null;Et(Y)?I($,null,{shouldValidate:!0}):I($,[Y],{shouldValidate:!0})}})})})]})})});var ET={exports:{}},S6e=ET.exports,gX;function x6e(){return gX||(gX=1,(function(e,t){(function(r,n){e.exports=n()})(S6e,(function(){var r="week",n="year";return function(i,o,s){var a=o.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=s(this).startOf(n).add(1,n).date(u),f=s(this).endOf(r);if(c.isBefore(f))return 1}var p=s(this).startOf(n).date(u).startOf(r).subtract(1,"millisecond"),h=this.diff(p,r,!0);return h<0?s(this).startOf("week").week():Math.ceil(h)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(ET)),ET.exports}var b6e=x6e();const C6e=Un(b6e);var OT={exports:{}},_6e=OT.exports,EX;function w6e(){return EX||(EX=1,(function(e,t){(function(r,n){e.exports=n()})(_6e,(function(){var r={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"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,o=/\d\d/,s=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(m){return(m=+m)+(m>68?1900:2e3)},c=function(m){return function(O){this[m]=+O}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(O){if(!O||O==="Z")return 0;var y=O.match(/([+-]|\d\d)/g),T=60*y[1]+(+y[2]||0);return T===0?0:y[0]==="+"?-T:T})(m)}],p=function(m){var O=l[m];return O&&(O.indexOf?O:O.s.concat(O.f))},h=function(m,O){var y,T=l.meridiem;if(T){for(var v=1;v<=24;v+=1)if(m.indexOf(T(v,0,O))>-1){y=v>12;break}}else y=m===(O?"pm":"PM");return y},A={A:[a,function(m){this.afternoon=h(m,!1)}],a:[a,function(m){this.afternoon=h(m,!0)}],Q:[i,function(m){this.month=3*(m-1)+1}],S:[i,function(m){this.milliseconds=100*+m}],SS:[o,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[s,c("seconds")],ss:[s,c("seconds")],m:[s,c("minutes")],mm:[s,c("minutes")],H:[s,c("hours")],h:[s,c("hours")],HH:[s,c("hours")],hh:[s,c("hours")],D:[s,c("day")],DD:[o,c("day")],Do:[a,function(m){var O=l.ordinal,y=m.match(/\d+/);if(this.day=y[0],O)for(var T=1;T<=31;T+=1)O(T).replace(/\[|\]/g,"")===m&&(this.day=T)}],w:[s,c("week")],ww:[o,c("week")],M:[s,c("month")],MM:[o,c("month")],MMM:[a,function(m){var O=p("months"),y=(p("monthsShort")||O.map((function(T){return T.slice(0,3)}))).indexOf(m)+1;if(y<1)throw new Error;this.month=y%12||y}],MMMM:[a,function(m){var O=p("months").indexOf(m)+1;if(O<1)throw new Error;this.month=O%12||O}],Y:[/[+-]?\d+/,c("year")],YY:[o,function(m){this.year=u(m)}],YYYY:[/\d{4}/,c("year")],Z:f,ZZ:f};function g(m){var O,y;O=m,y=l&&l.formats;for(var T=(m=O.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(I,P,k){var N=k&&k.toUpperCase();return P||y[k]||r[k]||y[N].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(L,M,B){return M||B.slice(1)}))}))).match(n),v=T.length,C=0;C<v;C+=1){var x=T[C],b=A[x],w=b&&b[0],R=b&&b[1];T[C]=R?{regex:w,parser:R}:x.replace(/^\[|\]$/g,"")}return function(I){for(var P={},k=0,N=0;k<v;k+=1){var L=T[k];if(typeof L=="string")N+=L.length;else{var M=L.regex,B=L.parser,H=I.slice(N),j=M.exec(H)[0];B.call(P,j),I=I.replace(j,"")}}return(function(X){var F=X.afternoon;if(F!==void 0){var V=X.hours;F?V<12&&(X.hours+=12):V===12&&(X.hours=0),delete X.afternoon}})(P),P}}return function(m,O,y){y.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(u=m.parseTwoDigitYear);var T=O.prototype,v=T.parse;T.parse=function(C){var x=C.date,b=C.utc,w=C.args;this.$u=b;var R=w[1];if(typeof R=="string"){var I=w[2]===!0,P=w[3]===!0,k=I||P,N=w[2];P&&(N=w[2]),l=this.$locale(),!I&&N&&(l=y.Ls[N]),this.$d=(function(H,j,X,F){try{if(["x","X"].indexOf(j)>-1)return new Date((j==="X"?1e3:1)*H);var V=g(j)(H),G=V.year,D=V.month,$=V.day,U=V.hours,Y=V.minutes,z=V.seconds,Q=V.milliseconds,W=V.zone,q=V.week,Z=new Date,te=$||(G||D?1:Z.getDate()),ae=G||Z.getFullYear(),ne=0;G&&!D||(ne=D>0?D-1:Z.getMonth());var ue,Oe=U||0,Te=Y||0,se=z||0,ie=Q||0;return W?new Date(Date.UTC(ae,ne,te,Oe,Te,se,ie+60*W.offset*1e3)):X?new Date(Date.UTC(ae,ne,te,Oe,Te,se,ie)):(ue=new Date(ae,ne,te,Oe,Te,se,ie),q&&(ue=F(ue).week(q).toDate()),ue)}catch{return new Date("")}})(x,R,b,y),this.init(),N&&N!==!0&&(this.$L=this.locale(N).$L),k&&x!=this.format(R)&&(this.$d=new Date("")),l={}}else if(R instanceof Array)for(var L=R.length,M=1;M<=L;M+=1){w[1]=R[M-1];var B=y.apply(this,w);if(B.isValid()){this.$d=B.$d,this.$L=B.$L,this.init();break}M===L&&(this.$d=new Date(""))}else v.call(this,C)}}}))})(OT)),OT.exports}var I6e=w6e();const D6e=Un(I6e);var yT={exports:{}},R6e=yT.exports,OX;function P6e(){return OX||(OX=1,(function(e,t){(function(r,n){e.exports=n()})(R6e,(function(){var r={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"};return function(n,i,o){var s=i.prototype,a=s.format;o.en.formats=r,s.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=(function(f,p){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(h,A,g){var m=g&&g.toUpperCase();return A||p[g]||r[g]||p[m].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(O,y,T){return y||T.slice(1)}))}))})(l,u===void 0?{}:u);return a.call(this,c)}}}))})(yT)),yT.exports}var N6e=P6e();const L6e=Un(N6e);var vT={exports:{}},k6e=vT.exports,yX;function F6e(){return yX||(yX=1,(function(e,t){(function(r,n){e.exports=n()})(k6e,(function(){return function(r,n,i){n.prototype.isBetween=function(o,s,a,l){var u=i(o),c=i(s),f=(l=l||"()")[0]==="(",p=l[1]===")";return(f?this.isAfter(u,a):!this.isBefore(u,a))&&(p?this.isBefore(c,a):!this.isAfter(c,a))||(f?this.isBefore(u,a):!this.isAfter(u,a))&&(p?this.isAfter(c,a):!this.isBefore(c,a))}}}))})(vT)),vT.exports}var M6e=F6e();const B6e=Un(M6e);var TT={exports:{}},j6e=TT.exports,vX;function $6e(){return vX||(vX=1,(function(e,t){(function(r,n){e.exports=n()})(j6e,(function(){return function(r,n){var i=n.prototype,o=i.format;i.format=function(s){var a=this,l=this.$locale();if(!this.isValid())return o.bind(this)(s);var u=this.$utils(),c=(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(f){switch(f){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 u.s(a.week(),f==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),f==="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 f}}));return o.bind(this)(c)}}}))})(TT)),TT.exports}var U6e=$6e();const H6e=Un(U6e),TX=new Set;function SX(e,t="warning"){if(process.env.NODE_ENV==="production")return;const r=Array.isArray(e)?e.join(`
|
|
435
|
+
`;)i++;return n>=0&&i<e.length&&e[n]==='"'&&e[i]==='"'},Jz=e=>{const t=[],r=/\{\{[^}]*\}\}/g;let n;for(;(n=r.exec(e))!==null;){const i=n[0],o=n.index,s=n.index+i.length,a=IMe(e,o,s),l=wMe(a);t.push({start:o,end:s,content:i,replacement:l,isInsideQuotes:a})}return t},eX=(e,t)=>{let r=e,n=0;for(const i of t){const o=i.start+n,s=i.end+n;r=r.slice(0,o)+i.replacement+r.slice(s),n+=i.replacement.length-i.content.length}return r},DMe=e=>{const t=r=>{if(r.type==="object"&&r.children){const n=new Set;for(const i of r.children){const s=i.children?.[0]?.value;if(!s||typeof s!="string"||s==="__TEMPLATE_VAR__")continue;if(n.has(s))return!1;n.add(s);const a=i.children?.[1];if(a&&!t(a))return!1}}else if(r.type==="array"&&r.children){for(const n of r.children)if(!t(n))return!1}return!0};return t(e)},RMe=(e,t)=>{const r=e.trim();if(t.length!==1)return!1;const n=t[0];return r===n.content},PMe=(e,t,r=!0,n=!1,i=!1)=>e!=="json"?[]:nG(o=>{const s=o.state.doc.toString();if(s.trim()==="")return[];const a=[],l=Jz(s),u=RMe(s,l),c=eX(s,l),f=[],p=Vm(c,f);if(n){if(u)return t&&t([]),[];for(const y of l)y.isInsideQuotes||a.push({from:y.start,to:y.end,severity:"error",message:`Template variable "${y.content}" must be quoted in JSON GUI. Use "${y.content}" instead.`});const h=s.trim(),A=[],g=Vm(h,A),m=y=>!y||y.type!=="array"||!y.children?!1:y.children.every(T=>T.type==="object");((y,T)=>{if(y&&!T){if(y.type==="object")return;if(y.type==="array"){if(!i){a.push({from:0,to:s.length,severity:"error",message:'JSON GUI requires proper structure. Use format like {"key": "value"}'});return}m(y)||a.push({from:0,to:s.length,severity:"error",message:"When using an array at the root, it must be an array of objects."});return}a.push({from:0,to:s.length,severity:"error",message:'JSON GUI requires proper structure. Use format like {"key": "value"} or [{"key": "value"}].'})}else if(h&&h!=="")if(p&&(p.type==="object"||p.type==="array")){if(p.type==="object")return;if(p.type==="array"){if(!i){a.push({from:0,to:s.length,severity:"error",message:""});return}m(p)||a.push({from:0,to:s.length,severity:"error",message:"When using an array at the root, it must be an array of objects."});return}}else a.push({from:0,to:s.length,severity:"error",message:'JSON GUI requires proper key-value structure. Use format like {"key": "value"}.'})})(g,A.length>0)}for(const h of f){const A=_Me(h.error);let g=h.offset;for(const O of l){const y=O.content.length-O.replacement.length;h.offset>O.start&&(g+=y)}if(!l.some(O=>g>=O.start&&g<O.end||g+h.length>O.start&&g+h.length<=O.end||g<=O.start&&g+h.length>=O.end)){const O=o.state.doc.lineAt(g);a.push({from:g,to:g+h.length,severity:"error",message:`Syntax error: ${A} on line ${O.number}`})}}if(p&&r){const h=A=>{if(A.type==="object"&&A.children){const g=new Map;for(const m of A.children){const O=m.children?.[0],y=O?.value;if(!y||typeof y!="string"||y==="__TEMPLATE_VAR__")continue;if(g.has(y)){let v=O.offset+1;for(const x of l){const b=x.content.length-x.replacement.length;O.offset>x.start&&(v+=b)}if(!l.some(x=>v>=x.start&&v<x.end||v+y.length>x.start&&v+y.length<=x.end||v<=x.start&&v+y.length>=x.end)){const x=o.state.doc.lineAt(v);a.push({from:v,to:v+y.length,severity:"error",message:`Duplicate key "${y}" found on line ${x.number}. This may corrupt the JSON GUI data.`})}}else g.set(y,O);const T=m.children?.[1];T&&h(T)}}else if(A.type==="array"&&A.children)for(const g of A.children)h(g)};h(p)}return t&&t(a),a}),NMe=[],tX={json:KH(),javascript:aD({jsx:!0,typescript:!0}),html:qH(),xml:MV(),plaintext:[],sql:_D(),python:AV(),graphql:NMe},LMe=e=>{const t=E.useTheme(),{showMenu:r,contextMenuElement:n}=QFe(),{value:i,onChange:o,onFocus:s,onBlur:a,language:l="plaintext",height:u="150px",suggestionsData:c={},placeholder:f,viewOnly:p=!1,className:h,error:A,errorMsg:g,codeEditorStyles:m={},showSuggestions:O,noDuplicateKeys:y=!0,enableJsonGuiValidation:T=!1,handleValidate:v,loading:C=!1,suggestionLabel:x,allowArrayAtRoot:b=!1,...w}=e,R=_.useMemo(()=>c&&typeof c=="object"&&Object.keys(c).length>0?c:{},[JSON.stringify(c)]),[I,P]=_.useState(null),k=_.useRef(null),N=_.useRef(null),L=ct.useDispatch(),M=_.useRef(null),B=_.useRef(null),[H,j]=_.useState(!1),X=Rt.useNodes(),{canvasWorkflow:F,activityExecutionData:V}=ct.useSelector(Ae=>Ae.canvas),{WORKFLOW_URLS:G,ENTITY_ID:D="",analytics:$,openAddonModal:U,currentSubscription:Y}=bi(),{VORTEX_MAIN_URL:z}=G,Q=xo(),W=xn(Q),Z=xn(Dr.VERSION)||W,{setNodes:te,getEdges:ae}=Rt.useReactFlow(),{MCP_INTEGRATION_FORM:ne}=aa(),ue=Ae=>{try{if(l!=="json")return!0;const fe=Jz(Ae);if(T&&fe.length===1&&Ae.trim()===fe[0].content)return!0;const Se=eX(Ae,fe),ge=[],ye=Vm(Se,ge);return ye?ge.length>0?!1:y?DMe(ye):!0:!0}catch{return!1}};_.useEffect(()=>{if(B.current&&i!==B.current.state.doc.toString()){const Ae=B.current.hasFocus;B.current.dispatch({changes:{from:0,to:B.current.state.doc.length,insert:i}}),Ae&&requestAnimationFrame(()=>{B.current?.focus()})}},[i]),_.useEffect(()=>{if(!M.current)return;const Ae=Nt.theme({...OMe(t,m,A,g,e.size,p)}),fe=Nt.updateListener.of($e=>{try{if($e.docChanged&&!p){const Je=$e.state.doc.toString();(ue(Je)||!T)&&o?.(Je)}if(($e.docChanged||$e.selectionSet)&&!p)try{const Je=$e.state.doc.toString(),rt=$e.state.selection.main.head;if(Je.slice(0,rt).endsWith("")){const Ie=M.current,Ve=Ie?.querySelector(".cm-cursor"),He=document.getElementById("suggestion-popover"),_e=!!Ie?.closest('[data-testid$="-full-mode"]'),we=He&&He.isConnected;if(Ve&&I===null&&O&&!we)if(_e){const ee=new CustomEvent("suggestions-about-to-open",{detail:{shouldShift:!0}});window.dispatchEvent(ee);const de=()=>{const be=Ie?.querySelector(".cm-cursor"),Ge=document.getElementById("suggestion-popover");be&&!Ge&&I===null&&P(be),window.removeEventListener("dialog-reposition-complete",de)};window.addEventListener("dialog-reposition-complete",de),setTimeout(()=>{window.removeEventListener("dialog-reposition-complete",de);const be=Ie?.querySelector(".cm-cursor"),Ge=document.getElementById("suggestion-popover");be&&!Ge&&I===null&&P(be)},400)}else P(Ve)}else P(null)}catch{}}catch{}}),Se=Nt.domEventHandlers({focus:()=>{try{const $e=B.current?.state.doc.toString()||"";if((ue($e)||!T)&&s?.($e),I===null&&O&&Object.keys(R).length>0){const Je=M.current,rt=Je?.querySelector(".cm-cursor"),tt=document.getElementById("suggestion-popover"),Ve=!!Je?.closest('[data-testid$="-full-mode"]');if(rt&&!tt)if(Ve){const He=new CustomEvent("suggestions-about-to-open",{detail:{shouldShift:!0}});window.dispatchEvent(He);const Ee=()=>{const _e=Je?.querySelector(".cm-cursor"),we=document.getElementById("suggestion-popover");_e&&!we&&I===null&&P(_e),window.removeEventListener("dialog-reposition-complete",Ee)};window.addEventListener("dialog-reposition-complete",Ee),setTimeout(()=>{window.removeEventListener("dialog-reposition-complete",Ee);const _e=Je?.querySelector(".cm-cursor"),we=document.getElementById("suggestion-popover");_e&&!we&&I===null&&P(_e)},400)}else P(rt)}}catch{}return!1},blur:()=>{try{const $e=B.current?.state.doc.toString()||"";try{(ue($e)||!T)&&a?.($e)}catch{}}catch{}return!1}}),ge=tX[l]||tX.plaintext;let ye=null;try{ye=bMe(R,l)}catch{ye=()=>null}const je=Dn.create({doc:i,extensions:[QD,ge,qz.of(l),U2({newGroupDelay:500}),Uf.of(CMe),qy({maxRenderedOptions:100,defaultKeymap:!0,icons:!0}),Dn.languageData.of(()=>[{...Object.keys(R).length>0&&O&&{autocomplete:ye}}]),aMe,Ae,l==="json"?[PMe(l,v,y,T,b)]:[],EMe,fe,yMe,Nt.lineWrapping,XI(f||"Enter text here"),Se,Dn.readOnly.of(!!p),Nt.editable.of(!p),...p?[Nt.contentAttributes.of({tabindex:"0"}),Nt.domEventHandlers({paste:$e=>($e.preventDefault(),!0)}),Uf.of([{key:"Ctrl-v",mac:"Cmd-v",run:()=>!0,preventDefault:!0},{key:"Ctrl-x",mac:"Cmd-x",run:()=>!0,preventDefault:!0}])]:[],GV({top:!0})]}),Qe=new Nt({state:je,parent:M.current});return B.current=Qe,lMe(Qe,r),()=>Qe.destroy()},[R,l]),_.useEffect(()=>()=>{N.current&&clearTimeout(N.current),B?.current?.dispatch({changes:{from:0,to:B.current.state.doc.length,insert:""}}),B.current?.destroy()},[]);const Oe=async Ae=>{const fe=[...Array.isArray(X)?X:[]],Se={nodes:[hc({...Ae})],result:G0(F,X,V,Ae?.id,ae())};j(!0);const{success:ge,isError:ye,data:je}=await V0(Ae,L,z,D,fe,X,Se,N,$,Z,U,Y);return ge&&!ye?(j(!1),wa(te,Ae,{...Ae.data.blt_node_states,test:"completed",node:"completed"}),ge):(ye&&(delete je.singleRunFailure,wa(te,Ae,{...Ae.data.blt_node_states,test:"error",node:"failed"}),Object.keys(je).forEach($e=>{WO(je[$e]).forEach(rt=>{L({type:Qr,payload:{open:!0,title:typeof rt!="string"?JSON.stringify(rt):rt,type:"error",width:"30rem",duration:3e3}})})})),j(!1),!1)},Te=async Ae=>{const fe=X?.find(Se=>Se?.id===Ae);fe&&await Oe(fe)},se=Ae=>{L({type:cu,payload:{id:Ae}})},ie=async({label:Ae})=>{const fe=B.current;if(!fe)return;const Se=fe.state.doc.length,ge=fe.state.selection.main,ye=Math.min(ge.from,Se),je=Math.min(ge.to,Se),Qe=["javascript","typescript","python"].includes(l)?`${Ae}`:`{{${Ae}}}`;fe.dispatch({changes:{from:ye,to:je,insert:Qe},selection:{anchor:ye+Qe.length},scrollIntoView:!0}),setTimeout(()=>{fe.focus()},100)},J=_.useCallback(()=>{const Ae=B.current;Ae&&!p&&(Lu(Ae),Ae.focus())},[p]),K=_.useCallback(()=>{const Ae=B.current;Ae&&!p&&(ja(Ae),Ae.focus())},[p]),re=_.useCallback(()=>{const Ae=B.current;return!Ae||p?!1:Nh(Ae.state)>0},[p]),le=_.useCallback(()=>{const Ae=B.current;return!Ae||p?!1:Lh(Ae.state)>0},[p]),he=_.useMemo(()=>d.jsx(E.Typography,{variant:"mdBold",children:x?`Insert data for ${x}`:"Insert data"}),[x]);return _.useImperativeHandle(w.ref,()=>({undo:J,redo:K,canUndo:re,canRedo:le,focus:()=>B.current?.focus(),getContent:()=>B.current?.state.doc.toString()||""}),[J,K,re,le]),d.jsxs(E.Stack,{style:{width:"100%"},ref:k,spacing:2,...w,children:[C?d.jsx(E.Stack,{justifyContent:"center",alignItems:"center",sx:{height:u,border:"1px solid",borderColor:t.palette.grey[300],borderRadius:2,backgroundColor:t.palette.background.default},children:d.jsx(hi,{size:24})}):d.jsx(E.Stack,{ref:M,className:`rounded-lg overflow-hidden ${h}`,style:{height:u,width:"100%",position:"relative"},children:!ne&&d.jsx($w,{title:x?he:"",anchorEl:I,suggestionsData:c,setAnchorEl:()=>P(null),ref:k,handleSuggestionClick:ie,runActivity:Te,handleCompleteSetup:se,isLoading:H})}),n]})};function kMe(e,t){const r=e.value===t.value&&e.language===t.language&&e.viewOnly===t.viewOnly&&e.height===t.height&&e.className===t.className&&e.error===t.error&&e.errorMsg===t.errorMsg&&e.showSuggestions===t.showSuggestions,n=e.suggestionsData,i=t.suggestionsData,o=n==null&&i==null||(typeof n=="object"&&typeof i=="object"?Object.keys(n).length===Object.keys(i).length&&Object.keys(n).every(s=>JSON.stringify(n[s])===JSON.stringify(i[s])):n===i);return r&&o}const PP=_.memo(LMe,kMe),rX={xs:{height:"36px"},sm:{height:"64px"},md:{height:"218px"},lg:{height:"320px"},xl:{height:"440px"},xxl:{height:"560px"}},FMe={xs:{height:"16",width:"16",padding:"2px !important"},sm:{height:"16",width:"16",padding:"4px !important"},md:{height:"20",width:"20",padding:"6px !important"},lg:{height:"20",width:"20",padding:"6px !important"},xl:{height:"20",width:"20",padding:"6px !important"},xxl:{height:"20",width:"20",padding:"6px !important"}},MMe={xs:{right:"40px",top:"6px"},sm:{right:"40px",top:"6px"},md:{right:"48px",top:"15px"},lg:{right:"48px",top:"15px"},xl:{right:"48px",top:"15px"},xxl:{right:"48px",top:"15px"}},BMe=({copied:e,theme:t,size:r})=>{const{padding:n,height:i,width:o}=FMe[r];return d.jsx(E.Button,{variant:"text",type:"button",sx:{position:"relative",minWidth:0,right:8,top:0,p:n,border:1,borderRadius:1,backgroundColor:t.palette.common.white,"&:hover":{backgroundColor:t.palette.common.white}},children:d.jsx("svg",{width:o,height:i,focusable:"false","aria-hidden":"true",viewBox:"0 0 24 24",children:e?d.jsx("path",{fill:t.palette.primary.main,d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.24 11.28L9.69 11.2c-.38-.39-.38-1.01 0-1.4.39-.39 1.02-.39 1.41 0l1.36 1.37 4.42-4.46c.39-.39 1.02-.39 1.41 0 .38.39.38 1.01 0 1.4l-5.13 5.17c-.37.4-1.01.4-1.4 0zM3 6c-.55 0-1 .45-1 1v13c0 1.1.9 2 2 2h13c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1-.45-1-1V7c0-.55-.45-1-1-1z"}):d.jsx("path",{fill:t.palette.common.black,d:"M15 20H5V7c0-.55-.45-1-1-1s-1 .45-1 1v13c0 1.1.9 2 2 2h10c.55 0 1-.45 1-1s-.45-1-1-1zm5-4V4c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2zm-2 0H9V4h9v12z"})})})},jMe=_.forwardRef(({activityType:e,language:t="javascript",value:r="",enableAskAI:n=!1,handleChange:i,handleFocus:o=()=>{},handleBlur:s=()=>{},height:a="",showExpandOption:l=!1,showHtmlPreview:u=!1,showCopyToClipboard:c=!1,VORTEX_MAIN_URL:f,ENTITY_ID:p,suggestionsData:h={},loading:A=!1,size:g="xs",label:m="",rightLabel:O=null,required:y=!1,rightLabelAlignment:T="center",placeholder:v="",helperText:C="",errorMsg:x="",error:b=!1,showSuggestions:w=!0,id:R="",viewOnly:I=!1,readOnly:P=!1,enableJsonGuiValidation:k=!1,handleValidate:N,sx:L={},codeEditorStyles:M={},suggestionLabel:B="",options:H,...j},X)=>{const F=ct.useDispatch(),V=E.useTheme(),[G,D]=_.useState(!1),[$,U]=_.useState(!1),[Y,z]=_.useState(!1),[Q,W]=_.useState(!1),[q,Z]=_.useState(""),[te,ae]=_.useState(!1),[ne,ue]=_.useState(""),[Oe,Te]=_.useState(!1),[se,ie]=_.useState(!1),[J,K]=_.useState(!1);_.useEffect(()=>{G||K(!1)},[G]),_.useEffect(()=>{if(!G)return;let ge=J,ye=null,je=!1,Qe=!1;const $e=()=>{const _e=window.innerWidth,de=500+32,be=60,Ge=_e>=1200?800:0,Ne=_e-de;if(_e<600)return"75%";if(_e<960){const mt=Math.min(Ne,_e*.55)/_e*100,St=Math.max(mt,be),De=_e*St/100;return`${(Ge>0?Math.max(De,Ge):De)/_e*100}%`}else{const mt=Math.min(Ne,_e*.45)/_e*100;let St=mt;mt<be&&_e*be/100+de<=_e&&(St=be);const De=_e*St/100;return`${(Ge>0?Math.max(De,Ge):De)/_e*100}%`}},Je=()=>window.innerWidth>=1200?"800px":"",rt=(_e=!1)=>{ye&&clearTimeout(ye),ye=setTimeout(()=>{const we=document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper"),ee=we?.closest(".MuiDialog-container");if(we&&ee){we.style.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",ee.style.transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)";const de=document.getElementById("suggestion-popover"),be=de!==null&&window.getComputedStyle(de).display!=="none"&&window.getComputedStyle(de).visibility!=="hidden";if(be!==je||be!==ge){je=be,be&&!ge&&(ge=!0,K(!0));const Ge=window.innerWidth;if((ge||be)&&Ge>=1200){const Ne=$e();we.style.width=Ne,we.style.maxWidth=Ne,we.style.minWidth=Je(),ee.style.justifyContent="flex-end",_e&&de&&!be&&(Qe=!0,de.style.visibility="hidden",de.style.opacity="0",we.addEventListener("transitionend",()=>{if(de){de.style.visibility="",de.style.opacity="";const Me=new Event("resize");window.dispatchEvent(Me)}Qe=!1},{once:!0}))}else Ge<1200?be&&!ge&&(ge=!0,K(!0)):(we.style.width="",we.style.maxWidth="",ee.style.justifyContent="")}}},50)},tt=()=>{if(window.innerWidth<1200){ge||(ge=!0,K(!0));const we=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(we);return}if(ge){const we=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(we)}else{const we=document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper"),ee=we?.closest(".MuiDialog-container");if(we&&ee){we.style.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",ee.style.transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)";const de=$e();we.style.width=de,we.style.maxWidth=de,we.style.minWidth=Je(),ee.style.justifyContent="flex-end",ge=!0,K(!0);const be=Ge=>{const Ne=Ge;if((Ne.target===we||Ne.target===ee)&&(Ne.propertyName==="width"||Ne.propertyName==="max-width"||Ne.propertyName==="justify-content")){const Me=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(Me),we.removeEventListener("transitionend",be),ee.removeEventListener("transitionend",be)}};we.addEventListener("transitionend",be),ee.addEventListener("transitionend",be),setTimeout(()=>{const Ge=new CustomEvent("dialog-reposition-complete",{detail:{repositioned:!0}});window.dispatchEvent(Ge),we.removeEventListener("transitionend",be),ee.removeEventListener("transitionend",be)},350)}}};window.addEventListener("suggestions-about-to-open",tt);const Ie=setTimeout(()=>{requestAnimationFrame(()=>{const _e=document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper"),we=_e?.closest(".MuiDialog-container");_e&&we&&(_e.style.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",we.style.transition="justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)"),rt()})},0),Ve=new MutationObserver(_e=>{if(_e.some(ee=>{const de=ee.target;return de.id==="suggestion-popover"||de.closest("#suggestion-popover")!==null||ee.type==="childList"&&(Array.from(ee.addedNodes).some(be=>be.id==="suggestion-popover")||Array.from(ee.removedNodes).some(be=>be.id==="suggestion-popover"))})&&!Qe){const Ge=(document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper")?.closest(".MuiDialog-container")?.style.justifyContent||"")!=="flex-end"&&!ge;rt(Ge)}});Ve.observe(document.body,{childList:!0,subtree:!1,attributes:!1});const He=setInterval(()=>{document.querySelector('[data-testid$="-full-mode"]')?.closest(".MuiDialog-paper")&&!Qe&&rt()},500),Ee=()=>{(J||ge)&&rt()};return window.addEventListener("resize",Ee),()=>{clearTimeout(Ie),ye&&clearTimeout(ye),clearInterval(He),Ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("suggestions-about-to-open",tt)}},[G,J]);const re=()=>{D(!1)},le=()=>{ne!==""&&i?.(ne),D(!1)},he=()=>{z(!1)},Ae=()=>{ne!==""&&i?.(ne),Te(!1),W(!1),ue(""),Z("")},fe=()=>{Te(!1),W(!1),ue(""),Z("")},Se=async()=>{ae(!0),ie(!1),Te(!1);try{const ge=Xt(f||"",`/v1.0/${p}`,"/utility/generate"),ye=await zt.post(ge,{data:{messages:xMe(e,q,t)},headers:{"Content-Type":"application/json"}});if(ye.data.data){const je=typeof ye.data.data=="string"?ye.data.data.trim():"";je.includes("GENERATION_ERROR")?Te(!0):(Te(!1),ue(je))}}catch(ge){sr(ge,F)}finally{ie(!0),ae(!1)}};return _.useEffect(()=>{$&&setTimeout(()=>{U(!1)},2e3)},[$]),_.useEffect(()=>{(!q||q==="")&&(ue(""),Te(!1))},[se,q]),d.jsxs(E.FormControl,{fullWidth:!0,children:[(m||O||C)&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:T,children:[m&&d.jsx(gn,{label:m,description:C,required:y}),O&&d.jsx(E.Typography,{variant:V.typography["components-inputs-label-sm"],pb:"0.25rem",color:"neutral.80",children:O})]}),d.jsxs(E.Box,{sx:{position:"relative",width:"100%",height:a||rX[g].height,opacity:I&&P?.6:1,'&:has(.cm-panel.cm-search) [data-testid="button-copy-code"]':{top:"42px !important"},...L},ref:X,"data-testid":R,children:[l&&g!=="xs"&&g!=="sm"&&d.jsx(E.Tooltip,{title:"Expand",placement:"top",arrow:!0,children:d.jsx(E.Box,{onClick:()=>{D(!0)},sx:{position:"absolute",right:"16px",top:c?"48px":"16px",zIndex:6,cursor:"pointer"},"data-testid":"button-expand-editor",children:d.jsx(Ue,{src:"ic_maximize",width:"16px",height:"16px",fill:V.palette.neutral.solid.bg})})}),n&&g!=="xs"&&g!=="sm"&&d.jsx(E.Box,{onClick:()=>!I&&W(!0),sx:{position:"absolute",right:"16px",bottom:"10px",zIndex:6,cursor:"pointer",opacity:I&&P?.6:1},"data-testid":"button-ask-ai",children:d.jsx(E.Tooltip,{title:"Ask AI",children:d.jsx("img",{src:"https://cdn.pixelbin.io/v2/fyndcloud/original/icons/genai_icon.svg",width:32,height:32})})}),c&&d.jsx(E.Tooltip,{title:"Copy to clipboard",placement:"top",arrow:!0,children:d.jsx(E.Box,{onClick:()=>{U(!0),hd(r||"")},sx:{position:"absolute",right:"0px",top:g==="xs"||g==="sm"?"6px":"16px",zIndex:1e3,cursor:"pointer"},"data-testid":"button-copy-code",children:d.jsx(BMe,{copied:$,theme:V,size:g})})}),u&&d.jsx(E.Tooltip,{title:"Preview",placement:"top",arrow:!0,children:d.jsx(E.Box,{onClick:()=>z(!0),sx:{position:"absolute",zIndex:999,cursor:"pointer",...c||l?MMe[g]:{right:"12px",top:"6px"}},children:d.jsx(Ue,{src:"ic_visibility",height:"20px",width:"20px"})})}),d.jsx(PP,{language:t,value:r||"",onChange:i,onFocus:o,onBlur:ge=>s(ge||""),suggestionsData:h,showSuggestions:w,placeholder:v,height:a||rX[g].height,viewOnly:I||P||(H?.readOnly??!1),className:R,errorMsg:x,error:b,codeEditorStyles:M,enableJsonGuiValidation:k,handleValidate:N,loading:A,suggestionLabel:B,size:g,...j})]}),d.jsx(E.Stack,{children:b&&x&&d.jsx(E.FormHelperText,{component:"span",error:!0,dangerouslySetInnerHTML:{__html:ao(x)}})}),d.jsx(Co,{open:G,handleClose:()=>{le(),re()},disableBackdropClick:!0,title:"Editor",content:d.jsxs(E.Box,{sx:{width:"100%",position:"relative"},"data-testid":`${R}-full-mode`,children:[d.jsx(PP,{language:t,value:r||"",onChange:i,placeholder:v,height:"70vh",suggestionsData:h,showSuggestions:w,viewOnly:I||P||(H?.readOnly??!1),className:`${R}-full-mode`,errorMsg:x,error:b,codeEditorStyles:M,enableJsonGuiValidation:k,handleValidate:N,loading:A,size:"xl",...j}),n&&d.jsx(E.Box,{onClick:()=>!I&&W(!0),sx:{position:"absolute",right:"16px",bottom:"16px",zIndex:1e3,cursor:"pointer",opacity:I?.6:1},children:d.jsx(E.Tooltip,{title:"Ask AI",children:d.jsx("img",{src:"https://cdn.pixelbin.io/v2/fyndcloud/original/icons/genai_icon.svg",width:32,height:32})})})]})}),d.jsx(Co,{open:Q,handleClose:()=>{fe()},title:"Generate using AI",content:ne===""?d.jsxs(E.Box,{sx:{display:"flex",flexDirection:"column",width:"100%"},children:[d.jsx(E.Typography,{sx:{mb:"8px"},children:"Use AI to generate content for this step. Write a prompt below to get started. You can reference prior step data in your prompt."}),d.jsxs(E.Grid,{children:[d.jsx(E.Typography,{variant:"smBold",sx:{marginBottom:"8px",display:"block"},children:"User Prompt*"}),d.jsx(lo,{parent:"autoComplete",name:"prompt",size:"md",sx:{fontWeight:400},placeholder:t==="javascript"||t==="python"?e&&Zz[e]?.[t]:e&&Zz[e]?.placeholder,fullWidth:!0,multiline:!0,rows:9,id:"message",onChange:ge=>{Z(ge.target.value)},value:q,required:!0}),Oe&&d.jsx(E.Box,{sx:{color:V.palette.primary.main,fontWeight:500},children:"OpenAI Prompt Error"})]}),d.jsxs(E.Box,{gap:2,sx:{display:"flex",p:3,pb:0,alignItems:"Center",justifyContent:"center"},children:[d.jsx(E.Button,{type:"submit",disabled:te||!q,variant:"contained",onClick:Se,sx:{fontSize:"14px",boxShadow:ge=>ge.shadows[0],padding:"2px 16px"},endIcon:te?d.jsx(E.CircularProgress,{color:"inherit",size:20}):null,"data-testid":"button-ai-generate",children:"Generate"}),d.jsx(E.Button,{variant:"outlined",color:"primary",onClick:()=>{W(!1),Z(""),ue("")},sx:{textTransform:"none"},"data-testid":"button-ai-cancel",children:"Cancel"})]})]}):d.jsxs(E.Box,{sx:{width:"100%",display:"flex",flexDirection:"column"},children:[d.jsx(E.Box,{sx:{width:"100%",position:"relative",borderRadius:"4px",border:`1px solid ${V.palette.grey[200]}`},children:d.jsx(E.Box,{sx:{p:1},"data-testid":`${R}-askAI`,children:d.jsx(PP,{language:t,value:ne||"",onChange:ge=>{ue(ge)},height:"27vh",viewOnly:!!ne||I,showSuggestions:w,className:`${R}-askAI`,errorMsg:x,error:b,codeEditorStyles:M,enableJsonGuiValidation:k,handleValidate:N,loading:A,suggestionLabel:B,size:"lg",...j})})}),Oe&&d.jsx(E.Box,{sx:{color:V.palette.primary.main,fontWeight:500},children:"OpenAI Prompt Error"}),d.jsxs(E.Grid,{container:!0,spacing:2,children:[d.jsx(E.Typography,{variant:"smMedium",sx:{marginBottom:"8px",display:"block",mt:1},children:"Request a quick adjustment..."}),d.jsxs(E.Grid,{container:!0,alignItems:"center",spacing:2,children:[d.jsx(E.Grid,{xs:10,sx:{p:0},children:d.jsx(lo,{parent:"autoComplete",name:"prompt",sx:{fontWeight:400,width:"100%"},placeholder:"Modify your prompt here",fullWidth:!0,id:"message",onChange:ge=>{Z(ge.target.value)},value:q,required:!0})}),d.jsx(E.Grid,{item:!0,xs:2,sx:{paddingTop:"0 !important"},children:d.jsx(E.Button,{disabled:te||!q,type:"submit",variant:"contained",onClick:Se,sx:{fontSize:"14px",boxShadow:ge=>ge.shadows[0],height:"36px",width:"100%"},children:"Apply"})})]})]}),d.jsxs(E.Box,{gap:2,sx:{display:"flex",p:3,pb:0,alignItems:"Center",justifyContent:"center"},children:[d.jsx(E.Button,{disabled:te,type:"submit",variant:"contained",onClick:Ae,sx:{fontSize:"14px",boxShadow:ge=>ge.shadows[0],padding:"2px 16px"},endIcon:te?d.jsx(E.CircularProgress,{color:"inherit",size:20}):null,children:"Accept"}),d.jsx(E.Button,{variant:"outlined",color:"primary",onClick:()=>{ue("")},sx:{textTransform:"none"},children:"Discard"})]})]})}),d.jsx(Co,{open:Y,handleClose:he,title:"Preview",variant:"xlarge",content:d.jsx(E.Box,{sx:{width:"100%",height:"600px",position:"relative",borderRadius:"4px",border:`1px solid ${V.palette.grey[200]}`},children:d.jsx("iframe",{title:"HTML Preview",srcDoc:r||"",sandbox:"allow-scripts",style:{width:"100%",height:"100%",border:"none"}})})})]})});function $Me(e,t){const r=e.value===t.value&&e.language===t.language&&e.viewOnly===t.viewOnly&&e.height===t.height&&e.size===t.size&&e.showCopyToClipboard===t.showCopyToClipboard&&e.showSuggestions===t.showSuggestions&&e.error===t.error&&e.errorMsg===t.errorMsg&&e.id===t.id,n=e.suggestionsData,i=t.suggestionsData,o=n==null&&i==null||(typeof n=="object"&&typeof i=="object"?Object.keys(n).length===Object.keys(i).length&&Object.keys(n).every(s=>JSON.stringify(n[s])===JSON.stringify(i[s])):n===i);return r&&o}const Fi=_.memo(vc(jMe),$Me),nX=Object.freeze(Object.defineProperty({__proto__:null,default:Fi},Symbol.toStringTag,{value:"Module"})),iX=e=>d.jsx(Ue,{...e,sx:{"&.MuiSelect-icon":{top:"auto",mr:"0.25rem",pointerEvents:"none"}},src:"ic_arrow_down",width:20,height:20}),UMe=({value:e,content:t,onChange:r,triggerHelpData:n,selectedMethod:i,setSelectedMethod:o,setSelectedLanguage:s,excludeUrlLanguage:a=!1})=>{const l=E.useTheme();return d.jsxs(E.Stack,{alignItems:"center",justifyContent:"space-between",p:1.5,direction:"row",children:[d.jsx(E.Typography,{variant:"smNormal",color:l.palette.text.secondary,children:"Use below code to trigger this workflow"}),d.jsxs(E.Stack,{direction:"row",gap:1.5,alignItems:"center",children:[d.jsx(E.Select,{labelId:"method-select-label",value:n?.methods?.includes(i)?i:"",label:"Method",onChange:u=>{const c=u.target.value;o(c);const f=Object.keys(n[c]||{});s(f[0])},IconComponent:iX,MenuProps:{PaperProps:{style:{padding:8},"& li":{p:0}}},sx:{p:0,border:"none",minHeight:0,"& fieldset":{border:"none"},boxShadow:"none",".MuiOutlinedInput-notchedOutline":{border:0},"& .MuiSelect-select":{py:0},height:"auto","& .MuiSelect-outlined":{display:"flex",gap:.5},"& .MuiStack-root > svg":{width:14,height:14},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{border:0}},children:n?.methods?.map(u=>d.jsx(E.MenuItem,{value:u,children:u.toUpperCase()},u))}),d.jsx(E.Select,{sx:{p:0,border:"none",minHeight:0,"& fieldset":{border:"none"},boxShadow:"none",".MuiOutlinedInput-notchedOutline":{border:0},"& .MuiSelect-select":{py:0},height:"auto","& .MuiSelect-outlined":{display:"flex",gap:.5},"& .MuiStack-root > svg":{width:14,height:14},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{border:0}},value:e,label:"Age",onChange:r,IconComponent:iX,MenuProps:{PaperProps:{style:{padding:8},"& li":{p:0}}},children:oce.filter(u=>!(a&&u.value==="URL")).map(u=>d.jsxs(E.MenuItem,{value:u.value,sx:{padding:"6px",marginTop:.5},children:[d.jsx(ch,{src:sce[u.label],alt:u.label,asHtmlElement:!0}),u.label]},u.value))}),d.jsx(E.Box,{width:24,height:24,onClick:u=>{u.stopPropagation(),hd(t)},sx:{"& > span":{border:`1px solid ${l.palette.grey.outlined.border}`,borderRadius:1},cursor:"pointer"},children:d.jsx(Ue,{src:"ic_copy",width:24,height:24})})]})]})},HMe=({VORTEX_MAIN_URL:e,ENTITY_ID:t,viewOnly:r=!1,excludeUrlLanguage:n=!1})=>{const i=ct.useDispatch(),o=E.useTheme(),{getNodes:s}=Rt.useReactFlow(),a=s(),{trigger_help:l,workflow:u}=ct.useSelector(C=>C.workflows),[c,f]=_.useState(""),[p,h]=_.useState("get"),[A,g]=_.useState({}),m=xn(),O=xn("version");_.useEffect(()=>{if(!Et(l)){const C={},x=[];l?.items?.forEach(R=>{x.push(R.title),R.snippets.forEach(I=>{C[R.title]||(C[R.title]={}),C[R.title][I.title]=I.value})}),g({...C,methods:x}),h(x[0]);const b=Object.keys(C[x[0]]||{}),w=n?b.find(R=>R!=="URL")??b[0]:b[0];f(w)}},[l]),_.useEffect(()=>{const C=a.find(x=>x.type===xt.TRIGGER);!Et(u)&&(C?.data?.type===Ze.WEBHOOK||C?.data?.type===Ze.HTTP)&&(O||m)&&i(Gb(O||m,e,t))},[]);const y=C=>{f(C.target.value)},T=a.find(C=>C.type===xt.TRIGGER),v=T?.data?.type===Ze.WEBHOOK||T?.data?.type===Ze.HTTP;return d.jsx(E.Box,{sx:{mt:2,"& .MuiAccordionSummary-content":{margin:0,borderRadius:2},"& .MuiButtonBase-root.MuiAccordionSummary-root":{px:1.5,py:"10.5px",borderRadius:"8px 8px 0 0",backgroundColor:o.palette.white.smoke},borderRadius:2},children:d.jsxs(E.Box,{sx:{"& > .MuiBox-root > .MuiBox-root > .MuiFormControl-root > .MuiBox-root":{border:"none",p:0},border:`1px solid ${o.palette.grey[300]}`,borderRadius:2},children:[d.jsx(UMe,{value:c,content:A?.[p]?.[c]||"",onChange:y,triggerHelpData:A,selectedMethod:p,setSelectedMethod:h,setSelectedLanguage:f,excludeUrlLanguage:n}),d.jsx(E.Box,{sx:{width:"100%"},children:d.jsx(E.Box,{sx:{minHeight:"300px",overflowX:"auto",borderTop:`1px solid ${o.palette.grey[300]}`,"& > .MuiStack-root > .MuiBox-root":{m:0},"& .monaco-editor .overflow-guard":{borderRadius:"0 0 8px 8px"}},children:d.jsx(Fi,{viewOnly:!0,readOnly:r&&v,height:"300px",language:c.toLowerCase(),value:A?.[p]?.[c]||"",handleChange:()=>{},size:"md",loading:!l,codeEditorStyles:{border:"none"},showSuggestions:!1})})})]})})},VMe=({VORTEX_MAIN_URL:e,ENTITY_ID:t})=>{const r=E.useTheme(),n=ct.useDispatch(),{trigger_help:i,workflow:o}=ct.useSelector(h=>h.workflows),s=xn(),a=xn("version"),[l,u]=_.useState(""),[c,f]=_.useState("");_.useEffect(()=>{!Et(o)&&(a||s)&&n(Gb(a||s,e,t))},[]),_.useEffect(()=>{if(!Et(i)){const h=i?.items||[];for(const A of h){const g=A.snippets?.find(m=>m.title==="URL");if(g?.value){u(g.value),f(A.title.toUpperCase());break}}}},[i]);const p=()=>{l&&navigator.clipboard.writeText(l).then(()=>{n({type:Qr,payload:{open:!0,title:"Copied to clipboard",type:"success"}})})};return d.jsxs(E.Stack,{gap:1,sx:{background:r.palette.background.paper,borderRadius:2,p:1,border:`1px solid ${r.palette.grey[300]}`},children:[d.jsxs(E.Stack,{gap:.3,children:[d.jsx(E.Typography,{variant:"smSemiBold",color:r.palette.text.primary,children:"Your webhook URL"}),d.jsx(E.Typography,{variant:"smNormal",color:r.palette.text.secondary,children:"You'll need to configure your application with this workflow's webhook URL."})]}),d.jsxs(E.Stack,{direction:"row",alignItems:"center",gap:1.5,sx:{background:r.palette.white.smoke,border:`1px solid ${r.palette.grey[300]}`,borderRadius:1,pl:1.5,pr:1,py:.75},children:[d.jsx(E.Box,{component:"img",src:"https://cdn.pixelbin.io/v2/fyndcloud/original/url.svg",alt:"webhook",sx:{width:20,height:20,flexShrink:0}}),d.jsx(E.Tooltip,{title:l||"",arrow:!0,placement:"top",disableHoverListener:!l,children:d.jsx(E.Typography,{variant:"smNormal",color:r.palette.text.secondary,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:l||"Generating webhook URL…"})}),d.jsx(E.Tooltip,{title:"Copy URL",arrow:!0,placement:"top",children:d.jsx("span",{children:d.jsx(E.IconButton,{size:"small",onClick:p,disabled:!l,sx:{"& svg path, & svg g path":{fill:r.palette.primary.main},"&:hover":{backgroundColor:`${r.palette.primary.main}14`,"& svg path, & svg g path":{fill:r.palette.primary.light}}},children:d.jsx(Ue,{src:"ic_copy",width:18,height:18})})})})]}),d.jsxs(E.Typography,{variant:"xsNormal",color:r.palette.text.tertiary,children:["We've generated a custom webhook URL for this workflow. Try this URL with"," ",c?d.jsx(E.Box,{component:"span",sx:{fontWeight:600,color:r.palette.primary.main},children:c}):"the required"," ","method to send data and trigger your workflow automatically."]})]})},GMe=["Basic","Advanced"],WMe=({type:e,name:t,ENTITY_ID:r,VORTEX_MAIN_URL:n,loading:i,activityExecutionList:o,nodeId:s,integrationSlug:a,integrationType:l,activityType:u,viewOnly:c=!1})=>{const f=E.useTheme(),[p,h]=_.useState("Basic");return e===Ze.WEBHOOK||e===Ze.HTTP?d.jsxs(E.Stack,{gap:2,children:[d.jsxs(E.Stack,{justifyContent:"center",gap:1.5,children:[d.jsx(E.Typography,{variant:"lgSemiBold",color:f.palette.text.primary,children:"Test"}),d.jsxs(E.Stack,{gap:.75,children:[d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.secondary,children:"Test your trigger"}),d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.tertiary,children:"To test/run your workflow, configure your application with the webhook URL or use the code snippet below to send a request to the workflow's trigger endpoint."})]})]}),d.jsx(ss,{variant:"normal",width:"max-content",tabs:GMe.map(A=>({title:A})),selectedTab:p,setSelectedTab:A=>h(A),sx:{width:"max-content"}}),p==="Basic"&&d.jsx(VMe,{VORTEX_MAIN_URL:n,ENTITY_ID:r}),p==="Advanced"&&d.jsx(E.Box,{sx:{"& > .MuiBox-root":{mt:0}},children:d.jsx(HMe,{ENTITY_ID:r,VORTEX_MAIN_URL:n,viewOnly:c,excludeUrlLanguage:!0})})]}):i?d.jsx(e6,{width:"100%",height:44,count:3,backgroundColor:f.palette.white.smoke}):o.length===0?d.jsxs(E.Stack,{gap:2,children:[d.jsx(E.Typography,{variant:"lgSemiBold",color:f.palette.text.secondary,children:"Test"}),d.jsx(E.Stack,{alignItems:"flex-start",sx:{border:`1px solid ${f.palette.grey.outlined.border}`,backgroundColor:f.palette.white.smoke,height:70,borderRadius:"8px",padding:1.5},children:d.jsxs(E.Stack,{direction:"row",gap:1,sx:{...vf,alignItems:"flex-start"},children:[d.jsx(Ue,{src:"ic_info_filled"}),d.jsxs(E.Stack,{gap:.75,children:[!du.includes(e)&&d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.primary,children:"No recent tests available"}),d.jsx(E.Typography,{variant:"smNormal",color:f.palette.text.tertiary,children:h4.includes(e)?"Testing is not required for triggers as they are initiated by external events or schedules.":A4.includes(e)?"Testing is not required for this step as it is a control flow or system configuration that does not support direct testing.":"Please test using the Test step button on the bottom"})]})]})})]}):d.jsxs(E.Stack,{justifyContent:"center",gap:2,children:[d.jsx(E.Typography,{variant:"lgSemiBold",color:f.palette.text.primary,children:"Test"}),d.jsx(O0e,{ENTITY_ID:r,VORTEX_MAIN_URL:n,nodeId:s,items:o,integrationSlug:a,integrationType:l,name:t,activityType:u})]})},QMe=e=>{const{ENTITY_ID:t,VORTEX_MAIN_URL:r,selectedNode:n,activityExecutionList:i,setActivityExecutionList:o,loading:s,fetchActivityExecutions:a,viewOnly:l=!1}=e,{data:{type:u,name:c},id:f}=n,p=dd(n?.data);return _.useEffect(()=>(a(),()=>{o([])}),[f,u]),d.jsx(E.Stack,{overflow:"auto",height:"calc(100vh - 212px)",children:d.jsx(E.Box,{mt:.5,children:d.jsx(WMe,{type:u,ENTITY_ID:t,VORTEX_MAIN_URL:r,loading:s,activityExecutionList:i,nodeId:f,name:c,integrationSlug:n?.data?.properties?.integration_slug||"",integrationType:u,activityType:p,viewOnly:l})})})},Kd=["resource","operation","secret","config","credential_id","slack_auth_id","mode","gmail_config_id","event","integration_slug","custom.query_params","custom.state_params","custom.headers","custom.body"],zMe=e=>{const t={"not-configured-yet":"not-configured-yet","partially-configured":"partially-configured",completed:"completed",failed:"failed",error:"error",success:"success",default:"default",skipped:"skipped"};return e in t?t[e]:"default"},oX=({value:e,onSave:t,isEditing:r,setIsEditing:n,disabled:i=!1,maxLength:o=50,placeholder:s="",showEditIcon:a=!0,variant:l="body1",textSx:u={},inputSx:c={},validate:f,error:p=null,minWidth:h=64,maxWidth:A=400,enableDoubleClick:g=!0,editIcon:m="ic_edit",autoResize:O=!0})=>{const y=E.useTheme(),[T,v]=_.useState(e||""),[C,x]=_.useState(h||64),b=_.useRef(null),w=_.useRef(null);_.useEffect(()=>{v(e||"")},[e]),_.useEffect(()=>{if(O&&b.current&&r){const L=b.current;L.textContent=T||s||"";const M=L.offsetWidth||0,B=12,H=h||64,j=A||400,F=Math.min(Math.max(M+B+40,H),j);x(F)}},[r,s,h,A,O]),_.useEffect(()=>{r&&w.current&&(w.current.focus(),w.current.select())},[r]);const R=async()=>{const L=T.trim();f&&await f(L)||L.length!==0&&(L.length>o||(t(L),n(!1)))},I=()=>{v(e),n(!1)},P=()=>{g&&!i&&(v(e),n(!0))},k=()=>{i||(v(e),n(!0))},N={cursor:g&&!i?"pointer":"default",...u};return d.jsxs(d.Fragment,{children:[O&&d.jsx("span",{ref:b,style:{position:"absolute",visibility:"hidden",whiteSpace:"nowrap",fontSize:c?.[".MuiInputBase-input"]?.fontSize||"16px",fontWeight:c?.[".MuiInputBase-input"]?.fontWeight||600,fontFamily:y?.typography?.fontFamily||"inherit",padding:"0px 8px",border:"1px solid transparent",zIndex:-1}}),r?d.jsx(E.TextField,{inputRef:w,autoFocus:!0,value:T,placeholder:s,error:!!p,helperText:p,disabled:i,onChange:L=>{const M=L.target.value.slice(0,o);v(M)},onBlur:R,onKeyDown:L=>{L.key==="Enter"?(L.preventDefault(),R()):L.key==="Escape"&&(L.preventDefault(),I())},inputProps:{maxLength:o},InputProps:{endAdornment:d.jsx(E.InputAdornment,{position:"end",children:d.jsx("span",{style:{color:y.palette.neutral.main,fontSize:12},children:`${T.length}/${o}`})})},sx:{width:O?`${C||h||64}px`:"100%",minWidth:`${h||64}px`,...c}}):d.jsxs(E.Stack,{direction:"row",alignItems:"center",onDoubleClick:P,sx:{cursor:g&&!i?"pointer":"default"},children:[d.jsx(E.Typography,{variant:l,sx:N,title:e,children:e}),a&&!i&&d.jsx(E.IconButton,{onClick:k,sx:{ml:1,p:0,"&:hover":{backgroundColor:"transparent","& .inline-svg svg path":{transition:"fill 0.2s ease"},"& svg path":{fill:`${y.palette.text.primary}`}}},title:"Edit",children:d.jsx(Ue,{width:20,height:20,src:m})})]})]})},Zd=()=>{const e=E.useTheme();return d.jsxs(E.Stack,{direction:"row",alignItems:"center",height:20,sx:{px:"6px",py:"4px",borderRadius:8,background:t=>`linear-gradient(100.41deg, ${t.palette.pro.badge.start} -5.78%, ${t.palette.pro.badge.end} 69.93%)`},children:[d.jsx(Ue,{src:"ic_crown",width:14,height:14,sx:{path:{fill:e.palette.common.black}}}),d.jsx(E.Typography,{variant:"xsNormal",sx:{ml:"4px",color:t=>t.palette.text.primary},children:"Pro"})]})},XMe=e=>{const t=e.match(/(?:-H|--header)\s+['"]?content-type:\s*([\w/-]+)/i),r=t?t[1].toLowerCase():null,n=e.match(/(?:--data(?:-raw)?|-d)\s+(['"]?)(.+?)\1/),i=n?n[2]:null;return e.match(/(?:^|\s)(?:-F|--form)(?:\s|["']|$)/)?"form-data":i?r&&r.startsWith("multipart/form-data")?"form-data":r==="application/x-www-form-urlencoded"?"x-www-form-urlencoded":r&&(r==="application/xml"||r==="text/xml")?"xml":/^\w+=([^&]+)(&\w+=([^&]+))*$/.test(i)?"x-www-form-urlencoded":/^\s*<[\s\S]*>\s*$/.test(i.trim())?"xml":"raw":"none"},qMe=(e,t)=>{let r=[];const n=!Array.isArray(t.headers);t.headers&&(r=n?{...t.headers}:[...t.headers]);let i=n?Lo(r):Lo(r)?.filter(o=>o.key!=="Content-Type");switch(e){case"none":n?delete i["Content-Type"]:i=i.filter(o=>o.key!=="Content-Type");break;case"form-data":n?i={...i,"Content-Type":"multipart/form-data"}:i.push({key:"Content-Type",value:"multipart/form-data"});break;case"x-www-form-urlencoded":n?i={...i,"Content-Type":"application/x-www-form-urlencoded"}:i.push({key:"Content-Type",value:"application/x-www-form-urlencoded"});break;case"xml":n?i={...i,"Content-Type":"application/xml"}:i.push({key:"Content-Type",value:"application/xml"});break;default:n?i={...i,"Content-Type":"application/json"}:i.push({key:"Content-Type",value:"application/json"});break}return i},En=e=>{const{children:t}=e;return d.jsxs(E.Stack,{gap:2,children:[d.jsx(E.Typography,{className:"config",variant:"lgSemiBold",children:"Configure"}),t]})},kr=vc(e=>{const{name:t,type:r="text",meta:{displayName:n="",placeholder:i="",value:o="",displayType:s="",description:a="",isDisabled:l=!1,htmlProps:{showInfoIcon:u=!1,rightLabel:c="",rightLabelAlignment:f="flex-end"}={},renderFieldValue:p=null},control:h,handleChange:A,validationRules:g,viewOnly:m=!1,size:O="xs",multiline:y=!1,...T}=e,v=typeof a=="object"?a:ao(a),C=E.useTheme(),[x,b]=_.useState(!1),w=(I,P)=>{let k=I.target.value;s==="number"&&k.trim()!==""?k=parseFloat(k)||0:s==="number"&&k.trim()===""&&(k=""),P.onChange(k),A&&A({field:t,value:k,fieldData:e})},R=I=>{r==="number"&&I.target?.blur()};return d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(pr,{name:t,control:h,rules:g,render:({field:{value:I,...P},fieldState:{error:k}})=>d.jsxs(E.Stack,{children:[(n||c||u)&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:f,children:[n&&d.jsx(gn,{label:n,description:v,required:e?.required}),c&&d.jsx(E.Typography,{variant:C.typography["components-inputs-label-sm"],pb:"0.25rem",color:"neutral.80",children:c})]}),d.jsx(lo,{...P,...T,type:e?.htmlProps?.type==="password"&&x?"text":r,placeholder:i,variant:"outlined",fullWidth:!0,errorMsg:k?.message,size:y&&O==="xs"?"sm":O,multiline:y,disabled:l||m,onChange:N=>{w(N,P)},value:p?p(I):I||o,onWheel:R})]})})})}),dT=e=>e.sort((t,r)=>{const n=t.integration_meta?.auth_type||"",i=r.integration_meta?.auth_type||"";return n.localeCompare(i)}),fT=e=>e.map(r=>{const n=Rs(r.integration_meta.auth_type.replace("_auth",""));return{...r,name:`${r.name} (${n})`}}),NP=e=>(e&&typeof e=="string"&&e.replace("(Header)","").replace("(Basic)",""),e),nA=e=>{if(e===null||typeof e!="object")return!1;const t=new Set;return Array.isArray(e)?e.some(r=>r===null?!1:nA(r)):Object.entries(e).some(([r,n])=>t.has(r)||(t.add(r),!r.trim())?!0:n===null?!1:typeof n=="object"?nA(n):!1)},LP=(e,t)=>!e||e.trim()===""||e==="{{}}"?"Key is required":Object.keys(t).includes(e)?"Duplicate key found":"",YMe=e=>{const{onClick:t,refreshTooltip:r="",refreshing:n,sx:i,...o}=e,s=E.useTheme();return d.jsx(E.Tooltip,{title:r,arrow:!0,children:d.jsx("span",{children:d.jsx(E.IconButton,{onClick:t,disabled:n,sx:{width:32,height:32,border:`1px solid ${s.palette.grey.outlined.border}`,borderRadius:1.5,...Ii(s),...i},"data-testid":"button-refresh",...o,children:n?d.jsx(E.CircularProgress,{size:14}):d.jsx(Ue,{src:"ic_refresh",width:20,height:20,sx:{path:{fill:s.palette.neutral.solid.bg}}})})})})},KMe=_.forwardRef(({name:e,type:t,required:r=!1,title:n,helperText:i="",viewOnly:o=!1,disabled:s=!1,options:a=[],errorMsg:l,children:u,endItem:c,refreshTooltip:f="",refreshOptions:p,loading:h=!1,refreshing:A=!1,aiIndicatorVisible:g=!1,...m},O)=>{const y=E.useTheme(),T=ao(i),{sx:v,...C}=m;return d.jsxs(E.FormControl,{fullWidth:!0,children:[d.jsxs(E.Stack,{alignItems:"flex-end",justifyContent:"space-between",direction:"row",children:[d.jsx(gn,{description:T,label:n,required:r}),c]}),d.jsxs(E.Stack,{gap:1,direction:"row",alignItems:"flex-end",sx:{position:"relative"},children:[g&&d.jsx(E.Box,{sx:{position:"absolute",right:p?"3.1rem":"1px",top:1,bottom:1,width:"15%",minWidth:p?56:64,maxWidth:p?76:92,pointerEvents:"none",borderTopRightRadius:6,borderBottomRightRadius:6,zIndex:0,background:`linear-gradient(90deg, ${E.alpha(y.palette.primary[5],0)} 0%, ${E.alpha(y.palette.primary[5],.35)} 62%, ${E.alpha(y.palette.primary[5],.9)} 100%)`}}),d.jsx(E.Select,{...C,fullWidth:!p,inputRef:O,error:!!l,name:e,disabled:s||o,IconComponent:x=>d.jsx(Ue,{src:"ic_arrow_down",width:"1.25rem",height:"1.25rem",sx:{"&.MuiSelect-icon":{top:"auto",mr:"0.25rem"}},...x}),"data-testid":`select-${e||"field"}`,sx:p?{width:"94%",flexShrink:0,position:"relative",zIndex:1,...g?{"& .MuiSelect-select":{pr:"4.25rem !important"}}:{},...v||{}}:{position:"relative",zIndex:1,...g?{"& .MuiSelect-select":{pr:"4.25rem !important"}}:{},...v||{}},children:u||(a.length>0?a.map(x=>d.jsx(E.MenuItem,{value:x.value,"data-testid":`option-${x.value}`,children:x.title},x.value)):d.jsx(E.MenuItem,{disabled:!0,sx:{p:"14px 16px"},"data-testid":"option-no-options",children:d.jsx(E.Typography,{variant:"smNormal",children:"No options"})}))}),g&&d.jsx(E.Box,{sx:{position:"absolute",right:p?"3.35rem":"2.45rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,width:18,height:18},children:d.jsx(Ue,{src:"ic_AI",width:18,height:18,sx:{display:"block","& svg path":{fill:`${y.palette.primary.main} !important`,fillOpacity:"1 !important"}}})}),p&&d.jsx(YMe,{refreshing:A,disabled:h||o||s,onClick:p,refreshTooltip:f})]}),!!l&&d.jsx(E.FormHelperText,{error:!0,children:l})]})}),sX=vc(KMe),ZMe=e=>{const t=E.useTheme(),{getValues:r,setValue:n}=Rr(),{isMultiple:i,options:o,selected:s=null,name:a,placeholder:l="",setMenuOpen:u,menuOpen:c,viewOnly:f=!1}=e,p=_.useRef(null),[h,A]=_.useState(!1),g=(T,v)=>{T.stopPropagation(),T.preventDefault();const C=r(a);typeof C=="object"&&Array.isArray(C)&&n(a,C.filter(x=>typeof x=="object"&&x.value?x.value!==v:x!==v),{shouldValidate:!0})},m=s!=null?o?.some(T=>T?.value===s):!1;if(typeof s=="object"&&Et(s)||typeof s=="string"&&!s&&!m)return d.jsx(E.Typography,{sx:{fontSize:"14px",color:t.palette.neutral.solid.bg,fontFamily:"inherit",":hover":{color:t.palette.neutral.main}},children:l||""});let O=(p.current?.offsetWidth||440)-95;if(i){const{visible:T,extra:v,hiddenSelections:C}=Ub(s,O);return d.jsxs(E.Stack,{direction:"row",ref:p,sx:{...di,position:"relative",width:"100%"},children:[d.jsxs(E.Box,{"data-testid":"select-chip-container",sx:{display:"flex",flexWrap:"nowrap",gap:.5,maxWidth:"calc(100% - 65px)",overflow:"hidden"},onClick:x=>{x.preventDefault(),x.stopPropagation(),u?.(!c)},children:[T.map(x=>{const{value:b,title:w}=x,R=Math.min(O,Math.max(w.length*8+50,90));return O=O-R-4,d.jsx(w7,{label:w,onDelete:I=>g(I,b),sx:{flex:"0 0 auto",minWidth:"40px","&.MuiChip-root":{maxWidth:`${R}px !important`}}},b)}),v>0&&d.jsx(Bw,{hiddenSelections:C,extra:v,handleChipDelete:g})]}),T?.length?d.jsx(E.IconButton,{disableRipple:!0,onMouseDown:x=>{x.preventDefault(),x.stopPropagation(),typeof n=="function"&&n(a,[],{shouldValidate:!0})},sx:{position:"absolute",right:0,top:"auto","&.MuiButton-root":{paddingRight:1},zIndex:1e3,"&:hover":{backgroundColor:"transparent"}},children:d.jsx(Ue,{src:"ic_close",height:16,width:16})}):null]})}const y=NP(o?.find(T=>T?.value===s)?.title);return d.jsxs(E.Stack,{direction:"row",alignItems:"center",onMouseEnter:()=>!f&&A(!0),onMouseLeave:()=>A(!1),sx:{position:"relative",width:"100%",minWidth:0,maxWidth:"100%",pr:f?0:"36px"},children:[d.jsx(E.Typography,{sx:{fontSize:"14px",color:t.palette.text.primary,fontFamily:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,maxWidth:"100%",pr:!f&&s&&h?"24px":0},children:y}),!f&&s&&h&&d.jsx(E.IconButton,{disableRipple:!0,size:"small",onMouseDown:T=>{T.preventDefault(),T.stopPropagation(),n(a,"",{shouldValidate:!0})},sx:{position:"absolute",right:"34px",top:"50%",transform:"translateY(-50%)",padding:"4px",zIndex:1e3,"&:hover":{backgroundColor:"transparent","& svg path":{fill:t.palette.text.primary}}},children:d.jsx(Ue,{src:"ic_close",height:16,width:16,sx:{path:{fill:t.palette.neutral.solid.bg}}})})]})};function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ce.apply(null,arguments)}function kP(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FP(e,t){return FP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},FP(e,t)}function pT(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,FP(e,t)}var aX=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function JMe(e,t){return!!(e===t||aX(e)&&aX(t))}function e6e(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!JMe(e[r],t[r]))return!1;return!0}function MP(e,t){t===void 0&&(t=e6e);var r,n=[],i,o=!1;function s(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&r===this&&t(a,n)||(i=e.apply(this,a),o=!0,r=this,n=a),i}return s}function _t(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var t6e=typeof performance=="object"&&typeof performance.now=="function",lX=t6e?function(){return performance.now()}:function(){return Date.now()};function uX(e){cancelAnimationFrame(e.id)}function r6e(e,t){var r=lX();function n(){lX()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var BP=-1;function cX(e){if(e===void 0&&(e=!1),BP===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),BP=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return BP}var iA=null;function dX(e){if(e===void 0&&(e=!1),iA===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?iA="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?iA="negative":iA="positive-ascending"),document.body.removeChild(t),iA}return iA}process.env.NODE_ENV;var n6e=150,i6e=function(t,r){return t},hT=null,AT=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(hT=new WeakSet,AT=new WeakSet);function o6e(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,o=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,l=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,c=e.validateProps;return t=(function(f){pT(p,f);function p(A){var g;return g=f.call(this,A)||this,g._instanceProps=l(g.props,kP(g)),g._outerRef=void 0,g._resetIsScrollingTimeoutId=null,g.state={instance:kP(g),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof g.props.initialScrollOffset=="number"?g.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},g._callOnItemsRendered=void 0,g._callOnItemsRendered=MP(function(m,O,y,T){return g.props.onItemsRendered({overscanStartIndex:m,overscanStopIndex:O,visibleStartIndex:y,visibleStopIndex:T})}),g._callOnScroll=void 0,g._callOnScroll=MP(function(m,O,y){return g.props.onScroll({scrollDirection:m,scrollOffset:O,scrollUpdateWasRequested:y})}),g._getItemStyle=void 0,g._getItemStyle=function(m){var O=g.props,y=O.direction,T=O.itemSize,v=O.layout,C=g._getItemStyleCache(u&&T,u&&v,u&&y),x;if(C.hasOwnProperty(m))x=C[m];else{var b=r(g.props,m,g._instanceProps),w=i(g.props,m,g._instanceProps),R=y==="horizontal"||v==="horizontal",I=y==="rtl",P=R?b:0;C[m]=x={position:"absolute",left:I?void 0:P,right:I?P:void 0,top:R?0:b,height:R?"100%":w,width:R?w:"100%"}}return x},g._getItemStyleCache=void 0,g._getItemStyleCache=MP(function(m,O,y){return{}}),g._onScrollHorizontal=function(m){var O=m.currentTarget,y=O.clientWidth,T=O.scrollLeft,v=O.scrollWidth;g.setState(function(C){if(C.scrollOffset===T)return null;var x=g.props.direction,b=T;if(x==="rtl")switch(dX()){case"negative":b=-T;break;case"positive-descending":b=v-y-T;break}return b=Math.max(0,Math.min(b,v-y)),{isScrolling:!0,scrollDirection:C.scrollOffset<b?"forward":"backward",scrollOffset:b,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._onScrollVertical=function(m){var O=m.currentTarget,y=O.clientHeight,T=O.scrollHeight,v=O.scrollTop;g.setState(function(C){if(C.scrollOffset===v)return null;var x=Math.max(0,Math.min(v,T-y));return{isScrolling:!0,scrollDirection:C.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._outerRefSetter=function(m){var O=g.props.outerRef;g._outerRef=m,typeof O=="function"?O(m):O!=null&&typeof O=="object"&&O.hasOwnProperty("current")&&(O.current=m)},g._resetIsScrollingDebounced=function(){g._resetIsScrollingTimeoutId!==null&&uX(g._resetIsScrollingTimeoutId),g._resetIsScrollingTimeoutId=r6e(g._resetIsScrolling,n6e)},g._resetIsScrolling=function(){g._resetIsScrollingTimeoutId=null,g.setState({isScrolling:!1},function(){g._getItemStyleCache(-1,null)})},g}p.getDerivedStateFromProps=function(g,m){return s6e(g,m),c(g),null};var h=p.prototype;return h.scrollTo=function(g){g=Math.max(0,g),this.setState(function(m){return m.scrollOffset===g?null:{scrollDirection:m.scrollOffset<g?"forward":"backward",scrollOffset:g,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},h.scrollToItem=function(g,m){m===void 0&&(m="auto");var O=this.props,y=O.itemCount,T=O.layout,v=this.state.scrollOffset;g=Math.max(0,Math.min(g,y-1));var C=0;if(this._outerRef){var x=this._outerRef;T==="vertical"?C=x.scrollWidth>x.clientWidth?cX():0:C=x.scrollHeight>x.clientHeight?cX():0}this.scrollTo(o(this.props,g,m,v,this._instanceProps,C))},h.componentDidMount=function(){var g=this.props,m=g.direction,O=g.initialScrollOffset,y=g.layout;if(typeof O=="number"&&this._outerRef!=null){var T=this._outerRef;m==="horizontal"||y==="horizontal"?T.scrollLeft=O:T.scrollTop=O}this._callPropsCallbacks()},h.componentDidUpdate=function(){var g=this.props,m=g.direction,O=g.layout,y=this.state,T=y.scrollOffset,v=y.scrollUpdateWasRequested;if(v&&this._outerRef!=null){var C=this._outerRef;if(m==="horizontal"||O==="horizontal")if(m==="rtl")switch(dX()){case"negative":C.scrollLeft=-T;break;case"positive-ascending":C.scrollLeft=T;break;default:var x=C.clientWidth,b=C.scrollWidth;C.scrollLeft=b-x-T;break}else C.scrollLeft=T;else C.scrollTop=T}this._callPropsCallbacks()},h.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&uX(this._resetIsScrollingTimeoutId)},h.render=function(){var g=this.props,m=g.children,O=g.className,y=g.direction,T=g.height,v=g.innerRef,C=g.innerElementType,x=g.innerTagName,b=g.itemCount,w=g.itemData,R=g.itemKey,I=R===void 0?i6e:R,P=g.layout,k=g.outerElementType,N=g.outerTagName,L=g.style,M=g.useIsScrolling,B=g.width,H=this.state.isScrolling,j=y==="horizontal"||P==="horizontal",X=j?this._onScrollHorizontal:this._onScrollVertical,F=this._getRangeToRender(),V=F[0],G=F[1],D=[];if(b>0)for(var $=V;$<=G;$++)D.push(_.createElement(m,{data:w,key:I($,w),index:$,isScrolling:M?H:void 0,style:this._getItemStyle($)}));var U=n(this.props,this._instanceProps);return _.createElement(k||N||"div",{className:O,onScroll:X,ref:this._outerRefSetter,style:ce({position:"relative",height:T,width:B,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:y},L)},_.createElement(C||x||"div",{children:D,ref:v,style:{height:j?"100%":U,pointerEvents:H?"none":void 0,width:j?U:"100%"}}))},h._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var g=this.props.itemCount;if(g>0){var m=this._getRangeToRender(),O=m[0],y=m[1],T=m[2],v=m[3];this._callOnItemsRendered(O,y,T,v)}}if(typeof this.props.onScroll=="function"){var C=this.state,x=C.scrollDirection,b=C.scrollOffset,w=C.scrollUpdateWasRequested;this._callOnScroll(x,b,w)}},h._getRangeToRender=function(){var g=this.props,m=g.itemCount,O=g.overscanCount,y=this.state,T=y.isScrolling,v=y.scrollDirection,C=y.scrollOffset;if(m===0)return[0,0,0,0];var x=s(this.props,C,this._instanceProps),b=a(this.props,x,C,this._instanceProps),w=!T||v==="backward"?Math.max(1,O):1,R=!T||v==="forward"?Math.max(1,O):1;return[Math.max(0,x-w),Math.max(0,Math.min(m-1,b+R)),x,b]},p})(_.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var s6e=function(t,r){var n=t.children,i=t.direction,o=t.height,s=t.layout,a=t.innerTagName,l=t.outerTagName,u=t.width,c=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||l!=null)&&AT&&!AT.has(c)&&AT.add(c);var f=i==="horizontal"||s==="horizontal";switch(i){case"horizontal":case"vertical":hT&&!hT.has(c)&&hT.add(c);break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(s){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+s+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof o!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(o===null?"null":typeof o)+'" was specified.'))}},a6e=50,oA=function(t,r,n){var i=t,o=i.itemSize,s=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var l=0;if(a>=0){var u=s[a];l=u.offset+u.size}for(var c=a+1;c<=r;c++){var f=o(c);s[c]={offset:l,size:f},l+=f}n.lastMeasuredIndex=r}return s[r]},l6e=function(t,r,n){var i=r.itemMetadataMap,o=r.lastMeasuredIndex,s=o>0?i[o].offset:0;return s>=n?fX(t,r,o,0,n):u6e(t,r,Math.max(0,o),n)},fX=function(t,r,n,i,o){for(;i<=n;){var s=i+Math.floor((n-i)/2),a=oA(t,s,r).offset;if(a===o)return s;a<o?i=s+1:a>o&&(n=s-1)}return i>0?i-1:0},u6e=function(t,r,n,i){for(var o=t.itemCount,s=1;n<o&&oA(t,n,r).offset<i;)n+=s,s*=2;return fX(t,r,Math.min(n,o-1),Math.floor(n/2),i)},pX=function(t,r){var n=t.itemCount,i=r.itemMetadataMap,o=r.estimatedItemSize,s=r.lastMeasuredIndex,a=0;if(s>=n&&(s=n-1),s>=0){var l=i[s];a=l.offset+l.size}var u=n-s-1,c=u*o;return a+c},hX=o6e({getItemOffset:function(t,r,n){return oA(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:pX,getOffsetForIndexAndAlignment:function(t,r,n,i,o,s){var a=t.direction,l=t.height,u=t.layout,c=t.width,f=a==="horizontal"||u==="horizontal",p=f?c:l,h=oA(t,r,o),A=pX(t,o),g=Math.max(0,Math.min(A-p,h.offset)),m=Math.max(0,h.offset-p+h.size+s);switch(n==="smart"&&(i>=m-p&&i<=g+p?n="auto":n="center"),n){case"start":return g;case"end":return m;case"center":return Math.round(m+(g-m)/2);default:return i>=m&&i<=g?i:i<m?m:g}},getStartIndexForOffset:function(t,r,n){return l6e(t,n,r)},getStopIndexForStartIndex:function(t,r,n,i){for(var o=t.direction,s=t.height,a=t.itemCount,l=t.layout,u=t.width,c=o==="horizontal"||l==="horizontal",f=c?u:s,p=oA(t,r,i),h=n+f,A=p.offset+p.size,g=r;g<a-1&&A<h;)g++,A+=oA(t,g,i).size;return g},initInstanceProps:function(t,r){var n=t,i=n.estimatedItemSize,o={itemMetadataMap:{},estimatedItemSize:i||a6e,lastMeasuredIndex:-1};return r.resetAfterIndex=function(s,a){a===void 0&&(a=!0),o.lastMeasuredIndex=Math.min(o.lastMeasuredIndex,s-1),r._getItemStyleCache(-1),a&&r.forceUpdate()},o},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});const AX=40,c6e=400,d6e=_.forwardRef(({options:e=[],itemHeight:t=AX,maxHeight:r=c6e,renderItem:n,headerComponent:i,footerComponent:o,emptyComponent:s,groupBy:a="",getNestedProperty:l=(h,A)=>A.split(".").reduce((g,m)=>g?g[m]:null,h),startCase:u=h=>h.replace(/([A-Z])/g," $1").replace(/_/g," ").trim().split(" ").map(A=>A.charAt(0).toUpperCase()+A.slice(1).toLowerCase()).join(" "),listWidth:c,...f},p)=>{const h=E.useTheme();if(e.length===0&&!i&&!o&&s)return d.jsx(E.MenuList,{component:"ul",...f,children:s});const A=_.useMemo(()=>{if(!a||e.length===0)return e.map(w=>({type:"item",data:w}));const x={};e.forEach(w=>{const I=l(w,a)||"Other";x[I]||(x[I]=[]),x[I].push(w)});const b=[];return Object.entries(x).forEach(([w,R])=>{b.push({type:"header",label:u(w.replace("_"," ")).replace("Auth","Authentication")}),R.forEach(I=>{b.push({type:"item",data:I})})}),b},[e,a,l,u]),g=i&&e.length>0?56:0,m=o?68:0,O=40,y=x=>{if(a&&A[x]&&A[x].type==="header")return O;const b=A[x],w=a?b.data:e[x];let R=40;const I=Math.floor((c-70)/7.3);if(w?.description){const P=Math.ceil(w.description.length/I);R+=Math.max(P,1)*26}return w?.title&&w.title.length>I&&(R+=26),R+4},T=Math.min(g+(a?A.reduce((x,b)=>x+y(A.indexOf(b)),0):e.length*(t+4))+m,r),v=Math.max(T-g-m,0),C=({index:x,style:b})=>{const w=A[x];return a&&"type"in w&&w.type==="header"?d.jsx("div",{style:b,children:d.jsx(E.ListSubheader,{component:"div",sx:{fontSize:"0.8rem",fontWeight:600,color:h.palette.text.secondary,bgcolor:h.palette.grey[300],lineHeight:"2rem",position:"sticky",top:0,zIndex:1},children:w.label})}):d.jsx("div",{style:b,children:n(a?w.data:e[x],x)})};return d.jsxs(E.MenuList,{component:"ul",ref:p,...f,children:[i||null,A.length>0&&(a?d.jsx(hX,{height:v,width:"100%",itemCount:A.length,itemSize:y,overscanCount:5,children:C}):d.jsx(hX,{height:v,width:"100%",itemCount:A.length,itemSize:y||AX,overscanCount:5,children:C})),e.length===0&&s,o]})}),f6e=_.forwardRef((e,t)=>{const r=E.useTheme(),{getNodes:n}=Rt.useReactFlow(),{selectedActivityId:i,nodes:o,aiGeneratedFieldMap:s}=ct.useSelector(ge=>ge.canvas),a=_.useCallback((ge,ye,je,Qe,$e,Je=!1)=>{const{multiple:rt,renderOption:tt,name:Ie,handleChange:Ve}=e,He=Array.isArray(ye)?ye.map(de=>de&&typeof de=="object"&&"value"in de?de.value:de):[],Ee=rt?He.includes(ge.value):ye===ge.value;if(tt){let de=null;try{tt.length>=2?de=tt(null,ge,Ee):de=tt(ge,Ee)}catch{de=null}if(de)return de}const _e=de=>{de.preventDefault();let be;rt?be=He.includes(ge.value)?He.filter(Me=>Me!==ge.value):[...He,ge.value]:be=ge.value,je({target:{value:be}}),$e?$e({field:Ie,value:be}):Ve&&Ve({field:Ie,value:be}),rt||ue(!1)},we=Je?NP(ge.title):ge.title,ee=Je?NP(ge.value):ge.value;return d.jsx(E.MenuItem,{value:ee,disabled:ge.disabled,onClick:_e,selected:Ee,"data-testid":`menu-item-${ee}`,sx:{display:"flex",justifyContent:"flex-start",mx:1,height:"auto",p:"8px !important",minHeight:"fit-content !important","&.Mui-selected":{backgroundColor:rt?r.palette.common.white:"auto","& .MuiTypography-root":{color:rt?r.palette.text.tertiary:r.palette.primary.main}}},children:rt?d.jsxs(d.Fragment,{children:[d.jsx(E.Checkbox,{sx:{p:0},icon:d.jsx(Ue,{src:"ic_unchecked",width:16,height:16,sx:{path:{fill:r.palette.common.white}}}),checkedIcon:d.jsx(Ue,{src:"ic_checked",width:16,height:16}),checked:!!Ee,"data-testid":"checkbox-"+ee}),d.jsx(E.ListItemText,{primary:we,sx:{whiteSpace:"normal"},secondary:ge.description})]}):d.jsxs(E.Stack,{gap:.5,sx:{whiteSpace:"normal"},children:[d.jsxs(E.Stack,{direction:"row",gap:1,flexWrap:"wrap",alignItems:"center",children:[d.jsxs(E.Typography,{variant:"mdNormal",color:r.palette.text.primary,sx:{whiteSpace:"normal"},children:[we,ge?.legacy&&d.jsx(E.Chip,{label:"Legacy",sx:{fontSize:11,ml:1},size:"small"},`${ee}-chip-${ge?.legacy}`)]}),!Je&&ge.chips&&Array.isArray(ge.chips)&&ge.chips.length>0&&d.jsx(E.Stack,{direction:"row",gap:.5,children:ge.chips.map((de,be)=>d.jsx(E.Chip,{sx:{fontSize:11},size:"small",label:de},`${ee}-chip-${be}`))})]}),ge.description&&!ge.chips&&d.jsx(E.Typography,{sx:{fontSize:"0.875rem",fontWeight:400,color:r.palette.text.tertiary},children:ge.description})]})},ee+Qe)},[e,r]),{name:l,control:u,meta:{options:c=[],displayName:f="",error:p={},description:h="",placeholder:A="",readOnly:g=!1,isDisabled:m=!1,displayProps:{loading:O=!1,refreshing:y=!1}={},htmlProps:{showAddNew:T=!1,onClickAddNew:v=null}={},TESSERACT_MAIN_URL:C="",FRONTEND_URL:x="",ENTITY_ID:b="",openIntegrationDrawer:w,addNewButtonText:R="",searchFieldPlaceholder:I="",authType:P="",handleSearchOptions:k=null,showSearchOnLoad:N=!1,showSearch:L=!0},handleChange:M,onFocus:B=null,validationRules:H,viewOnly:j=!1,disabled:X=!1,multiple:F=!1,renderValueUi:V=null,refreshOptions:G=null,renderFieldValue:D=null,groupBy:$="",onOpen:U=null,refreshTooltip:Y="",getSelectedValue:z=null,virtualized:Q=!1,...W}=e,[q,Z]=_.useState(c),[te,ae]=_.useState(""),[ne,ue]=_.useState(!1);_.useEffect(()=>{Z(c)},[c]);const Oe=()=>{B&&B({field:l,fieldData:e})},Te=_.useMemo(()=>_a(ge=>{if(!ge)Z(c);else{const ye=c.filter(je=>String(je.title).toLowerCase().includes(ge.toLowerCase()));Z(ye)}},300),[c]),se=_.useCallback(ge=>{ge.stopPropagation(),ge.preventDefault();const ye=ge.target.value;ae(ye),Te(ye),k&&k(ye)},[Te]),ie=ge=>D?D(ge):F||c.some(ye=>ye.value===ge)?ge:"",J=()=>{ae(""),Z(c)},[K,re]=_.useState(0),le=_.useRef(null),he=_.useMemo(()=>{const ge=String(e?.nodeId||e?.id||""),ye=typeof n=="function"?n():[],je=Array.isArray(ye)&&ye.length>0?ye:o||[],Qe=je.find(Ie=>Ie?.selected),$e=je.find(Ie=>String(Ie?.id)===ge)||je.find(Ie=>String(Ie?.id)===String(i))||Qe,Je=String($e?.id||""),tt=(s||{})[Je]||(s||{})[String(i||"")]||(s||{})[ge];return tt&&typeof tt=="object"?tt:{}},[s,n,o,e,i]),Ae=_.useCallback((ge,ye)=>{const je=String(ge||"").replace(/^properties\./,"");return!(!je||!(je in he)||ye==null||typeof ye=="string"&&ye.trim()===""||Array.isArray(ye)&&ye.length===0)},[he]),fe=()=>r?.drawer.rightMenu.replace("px","")-36;_.useEffect(()=>{const ge=()=>{if(le.current){const je=le.current.clientWidth;re(je>0?je:fe())}else re(fe())};ge();const ye=new ResizeObserver(ge);return le.current&&ye.observe(le.current),()=>{le.current&&ye.unobserve(le.current),ye.disconnect()}},[le?.current?.clientWidth]);const Se=_.useCallback((ge,ye)=>{if($){const je={};return q.forEach(Qe=>{const Je=N4(Qe,$)||"Other";je[Je]||(je[Je]=[]),je[Je].push(Qe)}),Object.entries(je).map(([Qe,$e])=>d.jsxs(_.Fragment,{children:[d.jsx(E.ListSubheader,{sx:{fontSize:"0.8rem",fontWeight:600,color:r.palette.text.secondary,bgcolor:r.palette.grey[300],lineHeight:"2rem"},children:Rs(Qe.replace("_"," ")).replace("Auth","Authentication")}),$e.map((Je,rt)=>a(Je,ge,ye,rt,M,!0))]},Qe))}return q.map((je,Qe)=>a(je,ge,ye,Qe,M,!1))},[q,$,a,r,M]);return d.jsx(pr,{name:l,control:u,rules:H,render:({field:{onChange:ge,onBlur:ye,value:je},fieldState:{error:Qe}})=>d.jsx(E.Stack,{position:"relative",ref:le,children:d.jsxs(sX,{...W,multiple:F,ref:t,title:f,disabled:m||j||X,viewOnly:j,placeholder:A||f,displayEmpty:!0,errorMsg:Qe?.message||p?.errorMsg,helperText:h,value:ie(je),refreshOptions:G,loading:O,open:ne,refreshing:y,refreshTooltip:Y,onOpen:()=>{ue(!0),U&&U()},onClose:()=>{ae(""),Z(c),ue(!1),J()},MenuProps:{PaperProps:{component:"div",sx:{boxShadow:`0 0.25rem 1rem 0 ${r.palette.secondary.main}`,marginTop:"0.5rem",maxHeight:"21.25rem",border:"1px solid",borderColor:r.palette.neutral.outlined.border,maxWidth:`${K}px`,"& .MuiList-root":{display:"flex",maxHeight:"21.25rem",flexDirection:"column",gap:.5,pt:L?0:1,mb:R||c.length===0||O?0:1,"&.MuiMenu-list .MuiListSubheader-root":{p:1},overflowY:"auto"}}},MenuListProps:Q?{component:d6e,options:q,maxHeight:340,listWidth:K,renderItem:($e,Je)=>a($e,je,ge,Je,M),groupBy:$,getNestedProperty:N4,startCase:Rs,headerComponent:L&&(N||k||c.length&&!O)&&d.jsx(E.ListSubheader,{sx:{position:"sticky",top:0,zIndex:10,bgcolor:"white","& .MuiInputBase-root":{width:"100%"},padding:0,marginBottom:1},children:d.jsx(E.OutlinedInput,{onChange:se,value:te,placeholder:I,startAdornment:d.jsx(Ue,{src:"ic_search",width:24,height:24}),onKeyDown:$e=>{$e.stopPropagation(),$e.key==="Escape"&&(ue(!1),ae(""),Z(c))},onClick:$e=>{$e.stopPropagation()},inputRef:$e=>{$e&&ne&&setTimeout(()=>$e.focus(),0)}})},"search-input"),footerComponent:d.jsxs(d.Fragment,{children:[O&&d.jsx(E.Stack,{direction:"row",justifyContent:"center",py:1,px:2,children:d.jsx(E.CircularProgress,{size:24})}),!O&&q.length===0&&d.jsx(E.MenuItem,{disabled:!0,sx:{justifyContent:"center",p:"6px 12px"},children:d.jsx(E.Typography,{variant:"smNormal",children:"No options available"})}),R&&T&&d.jsx(E.MenuItem,{"data-testid":`${f}-popup-footer-item`,selected:!1,sx:{position:"sticky",bottom:0,p:2,zIndex:1e3,height:"auto",":hover":{backgroundColor:`${r.palette.common.white}`},backgroundColor:`${r.palette.common.white}`,borderRadius:0,cursor:"auto",borderTop:`1px solid ${r.palette.neutral.outlined.border}`},disableRipple:!0,onClick:$e=>{$e.stopPropagation(),$e.preventDefault(),ue(!1)},children:d.jsx(HC,{type:P,openIntegrationDrawer:w,TESSERACT_MAIN_URL:C,FRONTEND_URL:x,ENTITY_ID:b,buttonText:R,onClick:v,setMenuOpen:ue})},`${f}-popup-footer-item`)]})}:{component:E.Box},autoFocus:!1,disableAutoFocusItem:!0},renderValue:V||($e=>{const Je=z?.($e)||$e;return d.jsx(ZMe,{isMultiple:F,name:l,placeholder:A,options:c,selected:Je,setMenuOpen:ue,menuOpen:ne,viewOnly:j})}),readOnly:g,name:l,aiIndicatorVisible:Ae(l,je),onFocus:Oe,onChange:$e=>{ge($e),M&&M({field:l,value:$e.target.value}),F||ue(!1)},onBlur:ye,error:!!Qe,children:[L&&(N||k||c.length&&!O)&&d.jsx(E.ListSubheader,{sx:{position:"sticky",top:0,zIndex:10,bgcolor:"white","& .MuiInputBase-root":{width:"100%"}},children:d.jsx(E.OutlinedInput,{onChange:se,value:te,placeholder:I,startAdornment:d.jsx(Ue,{src:"ic_search",width:24,height:24}),onKeyDown:$e=>{$e.stopPropagation(),$e.key==="Escape"&&(ue(!1),ae(""),Z(c))},onClick:$e=>{$e.stopPropagation()},inputRef:$e=>{$e&&ne&&setTimeout(()=>$e.focus(),0)}})},"search-input"),c.length&&!O&&Se(je,ge),O&&d.jsx(E.MenuItem,{disabled:!0,sx:{p:"6px 12px","&.MuiButtonBase-root.MuiMenuItem-root.Mui-disabled":{opacity:1}},children:d.jsx(E.Stack,{alignItems:"center",width:"100%",children:d.jsx(E.CircularProgress,{size:16})})}),q.length===0&&!O&&d.jsx(E.MenuItem,{disabled:!0,sx:{p:"6px 12px"},children:d.jsx(E.Typography,{variant:"smNormal",children:"No options available"})}),T&&d.jsx(E.MenuItem,{"data-testid":`${f}-popup-footer-item`,selected:!1,sx:{position:"sticky",bottom:0,p:2,zIndex:1e3,height:"auto",":hover":{backgroundColor:`${r.palette.common.white} !important`},backgroundColor:`${r.palette.common.white} !important`,borderRadius:0,cursor:"auto",borderTop:`1px solid ${r.palette.neutral.outlined.border}`},disableRipple:!0,onClick:$e=>{$e.stopPropagation()},children:d.jsx(HC,{type:P,openIntegrationDrawer:w,TESSERACT_MAIN_URL:C,FRONTEND_URL:x,ENTITY_ID:b,buttonText:R,onClick:v,setMenuOpen:ue})},`${f}-popup-footer-item`)]})})})}),Yt=vc(f6e),Ei=e=>{const{children:t,rightElement:r=null}=e;return d.jsxs(E.Stack,{gap:2,children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[d.jsx(E.Typography,{className:"setup",variant:"lgSemiBold",children:"Setup"}),r]}),t]})},p6e=e=>{const t=E.useTheme(),{meta:{className:r="",displayName:n="",htmlProps:{headerVariant:i="smSemiBold"}={},description:o=""}={},children:s,defaultExpanded:a=!1}=e,[l,u]=_.useState(a),c=(f,p)=>{u(p)};return d.jsxs(E.Stack,{sx:{width:"100%"},className:r,children:[d.jsxs(E.Accordion,{expanded:l,onChange:c,sx:{border:`1px solid ${t.palette.neutral.outlined.border}`,borderRadius:".5rem !important",overflow:"auto"},children:[d.jsx(E.AccordionSummary,{sx:{borderBottom:l?`1px solid ${t.palette.neutral.outlined.border}`:"none",p:"0.5rem 0.75rem","& .MuiAccordionSummary-content":{margin:"0 !important"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"},backgroundColor:t.palette.white.smoke},expandIcon:d.jsx(Ue,{src:"ic_arrow_down",width:"1.5rem",height:"1.5rem"}),children:d.jsx(E.Stack,{spacing:"0.25rem",justifyContent:"flex-start",children:!Et(n)&&d.jsx(E.Typography,{variant:i,children:n})})}),d.jsx(E.AccordionDetails,{sx:{p:"1rem 0.75rem"},children:s})]}),o&&d.jsx(E.FormHelperText,{children:o})]})},mT=_.forwardRef(({type:e,name:t,label:r,value:n,onChange:i,inputProps:o,errorMsg:s,required:a=!1,viewOnly:l=!1},u)=>d.jsx(lo,{ref:u,label:r,name:t,type:"number",fullWidth:!0,required:a,viewOnly:l,errorMsg:s,helperText:_n(e,t),value:n||"",onChange:c=>{const f=Number(c.target.value);i(f)},inputProps:o})),Mi=e=>{const{type:t,viewOnly:r=!1}=e,{control:n,formState:{errors:i},watch:o}=Rr();return d.jsx(p6e,{meta:{displayName:"Advanced options"},children:d.jsxs(E.Grid,{container:!0,gap:1,children:[t===Ze.PARALLEL&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{sx:{mt:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d.jsx(gn,{label:"Isolate flow failures",description:ao("All parallel flows run to completion even if one fails. Once all finish, the execution is marked as failed if any flow failed — errors are not silently swallowed. When disabled (default), the first flow failure immediately stops all remaining flows."),sx:{fontSize:14,fontWeight:400}}),d.jsx(pr,{name:"properties.isolate_flows",control:n,defaultValue:!1,render:({field:s})=>d.jsx(E.FormControlLabel,{label:s.value?"On":"Off",labelPlacement:"start",control:d.jsx(E.Switch,{...s,checked:!!s.value,disabled:r}),sx:{mr:0,ml:2},componentsProps:{typography:{variant:"smNormal"}}})})]})}),t&&![Ze.SWITCH,Ze.PARALLEL,Ze.IF,Ze.SLEEP,Ze.RESPONSE].includes(t)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{sx:{mt:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d.jsx(gn,{label:"Continue on failure",description:ao("When enabled, a failure handle appears on this node. If this node fails, workflow continues through the failure path. If disabled and this node fails, the entire workflow stops."),sx:{fontSize:14,fontWeight:400}}),d.jsx(pr,{name:"properties.continue_on_failure",control:n,defaultValue:t===Ze.API||t===Ze.GRAPHQL,render:({field:s})=>d.jsx(E.FormControlLabel,{label:s.value?"On":"Off",labelPlacement:"start",control:d.jsx(E.Switch,{...s,checked:!!s.value,disabled:r}),sx:{mr:0,ml:2},componentsProps:{typography:{variant:"smNormal"}}})})]})}),(t===Ze.API||t===Ze.SERVERLESS)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.api_timeout",control:n,render:({field:s})=>d.jsxs(E.FormControl,{fullWidth:!0,children:[d.jsx(gn,{required:!0,label:"Max Time to Wait for API Response (seconds)",description:ao(_n(t,"api_timeout"))}),d.jsx(E.Select,{...s,value:s.value/1e3,disabled:r,onChange:a=>s.onChange(Number(a.target.value)*1e3),children:[3e4,6e4,9e4,12e4].map(a=>d.jsx(E.MenuItem,{value:a/1e3,children:a/1e3},a))})]})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.maximum_timeout",control:n,rules:{min:{value:6e4,message:"Maximum timeout must be at least 60"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"maximum_timeout",label:"Maximum Activity Completion Timeout(seconds)",viewOnly:r,errorMsg:i.properties?.maximum_timeout?.message,value:o("properties.maximum_timeout")/1e3,onChange:a=>s.onChange(a*1e3),inputProps:{min:60,step:10}})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.retry_config.maximum_attempts",control:n,rules:{min:{value:1,message:"Maximum number of attempts must be at least 1"},max:{value:10,message:"Maximum number of attempts must be at most 10"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"maximum_attempts",label:"Maximum Number of Attempts",viewOnly:r,errorMsg:i.properties?.retry_config?.maximum_attempts?.message,inputProps:{min:1,max:10}})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,meta:{options:b4,displayName:"Retry Backoff Rate",searchFieldPlaceholder:"Search",description:"Constants factor by which the time delay between the retry attempts increase after the each failure",placeholder:"Select Retry Backoff Rate"},name:"properties.retry_config.backoff_coefficient",control:n,disabled:r,type:"number"})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.retry_config.initial_interval",control:n,rules:{min:{value:1,message:"Initial interval must be at least 1"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"initial_interval",label:"Wait Time Before First Retry (seconds)",viewOnly:r,errorMsg:i.properties?.retry_config?.initial_interval?.message,inputProps:{min:1,step:1},value:o("properties.retry_config.initial_interval")/1e3,onChange:a=>s.onChange(a*1e3)})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.retry_config.maximum_interval",control:n,rules:{min:{value:100,message:"Max interval must be at least 100"}},render:({field:s})=>d.jsx(mT,{...s,required:!0,type:"advancedOptions",name:"maximum_interval",label:"Maximum Wait Between Retries (seconds)",viewOnly:r,errorMsg:i.properties?.retry_config?.maximum_interval?.message,inputProps:{min:100,step:1},value:o("properties.retry_config.maximum_interval")/1e3,onChange:a=>s.onChange(a*1e3)})})})]})})},h6e=({tabs:e,selectedTab:t,setSelectedTab:r,sx:n,textTransform:i="capitalize"})=>{const o=E.useTheme(),[s,a]=_.useState(!1);return _.useEffect(()=>{JM(t)||a(t)},[t]),d.jsx(E.Tabs,{sx:{width:"100%",border:`1px solid ${o.palette.neutral.outlined.border}`,"& .MuiTab-root":{fontSize:12,lineHeight:1},...n},value:s,onChange:(l,u)=>r(u),children:e.map(l=>d.jsx(E.Tab,{sx:{textTransform:i,flex:1,"& .MuiTab-iconWrapper":{ml:0},"&.MuiButtonBase-root.MuiTab-root":{py:.5}},icon:l?.icon,label:l.title,value:l.title,disabled:l.disabled||!1,iconPosition:"end"},l.title))})},gT=(e,t)=>t.split(".").reduce((r,n)=>r?.[n],e),A6e=({id:e,type:t="",field:r,suggestionsData:n,isLoop:i=!1,showKeyValuePair:o=!0,valueTypeSelector:s=null,viewOnly:a=!1,hideLabel:l=!0,name:u,fieldName:c="JSON",excludePayloadSuggestions:f=!1})=>d.jsx(d.Fragment,{children:o?d.jsx(m6e,{id:e,name:u,valueTypeSelector:s,viewOnly:a,isLoop:i,hideLabel:l,type:t,field:r,excludePayloadSuggestions:f}):d.jsx(g6e,{name:u,viewOnly:a,type:t,isLoop:i,fieldName:c,suggestionsData:n})}),m6e=({id:e,name:t,valueTypeSelector:r=null,viewOnly:n=!1,isLoop:i,hideLabel:o=!1,type:s,field:a,excludePayloadSuggestions:l})=>{const{control:u,watch:c,setValue:f,formState:{errors:p}}=Rr(),h=c(t),A=E.useTheme(),{reserved_keywords:g}=ct.useSelector(y=>y.activities),m=()=>{!h||!Array.isArray(h)?f(t,[{key:"",value:""}]):f(t,[...h,{key:"",value:""}])},O=y=>{Array.isArray(h)&&f(t,[...h.slice(0,y),...h.slice(y+1)])};return d.jsxs(E.Box,{children:[!Et(h)&&d.jsxs(E.Box,{sx:{border:`1px solid ${A.palette.grey[300]}`,borderRadius:3},children:[d.jsxs(E.Stack,{direction:"row",sx:{backgroundColor:A.palette.white.smoke,borderRadius:"12px 12px 0 0"},children:[d.jsx(E.Box,{width:r?"29.5%":"44%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Key"})}),r&&d.jsx(E.Box,{width:"29.5%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Type"})}),d.jsx(E.Box,{width:r?"29.5%":"44%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Value"})}),d.jsx(E.Box,{width:r?"11.5%":"12%",px:1,py:1.5,children:d.jsx(E.Typography,{color:A.palette.text.tertiary,variant:"xsSemiBold",children:"Actions"})})]}),d.jsx(E.Stack,{children:Array.isArray(h)&&h?.map((y,T)=>d.jsxs(E.Stack,{direction:"row",flex:1,justifyContent:"normal",alignItems:"flex-start",children:[d.jsx(E.Box,{width:r?"29.5%":"44%",px:1,py:1.5,children:d.jsx(pr,{name:`${t}.${T}.key`,control:u,rules:{required:"Key is required",validate:v=>g.includes(v)?`${v} is a reserved keyword and cannot be used.`:v==null||v===""?"Key cannot be empty":!0},render:({field:v})=>d.jsx(lo,{...v,label:o?"":"Key",fullWidth:!0,id:e,viewOnly:n,showSuggestions:!1,isLoop:i,editorId:`${s}-key_${a}-${T}`,required:!0,placeholder:"Key",errorMsg:gT(p,`${t}.${T}.key`)?.message,excludePayloadSuggestions:l})})}),r,d.jsx(E.Box,{sx:{width:r?"29.5%":"44%",minWidth:0},px:1,py:1.5,children:d.jsx(pr,{name:`${t}.${T}.value`,control:u,rules:{required:"Value is required",validate:v=>g.includes(v)?`${v} is a reserved keyword and cannot be used.`:v==null||v===""?"Value cannot be empty":!0},render:({field:v})=>d.jsx(lo,{...v,showSuggestions:!0,editorId:`${s}-value_${a}-${T}`,label:o?"":"Value",isLoop:i,fullWidth:!0,viewOnly:n,type:"text",top:"6px",required:!0,id:e,placeholder:"Value",errorMsg:gT(p,`${t}.${T}.value`)?.message,excludePayloadSuggestions:l})})}),d.jsx(E.Box,{width:r?"11.5%":"12%",px:1,py:1.5,sx:{display:"flex",alignItems:"flex-start",justifyContent:"center"},children:d.jsx(E.IconButton,{sx:{top:0,p:.75,"& path":{fill:A.palette.neutral.solid.bg},"&:hover path":{fill:A.palette.error[60]},"&:hover":{backgroundColor:"transparent"}},disabled:n,color:"error",onClick:()=>O(T),children:d.jsx(Ue,{width:20,height:20,src:"ic_delete"})})})]},`bulk-edit-${T}`))})]}),d.jsx(E.Tooltip,{title:"Add value set",arrow:!0,children:d.jsx("span",{children:d.jsxs(E.IconButton,{onClick:()=>m(),sx:{mt:Et(h)?0:1.5,fontSize:"1rem","&:hover":{color:A.palette.primary[50],"& .MuiTypography-root":{color:A.palette.primary[50]},"& svg path":{fill:A.palette.primary[50]}}},disableFocusRipple:!0,disableTouchRipple:!0,disableRipple:!0,disabled:n,color:"primary",children:[d.jsx(Ue,{src:"ic_plus",width:16,height:16,sx:{path:{fill:A.palette.primary[60]}}}),d.jsx(E.Typography,{sx:{ml:.5,lineHeight:"20px"},variant:"smMedium",color:A.palette.primary[60],children:"Add"})]})})})]})},g6e=({name:e,viewOnly:t,type:r,isLoop:n,suggestionsData:i,fieldName:o})=>{const{control:s,formState:{errors:a},watch:l}=Rr(),{loopSuggestionsData:u={}}=ct.useSelector(f=>f.loopActivity),c=l("properties.body_type");return d.jsx(pr,{name:e,control:s,rules:{required:`${o} is required`,validate:f=>{if(f.indexOf("{{")!==-1&&f.lastIndexOf("}}")!==-1&&f.lastIndexOf("}}")>f.indexOf("{{"))return!0;try{JSON.parse(f)}catch{return"The provided value is not valid JSON."}return!0}},render:({field:f})=>d.jsx(Fi,{size:"md",language:c==="xml"?"xml":"json",showSuggestions:!0,viewOnly:t,id:`${r}-${f}`,suggestionsData:n?u:i,showExpandOption:!0,handleChange:p=>{f.onChange(p)},value:typeof f.value=="object"?JSON.stringify(f.value,null,2):f.value,error:!!gT(a,e)?.message,errorMsg:gT(a,e)?.message})})},Aa=Gi(A6e),E6e=e=>{const{id:t,isLoop:r,control:n,bodyTypeWatch:i,method:o,...s}=e;return i==="form-data"||i==="x-www-form-urlencoded"?d.jsx(Aa,{id:t,isLoop:r,field:"body",type:"apiActivity",title:"Body",fieldName:"Body",valueTypeSelector:i==="form-data"&&d.jsx(E.Stack,{width:"29.5%",px:1,py:1.5,children:d.jsx(E.Select,{name:"value_type",value:"text",sx:{".MuiInputBase-inputSizeSmall":{height:"auto !important"}},children:_4.length?_4.map(a=>d.jsx(E.MenuItem,{value:a.value,sx:{minHeight:"40px !important","@media (min-width: 600px)":{minHeight:"40px !important"}},children:a.title},a.value)):d.jsx(E.MenuItem,{disabled:!0,sx:{p:"14px 16px"},children:d.jsx(E.Typography,{variant:"smNormal",children:"No options"})})})}),...s}):["raw","xml"].includes(i)?d.jsx(Aa,{id:t,isLoop:r,field:"body",type:"apiActivity",title:"Body",showKeyValuePair:!1,fieldName:"Body",...s}):null},O6e=_.forwardRef((e,t)=>{const r=ct.useDispatch(),n=E.useTheme(),{type:i,lambdaUrls:o,id:s,isLoop:a=!1,VORTEX_MAIN_URL:l,ENTITY_ID:u,viewOnly:c=!1}=e,[f,p]=_.useState(""),[h,A]=_.useState(!1),[g,m]=_.useState("Query Params"),[O,y]=_.useState(!1),{setValue:T,control:v,watch:C,trigger:x}=Rr(),[b,w,R,I]=C(["properties","type","properties.body_type","properties.method"]),P=async N=>{y(!0);const L=Xt(l,`/v1.0/${u}`,"/utility/curl");try{const B=(await zt.post(L,{data:{curl:N}}))?.data?.data,H=XMe(N),j=V=>typeof V=="string"?(D=>{const $=[];return D.split("&").forEach(U=>{const[Y,z]=U.split("=");$.push({key:Y,value:z})}),$})(V):typeof V=="object"&&V!==null&&!Array.isArray(V)?qo(V):V,X=V=>H==="none"?null:H==="raw"&&V!==null?JSON.stringify(V,null,2):H==="xml"&&V!==null?typeof V=="string"?V:"":j(V),F={method:B?.method?.toLowerCase()||"",endpoint:B?.url,headers:qo(B?.headers||{}),body:X(B?.data)||{},state_params:qo(B?.state_params||{}),query_params:qo(B?.queries||{}),body_type:H};T("properties",{...b,...F}),r({type:Qr,payload:{open:!0,title:"cURL imported successfully",type:"success"}}),A(!1),p("")}catch(M){sr(M,r)}finally{y(!1)}},k=async N=>{if(!N){r({type:Qr,payload:{open:!0,title:"Please enter cURL",type:"error"}});return}P(N)};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{rightElement:w==="apiActivity"&&d.jsx(E.Button,{variant:"outlined",color:"primary",onClick:()=>{A(!0)},disabled:c,sx:{textTransform:"none","&.MuiButtonBase-root.MuiButton-root.MuiButton-outlined":{color:n.palette.primary.main,borderColor:n.palette.primary[30]}},children:"Import cURL"}),children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.method",control:v,meta:{options:QO,displayName:"Method",searchFieldPlaceholder:"Search Method",placeholder:"Select Method",description:"The HTTP Method to be used for the request"},validationRules:{required:"Method is required"},viewOnly:c,id:i})})})}),b.method&&d.jsx(E.Divider,{}),b.method&&d.jsxs(En,{children:[d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:w===Ze.SERVERLESS?d.jsx(Yt,{required:!0,name:"properties.endpoint",control:v,meta:{options:o,displayName:"Endpoint",searchFieldPlaceholder:"Search Endpoint",description:"The URL of the HTTP Request.",placeholder:"Select Endpoint"},validationRules:{required:"Endpoint is required"},viewOnly:c,id:i}):d.jsx(kr,{required:!0,id:s,name:"properties.endpoint",control:v,meta:{displayName:"Base URL",description:"The URL of the HTTP Request.",placeholder:"Enter URL"},validationRules:{required:"Base URL is required"},viewOnly:c,editorId:`${i}-base_url-${a}`,showSuggestions:!0,isLoop:a})}),d.jsx(h6e,{variant:"normal",tabs:[{title:"Query Params",icon:d.jsx(E.Tooltip,{arrow:!0,title:"Query params are key-value pairs added to a URL to filter or specify data in a request.",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})},{title:"State Params",icon:d.jsx(E.Tooltip,{arrow:!0,title:"Path params are variables embedded directly in the URL path to identify specific resources (e.g., an ID).",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})},{title:"Headers",icon:d.jsx(E.Tooltip,{arrow:!0,title:"Headers are key-value pairs sent along with the HTTP request or response to pass metadata such as authentication tokens, content type, or client information.",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})},{title:"Body",icon:d.jsx(E.Tooltip,{arrow:!0,title:"The body is the payload of the request, typically used in POST, PUT, or PATCH methods to send data to the server.",children:d.jsx(E.Box,{sx:{cursor:"pointer"},children:d.jsx(Ue,{src:"ic_info"})})})}],selectedTab:g,setSelectedTab:m}),g==="Query Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:s,field:"query_params",type:"apiActivity",title:"Query Params",viewOnly:c,isLoop:a,name:"properties.query_params"})}),g==="State Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:s,isLoop:a,viewOnly:c,field:"state_params",type:"apiActivity",title:"State Params",name:"properties.state_params"})}),g==="Headers"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:s,field:"headers",viewOnly:c,isLoop:a,type:"apiActivity",title:"Headers",name:"properties.headers"})}),g==="Body"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{direction:"column",container:!0,gap:1,children:[d.jsx(Yt,{required:!0,name:"properties.body_type",control:v,meta:{options:Rue,displayName:"Body Type",searchFieldPlaceholder:"Search Body type",placeholder:"Select Body type"},validationRules:{required:"Body type is required"},viewOnly:c,id:i,handleChange:N=>{const{value:L}=N;x("properties.body"),L==="none"?T("properties.body",null):L==="raw"?T("properties.body","{}"):L==="form-data"?T("properties.body",qo({})):L==="x-www-form-urlencoded"?T("properties.body",qo({})):L==="xml"&&T("properties.body",""),T("properties.headers",qMe(L,b))}}),d.jsx(E6e,{id:s,isLoop:a,viewOnly:c,name:"properties.body",control:v,method:I,bodyTypeWatch:R})]})},R),!a&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:c,type:i})})]}),d.jsx(Co,{variant:"medium",open:h,icon:d.jsx(Ue,{width:24,height:24,src:"ic_download",sx:{path:{fill:n.palette.primary.main}}}),title:"Import cURL",handleClose:()=>{A(!1)},content:d.jsxs(E.Stack,{flexDirection:"column",gap:.5,width:"100%",children:[d.jsx(E.TextField,{name:"curl",disabled:O||c,fullWidth:!0,multiline:!0,rows:10,variant:"outlined",placeholder:"Paste cURL here",value:f,onChange:N=>{p(N.target.value)}}),d.jsxs(E.Stack,{flexDirection:"row",alignItems:"center",sx:{mt:.5},children:[d.jsx(Ue,{src:"ic_info"}),d.jsx(E.Typography,{variant:"smMedium",sx:{ml:1,fontStyle:"italic"},children:"This will overwrite any changes you have already made."})]})]}),footer:d.jsx(E.Stack,{flexDirection:"row",width:"100%",justifyContent:"flex-end",alignItems:"center",children:d.jsx(E.Box,{children:d.jsx(E.Button,{variant:"contained",onClick:()=>{k(f)},disabled:c,sx:{fontSize:"14px",boxShadow:N=>N.shadows[0],padding:"2px 16px"},startIcon:O&&d.jsx(E.CircularProgress,{color:"inherit",size:16}),children:"Import"})})})})]})]})}),mX={Folder:[{name:"Created",value:"storage.folder.created"},{name:"Deleted",value:"storage.folder.deleted"}],File:[{name:"Uploaded",value:"storage.file.uploaded"},{name:"Deleted",value:"storage.file.deleted"},{name:"Made Public",value:"storage.file.public"},{name:"Made Private",value:"storage.file.private"}]},y6e=_.forwardRef((e,t)=>{const{viewOnly:r=!1}=e,{setValue:n}=Rr(),{control:i}=Rr(),o={"storage.file.uploaded":"Workflow will be triggered when a new file is uploaded to the boltic storage.","storage.file.updated":"The content or metadata of an existing file is updated.","storage.file.deleted":"A file has been permanently deleted from the storage.","storage.file.public":"A file has been made publicly accessible.","storage.file.private":"A file's public access has been revoked, making it private.","storage.folder.created":"Workflow will be triggered when a new folder is created in the boltic storage.","storage.folder.deleted":"A folder has been permanently deleted from the storage."},s=[...mX.Folder.map(a=>({title:"Folder "+a.name,value:a.value})),...mX.File.map(a=>({title:"File "+a.name,value:a.value}))];return d.jsx(En,{children:d.jsx(Yt,{name:"properties.events",control:i,meta:{options:s.map(a=>({...a,description:o[a.value]})),displayName:"Events",searchFieldPlaceholder:"Search",description:"Select Boltic storage event(s) when you want to trigger workflow",placeholder:"Select Events"},validationRules:{validate:a=>a.length===0?"Events is required":!0},multiple:!0,renderFieldValue:a=>Array.isArray(a)?a.map(l=>l?.value):[],handleChange:a=>{n(a?.field,a?.value?.map(l=>l.value?l:{value:l}))},viewOnly:r,getSelectedValue:a=>Array.isArray(a)?a?.map(l=>s.find(u=>u.value===l))?.filter(l=>l?.title):[],required:!0})})}),v6e=_.forwardRef((e,t)=>{const r=E.useTheme(),{setValue:n,control:i,watch:o}=Rr(),s=o("properties"),a={folder_name:""},l={file_content:"",file_name:"",folder_path:"",overwrite:!1,is_public:!1,is_public_permanent:!1},u={file_paths:"",ttl_seconds:""},c={file_path:""},f={folder_path:"",page_size:"",next_page_token:""},{id:p,isLoop:h=!1,viewOnly:A=!1,type:g}=e,m=y=>T=>{if(s?.event==="upload_file"){if(y==="file_name"){if(T?.trim()==="")return"File name is required";if(T?.trim()?.includes("/"))return"'/' is not allowed in file name."}return y==="file_content"&&T?.trim()===""?"File content is required":y==="expire_in"&&(T<1||T>10080)?"Expiry values between 1 to 10080 are accepted.":!0}else{if(["delete_file","make_file_public","make_file_private"].includes(s?.event))return y==="file_paths"&&T?.trim()===""?"File path is required":!0;if(s?.event==="download_file")return y==="file_path"&&T?.trim()===""?"File path is required":!0;if(s?.event==="create_folder"){if(T?.trim()==="")return"Folder name can not be empty";const v=/^[A-Za-z0-9 _-]*$/,C=/{{[^{}]+}}/g,x=T.replace(C,"");if(!Vue(T)&&!v.test(x))return"Folder name should not contain special characters [!@#$%^&*()+{}[]:;<>,.?~/]."}}return!0},O=()=>({create_folder:[{required:!0,type:"text",label:"Folder Name",fieldName:"folder_name",placeholder:""}],upload_file:[{required:!0,type:"text",label:"File Content",fieldName:"file_content",placeholder:""},{required:!0,type:"text",label:"File Name",fieldName:"file_name",placeholder:"filename.csv"},{required:!1,type:"text",label:"Folder Path",fieldName:"folder_path",placeholder:"path/to/folder"},{required:!1,type:"checkbox",label:"Overwrite existing file with same name",fieldName:"overwrite",placeholder:""},{required:!1,type:"checkbox",label:"Generate Shareable Link",fieldName:"is_public",placeholder:""},{required:!1,type:"checkbox",label:"Make file public",fieldName:"is_public_permanent",placeholder:""},{required:!1,type:"number",label:"Expires in",fieldName:"expire_in",placeholder:"Enter minute(s)",helperText:"Default is 60min"}],download_file:[{required:!0,type:"text",label:"File Path",fieldName:"file_path",placeholder:"folder/file.csv",description:"Path of the file to download. The workflow output returns Base64 file content."}],delete_file:[{required:!0,type:"text",label:"File Path(s)",fieldName:"file_paths",placeholder:"file.csv or folder/file.csv"}],make_file_public:[{required:!0,type:"text",label:"File Path(s)",fieldName:"file_paths",placeholder:"file.csv or folder/file.csv"},{required:!1,type:"number",label:"Cache TTL seconds",fieldName:"ttl_seconds",placeholder:"300"}],make_file_private:[{required:!0,type:"text",label:"File Path(s)",fieldName:"file_paths",placeholder:"file.csv or folder/file.csv"}],list_files:[{required:!1,type:"text",label:"Folder Path or File Prefix",fieldName:"folder_path",placeholder:"reports/ or report.csv",description:"Use a trailing slash to list a folder (for example, reports/). Enter a file name or prefix to search files. Leave blank for root."},{required:!1,type:"number",label:"Page Size",fieldName:"page_size",placeholder:"100"},{required:!1,type:"text",label:"Next Page Token",fieldName:"next_page_token",placeholder:"{{listFiles1.files.next_page_token}}",description:"Leave blank for the first page. To fetch the next page, pass next_page_token from the previous List Files/Folders result."}]}[s.event]||[]).map(({label:v,fieldName:C,type:x,required:b,placeholder:w,description:R})=>{if(x==="text")return d.jsx(kr,{name:`properties.${s.event}.${C}`,control:i,meta:{displayName:v,description:R||_n(g,C),placeholder:w},validationRules:{validate:m(C)},editorId:`${x}-bs-activity-${C}`,id:p,required:b,isLoop:h,viewOnly:A,showSuggestions:!0},C);if(x=="number"&&(s?.event!=="upload_file"||s?.upload_file?.is_public))return d.jsx(kr,{name:`properties.${s.event}.${C}`,control:i,meta:{displayName:v,description:_n(g,C),placeholder:w},validationRules:{validate:m(C)},editorId:`${x}-bs-activity-${C}`,id:p,fieldType:"number",required:b,isLoop:h,viewOnly:A,showSuggestions:!0},C);if(x==="checkbox")return d.jsx(E.Box,{sx:{width:"100%"},children:d.jsx(pr,{name:`properties.upload_file.${C}`,control:i,rules:{validate:m(C)},render:({field:{value:I,...P},fieldState:{error:k}})=>d.jsxs(E.FormGroup,{children:[d.jsx(E.FormControlLabel,{control:d.jsx(E.Checkbox,{...P,icon:d.jsx(Ue,{src:"ic_unchecked",width:16,height:16,sx:{path:{fill:r.palette.common.white}}}),checkedIcon:d.jsx(Ue,{src:"ic_checked",width:16,height:16}),sx:{p:0,"& .MuiSvgIcon-root":{fontSize:N=>N.typography.xlMedium.fontSize}},readOnly:A,checked:I}),label:v}),k?.message&&d.jsx(E.FormHelperText,{children:k.message})]})})},C)});return d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event",control:i,meta:{options:C4,displayName:"Event",searchFieldPlaceholder:"Search",description:"Select a event",placeholder:"Select a event"},validationRules:{required:"Event is required"},viewOnly:A,id:"event",handleChange:y=>{const{value:T}=y;T=="create_folder"?n("properties",{...s,create_folder:a,event:T}):T==="upload_file"?n("properties",{...s,upload_file:l,event:T}):T==="download_file"?n("properties",{...s,download_file:c,event:T}):T==="list_files"?n("properties",{...s,list_files:f,event:T}):n("properties",{...s,[T]:u,event:T})},renderValueUi:y=>{const T=C4.find(v=>v.value===y);return T?T.title:""}})}),O(),!h&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:A,type:g})})]})})}),jP=({type:e="",name:t,title:r,options:n,required:i,loadDataFromApi:o,loadingState:s,show:a=!1,secretType:l="",onFocus:u,TESSERACT_MAIN_URL:c="",FRONTEND_URL:f="",ENTITY_ID:p="",onTextInputChange:h,onAddButtonClick:A,buttonName:g="",viewOnly:m=!1,validationRules:O=null,control:y,handleChange:T=null,...v})=>{const[C,x]=_.useState(!1);return _.useEffect(()=>{x(!!s)},[s]),d.jsx(Yt,{required:i,name:t,control:y,renderFieldValue:b=>Array.isArray(b)?b?.length>0&&b[0]&&n.some(w=>w.id===b[0]?.id)?b[0]?.id:"":n.some(w=>w.value===b)?b:"",meta:{options:yn(n),displayProps:{loading:C},displayName:r,TESSERACT_MAIN_URL:c,FRONTEND_URL:f,ENTITY_ID:p,addNewButtonText:g,searchFieldPlaceholder:"Search",authType:l,description:_n(e,t),handleSearchOptions:b=>{h&&h(x,b)},htmlProps:{showAddNew:a,onClickAddNew:A},showSearchOnLoad:!0,placeholder:`Select ${r?.toLowerCase()}`},validationRules:O,viewOnly:m,id:t,onOpen:()=>{o&&(x(!0),o(x,""))},onFocus:u,handleChange:T,...v})},T6e=_.forwardRef((e,t)=>{const r=E.useTheme(),[n,i]=_.useState(!1),[o,s]=_.useState(!1),[a,l]=_.useState([]),[u,c]=_.useState([]),[f,p]=_.useState([]),[h,A]=_.useState([]),[g,m]=_.useState(!1),[O,y]=_.useState(!1),T=ct.useDispatch(),{ATHENA_MAIN_URL:v,FRONTEND_URL:C,ENTITY_ID:x,viewOnly:b=!1}=e,{control:w,watch:R,setValue:I,getValues:P}=Rr(),k=R("properties"),[N,L,M]=R(["properties.field","properties.events","properties.table"]),B=(D=null,$=null,U=null,Y=null)=>{const z=P("properties.database")||"";let W=(Y!==null?Y:h).find(ae=>ae.id===z);if(!W&&z&&(W={id:z,resource_id:"boltic"}),!z||!W){U&&U(!1);return}const q=Xt(v,`/list?db_id=${z}`),Z=[{field:"name",operator:"ILIKE",values:[""]},{field:"resource_id",operator:"=",values:[W.resource_id||"boltic"]},{field:"db_id",operator:"=",values:[z]}],te={data:{page:{page_no:1,page_size:999},filters:Z,sort:[{field:"created_at",direction:"desc"}]}};if(D&&Array.isArray(D)){const ae=D.find(ne=>ne.field==="name");if(ae){te.data.filters[0]=ae;const ne=D.filter(ue=>!["name","resource_id","db_id"].includes(ue.field));te.data.filters.push(...ne)}}zt.post(q,te).then(ae=>{if(l(ae?.data?.data||[]),$){$=ae?.data?.data?.filter(Te=>Te?.id===$);const ne=R("properties"),{payload:ue,...Oe}=ne||{};I("properties",{...Oe,table:$})}}).catch(ae=>{sr(ae,T)}).finally(()=>{U&&U(!1)})},H=async()=>{if(!v){m(!1);return}m(!0);const D=Xt(v,"/connectors/list");zt.post(D,{data:{page:{page_no:1,page_size:999},filters:[],sort:[]}}).then($=>{m(!1);const U=[{id:"boltic",name:"Boltic Cloud"},...$?.data?.data||[]];p(U);const z=R("properties")?.connector;if(!z&&U.length>0){const Q=U[0].id;I("properties.connector",Q),j(Q)}else z&&j(z)}).catch($=>{sr($,T),m(!1)})},j=async D=>{if(!D)return[];y(!0);try{const $={page:{page_no:1,page_size:1e3},filters:[{field:"status",operator:"=",values:["ACTIVE"]}],sort:[]},U=`${v}/databases/list?connector_id=${D}`,z=(await zt.post(U,{data:$}))?.data?.data||[];A(z);const W=R("properties")?.database;if(!W&&z.length>0){const q=z[0].id;I("properties.database",q),setTimeout(()=>{B()},100)}else W&&setTimeout(()=>{B(null,null,null,z)},100);return z}catch($){return sr($,T),[]}finally{y(!1)}},X=()=>{i(!0);const D=P("properties.database")||"",$=P("properties.connector")||"boltic";let U=h.find(W=>W.id===D);!U&&D&&(U={id:D,resource_id:"boltic"});const Y=U?.resource_id||"boltic",z={name:"Workflow Table",is_ai_generated_schema:!0},Q={};D&&(Q.db_id=D),Q.resource_id=Y,zt.post(v,{data:z,params:Q}).then(W=>{W?.data?.data?.id&&(D==""&&j($),B(null,W?.data?.data?.id)),T({type:Qr,payload:{open:!0,title:"Table created successfully",type:"success"}}),i(!1);const q=W?.data?.data?.id,Z=new URLSearchParams({connector:$,database:D,resource:Y}).toString(),te=`${C}/accounts/${x}/tables/create/${q}?${Z}`;window.open(te)}).catch(W=>{i(!1),T({type:Qr,payload:{open:!0,title:"Table creation failed",type:"error"}}),sr(W,T)})};_.useEffect(()=>{N?.length>0&&M.length>0&&V(M[0]?.id)},[]),_.useEffect(()=>{L?.some($=>$?.value==="table.button.triggered"||$?.value==="table.field.updated")&&M?.length>0&&V(M[0]?.id)},[JSON.stringify(L),JSON.stringify(M)]);const F=[...Due.Record.map(D=>({title:D.name,value:D.value,description:D.description}))],V=async D=>{const $=k?.database||"";if(!$){s(!1);return}s(!0);const U=Xt(v,`/${D}/fields/list?db_id=${$}`);try{let Y=await zt.post(U,{data:{page:{page_no:1,page_size:999},filters:[],sort:[{field:"name",direction:"desc"}]}});Y=Y.data?.data?Y.data.data:[];const z=Y.filter(Q=>!["created_at","updated_at","id","created_by","updated_by"].includes(Q.name));c(z),s(!1)}catch(Y){sr(Y,T)}finally{s(!1)}},G=_a((D,$)=>{B(D=D,null,$)},300);return _.useEffect(()=>{H()},[]),_.useEffect(()=>{if(N===null){const{field:D,...$}=R("properties");I("properties",$)}},[N]),d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.connector",control:w,meta:{options:(f||[]).map(D=>({value:D.id,title:D.name||D.id})),displayName:"Connector",searchFieldPlaceholder:"Search Connector",placeholder:"Select Connector",isLoading:g},validationRules:{required:"Connector is required"},viewOnly:b,fullWidth:!0,id:"connector",required:!0,handleChange:async D=>{const{value:$}=D;I("properties.connector",$),I("properties.database",""),I("properties.table",[]),I("properties.events",[]),I("properties.field",null),I("properties.button",[]),A([]),l([]),c([]),$&&await j($)}})})}),k?.connector&&d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.database",control:w,meta:{options:(h||[]).map(D=>({value:D.id,title:D.db_name||D.id,...k?.connector&&k.connector!=="boltic"&&D?.resource_name?{description:D.resource_name}:{}})),displayName:"Database",searchFieldPlaceholder:"Search Database",placeholder:"Select Database",isLoading:O},viewOnly:b,fullWidth:!0,id:"database",required:!0,handleChange:D=>{const{value:$}=D;I("properties.database",$),I("properties.table",[]),I("properties.events",[]),I("properties.field",null),I("properties.button",[]),l([]),c([]),$&&B()}})}),!O&&h?.length===0&&d.jsx(E.Typography,{variant:"caption",sx:{mt:.5,display:"block",color:"text.secondary"},children:"No database is present, please create your first table to create a database."})]}),(k?.database||k?.database=="")&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(jP,{type:"bolticTable",viewOnly:b,title:"Table",required:!0,onTextInputChange:async(D,$)=>{D(!0),G([{field:"name",operator:"ILIKE",values:[$]}],D)},onAddButtonClick:X,buttonName:"Create New Table",options:a,loadingState:n,loadDataFromApi:async D=>{a?.length?D(!1):B(null,null,D)},handleChange:D=>{const $=a?.find(U=>U?.id===D?.value)||null;I("properties.table",[$],{shouldValidate:!0}),(k.events||[]).map(U=>U?.value).filter(Boolean).indexOf("table.button.triggered")!==-1&&V($?.id)},name:"properties.table",control:w,validationRules:{validate:D=>!D||!Array.isArray(D)||D.length===0?"Table is required":!0},show:!0})})}),!Et(k.table)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.events",control:w,multiple:!0,renderFieldValue:D=>D?.map($=>$?.value),meta:{options:F.map(D=>{const $=(k.events||[]).map(Q=>Q?.value).filter(Boolean),U=$.includes("table.field.updated"),Y=$.includes("table.record.updated"),z=U&&D.value==="table.record.updated"||Y&&D.value==="table.field.updated";return{...D,disabled:z}}),displayName:"Events",searchFieldPlaceholder:"Search",description:"Select Boltic table event(s) when you want to trigger the workflow.",placeholder:"Select Events"},validationRules:{validate:{required:D=>!D||D.length===0?"Events is required":!0}},viewOnly:b,id:"events",handleChange:D=>{const $=[...D.value],U=$.pop();$.includes(U)?I("properties.events",$.filter(z=>z!==U).map(z=>({value:z})),{shouldValidate:!0}):I("properties.events",[...$.map(z=>({value:z})),{value:U}],{shouldValidate:!0})},renderValueUi:D=>D?.length>0&&D?.[0]?d.jsx(E.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:D.map($=>F.find(U=>U.value===$)).filter($=>$?.title).map($=>d.jsx(E.Chip,{label:$.title},$.title))}):d.jsx(E.Typography,{sx:{color:"neutral.solid.bg",fontSize:"14px",":hover":{opacity:.7}},children:"Select Events"}),renderOption:(D,$)=>d.jsxs(E.MenuItem,{value:$.value,disabled:$.disabled,sx:{p:"8px !important",mx:1,height:"auto","&.Mui-selected":{"& .MuiTypography-root":{color:U=>U.palette.primary.main}}},children:[d.jsx(E.Checkbox,{sx:{p:0},icon:d.jsx(Ue,{src:"ic_unchecked",width:16,height:16,sx:{path:{fill:r.palette.common.white}}}),checkedIcon:d.jsx(Ue,{src:"ic_checked",width:16,height:16}),checked:!!(Array.isArray(k.events)&&k.events.find(U=>$.value===U.value))}),d.jsx(E.ListItemText,{primary:$.title,secondary:$.description})]},$.value)})}),L?.map(D=>D?.value).filter(Boolean).indexOf("table.button.triggered")!==-1&&M?.[0]&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.button",control:w,renderFieldValue:D=>D?.map($=>$?.value),meta:{options:yn(u),displayProps:{loading:o},displayName:"Trigger button",value:"",searchFieldPlaceholder:"Search",renderFieldValue:D=>u?.find($=>$?.id===D?.[0]?.id)||null,placeholder:"Select Trigger Button"},renderValueUi:D=>d.jsx(E.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:D?.map($=>yn(u).find(U=>U.value===$)).filter($=>$?.title).map($=>d.jsx(E.Chip,{label:$.title},$.title))}),handleChange:D=>{const{field:$,value:U}=D;Et(U)||I($,[U],{shouldValidate:!0})},validationRules:{required:"Button is required",validate:D=>L?.some($=>$?.value==="table.button.triggered")&&(!D||D.length==0)?"Trigger button is required":!0},viewOnly:b,id:"button",renderOption:(D,$)=>d.jsxs(E.MenuItem,{value:$.value,disabled:$.disabled,sx:{p:"8px !important",mx:1,height:"auto","&.Mui-selected":{"& .MuiTypography-root":{color:U=>U.palette.primary.main}}},children:[d.jsx(E.Checkbox,{sx:{p:0},checked:!!(Array.isArray(k.button)&&k.events.find(U=>$.value===U.value))}),d.jsx(E.ListItemText,{primary:$.title,secondary:$.description})]},$.value)})}),L?.map(D=>D?.value).filter(Boolean).indexOf("table.field.updated")!==-1&&M?.[0]&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.field",control:w,meta:{options:yn(u),displayName:"Trigger field",searchFieldPlaceholder:"Search for authentication type",displayProps:{loading:o},description:"Choose a field to trigger the workflow when it changes.",placeholder:"Select Trigger Field"},renderFieldValue:D=>D?.length>0&&u?.some($=>$?.id===D[0]?.id)?D[0]?.id:"",validationRules:{validate:D=>L?.some($=>$?.value==="table.field.updated")&&(!D||D.length==0)?"Field is required":!0},viewOnly:b,id:"field",required:!0,handleChange:D=>{const{field:$,value:U}=D,Y=u?.find(z=>z?.id===U)||null;Et(Y)?I($,null,{shouldValidate:!0}):I($,[Y],{shouldValidate:!0})}})})})]})})});var ET={exports:{}},S6e=ET.exports,gX;function x6e(){return gX||(gX=1,(function(e,t){(function(r,n){e.exports=n()})(S6e,(function(){var r="week",n="year";return function(i,o,s){var a=o.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=s(this).startOf(n).add(1,n).date(u),f=s(this).endOf(r);if(c.isBefore(f))return 1}var p=s(this).startOf(n).date(u).startOf(r).subtract(1,"millisecond"),h=this.diff(p,r,!0);return h<0?s(this).startOf("week").week():Math.ceil(h)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(ET)),ET.exports}var b6e=x6e();const C6e=Un(b6e);var OT={exports:{}},_6e=OT.exports,EX;function w6e(){return EX||(EX=1,(function(e,t){(function(r,n){e.exports=n()})(_6e,(function(){var r={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"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,o=/\d\d/,s=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(m){return(m=+m)+(m>68?1900:2e3)},c=function(m){return function(O){this[m]=+O}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(O){if(!O||O==="Z")return 0;var y=O.match(/([+-]|\d\d)/g),T=60*y[1]+(+y[2]||0);return T===0?0:y[0]==="+"?-T:T})(m)}],p=function(m){var O=l[m];return O&&(O.indexOf?O:O.s.concat(O.f))},h=function(m,O){var y,T=l.meridiem;if(T){for(var v=1;v<=24;v+=1)if(m.indexOf(T(v,0,O))>-1){y=v>12;break}}else y=m===(O?"pm":"PM");return y},A={A:[a,function(m){this.afternoon=h(m,!1)}],a:[a,function(m){this.afternoon=h(m,!0)}],Q:[i,function(m){this.month=3*(m-1)+1}],S:[i,function(m){this.milliseconds=100*+m}],SS:[o,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[s,c("seconds")],ss:[s,c("seconds")],m:[s,c("minutes")],mm:[s,c("minutes")],H:[s,c("hours")],h:[s,c("hours")],HH:[s,c("hours")],hh:[s,c("hours")],D:[s,c("day")],DD:[o,c("day")],Do:[a,function(m){var O=l.ordinal,y=m.match(/\d+/);if(this.day=y[0],O)for(var T=1;T<=31;T+=1)O(T).replace(/\[|\]/g,"")===m&&(this.day=T)}],w:[s,c("week")],ww:[o,c("week")],M:[s,c("month")],MM:[o,c("month")],MMM:[a,function(m){var O=p("months"),y=(p("monthsShort")||O.map((function(T){return T.slice(0,3)}))).indexOf(m)+1;if(y<1)throw new Error;this.month=y%12||y}],MMMM:[a,function(m){var O=p("months").indexOf(m)+1;if(O<1)throw new Error;this.month=O%12||O}],Y:[/[+-]?\d+/,c("year")],YY:[o,function(m){this.year=u(m)}],YYYY:[/\d{4}/,c("year")],Z:f,ZZ:f};function g(m){var O,y;O=m,y=l&&l.formats;for(var T=(m=O.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(I,P,k){var N=k&&k.toUpperCase();return P||y[k]||r[k]||y[N].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(L,M,B){return M||B.slice(1)}))}))).match(n),v=T.length,C=0;C<v;C+=1){var x=T[C],b=A[x],w=b&&b[0],R=b&&b[1];T[C]=R?{regex:w,parser:R}:x.replace(/^\[|\]$/g,"")}return function(I){for(var P={},k=0,N=0;k<v;k+=1){var L=T[k];if(typeof L=="string")N+=L.length;else{var M=L.regex,B=L.parser,H=I.slice(N),j=M.exec(H)[0];B.call(P,j),I=I.replace(j,"")}}return(function(X){var F=X.afternoon;if(F!==void 0){var V=X.hours;F?V<12&&(X.hours+=12):V===12&&(X.hours=0),delete X.afternoon}})(P),P}}return function(m,O,y){y.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(u=m.parseTwoDigitYear);var T=O.prototype,v=T.parse;T.parse=function(C){var x=C.date,b=C.utc,w=C.args;this.$u=b;var R=w[1];if(typeof R=="string"){var I=w[2]===!0,P=w[3]===!0,k=I||P,N=w[2];P&&(N=w[2]),l=this.$locale(),!I&&N&&(l=y.Ls[N]),this.$d=(function(H,j,X,F){try{if(["x","X"].indexOf(j)>-1)return new Date((j==="X"?1e3:1)*H);var V=g(j)(H),G=V.year,D=V.month,$=V.day,U=V.hours,Y=V.minutes,z=V.seconds,Q=V.milliseconds,W=V.zone,q=V.week,Z=new Date,te=$||(G||D?1:Z.getDate()),ae=G||Z.getFullYear(),ne=0;G&&!D||(ne=D>0?D-1:Z.getMonth());var ue,Oe=U||0,Te=Y||0,se=z||0,ie=Q||0;return W?new Date(Date.UTC(ae,ne,te,Oe,Te,se,ie+60*W.offset*1e3)):X?new Date(Date.UTC(ae,ne,te,Oe,Te,se,ie)):(ue=new Date(ae,ne,te,Oe,Te,se,ie),q&&(ue=F(ue).week(q).toDate()),ue)}catch{return new Date("")}})(x,R,b,y),this.init(),N&&N!==!0&&(this.$L=this.locale(N).$L),k&&x!=this.format(R)&&(this.$d=new Date("")),l={}}else if(R instanceof Array)for(var L=R.length,M=1;M<=L;M+=1){w[1]=R[M-1];var B=y.apply(this,w);if(B.isValid()){this.$d=B.$d,this.$L=B.$L,this.init();break}M===L&&(this.$d=new Date(""))}else v.call(this,C)}}}))})(OT)),OT.exports}var I6e=w6e();const D6e=Un(I6e);var yT={exports:{}},R6e=yT.exports,OX;function P6e(){return OX||(OX=1,(function(e,t){(function(r,n){e.exports=n()})(R6e,(function(){var r={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"};return function(n,i,o){var s=i.prototype,a=s.format;o.en.formats=r,s.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=(function(f,p){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(h,A,g){var m=g&&g.toUpperCase();return A||p[g]||r[g]||p[m].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(O,y,T){return y||T.slice(1)}))}))})(l,u===void 0?{}:u);return a.call(this,c)}}}))})(yT)),yT.exports}var N6e=P6e();const L6e=Un(N6e);var vT={exports:{}},k6e=vT.exports,yX;function F6e(){return yX||(yX=1,(function(e,t){(function(r,n){e.exports=n()})(k6e,(function(){return function(r,n,i){n.prototype.isBetween=function(o,s,a,l){var u=i(o),c=i(s),f=(l=l||"()")[0]==="(",p=l[1]===")";return(f?this.isAfter(u,a):!this.isBefore(u,a))&&(p?this.isBefore(c,a):!this.isAfter(c,a))||(f?this.isBefore(u,a):!this.isAfter(u,a))&&(p?this.isAfter(c,a):!this.isBefore(c,a))}}}))})(vT)),vT.exports}var M6e=F6e();const B6e=Un(M6e);var TT={exports:{}},j6e=TT.exports,vX;function $6e(){return vX||(vX=1,(function(e,t){(function(r,n){e.exports=n()})(j6e,(function(){return function(r,n){var i=n.prototype,o=i.format;i.format=function(s){var a=this,l=this.$locale();if(!this.isValid())return o.bind(this)(s);var u=this.$utils(),c=(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(f){switch(f){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 u.s(a.week(),f==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),f==="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 f}}));return o.bind(this)(c)}}}))})(TT)),TT.exports}var U6e=$6e();const H6e=Un(U6e),TX=new Set;function SX(e,t="warning"){if(process.env.NODE_ENV==="production")return;const r=Array.isArray(e)?e.join(`
|
|
436
436
|
`):e;TX.has(r)||TX.add(r)}Tr.extend(L6e),Tr.extend(C6e),Tr.extend(B6e),Tr.extend(H6e);const V6e={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},G6e={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime:"LT",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime:"L LT",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},$P=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join(`
|
|
437
437
|
`),xX=["Missing timezone plugin","To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join(`
|
|
438
438
|
`),W6e=(e,t)=>t?(...r)=>e(...r).locale(t):e;class Zl{constructor({locale:t,formats:r}={}){this.isMUIAdapter=!0,this.isTimezoneCompatible=!0,this.lib="dayjs",this.dayjs=void 0,this.locale=void 0,this.formats=void 0,this.escapedCharacters={start:"[",end:"]"},this.formatTokenMap=V6e,this.setLocaleToValue=n=>{const i=this.getCurrentLocaleCode();return i===n.locale()?n:n.locale(i)},this.hasUTCPlugin=()=>typeof Tr.utc<"u",this.hasTimezonePlugin=()=>typeof Tr.tz<"u",this.isSame=(n,i,o)=>{const s=this.setTimezone(i,this.getTimezone(n));return n.format(o)===s.format(o)},this.cleanTimezone=n=>{switch(n){case"default":return;case"system":return Tr.tz.guess();default:return n}},this.createSystemDate=n=>{if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const i=Tr.tz.guess();return i!=="UTC"?Tr.tz(n,i):Tr(n)}return Tr(n)},this.createUTCDate=n=>{if(!this.hasUTCPlugin())throw new Error($P);return Tr.utc(n)},this.createTZDate=(n,i)=>{if(!this.hasUTCPlugin())throw new Error($P);if(!this.hasTimezonePlugin())throw new Error(xX);const o=n!==void 0&&!n.endsWith("Z");return Tr(n).tz(this.cleanTimezone(i),o)},this.getLocaleFormats=()=>{const n=Tr.Ls,i=this.locale||"en";let o=n[i];return o===void 0&&(process.env.NODE_ENV!=="production"&&SX(["MUI X: Your locale has not been found.","Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.","Or you forget to import the locale from 'dayjs/locale/{localeUsed}'","fallback on English locale."]),o=n.en),o.formats},this.adjustOffset=n=>{if(!this.hasTimezonePlugin())return n;const i=this.getTimezone(n);if(i!=="UTC"){const o=n.tz(this.cleanTimezone(i),!0);if(o.$offset===(n.$offset??0))return n;n.$offset=o.$offset}return n},this.date=(n,i="default")=>{if(n===null)return null;let o;return i==="UTC"?o=this.createUTCDate(n):i==="system"||i==="default"&&!this.hasTimezonePlugin()?o=this.createSystemDate(n):o=this.createTZDate(n,i),this.locale===void 0?o:o.locale(this.locale)},this.getInvalidDate=()=>Tr(new Date("Invalid date")),this.getTimezone=n=>{if(this.hasTimezonePlugin()){const i=n.$x?.$timezone;if(i)return i}return this.hasUTCPlugin()&&n.isUTC()?"UTC":"system"},this.setTimezone=(n,i)=>{if(this.getTimezone(n)===i)return n;if(i==="UTC"){if(!this.hasUTCPlugin())throw new Error($P);return n.utc()}if(i==="system")return n.local();if(!this.hasTimezonePlugin()){if(i==="default")return n;throw new Error(xX)}return Tr.tz(n,this.cleanTimezone(i))},this.toJsDate=n=>n.toDate(),this.parse=(n,i)=>n===""?null:this.dayjs(n,i,this.locale,!0),this.getCurrentLocaleCode=()=>this.locale||"en",this.is12HourCycleInCurrentLocale=()=>/A|a/.test(this.getLocaleFormats().LT||""),this.expandFormat=n=>{const i=this.getLocaleFormats(),o=s=>s.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(a,l,u)=>l||u.slice(1));return n.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(s,a,l)=>{const u=l&&l.toUpperCase();return a||i[l]||o(i[u])})},this.isValid=n=>n==null?!1:n.isValid(),this.format=(n,i)=>this.formatByString(n,this.formats[i]),this.formatByString=(n,i)=>this.dayjs(n).format(i),this.formatNumber=n=>n,this.isEqual=(n,i)=>n===null&&i===null?!0:n===null||i===null?!1:n.toDate().getTime()===i.toDate().getTime(),this.isSameYear=(n,i)=>this.isSame(n,i,"YYYY"),this.isSameMonth=(n,i)=>this.isSame(n,i,"YYYY-MM"),this.isSameDay=(n,i)=>this.isSame(n,i,"YYYY-MM-DD"),this.isSameHour=(n,i)=>n.isSame(i,"hour"),this.isAfter=(n,i)=>n>i,this.isAfterYear=(n,i)=>this.hasUTCPlugin()?!this.isSameYear(n,i)&&n.utc()>i.utc():n.isAfter(i,"year"),this.isAfterDay=(n,i)=>this.hasUTCPlugin()?!this.isSameDay(n,i)&&n.utc()>i.utc():n.isAfter(i,"day"),this.isBefore=(n,i)=>n<i,this.isBeforeYear=(n,i)=>this.hasUTCPlugin()?!this.isSameYear(n,i)&&n.utc()<i.utc():n.isBefore(i,"year"),this.isBeforeDay=(n,i)=>this.hasUTCPlugin()?!this.isSameDay(n,i)&&n.utc()<i.utc():n.isBefore(i,"day"),this.isWithinRange=(n,[i,o])=>n>=i&&n<=o,this.startOfYear=n=>this.adjustOffset(n.startOf("year")),this.startOfMonth=n=>this.adjustOffset(n.startOf("month")),this.startOfWeek=n=>this.adjustOffset(this.setLocaleToValue(n).startOf("week")),this.startOfDay=n=>this.adjustOffset(n.startOf("day")),this.endOfYear=n=>this.adjustOffset(n.endOf("year")),this.endOfMonth=n=>this.adjustOffset(n.endOf("month")),this.endOfWeek=n=>this.adjustOffset(this.setLocaleToValue(n).endOf("week")),this.endOfDay=n=>this.adjustOffset(n.endOf("day")),this.addYears=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"year"):n.add(i,"year")),this.addMonths=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"month"):n.add(i,"month")),this.addWeeks=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"week"):n.add(i,"week")),this.addDays=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"day"):n.add(i,"day")),this.addHours=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"hour"):n.add(i,"hour")),this.addMinutes=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"minute"):n.add(i,"minute")),this.addSeconds=(n,i)=>this.adjustOffset(i<0?n.subtract(Math.abs(i),"second"):n.add(i,"second")),this.getYear=n=>n.year(),this.getMonth=n=>n.month(),this.getDate=n=>n.date(),this.getHours=n=>n.hour(),this.getMinutes=n=>n.minute(),this.getSeconds=n=>n.second(),this.getMilliseconds=n=>n.millisecond(),this.setYear=(n,i)=>this.adjustOffset(n.set("year",i)),this.setMonth=(n,i)=>this.adjustOffset(n.set("month",i)),this.setDate=(n,i)=>this.adjustOffset(n.set("date",i)),this.setHours=(n,i)=>this.adjustOffset(n.set("hour",i)),this.setMinutes=(n,i)=>this.adjustOffset(n.set("minute",i)),this.setSeconds=(n,i)=>this.adjustOffset(n.set("second",i)),this.setMilliseconds=(n,i)=>this.adjustOffset(n.set("millisecond",i)),this.getDaysInMonth=n=>n.daysInMonth(),this.getWeekArray=n=>{const i=this.startOfWeek(this.startOfMonth(n)),o=this.endOfWeek(this.endOfMonth(n));let s=0,a=i;const l=[];for(;a<o;){const u=Math.floor(s/7);l[u]=l[u]||[],l[u].push(a),a=this.addDays(a,1),s+=1}return l},this.getWeekNumber=n=>n.week(),this.getYearRange=([n,i])=>{const o=this.startOfYear(n),s=this.endOfYear(i),a=[];let l=o;for(;this.isBefore(l,s);)a.push(l),l=this.addYears(l,1);return a},this.dayjs=W6e(Tr,t),this.locale=t,this.formats=ce({},G6e,r),Tr.extend(D6e)}getDayOfWeek(t){return t.day()+1}}const UP=e=>!e.field||typeof e.field=="object"&&Object.keys(e.field).length===0?"Filter name cannot be empty.":e.type?e.value?!0:"Lookup Value cannot be empty.":"Operator cannot be empty.",Q6e=e=>{const t=String(e||"").toLowerCase().trim();return t?t==="smallint"||t==="integer"||t==="bigint"||t==="real"||t==="double precision"||t==="numeric"||t==="decimal"||t.startsWith("numeric(")||t.startsWith("decimal(")?"number":t==="boolean"?"checkbox":t.includes("timestamp")||t==="date"||t.startsWith("time")?"date-time":t==="json"||t==="jsonb"?"json":t.endsWith("[]")||t.startsWith("_")?"dropdown":"text":"foreign-key"},ST=e=>{const t=e?.type,r=t==="foreign-key"||e?.is_foreign_key===!0,n=e?.referenced_sql_type||e?.sql_field_type||null;return r?Q6e(n):t},Jd=e=>t=>{const r=ST(e),n=/{{[^{}]+}}/g;let i=!1;if(typeof t=="string"&&n.test(t)&&(i=!0,t=t.replace(n,"")),e.is_nullable===!0&&(t==null||t===void 0))return!0;if((i&&t!==""||!i)&&(e.is_nullable&&t!==""||!e.is_nullable))switch(r){case"text":case"long-text":case"encrypted":if(typeof t!="string")return`${e.name} should be a valid text input.`;if(t.length===0&&!e.is_nullable)return`${e.name} is a required field and cannot be empty.`;break;case"email":{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return`Please provide a valid email address for ${e.name}.`;break}case"date-time":if(t!==""&&isNaN(Date.parse(t)))return`The value for ${e.name} should be a valid date and time format.`;break;case"number":case"currency":if(isNaN(t))return`${e.name} should be a numeric value.`;break;case"phone-number":{if(!/^\+?[0-9\s-]+$/.test(t))return`Please enter a valid phone number for ${e.name}.`;break}case"checkbox":if(typeof t!="boolean")return`${e.name} must be either true or false.`;break;case"dropdown":try{const o=e.selectable_items||[];if(Array.isArray(t)){if(!t.every(s=>o.includes(s)))return`All selected values for ${e.name} must be from the allowed options: ${o.join(", ")}.`}else if(typeof t=="string"){if(!o.includes(t))return`The value for ${e.name} must be one of the allowed options: ${o.join(", ")}.`}else return`${e.name} has an invalid input type. Please choose from the allowed options.`}catch{return`There seems to be an issue with the configuration of ${e.name}.`}break;case"link":{if(!/^((https?|ftp):\/\/)?(localhost|(\d{1,3}(\.\d{1,3}){3})|(([a-zA-Z\d-]+\.)+[a-zA-Z]{2,}))(\:\d+)?([\/?#][^\s]*)?$/.test(t))return`Please provide a valid URL for ${e.name}.`;break}case"json":try{typeof t=="string"&&JSON.parse(t)}catch{return`The value for ${e.name} should be a valid JSON string.`}break;default:return!0}return!0},xT=e=>{switch(e){case"text":return"Enter text";case"email":return"Enter email address";case"link":return"Enter URL";case"phone-number":return"Enter phone number";case"date-time":return"Select date and time";case"long-text":return"Enter long text";case"json":return"Enter JSON data";case"number":return"Enter number";case"currency":return"Enter amount";case"encrypted":return"Enter text (will be encrypted)";case"foreign-key":return"Enter referenced value";default:return"Enter value"}},z6e=({label:e="",required:t=!1,infoMsg:r="",helperText:n="",nodeId:i="",onChange:o,value:s,name:a,isLoop:l,...u})=>{const[c,f]=_.useState("Static"),{MCP_INTEGRATION_FORM:p}=aa();_.useEffect(()=>{if(typeof s=="string"&&s.trim().startsWith("{{")){f("Dynamic");return}if(s==null||s===""){f("Static");return}let g=!1;const m=s;if(m&&typeof m=="object")m instanceof Date?g=!isNaN(m.getTime()):"isValid"in m&&typeof m.isValid=="function"&&(g=m.isValid());else if(typeof m=="string"){const O=new Date(m);g=!isNaN(O.getTime())}f(g?"Static":"Dynamic")},[s]);const h=new Date(Date.now()-360*60*60*1e3),A=g=>{if(g==null||g===""||typeof g=="string"&&g.trim().startsWith("{{"))return null;if(g&&typeof g=="object"&&"isValid"in g&&typeof g.isValid=="function")return g.isValid()?g:null;if(typeof g=="string"||g instanceof Date){const m=Tr(g);return m.isValid()?m:null}return null};return d.jsx(E.FormControl,{fullWidth:!0,children:d.jsxs(E.Stack,{children:[e&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-end",children:[d.jsx(gn,{label:e,description:n,required:t}),!p&&d.jsx(E.Stack,{pb:.5,children:d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],selectedTab:c,setSelectedTab:()=>{c==="Static"?(o(""),f("Dynamic")):(o(h),f("Static"))}})})]}),c==="Static"?d.jsx(Qo.DateTimePicker,{slotProps:{textField:{error:!!u?.errorMsg,helperText:u?.errorMsg}},value:A(s),onChange:g=>o(g),...u}):d.jsx(lo,{id:i,language:"plaintext",value:s,isLoop:l,editorId:`${i}-${a}`,showSuggestions:!0,handleChange:g=>{o(g)},name:a,loading:null,...u})]})})},ef=e=>{const{isLoading:t,data:r,name:n,type:i,id:o,label:s,helperTextForDropdown:a,helperTextForTextField:l,control:u,isMultiple:c=!1,onTabChange:f,value:p,eventName:h="",fieldName:A,isLoop:g=!1,viewOnly:m=!1,required:O=!1,refreshData:y,refreshing:T=!1,placeholder:v="",refreshTooltip:C="",handleSearchOptions:x=null,handleChange:b=null,onOpen:w=null,customValidations:R={},virtualized:I=!1,allowCustomInStatic:P=!1}=e,{MCP_INTEGRATION_FORM:k}=aa(),[N,L]=_.useState(p&&!Et(p)&&Gue(p)?"Dynamic":"Static"),M=B=>{L(B),f()};return d.jsx(E.Grid,{item:!0,xs:12,children:N==="Static"&&P?d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Stack,{gap:.25,children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{minHeight:24},children:[d.jsxs(E.Typography,{variant:"smNormal",sx:{color:"text.secondary",display:"flex",alignItems:"center",gap:.25},children:[s,O?"*":""]}),!k&&d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],sx:{"& .MuiButtonBase-root":{px:.5,fontSize:"12px"},"& .MuiButtonBase-root.Mui-selected":{px:.5,fontSize:"12px"}},selectedTab:N,setSelectedTab:B=>M(B)})]}),d.jsx(pr,{name:n,control:u,rules:{...O&&{required:`${s} is required`},...R&&{validate:R}},render:({field:B,fieldState:{error:H}})=>d.jsx(E.Autocomplete,{freeSolo:!0,options:r||[],loading:t,disabled:m,value:(r||[]).find(j=>j.value===B.value)||null,inputValue:B.value===null||B.value===void 0?"":String(B.value),getOptionLabel:j=>typeof j=="string"?j:j?.title||"",isOptionEqualToValue:(j,X)=>j?.value===X?.value,onOpen:()=>{w&&w()},onInputChange:(j,X,F)=>{(F==="input"||F==="clear")&&(B.onChange(X),x&&x(X),b&&b({field:n,value:X}))},onChange:(j,X)=>{const F=typeof X=="string"?X:X?.value??"";B.onChange(F),b&&b({field:n,value:F})},renderInput:j=>d.jsx(E.TextField,{...j,label:"",placeholder:v||`Select or enter ${s}`,helperText:H?.message||_n(i,a),error:!!H,size:"small",sx:{"& .MuiOutlinedInput-root":{minHeight:36}}})})})]})}):N==="Static"?d.jsx(Yt,{virtualized:I,required:O,name:n,control:u,meta:{options:r,displayProps:{loading:t,refreshing:T},displayName:s,searchFieldPlaceholder:"Search",placeholder:v||`Select ${s}`,description:_n(i,a),handleSearchOptions:B=>{x&&x(B)}},validationRules:{...O&&{required:`${s} is required`},...R&&{validate:R}},viewOnly:m,id:o,multiple:c,renderFieldValue:B=>c?Array.isArray(B)?B:[]:r.some(H=>H.value===B)?B:"",getSelectedValue:B=>c?B.map(H=>r.find(j=>j.value===H)).filter(H=>H?.title):null,endItem:!k&&d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],sx:{marginBottom:.5,"& .MuiButtonBase-root":{px:.5,fontSize:"12px"},"& .MuiButtonBase-root.Mui-selected":{px:.5,fontSize:"12px"}},selectedTab:N,setSelectedTab:B=>M(B)}),refreshOptions:y?()=>{y(s)}:null,refreshTooltip:C,handleChange:B=>{b&&b(B)},onOpen:()=>{w&&w()}}):d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(kr,{name:n,control:u,meta:{displayName:s,description:_n(i,l),placeholder:v||`Enter ${s}`,htmlProps:{rightLabel:!k&&d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],sx:{marginBottom:.5,"& .MuiButtonBase-root":{px:.5,fontSize:"12px"},"& .MuiButtonBase-root.Mui-selected":{px:.5,fontSize:"12px"}},selectedTab:N,setSelectedTab:B=>M(B)})}},validationRules:{...O&&{required:`${s} is required`},...R&&{validate:R}},showSuggestions:!0,id:o,fullWidth:!0,editorId:`${i}-${h}-${A}`,isLoop:g,viewOnly:m,required:O,handleChange:B=>{b&&b(B)}})})})})},HP=vc(({control:e,label:t="",required:r=!1,showInfoIcon:n=!1,infoMsg:i="",helperText:o="",nodeId:s="",id:a,name:l,isLoop:u,validationRules:c={},inputProps:f=null,placeholder:p="",showSuggestions:h=!1,onChange:A,...g})=>{const[m,O]=_.useState("Static"),[y,T]=_.useState(!1),{setValue:v,watch:C}=Rr(),{MCP_INTEGRATION_FORM:x}=aa(),b=C(l);return _.useEffect(()=>{y||(typeof b=="string"&&b.trim().startsWith("{{")?O("Dynamic"):O("Static"))},[y,b]),d.jsx(E.FormControl,{fullWidth:!0,children:d.jsxs(E.Stack,{children:[t&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-end",children:[d.jsx(gn,{label:t,description:o,required:r}),!x&&d.jsx(E.Stack,{pb:.5,children:d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],selectedTab:m,setSelectedTab:()=>{v(l,""),m==="Static"?(T(!0),O("Dynamic")):(T(!0),O("Static"))}})})]}),m==="Dynamic"?d.jsx(kr,{control:e,meta:{placeholder:p},validationRules:c,id:a,language:"plaintext",isLoop:u,editorId:`${s}-${l}`,showSuggestions:h,name:l,handleChange:()=>{T(!0)},loading:null,...g}):d.jsx(pr,{name:l,control:e,rules:{...c,valueAsNumber:!0},render:({field:w,fieldState:{error:R}})=>{const{onChange:I,...P}=w;return d.jsx(lo,{...g,...P,value:w.value??"",fullWidth:!0,type:"number",name:l,isLoop:u,inputProps:f||{step:1,min:1},placeholder:p,handleChange:k=>{T(!0);let N;k===""?(I(""),A?.("")):(N=Number(k),isNaN(N)||(I(N),A?.(N)))},error:!!R?.message,errorMsg:R?.message})}})]})})}),X6e=e=>{const t=J=>J?.type==="foreign-key"||!!(J?.reference_table_name&&J?.reference_column_name);function r(J){return jue.filter(K=>K.appliesTo.includes(J)).map(K=>({operator:K.operator,filterName:K.filterName}))}const{watch:n,setValue:i,control:o,getValues:s}=Rr(),a=n("properties"),{FRONTEND_URL:l,ENTITY_ID:u,viewOnly:c=!1,type:f,isLoop:p,id:h}=e,A=location.pathname.split("/");let g="";A.length>=5&&(g=A[2]);const m=E.useTheme(),O=ct.useDispatch(),[y,T]=_.useState([]),[v,C]=_.useState([]),[x,b]=_.useState([]),[w,R]=_.useState(!1),[I,P]=_.useState(!1),[k,N]=_.useState(!1),[L,M]=_.useState([]),[B,H]=_.useState({}),[j,X]=_.useState({}),[F,V]=_.useState([]),[G,D]=_.useState(!1),$=e.ATHENA_MAIN_URL,U=()=>{D(!0);const J=s("properties.database")||"",K=s("properties.connector")||"boltic";let re=x.find(fe=>fe.id===J);!re&&J&&(re={id:J,resource_id:"boltic"});const le=re?.resource_id||"boltic",he={name:"Workflow Table",is_ai_generated_schema:!0},Ae={};J&&(Ae.db_id=J),Ae.resource_id=le,zt.post($,{data:he,params:Ae}).then(fe=>{fe?.data?.data?.id&&(J==""&&ae(K),Y(null,fe.data.data.id)),D(!1),O({type:Qr,payload:{open:!0,title:"Table created successfully",type:"success"}});const Se=fe?.data?.data?.id,ge=new URLSearchParams({connector:K,database:J,resource:le}).toString(),ye=`${l}/accounts/${u}/tables/create/${Se}?${ge}`;i("properties.table",""),i("properties.record_id",""),i("properties.updates",[]),i("properties.filters",[]),window.open(ye)}).catch(fe=>{D(!1),O({type:Qr,payload:{open:!0,title:"Table creation failed",type:"error"}}),sr(fe,O)})};_.useEffect(()=>{i("properties.org_id",g||null)},[g]),_.useEffect(()=>{te()},[]),_.useEffect(()=>{Et(a)||((a.event=="create_record"||a.event=="update_record"||a.event=="list_record"||a.event=="bulk_update")&&a.table&&a?.table&&z(a?.table),a?.record_id&&Q(a?.table),a.event==="list_record"&&a?.filter?.field?.type&&r(a?.filter?.field?.type))},[]),_.useEffect(()=>{Et(a)||(a.event=="create_record"&&a.table&&z(a?.table),a&&a?.record_id&&Q(a?.table))},[a.event]),_.useEffect(()=>{try{const J=a?.filters;if(Array.isArray(J)&&J.length){const K=J.map(le=>{const he=le?.field?.type,Ae=Array.isArray(le?.filterList)&&le.filterList.length>0;return{...le,filterList:Ae&&he?le.filterList:he?r(he):[]}});K.some((le,he)=>{const Ae=J[he],fe=Array.isArray(Ae?.filterList)?Ae.filterList.length:0,Se=Array.isArray(le?.filterList)?le.filterList.length:0;return Se>0&&Se!==fe})&&i("properties.filters",K,{shouldValidate:!1,shouldDirty:!1})}}catch{}},[a?.table,L,a?.filters]),_.useEffect(()=>{i("properties.org_id",g||null)},[g]);const Y=async(J=null,K=null,re=null,le=null)=>{const he=s("properties.database")||"";let fe=(le??x).find(je=>je.id===he);if(!fe&&he&&(fe={id:he,resource_id:"boltic"}),!he||!fe){re&&re(!1);return}const Se=Xt($,`/list?db_id=${he}`),ge=[{field:"name",operator:"ILIKE",values:[""]},{field:"resource_id",operator:"=",values:[fe.resource_id||"boltic"]},{field:"db_id",operator:"=",values:[he]}],ye={data:{page:{page_no:1,page_size:999},filters:ge,sort:[{field:"created_at",direction:"desc"}]}};if(J&&Array.isArray(J)){const je=J.find(Qe=>Qe.field==="name");if(je){ye.data.filters[0]=je;const Qe=J.filter($e=>!["name","resource_id","db_id"].includes($e.field));ye.data.filters.push(...Qe)}}zt.post(Se,ye).then(je=>{if(T(je?.data?.data||[]),K){const{payload:Qe,...$e}=a||{};i("properties",{...$e,table:K})}}).catch(je=>{sr(je,O)}).finally(()=>{re&&re(!1)})},z=async J=>{const K=a?.database||"";if(!K){R(!1);return}R(!0);const re=Xt($,`/${J}/fields/list?db_id=${K}`);zt.post(re,{data:{page:{page_no:1,page_size:999},filters:[],sort:[{field:"name",direction:"desc"}]}}).then(le=>{R(!1);const he=le?.data?.data.filter(Ae=>Ae.type!=="button");(le?.data?.data.length==0||he.length===0)&&sr({message:"No field found in table"},O),M(le?.data?.data||[])}).catch(le=>{sr(le,O),R(!1)})},Q=async(J,K=null)=>{const re=a?.database||"";if(!re)return;const le=Xt($,`/${J}/records/list?db_id=${re}`),he={data:{page:{page_no:1,page_size:999},filters:[],sort:[],field_names:["id"]}};K&&(he.data.filters=K),zt.post(le,he).then(Ae=>{V(Ae?.data?.data||[])}).catch(Ae=>{sr(Ae,O)})},W=async(J,K="")=>{const re=a?.database||"",le=J?.reference_table_id,he=J?.reference_column_name;if(!re||!le||!he)return;X(Ie=>({...Ie,[J.name]:!0}));const Ae=Xt($,`/${le}/records/list?db_id=${re}`),fe=Ie=>String(Ie||"").toLowerCase().trim(),Se=Ie=>{const Ve=fe(Ie);return Ve.includes("char")||Ve.includes("text")||Ve==="uuid"||Ve==="citext"},ge=(Ie,Ve)=>{const He=fe(Ve);if(He==="boolean"||He==="bool"){const Ee=Ie.toLowerCase();if(Ee==="true")return!0;if(Ee==="false")return!1}if(He.includes("int")||He.includes("numeric")||He.includes("decimal")||He.includes("real")||He.includes("double")){const Ee=Number(Ie);if(!Number.isNaN(Ee))return Ee}return Ie},ye=String(J?.referenced_sql_type||"").toLowerCase().trim(),je=Se(ye),Qe=typeof K=="string"?K.trim():String(K??"").trim(),$e=ge(Qe,ye),Je=!je;if(Je&&Qe.length>0&&typeof $e=="string"){H(Ie=>({...Ie,[J.name]:[]})),X(Ie=>({...Ie,[J.name]:!1}));return}const tt=Qe.length>0?[{field:he,operator:Je?"=":"ILIKE",values:[Je?$e:Qe]}]:[];try{const He=((await zt.post(Ae,{data:{page:{page_no:1,page_size:100},filters:tt,sort:[],field_names:["id",he]}}))?.data?.data||[]).map(Ee=>({value:Ee?.[he],title:Ee?.[he]!==void 0&&Ee?.[he]!==null&&String(Ee?.[he]).trim()!==""?String(Ee?.[he]):String(Ee?.id??"")})).filter(Ee=>Ee.value!==void 0&&Ee.value!==null);H(Ee=>({...Ee,[J.name]:He}))}catch(Ie){const Ve=Ie?.response?.data?.error?.meta||[],He=String(Ve?.[0]||Ie?.response?.data?.error?.message||Ie?.message||"").toLowerCase();Ie?.response?.status===400&&(He.includes("invalid input syntax")||He.includes("operator does not exist"))?H(_e=>({..._e,[J.name]:[]})):sr(Ie,O)}finally{X(Ie=>({...Ie,[J.name]:!1}))}};function q(J){for(const K in J)typeof J[K]=="number"&&(J[K]=J[K].toString()),typeof J[K]=="object"&&J[K]!==null&&J[K]!==void 0&&(Array.isArray(J[K])||(J[K]=JSON.stringify(J[K])));return J}const Z=async(J,K)=>{if(J&&await z(J),K){const re=a?.database||"";if(!re)return;const le=Xt($,`/${J}/records/${K}?db_id=${re}&show_decrypted=true`),he=await zt.get(le).catch(fe=>{sr(fe,O)}),Ae=q(he?.data?.data);i("properties.payload",{...a.payload,...Ae})}},te=async()=>{if(!$){P(!1);return}P(!0);const J=Xt($,"/connectors/list");zt.post(J,{data:{page:{page_no:1,page_size:999},filters:[],sort:[]}}).then(K=>{P(!1);const re=[{id:"boltic",name:"Boltic Cloud"},...K?.data?.data||[]];C(re);const he=n("properties")?.connector;if(!he&&re.length>0){const Ae=re[0].id;i("properties.connector",Ae),ae(Ae)}else he&&ae(he)}).catch(K=>{sr(K,O),P(!1)})},ae=async J=>{if(!J)return[];N(!0);try{const K={page:{page_no:1,page_size:1e3},filters:[{field:"status",operator:"=",values:["ACTIVE"]}],sort:[]},re=`${$}/databases/list?connector_id=${J}`,he=(await zt.post(re,{data:K}))?.data?.data||[];b(he);const fe=n("properties")?.database;if(!fe&&he.length>0){const Se=he[0].id;i("properties.database",Se),setTimeout(()=>{Y()},100)}else fe&&setTimeout(()=>{Y(null,null,null,he)},100);return he}catch(K){return sr(K,O),[]}finally{N(!1)}},ne=(J,K)=>{i(`properties.payload.${J}`,K)},ue=J=>{if((a||{})?.payload){const{[J]:K,...re}=(a||{}).payload;i("properties.payload",re)}},Oe=[{id:!0,name:"True"},{id:!1,name:"False"}],Te=J=>{if(["created_at","updated_at","id"].includes(J.name))return null;const K=JSON.parse(JSON.stringify(a?.payload?.[J.name]??null)),re=ST(J),le=fe=>{ne(J.name,fe)};if(t(J))return d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(ef,{viewOnly:c,id:e.id,helperTextForDropdown:J.help_text,helperTextForTextField:J.help_text,isLoading:!!j[J.name],label:J.name,type:e.type,isMultiple:!1,data:B[J.name]||[],value:K,placeholder:"Select referenced value",onTabChange:()=>ue(J.name),eventName:a.event,fieldName:J.name,isLoop:e.isLoop,required:!J.is_nullable,name:`properties.payload.${J.name}`,control:o,customValidations:{customValidation:Jd(J)},allowCustomInStatic:!0,onOpen:()=>{B[J.name]?.length||W(J)},handleSearchOptions:fe=>{W(J,fe)},handleChange:fe=>{const{value:Se}=fe;le(Se)}})})},J.name)});const he=(fe,Se=!1,ge="xs")=>fe==="text"?d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(kr,{viewOnly:c,editorId:`bolticTableAcitivity-${J.name}`,id:e.id,isLoop:e.isLoop,language:"plaintext",name:`properties.payload.${J.name}`,value:K,showSuggestions:!0,variant:"outlined",type:fe,required:!J.is_nullable,size:ge,control:o,meta:{displayName:fe=="text"?J.name:null,description:J.help_text,placeholder:xT(re)},validationRules:{validate:Jd(J)},handleChange:ye=>{const{value:je}=ye;le(je)}})})},J.name)}):d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(HP,{control:o,name:`properties.payload.${J.name}`,label:J.name,helperText:J.help_text,placeholder:xT(re),required:!J.is_nullable,showSuggestions:!0,isLoop:e.isLoop,id:e.id,nodeId:`bolticTableAcitivity-${J.name}`,validationRules:{validate:Jd(J)},onChange:ye=>{le(ye)},disabled:c})})},J.name)}),Ae=()=>d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(pr,{name:`properties.payload.${J.name}`,control:o,rules:{validate:Jd(J)},render:({field:fe,fieldState:{error:Se}})=>{let ge=null;if(K)if(typeof K=="string"&&K.trim().startsWith("{{"))ge=K;else{const ye=Tr(K);ge=ye.isValid()?ye:null}return d.jsx(z6e,{...fe,disabled:c,nodeId:`bolticTableAcitivity-${J.name}`,id:e.id,isLoop:e.isLoop,label:J.name,name:J.name,value:ge,showSuggestions:!0,helperText:J.help_text,onChange:ye=>{if(typeof ye=="string"||ye===null)fe.onChange(ye),le(ye);else{const je=ye.toISOString();fe.onChange(je),le(je)}},variant:"outlined",required:!J.is_nullable,errorMsg:Se?.message})}})})},J.name)});switch(re){case"text":case"email":case"link":case"phone-number":case"encrypted":return he("text");case"date-time":return d.jsx(Qo.LocalizationProvider,{dateAdapter:Zl,children:Ae()});case"long-text":case"json":return he("text",!0,"sm");case"number":case"currency":return he("number");case"checkbox":return d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(ef,{viewOnly:c,id:e.id,helperTextForTextField:"",isLoading:!1,label:J.name,type:e.type,helperTextForDropdown:"Select True or False",isMultiple:!1,data:yn(Oe),value:K,placeholder:"Select true or false",handleChange:fe=>{const{value:Se}=fe;le(Se)},onTabChange:()=>ue(J.name),eventName:a.event,fieldName:J.name,isLoop:e.isLoop,required:!J.is_nullable,name:`properties.payload.${J.name}`,control:o,customValidations:{validate:Jd(J)}})})},J.name)});case"dropdown":return J.multiple_selections?d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(ef,{viewOnly:c,helperTextForDropdown:J.help_text,helperTextForTextField:J.help_text,id:e.id,isLoading:!1,label:J.name,type:e.type,isMultiple:J.multiple_selections,data:J.selectable_items?J.selectable_items.map(fe=>({value:fe,title:fe})):[],value:(Array.isArray(K)&&K?.length,K),onTabChange:()=>ue(J.name),eventName:a.event,fieldName:J.name,placeholder:xT(re),isLoop:e.isLoop,handleChange:fe=>{const{value:Se}=fe;Array.isArray(Se)&&Se.length?i(`properties.payload.${J.name}`,Et(Se)?null:Se.map(ge=>ge)):Se[0]?.id?le(Se[0]?.id):le(null)},name:`properties.payload.${J.name}`,control:o,customValidations:{customValidation:Jd(J)}})})},J.name)}):d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(ef,{viewOnly:c,id:e.id,helperTextForDropdown:J.help_text,helperTextForTextField:J.help_text,isLoading:!1,label:J.name,type:e.type,isMultiple:!1,data:J.selectable_items?J.selectable_items.map(fe=>({value:fe,title:fe})):[],value:Array.isArray(K)&&K?.length?K[0]?.id?K[0]?.id:K?K?.[0]:"":K,placeholder:xT(re),onTabChange:()=>ue(J.name),eventName:a.event,fieldName:J.name,isLoop:e.isLoop,handleChange:fe=>{const{value:Se}=fe;le(Se)},name:`properties.payload.${J.name}`,control:o,customValidations:{customValidation:Jd(J)}})})},J.name)});case"vector":case"halfvec":case"sparsevec":return d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(kr,{viewOnly:c,editorId:`bolticTableAcitivity-${J.name}`,id:h,isLoop:p,language:"json",name:`properties.payload.${J.name}`,value:K,showSuggestions:!0,variant:"outlined",multiline:!0,rows:3,required:!J.is_nullable,control:o,meta:{displayName:J.name,description:J.help_text||(J.type==="sparsevec"?'Enter sparse vector (e.g. "{1:1,3:2,5:3}/5"':"Enter vector (e.g. [1.2, 3.4, 5.6])"),placeholder:J.type==="sparsevec"?'Enter sparse vector (e.g. "{1:1,3:2,5:3}/5")':"Enter vector (e.g. [1.2, 3.4, 5.6])"},validationRules:{validate:Jd(J)},handleChange:fe=>{const{value:Se}=fe;le(Se)}})})},J.name)});default:return null}},se=_a((J,K=null)=>{Y(J,null,K)},300),ie=_a((J,K)=>{Q(J,K)},300);return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.event",control:o,meta:{options:wue,displayName:"Event",searchFieldPlaceholder:"Search Event",placeholder:"Select Event"},validationRules:{required:"Event is required"},viewOnly:c,fullWidth:!0,id:"event",required:!0,handleChange:J=>{const{value:K}=J;i("properties.event",K),i("properties.connector",""),i("properties.database",""),i("properties.table",""),i("properties.record_id",""),i("properties.updates",[]),i("properties.filters",[]),C([]),b([]),T([]),M([]),K&&K!=="sql_query"&&te()}})})})})}),a?.event&&d.jsx(E.Divider,{}),a?.event&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[a?.event&&a?.event!="sql_query"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.connector",control:o,meta:{options:(v||[]).map(J=>({value:J.id,title:J.name||J.id})),displayName:"Connector",searchFieldPlaceholder:"Search Connector",placeholder:"Select Connector",isLoading:I},validationRules:{required:"Connector is required"},viewOnly:c,fullWidth:!0,id:"connector",required:!0,handleChange:J=>{const{value:K}=J;i("properties.connector",K),i("properties.database",""),i("properties.table",""),i("properties.record_id",""),i("properties.updates",[]),i("properties.filters",[]),b([]),T([]),M([]),K&&ae(K)}})})}),a?.event&&a?.event!="sql_query"&&a?.connector&&d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.database",control:o,meta:{options:(x||[]).map(J=>({value:J.id,title:J.db_name||J.id,...a?.connector&&a.connector!=="boltic"&&J?.resource_name?{description:J.resource_name}:{}})),displayName:"Database",searchFieldPlaceholder:"Search Database",placeholder:"Select Database",isLoading:k},viewOnly:c,fullWidth:!0,id:"database",required:!0,handleChange:J=>{const{value:K}=J;i("properties.database",K),i("properties.table",""),i("properties.record_id",""),i("properties.updates",[]),i("properties.filters",[]),T([]),M([]),K&&Y()}})}),!k&&x.length===0&&d.jsx(E.Typography,{variant:"caption",sx:{mt:.5,display:"block",color:"text.secondary"},children:"No database is present, please create your first table to create a database."})]}),a?.event&&a?.event!="sql_query"&&(a?.database||a?.database=="")&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(jP,{viewOnly:c,type:"bolticTableActivity",value:a.table||"",title:"Table",show:!0,buttonName:"Create New Table",loadingState:G,loadDataFromApi:async J=>{y?.length||await Y(),J(!1)},required:!0,onTextInputChange:async(J,K)=>{J(!0),se([{field:"name",operator:"ILIKE",values:[K]}],J)},handleChange:J=>{const{value:K}=J;M([]),i("properties.table",K),(a?.event==="bulk_update"||a?.event==="list_record")&&(i("properties.updates",[]),i("properties.filters",[])),i("properties.record_id",""),a?.event=="create_record"||a?.event=="list_record"||a?.event=="bulk_update"?K&&z(K):(a?.event=="delete_record"||a?.event=="update_record")&&Q(K)},onAddButtonClick:U,name:"properties.table",options:yn(y),validationRules:{required:"Table is required"}})})})}),d.jsx(E.Grid,{item:!0,xs:12,children:(a?.event==="delete_record"||a?.event==="update_record")&&a?.table&&d.jsx(E.Grid,{container:!0,gap:1,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{required:!0,name:"properties.record_id",control:o,viewOnly:c,id:h,meta:{options:(()=>{const J=[...F];return a.record_id&&!F.some(K=>K.id===a.record_id)&&J.unshift({id:a.record_id}),J.map(K=>({value:K.id,title:K.id}))})(),displayName:"Record ID",searchFieldPlaceholder:"Search Record ID",placeholder:"Select a record ID",handleSearchOptions:J=>{if(a?.table){const K=[{field:"id",operator:"ILIKE",values:[J]}];ie(a.table,K)}}},validationRules:{required:"Record ID is required"},renderFieldValue:J=>{const K=[...F];return a.record_id&&!F.some(le=>le.id===a.record_id)&&K.unshift({id:a.record_id}),K.map(le=>({value:le.id,title:le.id})).some(le=>le.value===J)?J:""},handleChange:J=>{const{value:K}=J;a.event==="update_record"&&Z(a.table,K),i("properties.record_id",K)}},a.event)})},"record_id")})}),(a?.event==="create_record"&&a?.table||a?.event==="update_record"&&a?.table&&a?.record_id)&&d.jsxs(d.Fragment,{children:[w&&d.jsx(E.Stack,{sx:{width:"100%",justifyContent:"center",alignItems:"center",height:"5rem",margin:"0 0 2rem 0"},children:d.jsx(E.CircularProgress,{})}),L.length>0&&JSON.parse(JSON.stringify(L)).map(J=>Te(J))]}),a?.event==="list_record"&&a?.table&&d.jsxs(E.Grid,{container:!0,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(HP,{control:o,name:"properties.page",viewOnly:c,editorId:"bolticTableAcitivity-page",id:e.id,isLoop:e.isLoop,language:"plaintext",label:"Page Number",showSuggestions:!0,placeholder:"Enter a page number",required:!0,variant:"outlined",inputProps:{min:1,max:1e4},helperText:`Which set of records you want to receive (starting from 1).
|
|
@@ -502,7 +502,7 @@ Expecting `+X.join(", ")+", got '"+(this.terminals_[P]||P)+"'":F="Parse error on
|
|
|
502
502
|
`))):q=D.stylize("[Circular]","special")),P(W)){if(Q&&z.match(/^\d+$/))return q;W=JSON.stringify(""+z),W.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(W=W.substr(1,W.length-2),W=D.stylize(W,"name")):(W=W.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),W=D.stylize(W,"string"))}return W+": "+q}function T(D,$,U){var Y=D.reduce(function(z,Q){return Q.indexOf(`
|
|
503
503
|
`)>=0,z+Q.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Y>60?U[0]+($===""?"":$+`
|
|
504
504
|
`)+" "+D.join(`,
|
|
505
|
-
`)+" "+U[1]:U[0]+$+" "+D.join(", ")+" "+U[1]}function v(D){return Array.isArray(D)}i.isArray=v;function C(D){return typeof D=="boolean"}i.isBoolean=C;function x(D){return D===null}i.isNull=x;function b(D){return D==null}i.isNullOrUndefined=b;function w(D){return typeof D=="number"}i.isNumber=w;function R(D){return typeof D=="string"}i.isString=R;function I(D){return typeof D=="symbol"}i.isSymbol=I;function P(D){return D===void 0}i.isUndefined=P;function k(D){return N(D)&&j(D)==="[object RegExp]"}i.isRegExp=k;function N(D){return typeof D=="object"&&D!==null}i.isObject=N;function L(D){return N(D)&&j(D)==="[object Date]"}i.isDate=L;function M(D){return N(D)&&(j(D)==="[object Error]"||D instanceof Error)}i.isError=M;function B(D){return typeof D=="function"}i.isFunction=B;function H(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}i.isPrimitive=H,i.isBuffer=r("./support/isBuffer");function j(D){return Object.prototype.toString.call(D)}function X(D){return D<10?"0"+D.toString(10):D.toString(10)}var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function V(){var D=new Date,$=[X(D.getHours()),X(D.getMinutes()),X(D.getSeconds())].join(":");return[D.getDate(),F[D.getMonth()],$].join(" ")}i.log=function(){},i.inherits=r("inherits"),i._extend=function(D,$){if(!$||!N($))return D;for(var U=Object.keys($),Y=U.length;Y--;)D[U[Y]]=$[U[Y]];return D};function G(D,$){return Object.prototype.hasOwnProperty.call(D,$)}}).call(this,r("_process"),typeof Ur<"u"?Ur:typeof self<"u"?self:typeof window<"u"?window:{})},{"./support/isBuffer":10,_process:14,inherits:9}],12:[function(r,n,i){},{}],13:[function(r,n,i){(function(o){function s(c,f){for(var p=0,h=c.length-1;h>=0;h--){var A=c[h];A==="."?c.splice(h,1):A===".."?(c.splice(h,1),p++):p&&(c.splice(h,1),p--)}if(f)for(;p--;p)c.unshift("..");return c}i.resolve=function(){for(var c="",f=!1,p=arguments.length-1;p>=-1&&!f;p--){var h=p>=0?arguments[p]:o.cwd();if(typeof h!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!h)continue;c=h+"/"+c,f=h.charAt(0)==="/"}return c=s(l(c.split("/"),function(A){return!!A}),!f).join("/"),(f?"/":"")+c||"."},i.normalize=function(c){var f=i.isAbsolute(c),p=u(c,-1)==="/";return c=s(l(c.split("/"),function(h){return!!h}),!f).join("/"),!c&&!f&&(c="."),c&&p&&(c+="/"),(f?"/":"")+c},i.isAbsolute=function(c){return c.charAt(0)==="/"},i.join=function(){var c=Array.prototype.slice.call(arguments,0);return i.normalize(l(c,function(f,p){if(typeof f!="string")throw new TypeError("Arguments to path.join must be strings");return f}).join("/"))},i.relative=function(c,f){c=i.resolve(c).substr(1),f=i.resolve(f).substr(1);function p(T){for(var v=0;v<T.length&&T[v]==="";v++);for(var C=T.length-1;C>=0&&T[C]==="";C--);return v>C?[]:T.slice(v,C-v+1)}for(var h=p(c.split("/")),A=p(f.split("/")),g=Math.min(h.length,A.length),m=g,O=0;O<g;O++)if(h[O]!==A[O]){m=O;break}for(var y=[],O=m;O<h.length;O++)y.push("..");return y=y.concat(A.slice(m)),y.join("/")},i.sep="/",i.delimiter=":",i.dirname=function(c){if(typeof c!="string"&&(c=c+""),c.length===0)return".";for(var f=c.charCodeAt(0),p=f===47,h=-1,A=!0,g=c.length-1;g>=1;--g)if(f=c.charCodeAt(g),f===47){if(!A){h=g;break}}else A=!1;return h===-1?p?"/":".":p&&h===1?"/":c.slice(0,h)};function a(c){typeof c!="string"&&(c=c+"");var f=0,p=-1,h=!0,A;for(A=c.length-1;A>=0;--A)if(c.charCodeAt(A)===47){if(!h){f=A+1;break}}else p===-1&&(h=!1,p=A+1);return p===-1?"":c.slice(f,p)}i.basename=function(c,f){var p=a(c);return f&&p.substr(-1*f.length)===f&&(p=p.substr(0,p.length-f.length)),p},i.extname=function(c){typeof c!="string"&&(c=c+"");for(var f=-1,p=0,h=-1,A=!0,g=0,m=c.length-1;m>=0;--m){var O=c.charCodeAt(m);if(O===47){if(!A){p=m+1;break}continue}h===-1&&(A=!1,h=m+1),O===46?f===-1?f=m:g!==1&&(g=1):f!==-1&&(g=-1)}return f===-1||h===-1||g===0||g===1&&f===h-1&&f===p+1?"":c.slice(f,h)};function l(c,f){if(c.filter)return c.filter(f);for(var p=[],h=0;h<c.length;h++)f(c[h],h,c)&&p.push(c[h]);return p}var u="ab".substr(-1)==="b"?function(c,f,p){return c.substr(f,p)}:function(c,f,p){return f<0&&(f=c.length+f),c.substr(f,p)}}).call(this,r("_process"))},{_process:14}],14:[function(r,n,i){var o=n.exports={},s,a;function l(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?s=setTimeout:s=l}catch{s=l}try{typeof clearTimeout=="function"?a=clearTimeout:a=u}catch{a=u}})();function c(v){if(s===setTimeout)return setTimeout(v,0);if((s===l||!s)&&setTimeout)return s=setTimeout,setTimeout(v,0);try{return s(v,0)}catch{try{return s.call(null,v,0)}catch{return s.call(this,v,0)}}}function f(v){if(a===clearTimeout)return clearTimeout(v);if((a===u||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(v);try{return a(v)}catch{try{return a.call(null,v)}catch{return a.call(this,v)}}}var p=[],h=!1,A,g=-1;function m(){!h||!A||(h=!1,A.length?p=A.concat(p):g=-1,p.length&&O())}function O(){if(!h){var v=c(m);h=!0;for(var C=p.length;C;){for(A=p,p=[];++g<C;)A&&A[g].run();g=-1,C=p.length}A=null,h=!1,f(v)}}o.nextTick=function(v){var C=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)C[x-1]=arguments[x];p.push(new y(v,C)),p.length===1&&!h&&c(O)};function y(v,C){this.fun=v,this.array=C}y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={};function T(){}o.on=T,o.addListener=T,o.once=T,o.off=T,o.removeListener=T,o.removeAllListeners=T,o.emit=T,o.prependListener=T,o.prependOnceListener=T,o.listeners=function(v){return[]},o.binding=function(v){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(v){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],15:[function(r,n,i){var o=r("escodegen").generate;n.exports=function(a,l,u){u||(u={});var c=!u.allowAccessToMethodsOnFunctions;l||(l={});var f={},p=(function h(A,g){if(A.type==="Literal")return A.value;if(A.type==="UnaryExpression"){var m=h(A.argument,g);return A.operator==="+"?+m:A.operator==="-"?-m:A.operator==="~"?~m:A.operator==="!"?!m:f}else if(A.type==="ArrayExpression"){for(var O=[],y=0,T=A.elements.length;y<T;y++){var v=h(A.elements[y],g);if(v===f)return f;O.push(v)}return O}else if(A.type==="ObjectExpression"){for(var C={},y=0;y<A.properties.length;y++){var x=A.properties[y],b=x.value===null?x.value:h(x.value,g);if(b===f)return f;C[x.key.value||x.key.name]=b}return C}else if(A.type==="BinaryExpression"||A.type==="LogicalExpression"){var w=A.operator;if(w==="&&"){var T=h(A.left);if(T===f)return f;if(!T)return T;var R=h(A.right);return R===f?f:R}else if(w==="||"){var T=h(A.left);if(T===f)return f;if(T)return T;var R=h(A.right);return R===f?f:R}var T=h(A.left,g);if(T===f)return f;var R=h(A.right,g);return R===f?f:w==="=="?T==R:w==="==="?T===R:w==="!="?T!=R:w==="!=="?T!==R:w==="+"?T+R:w==="-"?T-R:w==="*"?T*R:w==="/"?T/R:w==="%"?T%R:w==="<"?T<R:w==="<="?T<=R:w===">"?T>R:w===">="?T>=R:w==="|"?T|R:w==="&"?T&R:w==="^"?T^R:f}else{if(A.type==="Identifier")return{}.hasOwnProperty.call(l,A.name)?l[A.name]:f;if(A.type==="ThisExpression")return{}.hasOwnProperty.call(l,"this")?l.this:f;if(A.type==="CallExpression"){var I=h(A.callee,g);if(I===f||typeof I!="function")return f;var P=A.callee.object?h(A.callee.object,g):f;P===f&&(P=null);for(var k=[],y=0,T=A.arguments.length;y<T;y++){var v=h(A.arguments[y],g);if(v===f)return f;k.push(v)}return g?void 0:I.apply(P,k)}else if(A.type==="MemberExpression"){var C=h(A.object,g);if(C===f||typeof C=="function"&&c)return f;if(A.property.type==="Identifier"&&!A.computed)return s(A.property.name)?f:C[A.property.name];var x=h(A.property,g);return x===null||x===f||s(x)?f:C[x]}else if(A.type==="ConditionalExpression"){var m=h(A.test,g);return m===f?f:m?h(A.consequent):h(A.alternate,g)}else if(A.type==="ExpressionStatement"){var m=h(A.expression,g);return m===f?f:m}else{if(A.type==="ReturnStatement")return h(A.argument,g);if(A.type==="FunctionExpression"){var N=A.body.body,L={};Object.keys(l).forEach(function(D){L[D]=l[D]});for(var y=0;y<A.params.length;y++){var M=A.params[y];if(M.type=="Identifier")l[M.name]=null;else return f}for(var y in N)if(h(N[y],!0)===f)return f;l=L;var B=Object.keys(l),H=B.map(function(D){return l[D]});return Function(B.join(", "),"return "+o(A)).apply(null,H)}else if(A.type==="TemplateLiteral"){for(var j="",y=0;y<A.expressions.length;y++)j+=h(A.quasis[y],g),j+=h(A.expressions[y],g);return j+=h(A.quasis[y],g),j}else if(A.type==="TaggedTemplateExpression"){var X=h(A.tag,g),F=A.quasi,V=F.quasis.map(h),G=F.expressions.map(h);return X.apply(null,[V].concat(G))}else return A.type==="TemplateElement"?A.value.cooked:f}}})(a);return p===f?void 0:p};function s(a){return a==="constructor"||a==="__proto__"}},{escodegen:12}],jsonpath:[function(r,n,i){n.exports=r("./lib/index")},{"./lib/index":5}]},{},["jsonpath"])("jsonpath")})})(GP)),GP.exports}var pBe=fBe();const hBe=Un(pBe),ABe=e=>{try{return dBe(e),!0}catch(t){return t}},mBe=e=>{try{return hBe.query({},e),!0}catch(t){return t}},gBe=_.forwardRef((e,t)=>{const{type:r,isLoop:n,suggestionsData:i,id:o,viewOnly:s=!1}=e,{loopSuggestionsData:a={}}=ct.useSelector(m=>m.loopActivity),{watch:l,control:u,setValue:c,formState:{errors:f}}=Rr(),p=l("properties.from_type"),h=l("properties.to_type"),A=tue.filter(m=>!!m.visibleKey.find(O=>O===p)),g=m=>m==="json"?"json":m==="xml"?"xml":"html";return _.useEffect(()=>{h===""&&c("properties.query","")},[h]),d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.from_type",control:u,meta:{options:eue,displayName:"Convert from",searchFieldPlaceholder:"Search",description:"Choose the type of data you are starting with.",placeholder:"Select Convert from"},validationRules:{required:"Convert from is required"},handleChange:()=>{c("properties.to_type","")},viewOnly:s,required:!0})}),p&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.data",control:u,rules:{required:"Data is required"},render:({field:m})=>d.jsx(Fi,{...m,label:"Data",showSuggestions:!0,suggestionsData:n?a:i,id:`${r}-data`,size:"md",suggestionLabel:"Data",viewOnly:s,language:g(p?.toLowerCase()),showHtmlPreview:p?.toLowerCase()?.includes("html"),placeholder:"Enter the input data to be converted.",handleChange:O=>m.onChange(O),showExpandOption:!0,error:!!f.properties?.data?.message,errorMsg:f.properties?.data?.message,helperText:"Paste or enter the input data to be converted.",required:!0})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.to_type",control:u,meta:{options:A,displayName:"Convert to",searchFieldPlaceholder:"Search",description:"Choose the type you want to convert the data into.",placeholder:"Select Convert to"},validationRules:{required:"Convert to is required"},viewOnly:s,required:!0})}),h==="jsonata"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.query",control:u,rules:{validate:m=>m&&ABe(m)!==!0?"Error in JSONata expression. Please check the expression's syntax.":!0},render:({field:m})=>d.jsx(Fi,{...m,language:"javascript",suggestionLabel:"Query",placeholder:"Enter a JSONata / JSONPath query to transform the data",size:"md",suggestionsData:n?a:i,id:`${r}-query2`,showSuggestions:!0,viewOnly:s,handleChange:O=>{Et(O)||m.onChange(O)},label:"Query",helperText:"To know more about how to use jsonata, visit https://docs.jsonata.org/overview.html.",showExpandOption:!0,error:!!f.properties?.query?.message,errorMsg:f.properties?.query?.message})})}),h==="jsonpath"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.query",control:u,rules:{validate:m=>m&&mBe(m)!==!0?"Error in JSONPath expression. Please check the expression's syntax.":!0},render:({field:m})=>d.jsx(Fi,{...m,language:"javascript",placeholder:"Enter a JSONata / JSONPath query to transform the data",size:"md",suggestionsData:n?a:i,id:`${r}-query`,showSuggestions:!0,viewOnly:s,handleChange:O=>{Et(O)||m.onChange(O)},suggestionLabel:"Query",label:"Query",helperText:"To know more about how to use JSONPath, visit https://goessner.net/articles/JsonPath/",error:!!f.properties?.query?.message,errorMsg:f.properties?.query?.message,showExpandOption:!0})})}),h==="graphql"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{id:o,name:"properties.query_options",control:u,meta:{displayName:"Query Options",description:"Provide GraphQL-specific options if your query needs them.",placeholder:"Specify Query Options"},viewOnly:s,editorId:`${r}-query_options`})}),!n&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:s,type:r})})]})})}),EBe=Gi(gBe,"");var jo=(e=>(e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.OBJECT="object",e.ARRAY="array",e.NULL="null",e))(jo||{});const _X={string:"",boolean:!0,number:0,object:{},array:[],null:[]},wX=e=>e?.jsonGui??Eb.colors.jsonGui,WP=e=>{const t=wX(e);return[{value:"string",label:"abc",color:t.string,icon:"ic_string",name:"String"},{value:"number",label:"123",color:t.number,icon:"ic_number",name:"Number"},{value:"boolean",label:"true",color:t.boolean,icon:"ic_boolean",name:"Boolean"},{value:"array",label:"[]",color:t.array,icon:"ic_array",name:"Array"},{value:"object",label:"{}",color:t.object,icon:"ic_object",name:"Object"},{value:"null",label:"null",color:t.null,icon:"ic_null",name:"Null"}]},IX=e=>{const t=wX(e);return[{value:"string",label:"abc",color:t.string,icon:"ic_string",name:"String"},{value:"number",label:"123",color:t.number,icon:"ic_number",name:"Number"},{value:"boolean",label:"true",color:t.boolean,icon:"ic_boolean",name:"Boolean"},{value:"null",label:"null",color:t.null,icon:"ic_null",name:"Null"}]};WP(null),IX(null);const bT=e=>Object.prototype.toString.call(e).match(/\w+/g)?.[1].toLowerCase(),DX=(e,t,r)=>{const n=e.shift(),i=Object.keys(t);if(e.length)return DX(e,t[i[n]],r);t[i[n]]=r},RX=(e,t,r)=>(DX(t,r,e),r),PX=e=>e.split("-").slice(1),OBe=e=>e&&typeof e=="object",ag=_.createContext(null),QP=e=>{const{setEditObject:t,editObject:r,setTempData:n}=_.useContext(ag),i=E.useTheme(),o=WP(i.palette),{uniqueKey:s,sourceData:a,id:l,showSuggestions:u,excludePayloadSuggestions:c=!1,onChange:f,setIsEditing:p}=e,h=Array.isArray(a),[A,g]=_.useState({}),[m,O]=_.useState({}),[y,T]=_.useState(""),v={fontSize:"18px",marginRight:"5px"},C=(N,L)=>{m[N]=L,A[N]={},T(""),g({...A}),O({...m}),p?.(!0),n(L?M=>({...M,"":""}):M=>{const B={...M};return delete B[""],B})},x=()=>{g({}),O({}),T("")};_.useEffect(()=>{x()},[h]);const b=(N,L)=>{const M=N.target.value.trim();A[L].key=M,g({...A});const B=LP(M,a);T(B)},w=(N,L)=>{A[N].value=L,g({...A})},R=(N,L)=>{A[N].type=L,A[N].value=_X[L],g({...A})},I=(N,L)=>{switch(L){case jo.NULL:return null;case jo.BOOLEAN:return typeof N=="string"?N==="true":!!N;case jo.NUMBER:return Number(N);case jo.STRING:return String(N||"");default:return N||""}},P=(N,L)=>{const M=A[N];if(!M)return;const{key:B,value:H,type:j}=M,F=j===jo.OBJECT||j===jo.ARRAY?j===jo.ARRAY?[]:{}:I(H,j);if(!h){const V=LP(B,L);if(V){T(V);return}}h?L.push(F):L[B]=F,t({...r}),x(),n?.({...r}),p?.(!1)},k=N=>{switch(N){case jo.STRING:return d.jsx(E.Stack,{width:"150px",children:d.jsx(lo,{viewOnly:e.viewOnly,fullWidth:!0,onChange:L=>w(s,L.target.value),showSuggestion:u,id:l,placeholder:"value",editorId:`${l}-${N}-${s}`,"data-testid":`${l}-${N}-${s}`,excludePayloadSuggestions:c})});case jo.NUMBER:return d.jsx(E.Stack,{width:"150px",ml:-1.5,children:d.jsx(lo,{viewOnly:e.viewOnly,fullWidth:!0,type:"number",placeholder:"value",autoComplete:"off",onChange:L=>w(s,+L.target.value),"data-testid":`${l}-${N}-${s}`,excludePayloadSuggestions:c})});case jo.BOOLEAN:return d.jsx(E.Stack,{width:"150px",ml:-1.5,children:d.jsxs(E.Select,{disabled:e.viewOnly,size:"small",value:A[s]?.value!==!1,"data-testid":`${l}-${N}-${s}`,sx:{".MuiInputBase-inputSizeSmall":{height:"auto !important"}},onChange:L=>{const M=L.target.value==="true";w(s,M)},children:[d.jsx(E.MenuItem,{value:"true",children:"true"}),d.jsx(E.MenuItem,{value:"false",children:"false"})]})});default:return null}};return d.jsx(E.Box,{className:"addItem",width:"100%",children:m[s]?d.jsxs(E.Stack,{direction:"row",alignItems:y?"flex-start":"center",width:"100%",children:[!h&&d.jsxs(E.Stack,{sx:{position:"relative"},children:[d.jsx(lo,{viewOnly:e.viewOnly,fullWidth:!0,onChange:N=>b(N,s),showSuggestion:u,id:l,sx:{width:"130px"},placeholder:"key",editorId:`key-${s}`,"data-testid":`key-${s}`,error:!!y,excludePayloadSuggestions:c}),y&&d.jsx(E.Box,{sx:{position:"absolute",top:38,left:0,color:i.palette.error.main,fontSize:"0.75rem",lineHeight:1},children:d.jsx(E.FormHelperText,{"data-testid":`errorMsg-${s}`,error:!0,children:y})})]}),d.jsx(E.Select,{size:"small","data-testid":`select-type-${s}`,disabled:e.viewOnly,sx:{mx:1,mr:2.1,".MuiSelect-select":{padding:"10px 38px 10px 14px",fontSize:10},".MuiInputBase-inputSizeSmall":{height:"auto !important"},".MuiOutlinedInput-notchedOutline":{p:0,width:"120px"}},MenuProps:{PaperProps:{sx:{minWidth:"120px !important",marginLeft:"4px !important"}}},onChange:N=>R(s,N.target.value),value:A[s]?.type||jo.STRING,renderValue:N=>{const L=o.find(M=>M.value===N);return d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,children:[d.jsx(Ue,{src:L?.icon,width:14,height:14,sx:{marginRight:8,color:L?.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:L?.name})]})},children:o.map(N=>d.jsxs(E.MenuItem,{value:N.value,sx:{...vf,minHeight:"40px !important","@media (min-width: 600px)":{minHeight:"40px !important"}},children:[d.jsx(Ue,{src:N.icon,width:18,height:18,sx:{color:N.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:N.name})]},N.value))}),d.jsx("span",{className:"jsonValue",children:k(A[s]?.type||jo.STRING)}),d.jsxs(E.Stack,{direction:"row",spacing:1,ml:Et(r)?1:0,children:[d.jsx(E.IconButton,{size:"small",color:"primary",onClick:()=>{P(s,a),f&&f(r)},sx:{minWidth:0},"data-testid":`confirm-${s}`,disabled:!!y||e?.viewOnly,children:d.jsx(Ue,{src:"ic_done",width:16,height:16})}),d.jsx(E.IconButton,{"data-testid":`close-btn-${s}`,size:"small",onClick:()=>{C(s,!1),p?.(!1)},disabled:e?.viewOnly,sx:{minWidth:0},children:d.jsx(Ue,{width:16,height:16,src:"ic_close"})})]})]}):d.jsxs(E.Button,{variant:"text",disabled:e.viewOnly,"data-testid":"json-gui-add-btn",sx:{color:N=>N.palette.primary[60],mt:Et(r)?0:2,"&:hover":{backgroundColor:"transparent",color:N=>N.palette.primary[50],"& .MuiTypography-root":{color:N=>N.palette.primary[50]},"& svg path":{fill:N=>N.palette.primary[50]}}},disableFocusRipple:!0,disableTouchRipple:!0,disableRipple:!0,disableElevation:!0,onClick:()=>C(s,!0),children:[d.jsx(Ue,{src:"ic_plus",sx:{...v,path:{fill:"currentColor"}}}),d.jsx(E.Typography,{variant:"smNormal",sx:{alignItems:"center"},children:"Add"})]})},s)},zP={base:{transformOrigin:"center",transition:"transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)",mr:.5},right:{transform:"rotate(0deg)"},down:{transform:"rotate(90deg)"}};function XP({fieldValue:e,uniqueKey:t}){const{onChangeAllow:r,allowMap:n}=_.useContext(ag);if(!OBe(e))return d.jsx("span",{});const i=!!n[t];return d.jsx(E.IconButton,{onClick:()=>r(t),"data-testid":`collapse-${t}`,sx:{...zP.base,...i?zP.down:zP.right},children:d.jsx(Ue,{src:"ic_right_arrow"})})}function NX(e){const t=E.useTheme(),r=WP(t.palette);return d.jsx(ag.Consumer,{children:({onChangeType:n})=>d.jsx(E.Select,{size:"small","data-testid":`select-type-${e.uniqueKey}`,disabled:e.viewOnly,sx:{".MuiSelect-select":{fontSize:10},".MuiInputBase-inputSizeSmall":{height:"auto !important"},".MuiOutlinedInput-notchedOutline":{p:0}},onChange:i=>n(i.target.value,e.uniqueKey),value:bT(e.fieldValue),renderValue:i=>{const o=r.find(s=>s.value===i);return d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,children:[d.jsx(Ue,{src:o?.icon,width:14,height:14,sx:{marginRight:8,color:o?.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:o?.name})]})},children:r.map(i=>d.jsxs(E.MenuItem,{value:i.value,sx:{...vf},children:[d.jsx(Ue,{src:i.icon,width:18,height:18,sx:{color:i.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:i.name})]},i.value))})})}function yBe(e){const{setIsEditing:t,fieldValue:r,parentUniqueKey:n,viewOnly:i,getValue:o,deepLevel:s,id:a,showSuggestions:l,excludePayloadSuggestions:u,onClickDelete:c,onChange:f}=e,{allowMap:p}=_.useContext(ag),h=200,[A,g]=_.useState(h);_.useEffect(()=>{g(h)},[r]);const m=r.slice(0,A),O=r.length>A;return d.jsxs(E.Box,{className:"arrayContent",children:[d.jsx(E.Box,{sx:{marginTop:"10px"},"data-testid":"arrayContent",children:m.map((y,T)=>{const v=`${n}-${T}`,C=bT(y),x=["object","array"].includes(C)&&!!p[v];return d.jsxs(E.Stack,{className:"indexLine",direction:"row",alignItems:"center",gap:1,justifyContent:"flex-start",flexWrap:x?"wrap":"nowrap",sx:{"& .jsonValue":{flex:x?"1 1 100%":"0 0 auto",width:x?"100%":"auto",minWidth:x?"auto":"150px"}},children:[["object","array"].includes(C)&&d.jsx(XP,{uniqueKey:v,fieldValue:y}),d.jsx(NX,{viewOnly:i,uniqueKey:v,fieldValue:y,fieldKey:`${T}`,sourceData:r,"data-testid":`tools-${v}`,type:"array"}),d.jsx("span",{className:"jsonValue",children:o(y,T,r,s+1,v)}),d.jsx(E.Stack,{ml:1,alignItems:"center",direction:"row","data-testid":`delete-${v}`,sx:x?{position:"absolute",right:260,top:4}:{position:"relative",ml:1},children:d.jsx(E.IconButton,{disabled:i,onClick:()=>c(T,r),sx:{ml:.5,"&:hover":{backgroundColor:"transparent"}},children:d.jsx(Ue,{src:"ic_delete"})})})]},v)})}),O&&d.jsxs(E.Stack,{direction:"row",alignItems:"center",gap:1,sx:{mt:1},"data-testid":`array-load-more-${n}`,children:[d.jsx(E.Button,{size:"small",variant:"outlined",onClick:()=>g(y=>Math.min(y+h,r.length)),sx:{textTransform:"none"},children:`Load ${Math.min(h,r.length-A)} more`}),d.jsx(E.Typography,{variant:"xsNormal",color:"text.secondary",children:`Showing ${A} of ${r.length}`})]}),d.jsx(E.Box,{children:d.jsx(QP,{viewOnly:i,uniqueKey:n,deepLevel:s,sourceData:r,id:a,showSuggestions:l,excludePayloadSuggestions:u,setIsEditing:t,onChange:f},n)})]})}function LX(e){const t=E.useTheme(),{editObject:r,setEditObject:n,id:i,showSuggestions:o,setTempData:s,tempData:a,excludePayloadSuggestions:l=!1,viewOnly:u=!1,onChange:c,setIsEditing:f}=e,[p,h]=_.useState({}),[A,g]=_.useState({}),[m,O]=_.useState(!0),[y,T]=_.useState(!1),v=200,[C,x]=_.useState(v);_.useEffect(()=>{x(v)},[r]);const b=F=>{n({...F}),c?.(F),s&&s({...F})};_.useEffect(()=>{const F=setTimeout(()=>{O(!1)},500);return()=>clearTimeout(F)},[]);const w=(F,V)=>{Array.isArray(V)?(V.splice(+F,1),c&&c(V)):(Reflect.deleteProperty(V,F),c&&c(V)),b(r)},R=(F,V)=>{const G=F===jo.NULL?null:_X[F],D=RX(G,PX(V),r);b(D)},I=(F,V,G,D)=>{const $=F.target.value.trim();if(V!==$){const Q=LP($,D);if(g(W=>({...W,[G]:Q})),Q)return}const U={};for(const Q in D)Object.prototype.hasOwnProperty.call(D,Q)&&(Q===V?U[F.target.value]=D[Q]:U[Q]=D[Q]);g(Q=>{const W={...Q};return delete W[G],W});const Y=PX(G);if(Y.length===1)b(U);else{Y.pop();const Q=RX(U,Y,r);b(Q)}},P=(F,V,G,D="")=>{G[V]=D==="number"?Number(F):F,b(r)},k=F=>!!(typeof F!="object"||F===null||Array.isArray(F)||Object.keys(F).length===0),N={position:"absolute",left:-4,width:"2px",height:"calc(100% - 22px)",borderLeft:`1px solid ${t.palette.grey.outlined.border}`,"&::after":{content:'""',position:"absolute",bottom:0,width:"20px",height:"1px",backgroundColor:t.palette.grey.outlined.border},zIndex:1},L={position:"absolute",left:8,width:"2px",height:"calc(100% - 76px)",borderLeft:`1px solid ${t.palette.grey.outlined.border}`,zIndex:0,"&::after":{content:'""',position:"absolute",bottom:0,width:"30px",height:"1px",backgroundColor:t.palette.grey.outlined.border}},M=(F,V,G,D,$)=>{const U=bT(F),Y={autoComplete:"off",onChange:W=>P(W.target.value,V,G),value:F},z={position:"relative",paddingLeft:0},Q=k(F);switch(U){case jo.ARRAY:return!p[$]?d.jsx(E.Typography,{component:"span",variant:"smMedium",sx:{color:t.palette.text.secondary,opacity:.7,display:"inline-flex",alignItems:"center",height:24,whiteSpace:"nowrap"},"data-testid":`array-collapsed-${V}`,children:`[${F.length} ${F.length===1?"item":"items"}]`}):d.jsxs(E.Stack,{sx:z,children:[d.jsx(E.Box,{sx:{...N,height:"calc(100% - 17px)"}}),d.jsx(yBe,{viewOnly:u,fieldValue:F,fieldKey:V,sourceData:G,deepLevel:D,parentUniqueKey:$,getValue:M,id:i,showSuggestions:o,onClickDelete:w,"data-testid":`array-${V}`,excludePayloadSuggestions:l,setIsEditing:f,onChange:b})]});case jo.OBJECT:{const W=!!p[$],q=Object.keys(F||{}).length;return W?d.jsxs(E.Stack,{sx:z,"data-testid":`object-${V}`,children:[d.jsx(E.Box,{sx:{...N,height:Q?"calc(100% - 10px)":N.height}}),d.jsx("span",{children:X(F,D+1,$)})]}):d.jsx(E.Typography,{component:"span",variant:"smMedium",sx:{color:t.palette.text.secondary,opacity:.7,display:"inline-flex",alignItems:"center",height:24,whiteSpace:"nowrap"},"data-testid":`object-collapsed-${V}`,children:`{${q} ${q===1?"key":"keys"}}`})}case jo.STRING:return d.jsx(lo,{"data-testid":`text-string-${V}`,sx:{width:"140px"},size:"xs",disabled:u,id:i,showSuggestions:o,excludePayloadSuggestions:l,...Y,placeholder:"value"});case jo.NUMBER:return d.jsx(lo,{id:i,size:"xs",disabled:u,type:"number",placeholder:F,autoComplete:"off",showSuggestions:o,excludePayloadSuggestions:l,value:F,sx:{width:"140px"},"data-testid":`text-number-${V}`,onBlur:W=>P(+W.target.value,V,G),onChange:W=>P(W.target.value===""?"":+W.target.value,V,G,"number")});case jo.BOOLEAN:return d.jsxs(E.Select,{disabled:u,size:"small",sx:{width:"140px","& .MuiSelect-select":{display:"flex",alignItems:"center",paddingTop:"6px",paddingBottom:"6px"},"& .MuiOutlinedInput-input":{display:"flex",alignItems:"center"}},value:F?"true":"false","data-testid":`text-boolean-${V}`,onChange:W=>P(W.target.value==="true",V,G),children:[d.jsx(E.MenuItem,{value:"true",children:"true"}),d.jsx(E.MenuItem,{value:"false",children:"false"})]})}},B=F=>{p[F]=!p[F],h({...p})},H=()=>{T(!y)},j=1,X=(F,V=j,G=`${V}`)=>{const D=Object.keys(F);if(!D.length)return d.jsx(E.Box,{"data-testid":`addItem-${G}`,mt:Et(r)?0:"9px",ml:Et(r)?0:3,children:d.jsx(QP,{viewOnly:u,uniqueKey:`${G}`,deepLevel:V,sourceData:F,id:i,showSuggestions:o,excludePayloadSuggestions:l,onChange:z=>{c&&c(z)},setIsEditing:f})});const $=V===j,U=$?D.slice(0,C):D,Y=$&&D.length>C;return d.jsxs(E.Stack,{className:"objectContent","data-testid":"objectContent",sx:{marginLeft:j===V?"15px":"10px",py:1.5},onClick:z=>z.stopPropagation(),children:[d.jsx(E.Box,{children:U.map((z,Q)=>{const W=`${G}-${Q}`,q=F[z],Z=bT(q),te=["object","array"].includes(Z)&&!!p[W];return d.jsxs(E.Stack,{className:"indexLine",direction:"row",alignItems:A[W]?"flex-start":"center",gap:1,justifyContent:"flex-start",flexWrap:te?"wrap":"nowrap",sx:{"& .jsonValue":{flex:te?"1 1 100%":"0 0 auto",width:te?"100%":"auto",minWidth:te?"auto":"150px"},"& .jsonKey":{flex:"0 0 auto",minWidth:"auto"}},children:[["object","array"].includes(Z)&&d.jsx(E.Box,{sx:{width:j===V?"18px":"",display:"inline-block"},children:d.jsx(XP,{uniqueKey:W,fieldValue:q})}),d.jsxs(E.Stack,{direction:"row",alignItems:A[W]?"flex-start":"center",justifyContent:"flex-start",className:"jsonKey",gap:1,children:[d.jsx(lo,{disabled:u,size:"xs",sx:{width:"130px"},id:i,placeholder:"key",value:z||"",tabIndex:Q+1,onChange:ae=>I(ae,z,W,F),"data-testid":`text-key-${z}`,error:!!A[W],errorMsg:A[W],helperText:A[W]}),d.jsx(NX,{viewOnly:u,uniqueKey:W,fieldValue:q,fieldKey:z,sourceData:F,"data-testid":`tools-${z}`,type:"object"})]}),d.jsx("span",{className:Z!=="number"&&Z!=="boolean"?"jsonValue":"",children:M(q,z,F,V,W)}),d.jsx("span",{children:d.jsx(E.Stack,{ml:1,alignItems:"center",direction:"row",sx:{position:"absolute",right:te?150:30,top:4},"data-testid":`delete-${z}`,children:d.jsx(E.IconButton,{disabled:u,onClick:()=>w(z,F),sx:{"& path":{fill:t.palette.neutral.solid.bg},"&:hover":{backgroundColor:"transparent","& path":{fill:t.palette.error[60]}}},children:d.jsx(Ue,{src:"ic_delete",sx:{"& path":{fill:t.palette.neutral.solid.bg}}})})})})]},W)})}),Y&&d.jsxs(E.Stack,{direction:"row",alignItems:"center",gap:1,sx:{mt:1,ml:2},"data-testid":`load-more-${G}`,children:[d.jsx(E.Button,{size:"small",variant:"outlined",onClick:()=>x(z=>Math.min(z+v,D.length)),sx:{textTransform:"none"},children:`Load ${Math.min(v,D.length-C)} more`}),d.jsx(E.Typography,{variant:"xsNormal",color:"text.secondary",children:`Showing ${C} of ${D.length}`})]}),d.jsx(E.Box,{"data-testid":`addItem-button-${G}`,ml:j===V?4.5:2,children:d.jsx(QP,{viewOnly:u,uniqueKey:G,deepLevel:V,sourceData:F,id:i,showSuggestions:o,excludePayloadSuggestions:l,onChange:z=>{c&&c(z)},setIsEditing:f},G)})]})};return d.jsx(ag.Provider,{value:{editObject:r,setEditObject:n,setTempData:s,onChangeType:R,onClickDelete:w,onChangeAllow:B,allowMap:p},children:m?d.jsx(E.Box,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"300px",children:d.jsx(E.CircularProgress,{})}):d.jsxs(E.Box,{sx:{width:"100%",position:"relative",minHeight:y||Et(a)?0:"100px",paddingTop:"2rem"},"data-testid":"root-collapsible-json",children:[!Et(r)&&d.jsx(E.Box,{onClick:H,"data-testid":"root-collapse-part",children:d.jsx(XP,{uniqueKey:"ROOT_KEY",fieldValue:r})}),!y&&!Et(r)&&d.jsx(E.Box,{sx:L}),!y&&X(r,1,"ROOT_KEY")]})})}const kX=_.lazy(()=>Promise.resolve().then(()=>nX)),FX=()=>d.jsx(E.Stack,{alignItems:"center",justifyContent:"center",sx:{p:2,minHeight:120},children:d.jsx(hi,{size:30})}),vBe=_.forwardRef(({data:e={},label:t,infoVisible:r=!1,viewOnly:n=!1,helperText:i,required:o=!1,suggestionsData:s,showSuggestions:a=!1,errorMsg:l="",id:u,excludePayloadSuggestions:c=!1,onChange:f,title:p="",isDynamic:h=!1,fullScreen:A=!1,handleValidate:g,name:m},O)=>{const[y,T]=_.useState("GUI"),[v,C]=_.useState("GUI"),[x,b]=_.useState("Static"),[w,R]=_.useState({}),[I,P]=_.useState(!0),[k,N]=_.useState(!0),[L,M]=_.useState(!1),[B,H]=_.useState({}),[j,X]=_.useState(""),[F,V]=_.useState({}),G=E.useTheme(),[D,$]=_.useState(!1),[U,Y]=_.useState(!1),[z,Q]=_.useState([]),W=_.useRef(!1),q=_.useCallback(he=>{const Ae=he.trim();return/^\{\{[^}]+\}\}$/.test(Ae)},[]),Z=_.useMemo(()=>typeof w=="string"&&q(w),[w,q]),te=[{title:"GUI",disabled:U||Z},{title:"Raw",disabled:U}],ae=_.useCallback(he=>{if(he==null||he==="")return{};if(typeof he=="string"){if(q(he))return he;try{return JSON.parse(he)}catch{return{}}}return Lo(he)},[q]);_.useEffect(()=>{const he=ae(e);if(R(he),H(he),V(he),typeof he=="string"&&q(he))X(he),W.current=!1,P(!1),N(!1),T("Raw"),C("Raw");else{const Ae=JSON.stringify(he,null,2);Ae==="{}"&&W.current?(X(""),W.current=!1):(X(Ae),W.current=!1)}},[e,ae,q]);const ne=_.useMemo(()=>nA(B),[B]),ue=_.useCallback(()=>{if(!ne){if(Q([]),g&&g([]),I)typeof F=="string"&&q(F)?X(F):X(JSON.stringify(F,null,2));else if(q(j))V(j),R(j),H(j);else try{const he=JSON.parse(j);V(he),R(he),H(he)}catch{}P(he=>!he)}},[ne,I,F,j,g,q]),Oe=_.useCallback(()=>{if(Q([]),g&&g([]),k)typeof w=="string"&&q(w)?X(w):X(JSON.stringify(w,null,2));else if(q(j))R(j),H(j),V(j);else try{const he=JSON.parse(j);R(he),H(he),V(he)}catch{}N(he=>!he)},[k,w,j,g,q]),Te=()=>{H(he=>{const Ae={...he};return delete Ae[""],Ae}),M(!L)},se=_.useCallback(he=>{const Ae=ae(he);R(Ae),H(Ae),V(Ae)},[ae]),ie=_.useCallback(he=>{W.current=he.trim()==="",X(he)},[]),J=_.useCallback(he=>{try{if(!he||he.trim()===""){se({}),f&&f({});return}if(q(he)){f&&f(he.trim());return}let Ae;if(typeof he=="string")try{Ae=JSON.parse(he)}catch{return}else Ae=he;se(Ae),f&&f(Ae)}catch{}},[se,f,q]),K=_.useCallback(()=>{hd(JSON.stringify(w,null,2),"Copied to clipboard"),$(!0),setTimeout(()=>$(!1),2e3)},[w]),re=_.useCallback(he=>{if(he&&he.length>0){const Ae=he.map(fe=>fe.message);Q(Ae)}else Q([]);g&&g(he)},[g]),le={border:"1px solid",borderColor:l?G.palette.error.main:G.palette.grey.outlined.border,borderRadius:2};return d.jsxs(E.Stack,{spacing:1,"data-testid":"json-gui",ref:O,children:[r&&d.jsx(TBe,{"data-testid":"json-info-msg",message:"We recommend you expand this editor to full view for the best experience."}),d.jsx(Co,{open:L,"data-testid":"json-gui-fullscreen-popup",handleClose:Te,title:t||"Global variables",content:d.jsxs(E.Stack,{sx:{width:"100%",height:"80vh"},children:[d.jsx(ss,{variant:"normal",tabs:[{title:"GUI"},{title:"Raw"}],selectedTab:v,sx:{height:24,width:"fit-content",ml:"auto",mb:1},setSelectedTab:()=>{Oe(),C(v==="GUI"?"Raw":"GUI")}}),d.jsxs(E.Box,{sx:{overflow:"auto",position:"relative",height:"100%",background:G.palette.background.paper,...k?{borderRadius:"4px",border:`1px solid ${G.palette.grey[200]}`,p:1}:{}},children:[k?d.jsx(E.Stack,{"data-testid":"json-gui-builder",sx:{"& .MuiPaper-root":{width:"100% !important",borderRadius:"8px !important"}},children:d.jsx(E.Stack,{sx:{width:"100%",height:"auto",position:"relative",top:"unset",left:"unset",zIndex:"auto",maxWidth:"1200px",overflow:typeof w=="object"&&Object.keys(w).length===0?"visible":"auto"},p:1,children:d.jsx(E.Stack,{children:d.jsx(E.Stack,{minHeight:typeof B=="object"&&Object.keys(B).length===1?50:"auto",children:typeof w=="object"&&typeof B=="object"&&d.jsx(LX,{viewOnly:n,editObject:w,setEditObject:R,setTempData:H,id:u,showSuggestions:a,tempData:B,excludePayloadSuggestions:c,onChange:he=>{V(he),f&&f(he)},setIsEditing:Y})})})})}):d.jsx(E.Box,{sx:{height:"100%",overflowY:n?"visible":"auto"},children:d.jsx(_.Suspense,{fallback:d.jsx(FX,{}),children:d.jsx(kX,{size:"lg",language:"json",viewOnly:n,handleChange:ie,handleBlur:J,value:j,id:"code-editor-gui-full",suggestionsData:s,required:o,enableJsonGuiValidation:!0,handleValidate:re,"data-testid":"json-gui-code-editor-full",sx:{border:"none"},height:"75vh",allowArrayAtRoot:!!(m&&m.endsWith("payload"))||!!(m&&m.includes(".payload"))})})}),d.jsx(E.Stack,{onClick:K,sx:{position:"absolute",top:6,right:6,cursor:"pointer"},children:d.jsx(E.Tooltip,{"data-testid":"json-copy-tooltip",title:D?"Copied!":"Copy JSON",children:d.jsx(E.IconButton,{"data-testid":"json-gui-copy",onClick:K,size:"small",children:d.jsx(Ue,{src:"ic_copy",width:15,height:15,sx:{path:{fill:G.palette.common.black}}})})})})]})]})}),d.jsxs(E.Stack,{children:[d.jsxs(E.Stack,{direction:"row",alignItems:"flex-end",justifyContent:"space-between",children:[d.jsx(gn,{label:t||"",required:o,description:i}),h&&d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],selectedTab:x,sx:{height:24},setSelectedTab:()=>{b(x==="Static"?"Dynamic":"Static")}})]}),I?d.jsxs(E.Stack,{children:[d.jsxs(E.Stack,{"data-testid":"json-gui-builder",sx:{...le},children:[d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,p:1.5,children:[d.jsx(E.Typography,{variant:"smNormal",children:p}),d.jsxs(E.Stack,{direction:"row",position:"relative",alignItems:"center",children:[d.jsx(ss,{variant:"normal",tabs:te,selectedTab:y,sx:{height:24},setSelectedTab:()=>{ue(),T(y==="GUI"?"Raw":"GUI")}}),A&&d.jsx(E.IconButton,{"data-testid":"json-gui-fullscreen-button",onClick:Te,sx:{ml:1,position:"absolute",top:44,right:0,zIndex:999},children:d.jsx(Ue,{src:"ic_maximize"})})]})]}),d.jsx(E.Divider,{}),d.jsx(E.Stack,{sx:{width:"100%",height:"auto",position:"relative",maxWidth:"600px",maxHeight:"calc(80vh - 306px)",overflow:"auto"},p:1,children:d.jsx(E.Stack,{children:typeof w=="object"&&typeof B=="object"&&d.jsx(LX,{viewOnly:n,editObject:w,setEditObject:R,setTempData:H,id:u,showSuggestions:a,tempData:B,excludePayloadSuggestions:c,onChange:he=>{V(he),f&&f(he)},setIsEditing:Y})})})]}),z.length>0?d.jsx(E.Box,{sx:{mt:1},children:z.map((he,Ae)=>d.jsx(E.FormHelperText,{error:!0,children:he},`validation-error-${he}-${Ae}`))}):l?d.jsx(E.FormHelperText,{error:!0,children:l}):null,i&&d.jsx(E.FormHelperText,{children:i})]}):d.jsxs(E.Box,{children:[d.jsxs(E.Box,{sx:{...le,opacity:n?.6:1},children:[d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,p:1.5,children:[d.jsx(E.Typography,{variant:"smNormal",children:p}),d.jsxs(E.Stack,{direction:"row",alignItems:"center",position:"relative",children:[d.jsx(ss,{variant:"normal",tabs:te,selectedTab:y,sx:{height:24},setSelectedTab:()=>{ue(),T(x==="GUI"?"Raw":"GUI")}}),A&&d.jsx(E.IconButton,{"data-testid":"json-gui-fullscreen-button",onClick:Te,sx:{ml:1,position:"absolute",top:44,right:0,zIndex:999},children:d.jsx(Ue,{src:"ic_maximize"})})]})]}),d.jsx(E.Divider,{}),d.jsx(E.Box,{sx:{height:"100%",overflowY:n?"visible":"auto"},children:d.jsx(_.Suspense,{fallback:d.jsx(FX,{}),children:d.jsx(kX,{size:"lg",language:"json",viewOnly:n,handleChange:ie,handleBlur:J,value:j,id:`code-editor-gui-${u}`,suggestionsData:s,error:!!l,required:o,enableJsonGuiValidation:!0,handleValidate:re,"data-testid":"json-gui-code-editor",showSuggestions:a,codeEditorStyles:{border:"none"},allowArrayAtRoot:!!(m&&m.endsWith("payload"))||!!(m&&m.includes(".payload"))})})})]}),z.length>0?d.jsx(E.Box,{sx:{mt:1},children:z.map((he,Ae)=>d.jsx(E.FormHelperText,{error:!0,children:he},`validation-error-${he}-${Ae}`))}):l?d.jsx(E.FormHelperText,{error:!0,children:l}):null,i&&d.jsx(E.FormHelperText,{children:i})]})]})]})}),TBe=({message:e})=>{const t=E.useTheme();return d.jsxs(E.Stack,{alignItems:"center",spacing:1,direction:"row",sx:{background:t.palette.success[10],borderRadius:2,border:"1px solid",borderColor:t.palette.success[40]},p:1,children:[d.jsx(Ue,{src:"ic_success",sx:{path:{fill:t.palette.success.main}}}),d.jsx(E.Typography,{variant:"xsMedium",children:e})]})},MX=Gi(vBe),Wu=e=>{const{name:t,label:r,viewOnly:n=!1,validationRules:i={},required:o=!1,id:s,description:a,error:l,suggestionsData:u,...c}=e,{trigger:f,control:p}=Rr(),h=_.useRef(null),A=_.useRef([]),g=_.useCallback(y=>{const T=y?.length>0?y.map(v=>v.message):[];A.current=T,f(t)},[t,f]),m=_.useCallback(async y=>{if(i.validate){const v=typeof i.validate=="function"?await i.validate(y):!0;if(v!==!0)return v}const T=A.current;return T.length>0?T[0]:!0},[i.validate]),O=_.useMemo(()=>({...i,validate:m}),[i,m]);return d.jsx(pr,{name:t,control:p,rules:O,render:({field:y,fieldState:{error:T}})=>d.jsx(MX,{...y,ref:h,label:r,data:y.value,viewOnly:n,suggestionsData:u,helperText:a,errorMsg:T?.message||l?.errorMsg,required:o,id:s,showSuggestions:!0,handleValidate:g,onChange:v=>{f(t),y.onChange(v)},...c})})},SBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{type:n,openIntegrationDrawer:i,TESSERACT_MAIN_URL:o,ENTITY_ID:s,FRONTEND_URL:a,INTEGRATION_DATA:l,viewOnly:u=!1,id:c}=e,[f,p]=_.useState([]),[h,A]=_.useState(!1),{control:g,watch:m,setValue:O,resetField:y}=Rr(),T=m("properties.auth_type"),v=()=>{A(!0);const C={page_size:999,current_page:1,type:"SOURCE"},x=Xt(o,"/v1/integrations/entity/AUTHENTICATION");zt.get(x,{params:C}).then(({data:b})=>{const w=ro(b.data,["integration_meta"]),R=dT(w);p(fT(R))}).catch(b=>{sr(b,r)}).finally(()=>{A(!1)})};return _.useEffect(()=>{v()},[]),_.useEffect(()=>{l?._id&&l?.meta?.entity==="AUTHENTICATION"&&(v(),O("properties.auth_id",l._id,{shouldValidate:!0}))},[l]),_.useEffect(()=>{!Et(T)&&T!==Nl.NONE?v():y("properties.auth_id")},[T]),d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.auth_type",control:g,meta:{options:zO,displayName:"Authentication Type",searchFieldPlaceholder:"Search authentication type",placeholder:"Select Authentication Type"},validationRules:{required:"Auth type is required"},id:"auth_type",viewOnly:u,required:!0,onChange:C=>{O("properties.auth_type",C.target.value),O("properties.auth_id","")}})}),T&&T!==Nl.NONE&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.auth_id",control:g,meta:{options:yn(f),displayProps:{loading:h},displayName:"Authentication",value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:o,FRONTEND_URL:a,ENTITY_ID:s,openIntegrationDrawer:i,addNewButtonText:"Add new",searchFieldPlaceholder:"Search authentication",authType:"AUTHENTICATION",placeholder:"Select Authentication"},validationRules:{required:"Authentication is required"},viewOnly:u,id:n,groupBy:"integration_meta.auth_type"})})]})}),d.jsx(E.Divider,{}),d.jsx(En,{children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Wu,{name:"properties.test_payload",control:g,label:"Test Trigger Payload",viewOnly:u,showSuggestions:!0,excludePayloadSuggestions:!0,id:c})})})]})}),xBe=_.forwardRef(({placeholder:e="",onChange:t,value:r,height:n="100%",width:i="100%",label:o="",required:s=!1,errorMsg:a,helperText:l="",nodeId:u="",name:c,isLoop:f,viewOnly:p=!1,hideLabel:h=!1},A)=>{const g=E.useTheme(),{MCP_INTEGRATION_FORM:m}=aa(),{getNodes:O}=Rt.useReactFlow(),{selectedActivityId:y,aiGeneratedFieldMap:T}=ct.useSelector(G=>G.canvas),v=ao(l),[C,x]=_.useState(""),b=_.useRef(null),w=_.useRef(null),[R,I]=_.useState(""),P=G=>{x(G.target.value)},k=()=>{if(C.trim()!==""){const D=[...Array.isArray(r)?r:[],C.trim().split(",")[0]],$=new Set(D);t([...$]),x("")}},N=G=>{G.preventDefault();const{keyCode:D}=G;[13,32,188].includes(D)&&k()},L=G=>()=>{typeof r=="object"&&Array.isArray(r)&&t(r.filter(D=>D!==G))},M=(G,D)=>{G?.stopPropagation?.(),G?.preventDefault?.(),Array.isArray(r)&&t(r.filter($=>$!==D))},B=G=>{G.keyCode===8&&C.trim()===""?Array.isArray(r)&&r.length>0&&L(r[r.length-1])():G.key==="Enter"&&G.preventDefault()},H=()=>{b.current?.focus()},j=G=>{G.stopPropagation()};_.useEffect(()=>(document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}),[]),_.useEffect(()=>{I(typeof r=="string"?"Dynamic":"Static")},[r]);const X=(()=>{const G=O()||[],D=String(u||""),$=G.find(W=>W?.selected),U=G.find(W=>String(W?.id)===D)||G.find(W=>String(W?.id)===String(y))||$,Y=String(U?.id||""),Q=(T||{})[Y]||(T||{})[String(y||"")]||(T||{})[D];return Q&&typeof Q=="object"?Q:{}})(),F=String(c||"").replace(/^properties\./,""),V=!!F&&F in X&&r!==void 0&&r!==null&&(typeof r!="string"||r.trim()!=="")&&(!Array.isArray(r)||r.length>0);return d.jsx(E.FormControl,{fullWidth:!0,children:d.jsxs(E.Stack,{children:[o&&!h&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-end",children:[d.jsx(gn,{required:s,label:o,description:v}),!p&&!m&&d.jsx(E.Stack,{pb:.5,children:d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],selectedTab:R,setSelectedTab:()=>{R==="Static"?(t(""),I("Dynamic")):(t([]),I("Static"))}})})]}),typeof r=="object"&&Array.isArray(r)?d.jsxs(d.Fragment,{children:[d.jsxs(E.Stack,{spacing:1,border:1,sx:{position:"relative",borderColor:a?g.palette.error.main:g.palette.grey[300],":focus-within":{border:`1px solid ${g.palette.neutral.plain}`,transition:"all 100ms ease-in"}},height:n,width:i,borderRadius:2,px:1,py:0,maxHeight:"20rem",overflow:"auto",onClick:H,children:[V&&d.jsx(E.Stack,{sx:{position:"absolute",right:"1px",top:1,bottom:1,width:"15%",minWidth:64,maxWidth:96,borderTopRightRadius:8,borderBottomRightRadius:8,pointerEvents:"none",zIndex:0,background:`linear-gradient(90deg, ${E.alpha(g.palette.primary[5],0)} 0%, ${E.alpha(g.palette.primary[5],.35)} 62%, ${E.alpha(g.palette.primary[5],.9)} 100%)`}}),V&&d.jsx(E.Stack,{sx:{position:"absolute",right:12,top:11,zIndex:3,pointerEvents:"none",width:18,height:18,alignItems:"center",justifyContent:"center"},children:d.jsx(Ue,{src:"ic_AI",width:18,height:18,sx:{display:"block","& svg path":{fill:`${g.palette.primary.main} !important`,fillOpacity:"1 !important"}}})}),d.jsxs(E.Stack,{direction:"row",flexWrap:"nowrap",gap:1,alignItems:"center",ref:w,sx:{maxWidth:"100%",overflow:"hidden",minHeight:40,pr:V?4.75:0,position:"relative",zIndex:1},children:[(()=>{if(!r||!Array.isArray(r)||r.length===0)return null;const{visible:G,extra:D,hiddenSelections:$}=Ub(r||[],w);return d.jsxs(d.Fragment,{children:[G.map((U,Y)=>d.jsx(E.Chip,{label:U,disabled:p,deleteIcon:d.jsx(Ue,{sx:{"& svg":{width:16,height:16}},src:"ic_close"}),onDelete:L(U),sx:{flex:"0 0 auto",minWidth:"40px"}},`input-chip-${U}-${Y}`)),D>0&&d.jsx(Bw,{hiddenSelections:$,extra:D,handleChipDelete:M})]})})(),d.jsx(E.InputBase,{ref:A,fullWidth:!0,autoComplete:"off",placeholder:e,value:C,onChange:P,inputRef:b,onKeyUp:N,readOnly:p,disabled:p,onKeyDown:B,onBlur:()=>k(),sx:{"&.MuiInput-root":{border:"none",flex:1},"& .MuiInputBase-input":{padding:"4px"},":focus":{border:"none"},":focus-within":{border:"none",transition:"none",boxShadow:"none"},":active":{backgroundColor:"transparent"}}})]})]}),a&&d.jsx(E.FormHelperText,{error:!0,children:a})]}):d.jsx(lo,{id:u,language:"plaintext",required:!0,value:r,isLoop:f,viewOnly:p,editorId:`${u}-${c}`,showSuggestions:!0,placeholder:e,handleChange:G=>{t(G)},errorMsg:a,loading:null})]})})}),Qc=vc(xBe),BX=({field:e,type:t,nodeId:r,isLoop:n,viewOnly:i})=>{const o=E.useTheme(),{watch:s,control:a,setValue:l}=Rr(),u=s(e),c=p=>{l(e,u.filter((h,A)=>p!==A))},f=_.useMemo(()=>u?.map((p,h)=>`${r}-${t}-${Date.now()}-${h}`),[r,t,u?.length]);return d.jsx(d.Fragment,{children:u&&u?.map((p,h)=>d.jsxs(E.Grid,{container:!0,sx:{mb:1,py:1},alignItems:"flex-end",justifyContent:"space-between",children:[d.jsx(E.Grid,{item:!0,xs:11,children:d.jsx(kr,{autoFocus:!0,id:r,name:`${e}.${h}`,control:a,meta:{displayName:`Attachment ${h+1}`,description:_n(t,"attachments"),placeholder:`Attachment ${h+1}`},editorId:`${t}-attachment_${h}`,isLoop:n,viewOnly:i})}),d.jsx(E.Grid,{item:!0,xs:.5,sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:u.length>0&&d.jsx(E.IconButton,{sx:{p:.75,width:28,height:28,"& path":{fill:o.palette.neutral.solid.bg},"&:hover path":{fill:o.palette.error[60]},"&:hover":{backgroundColor:"transparent"}},disabled:i,onClick:()=>c(h),children:d.jsx(Ue,{src:"ic_delete",width:20,height:20})})})]},f[h]))})},bBe=e=>{const{field:t,viewOnly:r}=e,{watch:n,setValue:i,unregister:o}=Rr(),{setFieldControlState:s}=aa(),a=n(t),[l,u]=_.useState("BOLTIC_AI"),c=_.useRef([]);_.useEffect(()=>{a==="BOLTIC_AI"||a==="BOLTIC_AI_IGNORE"?u(a):Array.isArray(a)&&u("specific")},[a]);const f=p=>{const h=p.target.value;if(u(h),s(t,h),h==="specific"){const A=Array.isArray(a)&&a.length>0?a:c.current.length>0?c.current:[""];i(t,A)}else Array.isArray(a)&&(c.current=a,a.forEach((A,g)=>{o?.(`${t}.${g}`)}),o?.(t)),i(t,h)};return d.jsxs(E.Stack,{spacing:1.5,mt:.5,children:[d.jsx(E.FormControl,{fullWidth:!0,disabled:r,children:d.jsxs(E.Select,{value:l,onChange:f,children:[d.jsx(E.MenuItem,{sx:{py:.8},value:"BOLTIC_AI",children:"Have AI generate a value for this field"}),d.jsx(E.MenuItem,{sx:{py:.8},value:"BOLTIC_AI_IGNORE",children:"Do not include a value for this field"}),d.jsx(E.MenuItem,{sx:{py:.8},value:"specific",children:"Set a specific value for this field"})]})}),l==="specific"&&d.jsx(BX,{...e})]})},qP=e=>{const{MCP_INTEGRATION_FORM:t}=aa();return t?d.jsx(bBe,{...e}):d.jsx(BX,{...e})},CBe=_.forwardRef((e,t)=>{const{VORTEX_MAIN_URL:r,ENTITY_ID:n,TESSERACT_MAIN_URL:i,WORKFLOW_URLS:o,type:s,id:a,isLoop:l,FRONTEND_URL:u,suggestionsData:c,INTEGRATION_DATA:f,viewOnly:p=!1,openIntegrationDrawer:h}=e,A=ct.useDispatch(),g=E.useTheme(),{control:m,setValue:O,watch:y,getValues:T,formState:{errors:v}}=Rr(),{BOLTIC_EMAIL_DOMAIN:C}=o,x=y("properties"),[b,w]=_.useState([]),[R,I]=_.useState(!1),{loopSuggestionsData:P={}}=ct.useSelector(X=>X.loopActivity),k=_.useCallback(()=>{I(!0);const X={page_size:999,current_page:1,type:"DESTINATION"},F=Xt(i,"/v1/integrations/entity/EMAIL");zt.get(F,{params:X}).then(({data:V})=>{w(ro(V.data))}).catch(V=>{sr(V,A)}).finally(()=>{I(!1)})},[]),N=C?.split(",").map(X=>({title:`@${X.trim()}`,value:`@${X.trim()}`})),[L,M]=_.useState(()=>x.from?`@${x.from?.split("@")[1]}`:N[0]?.value),[B,H]=_.useState(()=>x.from?.split("@")[0]||"");_.useEffect(()=>{k()},[]),_.useEffect(()=>{f?._id&&f?.meta?.entity==="EMAIL"&&(k(),O("properties.email_auth_id",f._id,{shouldValidate:!0}))},[f]);const j=X=>{O(`properties.${X}`,[...T(`properties.${X}`)||[],""])};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:x.integration_slug==="blt-int.boltic-email"?d.jsxs(E.Stack,{direction:"row",children:[d.jsx(E.Box,{sx:{width:"60%"},children:d.jsx(kr,{id:a,name:"properties.from",control:m,meta:{displayName:"From",description:_n(s,"from"),renderFieldValue:()=>B},viewOnly:p,editorId:`${s}-from`,showSuggestions:!0,isLoop:l,handleChange:X=>{const{value:F}=X;O("properties.from",`${F}${L}`),H(F)},sx:{"& .MuiPaper-root":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"}}})}),d.jsx(E.Box,{sx:{width:"40%"},children:d.jsx(Yt,{name:"properties.from",control:m,meta:{options:N,displayName:"Domain",searchFieldPlaceholder:"Search Domain"},viewOnly:p,id:s,renderFieldValue:()=>L,handleChange:X=>{const{value:F}=X;O("properties.from",`${B}${F}`),M(F)},sx:{"& .MuiOutlinedInput-notchedOutline":{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})})]}):d.jsx(Yt,{required:!0,name:"properties.email_auth_id",control:m,meta:{options:yn(b),displayProps:{loading:R},displayName:"Email Account",value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:i,FRONTEND_URL:u,ENTITY_ID:n,openIntegrationDrawer:h,addNewButtonText:"Add new account",searchFieldPlaceholder:"Search email account",authType:"EMAIL",description:"Select Email secret here.",placeholder:"Select Email Account"},validationRules:{required:"Email account is required"},viewOnly:p,id:s})})})}),(x.email_auth_id||x.integration_slug==="blt-int.boltic-email")&&d.jsx(E.Divider,{}),(x.email_auth_id||x.integration_slug==="blt-int.boltic-email")&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:!0,id:a,name:"properties.subject",control:m,meta:{displayName:"Subject",description:"Enter the subject to send in the email.",placeholder:"Type or add suggestion"},validationRules:{required:"Subject is required"},viewOnly:p,editorId:`${s}-subject-${l}`,showSuggestions:!0,isLoop:l})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.to",control:m,rules:{required:"To is required",validate:X=>Array.isArray(X)&&!X.every(V=>fu(V))?"To must have all the valid emails":!0},render:({field:X})=>d.jsx(Qc,{...X,required:!0,nodeId:a,label:"To",name:"to",viewOnly:p,isLoop:l,placeholder:"Enter email",onChange:F=>{X.onChange(typeof F=="string"?F:[...F])},errorMsg:v.properties?.to?.message})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.email_template",control:m,rules:{required:"Email body is required"},render:({field:X})=>d.jsx(Fi,{...X,label:"Email body",suggestionLabel:"Email body",id:`${s}-email_template`,activityType:s,VORTEX_MAIN_URL:r,ENTITY_ID:n,size:"md",viewOnly:p,showSuggestions:!0,language:"html",suggestionsData:l?P:c,showExpandOption:!0,showHtmlPreview:!0,errorMsg:v.properties?.email_template?.message,error:!!v.properties?.email_template?.message,handleChange:F=>{X.onChange(F)},required:!0})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.cc",control:m,rules:{validate:X=>Array.isArray(X)&&!X.every(V=>fu(V))?"Cc must have all the valid emails":!0},render:({field:X})=>d.jsx(Qc,{...X,nodeId:a,label:"Cc",name:"cc",viewOnly:p,placeholder:"Enter email",isLoop:l,onChange:F=>{X.onChange(typeof F=="string"?F:[...F])},errorMsg:v.properties?.cc?.message})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.bcc",control:m,rules:{validate:X=>Array.isArray(X)&&!X.every(V=>fu(V))?"Bcc must have all the valid emails":!0},render:({field:X})=>d.jsx(Qc,{...X,nodeId:a,label:"Bcc",name:"bcc",isLoop:l,viewOnly:p,placeholder:"Enter email",onChange:F=>{X.onChange(typeof F=="string"?F:[...F])},errorMsg:v.properties?.bcc?.message})})}),d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsxs(E.Box,{sx:{display:"flex",alignItems:"center"},children:[d.jsx(E.FormControl,{fullWidth:!0,sx:{"& > .MuiStack-root > .MuiStack-root":{pb:0}},children:d.jsx(gn,{label:"Attachments",description:"The maximum attachment limit is 25Mb"})}),d.jsx(E.IconButton,{disabled:p,onClick:()=>j("attachments"),sx:{float:"right",p:.75,border:X=>`1px solid ${X.palette.grey.brainstem}`,fontSize:X=>X.typography.mdNormal.fontSize},color:"primary",children:d.jsx(Ue,{src:"ic_plus",width:g.icons.md,height:g.icons.md,sx:{svg:{path:{fill:g.palette.primary.main}}}})})]}),d.jsx(qP,{nodeId:a,type:s,isLoop:l,viewOnly:p,field:"properties.attachments"})]}),!l&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:p,type:s})})]})})]})}),_Be=Gi(CBe),wBe=_.forwardRef((e,t)=>{const{workflow:r}=ct.useSelector(x=>x.workflows),n=ct.useDispatch(),{type:i,VORTEX_MAIN_URL:o,ENTITY_ID:s,suggestionsData:a,viewOnly:l=!1,id:u}=e,[c,f]=_.useState([]),[p,h]=_.useState(!1),{control:A,setValue:g,watch:m}=Rr(),O=m("properties"),y=E.useTheme(),T=m("properties.child_workflow_id"),v=m("properties.child_workflow_name"),C=async(x="")=>{h(!0);const b={include:["scheduled","published"],limit:100,page:1,name:x};r&&(b.draft_id=r?.id);const w=Xt(o,`/v1.0/${s}/workflows`);zt.get(w,{params:b}).then(({data:R})=>{f(()=>T&&!R.data.find(I=>I.id===T)?[{id:T,name:v,version:O.version},...R.data]:R.data)}).catch(R=>{sr(R,n)}).finally(()=>{h(!1)})};return _.useEffect(()=>{C()},[]),_.useEffect(()=>{if(!T)g("properties",{...O,child_workflow_id:"",version:"",child_workflow_name:""});else{const x=c.find(b=>b.id===T);g("properties",{...O,version:x?.version,child_workflow_name:x?.name})}},[T]),d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.child_workflow_id",control:A,meta:{options:yn(c),displayName:"Workflow",searchFieldPlaceholder:"Search workflow",description:"Select the child workflow that you want to run",displayProps:{loading:p},placeholder:"Select Workflow"},validationRules:{required:"Workflow is required"},viewOnly:l,id:"child_workflow_id",handleChange:x=>{const{value:b}=x;if(b===""){const w=m("properties");g("properties",{...w,child_workflow_id:"",child_workflow_name:"",version:""})}},renderValueUi:x=>{if(!x)return d.jsx(E.Typography,{sx:{fontSize:"14px",color:y.palette.neutral.solid.bg,fontFamily:"inherit",":hover":{color:y.palette.neutral.main}},children:"Select Workflow"});const b=yn(c)?.find(w=>w?.value===x);return d.jsxs(E.Stack,{direction:"row",gap:1,children:[d.jsx(E.Typography,{sx:{fontSize:"14px",color:y.palette.text.primary,fontFamily:"inherit",...uu,maxWidth:"95%"},children:b?.title}),d.jsx(E.Chip,{sx:{fontSize:11},size:"small",label:`v${b?.version}`})]})},renderOption:(x,b)=>{const{title:w,value:R,version:I}=b;return d.jsx(E.MenuItem,{value:R,sx:{p:"8px !important",mx:1,height:"auto","&.Mui-selected":{"& .MuiTypography-root":{color:y.palette.primary.main}}},children:d.jsxs(E.Stack,{width:"100%",direction:"row",flexWrap:"wrap",sx:{...vf,gap:1},children:[d.jsx(E.Typography,{sx:{fontSize:"1rem",fontWeight:400,color:y.palette.text.primary,whiteSpace:"normal",wordBreak:"break-word",maxWidth:"88%"},children:w}),d.jsx(E.Chip,{sx:{fontSize:11},size:"small",label:`v${I}`})]})},R)}})})})}),O.child_workflow_id&&d.jsx(E.Divider,{}),O.child_workflow_id&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Wu,{name:"properties.payload",label:"Payload",viewOnly:l,id:u,suggestionsData:a,fullScreen:!0,showSuggestions:!0,helperText:"Provide the data needed for the child workflow, which will be available under the 'payload' property in the child workflow. This should always be an object. If you provide an array, only the first element will be used.",validationRules:{required:"Payload is required"}})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:l,type:i})})]})})]})}),IBe=Gi(wBe,"");var lg={exports:{}};lg.exports;var jX;function DBe(){return jX||(jX=1,(function(e,t){var r=200,n="Expected a function",i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Function]",A="[object GeneratorFunction]",g="[object Map]",m="[object Number]",O="[object Object]",y="[object Promise]",T="[object RegExp]",v="[object Set]",C="[object String]",x="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",R="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",k="[object Int8Array]",N="[object Int16Array]",L="[object Int32Array]",M="[object Uint8Array]",B="[object Uint8ClampedArray]",H="[object Uint16Array]",j="[object Uint32Array]",X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,V=/^\./,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,D=/[\\^$.*+?()[\]{}|]/g,$=/\\(\\)?/g,U=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,z={};z[I]=z[P]=z[k]=z[N]=z[L]=z[M]=z[B]=z[H]=z[j]=!0,z[l]=z[u]=z[w]=z[c]=z[R]=z[f]=z[p]=z[h]=z[g]=z[m]=z[O]=z[T]=z[v]=z[C]=z[b]=!1;var Q=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,W=typeof self=="object"&&self&&self.Object===Object&&self,q=Q||W||Function("return this")(),Z=t&&!t.nodeType&&t,te=Z&&!0&&e&&!e.nodeType&&e,ae=te&&te.exports===Z,ne=ae&&Q.process,ue=(function(){try{return ne&&ne.binding("util")}catch{}})(),Oe=ue&&ue.isTypedArray;function Te(xe,We,dt,Tt){for(var qt=-1,Qt=xe?xe.length:0;++qt<Qt;){var or=xe[qt];We(Tt,or,dt(or),xe)}return Tt}function se(xe,We){for(var dt=-1,Tt=xe?xe.length:0;++dt<Tt;)if(We(xe[dt],dt,xe))return!0;return!1}function ie(xe){return function(We){return We?.[xe]}}function J(xe,We){for(var dt=-1,Tt=Array(xe);++dt<xe;)Tt[dt]=We(dt);return Tt}function K(xe){return function(We){return xe(We)}}function re(xe,We){return xe?.[We]}function le(xe){var We=!1;if(xe!=null&&typeof xe.toString!="function")try{We=!!(xe+"")}catch{}return We}function he(xe){var We=-1,dt=Array(xe.size);return xe.forEach(function(Tt,qt){dt[++We]=[qt,Tt]}),dt}function Ae(xe,We){return function(dt){return xe(We(dt))}}function fe(xe){var We=-1,dt=Array(xe.size);return xe.forEach(function(Tt){dt[++We]=Tt}),dt}var Se=Array.prototype,ge=Function.prototype,ye=Object.prototype,je=q["__core-js_shared__"],Qe=(function(){var xe=/[^.]+$/.exec(je&&je.keys&&je.keys.IE_PROTO||"");return xe?"Symbol(src)_1."+xe:""})(),$e=ge.toString,Je=ye.hasOwnProperty,rt=ye.toString,tt=RegExp("^"+$e.call(Je).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=q.Symbol,Ve=q.Uint8Array,He=ye.propertyIsEnumerable,Ee=Se.splice,_e=Ae(Object.keys,Object),we=Gn(q,"DataView"),ee=Gn(q,"Map"),de=Gn(q,"Promise"),be=Gn(q,"Set"),Ge=Gn(q,"WeakMap"),Ne=Gn(Object,"create"),Me=Be(we),mt=Be(ee),St=Be(de),De=Be(be),nt=Be(Ge),ut=Ie?Ie.prototype:void 0,Ot=ut?ut.valueOf:void 0,It=ut?ut.toString:void 0;function Mt(xe){var We=-1,dt=xe?xe.length:0;for(this.clear();++We<dt;){var Tt=xe[We];this.set(Tt[0],Tt[1])}}function Dt(){this.__data__=Ne?Ne(null):{}}function Fe(xe){return this.has(xe)&&delete this.__data__[xe]}function Ye(xe){var We=this.__data__;if(Ne){var dt=We[xe];return dt===i?void 0:dt}return Je.call(We,xe)?We[xe]:void 0}function Xe(xe){var We=this.__data__;return Ne?We[xe]!==void 0:Je.call(We,xe)}function at(xe,We){var dt=this.__data__;return dt[xe]=Ne&&We===void 0?i:We,this}Mt.prototype.clear=Dt,Mt.prototype.delete=Fe,Mt.prototype.get=Ye,Mt.prototype.has=Xe,Mt.prototype.set=at;function yt(xe){var We=-1,dt=xe?xe.length:0;for(this.clear();++We<dt;){var Tt=xe[We];this.set(Tt[0],Tt[1])}}function vt(){this.__data__=[]}function $t(xe){var We=this.__data__,dt=vr(We,xe);if(dt<0)return!1;var Tt=We.length-1;return dt==Tt?We.pop():Ee.call(We,dt,1),!0}function Re(xe){var We=this.__data__,dt=vr(We,xe);return dt<0?void 0:We[dt][1]}function it(xe){return vr(this.__data__,xe)>-1}function et(xe,We){var dt=this.__data__,Tt=vr(dt,xe);return Tt<0?dt.push([xe,We]):dt[Tt][1]=We,this}yt.prototype.clear=vt,yt.prototype.delete=$t,yt.prototype.get=Re,yt.prototype.has=it,yt.prototype.set=et;function Pe(xe){var We=-1,dt=xe?xe.length:0;for(this.clear();++We<dt;){var Tt=xe[We];this.set(Tt[0],Tt[1])}}function st(){this.__data__={hash:new Mt,map:new(ee||yt),string:new Mt}}function gt(xe){return sn(this,xe).delete(xe)}function Zt(xe){return sn(this,xe).get(xe)}function dr(xe){return sn(this,xe).has(xe)}function Mr(xe,We){return sn(this,xe).set(xe,We),this}Pe.prototype.clear=st,Pe.prototype.delete=gt,Pe.prototype.get=Zt,Pe.prototype.has=dr,Pe.prototype.set=Mr;function hn(xe){var We=-1,dt=xe?xe.length:0;for(this.__data__=new Pe;++We<dt;)this.add(xe[We])}function dn(xe){return this.__data__.set(xe,i),this}function An(xe){return this.__data__.has(xe)}hn.prototype.add=hn.prototype.push=dn,hn.prototype.has=An;function lr(xe){this.__data__=new yt(xe)}function _r(){this.__data__=new yt}function wn(xe){return this.__data__.delete(xe)}function Ft(xe){return this.__data__.get(xe)}function Jt(xe){return this.__data__.has(xe)}function $r(xe,We){var dt=this.__data__;if(dt instanceof yt){var Tt=dt.__data__;if(!ee||Tt.length<r-1)return Tt.push([xe,We]),this;dt=this.__data__=new Pe(Tt)}return dt.set(xe,We),this}lr.prototype.clear=_r,lr.prototype.delete=wn,lr.prototype.get=Ft,lr.prototype.has=Jt,lr.prototype.set=$r;function Cr(xe,We){var dt=rn(xe)||wr(xe)?J(xe.length,String):[],Tt=dt.length,qt=!!Tt;for(var Qt in xe)Je.call(xe,Qt)&&!(qt&&(Qt=="length"||zs(Qt,Tt)))&&dt.push(Qt);return dt}function vr(xe,We){for(var dt=xe.length;dt--;)if(Xr(xe[dt][0],We))return dt;return-1}function Fr(xe,We,dt,Tt){return Vr(xe,function(qt,Qt,or){We(Tt,qt,dt(qt),or)}),Tt}var Vr=Ca(Cn),Br=Dl();function Cn(xe,We){return xe&&Br(xe,We,Ke)}function Sn(xe,We){We=Xs(We,xe)?[We]:ti(We);for(var dt=0,Tt=We.length;xe!=null&&dt<Tt;)xe=xe[me(We[dt++])];return dt&&dt==Tt?xe:void 0}function Ln(xe){return rt.call(xe)}function Ti(xe,We){return xe!=null&&We in Object(xe)}function eo(xe,We,dt,Tt,qt){return xe===We?!0:xe==null||We==null||!so(xe)&&!ri(We)?xe!==xe&&We!==We:en(xe,We,eo,dt,Tt,qt)}function en(xe,We,dt,Tt,qt,Qt){var or=rn(xe),gr=rn(We),mr=u,Ir=u;or||(mr=Si(xe),mr=mr==l?O:mr),gr||(Ir=Si(We),Ir=Ir==l?O:Ir);var qr=mr==O&&!le(xe),jr=Ir==O&&!le(We),nn=mr==Ir;if(nn&&!qr)return Qt||(Qt=new lr),or||to(xe)?rs(xe,We,dt,Tt,qt,Qt):pi(xe,We,mr,dt,Tt,qt,Qt);if(!(qt&s)){var Zr=qr&&Je.call(xe,"__wrapped__"),Ui=jr&&Je.call(We,"__wrapped__");if(Zr||Ui){var Wo=Zr?xe.value():xe,Ds=Ui?We.value():We;return Qt||(Qt=new lr),dt(Wo,Ds,Tt,qt,Qt)}}return nn?(Qt||(Qt=new lr),Rl(xe,We,dt,Tt,qt,Qt)):!1}function To(xe,We,dt,Tt){var qt=dt.length,Qt=qt;if(xe==null)return!Qt;for(xe=Object(xe);qt--;){var or=dt[qt];if(or[2]?or[1]!==xe[or[0]]:!(or[0]in xe))return!1}for(;++qt<Qt;){or=dt[qt];var gr=or[0],mr=xe[gr],Ir=or[1];if(or[2]){if(mr===void 0&&!(gr in xe))return!1}else{var qr=new lr,jr;if(!(jr===void 0?eo(Ir,mr,Tt,o|s,qr):jr))return!1}}return!0}function oe(xe){if(!so(xe)||So(xe))return!1;var We=kn(xe)||le(xe)?tt:U;return We.test(Be(xe))}function Ce(xe){return ri(xe)&&Qi(xe.length)&&!!z[rt.call(xe)]}function ze(xe){return typeof xe=="function"?xe:xe==null?pt:typeof xe=="object"?rn(xe)?er(xe[0],xe[1]):Pt(xe):Ut(xe)}function lt(xe){if(!Is(xe))return _e(xe);var We=[];for(var dt in Object(xe))Je.call(xe,dt)&&dt!="constructor"&&We.push(dt);return We}function Pt(xe){var We=zn(xe);return We.length==1&&We[0][2]?au(We[0][0],We[0][1]):function(dt){return dt===xe||To(dt,xe,We)}}function er(xe,We){return Xs(xe)&&Go(We)?au(me(xe),We):function(dt){var Tt=pe(dt,xe);return Tt===void 0&&Tt===We?Le(dt,xe):eo(We,Tt,void 0,o|s)}}function Yr(xe){return function(We){return Sn(We,xe)}}function Kr(xe){if(typeof xe=="string")return xe;if(zi(xe))return It?It.call(xe):"";var We=xe+"";return We=="0"&&1/xe==-1/0?"-0":We}function ti(xe){return rn(xe)?xe:lc(xe)}function Mn(xe,We){return function(dt,Tt){var qt=rn(dt)?Te:Fr,Qt={};return qt(dt,xe,ze(Tt),Qt)}}function Ca(xe,We){return function(dt,Tt){if(dt==null)return dt;if(!mn(dt))return xe(dt,Tt);for(var qt=dt.length,Qt=-1,or=Object(dt);++Qt<qt&&Tt(or[Qt],Qt,or)!==!1;);return dt}}function Dl(xe){return function(We,dt,Tt){for(var qt=-1,Qt=Object(We),or=Tt(We),gr=or.length;gr--;){var mr=or[++qt];if(dt(Qt[mr],mr,Qt)===!1)break}return We}}function rs(xe,We,dt,Tt,qt,Qt){var or=qt&s,gr=xe.length,mr=We.length;if(gr!=mr&&!(or&&mr>gr))return!1;var Ir=Qt.get(xe);if(Ir&&Qt.get(We))return Ir==We;var qr=-1,jr=!0,nn=qt&o?new hn:void 0;for(Qt.set(xe,We),Qt.set(We,xe);++qr<gr;){var Zr=xe[qr],Ui=We[qr];if(Tt)var Wo=or?Tt(Ui,Zr,qr,We,xe,Qt):Tt(Zr,Ui,qr,xe,We,Qt);if(Wo!==void 0){if(Wo)continue;jr=!1;break}if(nn){if(!se(We,function(Ds,Xi){if(!nn.has(Xi)&&(Zr===Ds||dt(Zr,Ds,Tt,qt,Qt)))return nn.add(Xi)})){jr=!1;break}}else if(!(Zr===Ui||dt(Zr,Ui,Tt,qt,Qt))){jr=!1;break}}return Qt.delete(xe),Qt.delete(We),jr}function pi(xe,We,dt,Tt,qt,Qt,or){switch(dt){case R:if(xe.byteLength!=We.byteLength||xe.byteOffset!=We.byteOffset)return!1;xe=xe.buffer,We=We.buffer;case w:return!(xe.byteLength!=We.byteLength||!Tt(new Ve(xe),new Ve(We)));case c:case f:case m:return Xr(+xe,+We);case p:return xe.name==We.name&&xe.message==We.message;case T:case C:return xe==We+"";case g:var gr=he;case v:var mr=Qt&s;if(gr||(gr=fe),xe.size!=We.size&&!mr)return!1;var Ir=or.get(xe);if(Ir)return Ir==We;Qt|=o,or.set(xe,We);var qr=rs(gr(xe),gr(We),Tt,qt,Qt,or);return or.delete(xe),qr;case x:if(Ot)return Ot.call(xe)==Ot.call(We)}return!1}function Rl(xe,We,dt,Tt,qt,Qt){var or=qt&s,gr=Ke(xe),mr=gr.length,Ir=Ke(We),qr=Ir.length;if(mr!=qr&&!or)return!1;for(var jr=mr;jr--;){var nn=gr[jr];if(!(or?nn in We:Je.call(We,nn)))return!1}var Zr=Qt.get(xe);if(Zr&&Qt.get(We))return Zr==We;var Ui=!0;Qt.set(xe,We),Qt.set(We,xe);for(var Wo=or;++jr<mr;){nn=gr[jr];var Ds=xe[nn],Xi=We[nn];if(Tt)var gf=or?Tt(Xi,Ds,nn,We,xe,Qt):Tt(Ds,Xi,nn,xe,We,Qt);if(!(gf===void 0?Ds===Xi||dt(Ds,Xi,Tt,qt,Qt):gf)){Ui=!1;break}Wo||(Wo=nn=="constructor")}if(Ui&&!Wo){var Wx=xe.constructor,Qx=We.constructor;Wx!=Qx&&"constructor"in xe&&"constructor"in We&&!(typeof Wx=="function"&&Wx instanceof Wx&&typeof Qx=="function"&&Qx instanceof Qx)&&(Ui=!1)}return Qt.delete(xe),Qt.delete(We),Ui}function sn(xe,We){var dt=xe.__data__;return ac(We)?dt[typeof We=="string"?"string":"hash"]:dt.map}function zn(xe){for(var We=Ke(xe),dt=We.length;dt--;){var Tt=We[dt],qt=xe[Tt];We[dt]=[Tt,qt,Go(qt)]}return We}function Gn(xe,We){var dt=re(xe,We);return oe(dt)?dt:void 0}var Si=Ln;(we&&Si(new we(new ArrayBuffer(1)))!=R||ee&&Si(new ee)!=g||de&&Si(de.resolve())!=y||be&&Si(new be)!=v||Ge&&Si(new Ge)!=b)&&(Si=function(xe){var We=rt.call(xe),dt=We==O?xe.constructor:void 0,Tt=dt?Be(dt):void 0;if(Tt)switch(Tt){case Me:return R;case mt:return g;case St:return y;case De:return v;case nt:return b}return We});function Qs(xe,We,dt){We=Xs(We,xe)?[We]:ti(We);for(var Tt,qt=-1,or=We.length;++qt<or;){var Qt=me(We[qt]);if(!(Tt=xe!=null&&dt(xe,Qt)))break;xe=xe[Qt]}if(Tt)return Tt;var or=xe?xe.length:0;return!!or&&Qi(or)&&zs(Qt,or)&&(rn(xe)||wr(xe))}function zs(xe,We){return We=We??a,!!We&&(typeof xe=="number"||Y.test(xe))&&xe>-1&&xe%1==0&&xe<We}function Xs(xe,We){if(rn(xe))return!1;var dt=typeof xe;return dt=="number"||dt=="symbol"||dt=="boolean"||xe==null||zi(xe)?!0:F.test(xe)||!X.test(xe)||We!=null&&xe in Object(We)}function ac(xe){var We=typeof xe;return We=="string"||We=="number"||We=="symbol"||We=="boolean"?xe!=="__proto__":xe===null}function So(xe){return!!Qe&&Qe in xe}function Is(xe){var We=xe&&xe.constructor,dt=typeof We=="function"&&We.prototype||ye;return xe===dt}function Go(xe){return xe===xe&&!so(xe)}function au(xe,We){return function(dt){return dt==null?!1:dt[xe]===We&&(We!==void 0||xe in Object(dt))}}var lc=kt(function(xe){xe=qs(xe);var We=[];return V.test(xe)&&We.push(""),xe.replace(G,function(dt,Tt,qt,Qt){We.push(qt?Qt.replace($,"$1"):Tt||dt)}),We});function me(xe){if(typeof xe=="string"||zi(xe))return xe;var We=xe+"";return We=="0"&&1/xe==-1/0?"-0":We}function Be(xe){if(xe!=null){try{return $e.call(xe)}catch{}try{return xe+""}catch{}}return""}var ot=Mn(function(xe,We,dt){Je.call(xe,dt)?xe[dt].push(We):xe[dt]=[We]});function kt(xe,We){if(typeof xe!="function"||We&&typeof We!="function")throw new TypeError(n);var dt=function(){var Tt=arguments,qt=We?We.apply(this,Tt):Tt[0],Qt=dt.cache;if(Qt.has(qt))return Qt.get(qt);var or=xe.apply(this,Tt);return dt.cache=Qt.set(qt,or),or};return dt.cache=new(kt.Cache||Pe),dt}kt.Cache=Pe;function Xr(xe,We){return xe===We||xe!==xe&&We!==We}function wr(xe){return $i(xe)&&Je.call(xe,"callee")&&(!He.call(xe,"callee")||rt.call(xe)==l)}var rn=Array.isArray;function mn(xe){return xe!=null&&Qi(xe.length)&&!kn(xe)}function $i(xe){return ri(xe)&&mn(xe)}function kn(xe){var We=so(xe)?rt.call(xe):"";return We==h||We==A}function Qi(xe){return typeof xe=="number"&&xe>-1&&xe%1==0&&xe<=a}function so(xe){var We=typeof xe;return!!xe&&(We=="object"||We=="function")}function ri(xe){return!!xe&&typeof xe=="object"}function zi(xe){return typeof xe=="symbol"||ri(xe)&&rt.call(xe)==x}var to=Oe?K(Oe):Ce;function qs(xe){return xe==null?"":Kr(xe)}function pe(xe,We,dt){var Tt=xe==null?void 0:Sn(xe,We);return Tt===void 0?dt:Tt}function Le(xe,We){return xe!=null&&Qs(xe,We,Ti)}function Ke(xe){return mn(xe)?Cr(xe):lt(xe)}function pt(xe){return xe}function Ut(xe){return Xs(xe)?ie(me(xe)):Yr(xe)}e.exports=ot})(lg,lg.exports)),lg.exports}var RBe=DBe();const YP=Un(RBe);var ug={exports:{}};ug.exports;var $X;function PBe(){return $X||($X=1,(function(e,t){var r=200,n="Expected a function",i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Function]",A="[object GeneratorFunction]",g="[object Map]",m="[object Number]",O="[object Object]",y="[object Promise]",T="[object RegExp]",v="[object Set]",C="[object String]",x="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",R="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",k="[object Int8Array]",N="[object Int16Array]",L="[object Int32Array]",M="[object Uint8Array]",B="[object Uint8ClampedArray]",H="[object Uint16Array]",j="[object Uint32Array]",X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,V=/^\./,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,D=/[\\^$.*+?()[\]{}|]/g,$=/\\(\\)?/g,U=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,z={};z[I]=z[P]=z[k]=z[N]=z[L]=z[M]=z[B]=z[H]=z[j]=!0,z[l]=z[u]=z[w]=z[c]=z[R]=z[f]=z[p]=z[h]=z[g]=z[m]=z[O]=z[T]=z[v]=z[C]=z[b]=!1;var Q=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,W=typeof self=="object"&&self&&self.Object===Object&&self,q=Q||W||Function("return this")(),Z=t&&!t.nodeType&&t,te=Z&&!0&&e&&!e.nodeType&&e,ae=te&&te.exports===Z,ne=ae&&Q.process,ue=(function(){try{return ne&&ne.binding("util")}catch{}})(),Oe=ue&&ue.isTypedArray;function Te(pe,Le){for(var Ke=-1,pt=pe?pe.length:0;++Ke<pt;)if(Le(pe[Ke],Ke,pe))return!0;return!1}function se(pe){return function(Le){return Le?.[pe]}}function ie(pe,Le){for(var Ke=-1,pt=Array(pe);++Ke<pe;)pt[Ke]=Le(Ke);return pt}function J(pe){return function(Le){return pe(Le)}}function K(pe,Le){return pe?.[Le]}function re(pe){var Le=!1;if(pe!=null&&typeof pe.toString!="function")try{Le=!!(pe+"")}catch{}return Le}function le(pe){var Le=-1,Ke=Array(pe.size);return pe.forEach(function(pt,Ut){Ke[++Le]=[Ut,pt]}),Ke}function he(pe,Le){return function(Ke){return pe(Le(Ke))}}function Ae(pe){var Le=-1,Ke=Array(pe.size);return pe.forEach(function(pt){Ke[++Le]=pt}),Ke}var fe=Array.prototype,Se=Function.prototype,ge=Object.prototype,ye=q["__core-js_shared__"],je=(function(){var pe=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return pe?"Symbol(src)_1."+pe:""})(),Qe=Se.toString,$e=ge.hasOwnProperty,Je=ge.toString,rt=RegExp("^"+Qe.call($e).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tt=q.Symbol,Ie=q.Uint8Array,Ve=ge.propertyIsEnumerable,He=fe.splice,Ee=he(Object.keys,Object),_e=rs(q,"DataView"),we=rs(q,"Map"),ee=rs(q,"Promise"),de=rs(q,"Set"),be=rs(q,"WeakMap"),Ge=rs(Object,"create"),Ne=Is(_e),Me=Is(we),mt=Is(ee),St=Is(de),De=Is(be),nt=tt?tt.prototype:void 0,ut=nt?nt.valueOf:void 0,Ot=nt?nt.toString:void 0;function It(pe){var Le=-1,Ke=pe?pe.length:0;for(this.clear();++Le<Ke;){var pt=pe[Le];this.set(pt[0],pt[1])}}function Mt(){this.__data__=Ge?Ge(null):{}}function Dt(pe){return this.has(pe)&&delete this.__data__[pe]}function Fe(pe){var Le=this.__data__;if(Ge){var Ke=Le[pe];return Ke===i?void 0:Ke}return $e.call(Le,pe)?Le[pe]:void 0}function Ye(pe){var Le=this.__data__;return Ge?Le[pe]!==void 0:$e.call(Le,pe)}function Xe(pe,Le){var Ke=this.__data__;return Ke[pe]=Ge&&Le===void 0?i:Le,this}It.prototype.clear=Mt,It.prototype.delete=Dt,It.prototype.get=Fe,It.prototype.has=Ye,It.prototype.set=Xe;function at(pe){var Le=-1,Ke=pe?pe.length:0;for(this.clear();++Le<Ke;){var pt=pe[Le];this.set(pt[0],pt[1])}}function yt(){this.__data__=[]}function vt(pe){var Le=this.__data__,Ke=Cr(Le,pe);if(Ke<0)return!1;var pt=Le.length-1;return Ke==pt?Le.pop():He.call(Le,Ke,1),!0}function $t(pe){var Le=this.__data__,Ke=Cr(Le,pe);return Ke<0?void 0:Le[Ke][1]}function Re(pe){return Cr(this.__data__,pe)>-1}function it(pe,Le){var Ke=this.__data__,pt=Cr(Ke,pe);return pt<0?Ke.push([pe,Le]):Ke[pt][1]=Le,this}at.prototype.clear=yt,at.prototype.delete=vt,at.prototype.get=$t,at.prototype.has=Re,at.prototype.set=it;function et(pe){var Le=-1,Ke=pe?pe.length:0;for(this.clear();++Le<Ke;){var pt=pe[Le];this.set(pt[0],pt[1])}}function Pe(){this.__data__={hash:new It,map:new(we||at),string:new It}}function st(pe){return Ca(this,pe).delete(pe)}function gt(pe){return Ca(this,pe).get(pe)}function Zt(pe){return Ca(this,pe).has(pe)}function dr(pe,Le){return Ca(this,pe).set(pe,Le),this}et.prototype.clear=Pe,et.prototype.delete=st,et.prototype.get=gt,et.prototype.has=Zt,et.prototype.set=dr;function Mr(pe){var Le=-1,Ke=pe?pe.length:0;for(this.__data__=new et;++Le<Ke;)this.add(pe[Le])}function hn(pe){return this.__data__.set(pe,i),this}function dn(pe){return this.__data__.has(pe)}Mr.prototype.add=Mr.prototype.push=hn,Mr.prototype.has=dn;function An(pe){this.__data__=new at(pe)}function lr(){this.__data__=new at}function _r(pe){return this.__data__.delete(pe)}function wn(pe){return this.__data__.get(pe)}function Ft(pe){return this.__data__.has(pe)}function Jt(pe,Le){var Ke=this.__data__;if(Ke instanceof at){var pt=Ke.__data__;if(!we||pt.length<r-1)return pt.push([pe,Le]),this;Ke=this.__data__=new et(pt)}return Ke.set(pe,Le),this}An.prototype.clear=lr,An.prototype.delete=_r,An.prototype.get=wn,An.prototype.has=Ft,An.prototype.set=Jt;function $r(pe,Le){var Ke=me(pe)||lc(pe)?ie(pe.length,String):[],pt=Ke.length,Ut=!!pt;for(var xe in pe)$e.call(pe,xe)&&!(Ut&&(xe=="length"||sn(xe,pt)))&&Ke.push(xe);return Ke}function Cr(pe,Le){for(var Ke=pe.length;Ke--;)if(au(pe[Ke][0],Le))return Ke;return-1}var vr=Yr();function Fr(pe,Le){return pe&&vr(pe,Le,ri)}function Vr(pe,Le){Le=zn(Le,pe)?[Le]:er(Le);for(var Ke=0,pt=Le.length;pe!=null&&Ke<pt;)pe=pe[So(Le[Ke++])];return Ke&&Ke==pt?pe:void 0}function Br(pe){return Je.call(pe)}function Cn(pe,Le){return pe!=null&&Le in Object(pe)}function Sn(pe,Le,Ke,pt,Ut){return pe===Le?!0:pe==null||Le==null||!wr(pe)&&!rn(Le)?pe!==pe&&Le!==Le:Ln(pe,Le,Sn,Ke,pt,Ut)}function Ln(pe,Le,Ke,pt,Ut,xe){var We=me(pe),dt=me(Le),Tt=u,qt=u;We||(Tt=pi(pe),Tt=Tt==l?O:Tt),dt||(qt=pi(Le),qt=qt==l?O:qt);var Qt=Tt==O&&!re(pe),or=qt==O&&!re(Le),gr=Tt==qt;if(gr&&!Qt)return xe||(xe=new An),We||$i(pe)?Kr(pe,Le,Ke,pt,Ut,xe):ti(pe,Le,Tt,Ke,pt,Ut,xe);if(!(Ut&s)){var mr=Qt&&$e.call(pe,"__wrapped__"),Ir=or&&$e.call(Le,"__wrapped__");if(mr||Ir){var qr=mr?pe.value():pe,jr=Ir?Le.value():Le;return xe||(xe=new An),Ke(qr,jr,pt,Ut,xe)}}return gr?(xe||(xe=new An),Mn(pe,Le,Ke,pt,Ut,xe)):!1}function Ti(pe,Le,Ke,pt){var Ut=Ke.length,xe=Ut;if(pe==null)return!xe;for(pe=Object(pe);Ut--;){var We=Ke[Ut];if(We[2]?We[1]!==pe[We[0]]:!(We[0]in pe))return!1}for(;++Ut<xe;){We=Ke[Ut];var dt=We[0],Tt=pe[dt],qt=We[1];if(We[2]){if(Tt===void 0&&!(dt in pe))return!1}else{var Qt=new An,or;if(!(or===void 0?Sn(qt,Tt,pt,o|s,Qt):or))return!1}}return!0}function eo(pe){if(!wr(pe)||Si(pe))return!1;var Le=kt(pe)||re(pe)?rt:U;return Le.test(Is(pe))}function en(pe){return rn(pe)&&Xr(pe.length)&&!!z[Je.call(pe)]}function To(pe){return typeof pe=="function"?pe:pe==null?to:typeof pe=="object"?me(pe)?ze(pe[0],pe[1]):Ce(pe):qs(pe)}function oe(pe){if(!Qs(pe))return Ee(pe);var Le=[];for(var Ke in Object(pe))$e.call(pe,Ke)&&Ke!="constructor"&&Le.push(Ke);return Le}function Ce(pe){var Le=Dl(pe);return Le.length==1&&Le[0][2]?Xs(Le[0][0],Le[0][1]):function(Ke){return Ke===pe||Ti(Ke,pe,Le)}}function ze(pe,Le){return zn(pe)&&zs(Le)?Xs(So(pe),Le):function(Ke){var pt=Qi(Ke,pe);return pt===void 0&&pt===Le?so(Ke,pe):Sn(Le,pt,void 0,o|s)}}function lt(pe){return function(Le){return Vr(Le,pe)}}function Pt(pe){if(typeof pe=="string")return pe;if(mn(pe))return Ot?Ot.call(pe):"";var Le=pe+"";return Le=="0"&&1/pe==-1/0?"-0":Le}function er(pe){return me(pe)?pe:ac(pe)}function Yr(pe){return function(Le,Ke,pt){for(var Ut=-1,xe=Object(Le),We=pt(Le),dt=We.length;dt--;){var Tt=We[++Ut];if(Ke(xe[Tt],Tt,xe)===!1)break}return Le}}function Kr(pe,Le,Ke,pt,Ut,xe){var We=Ut&s,dt=pe.length,Tt=Le.length;if(dt!=Tt&&!(We&&Tt>dt))return!1;var qt=xe.get(pe);if(qt&&xe.get(Le))return qt==Le;var Qt=-1,or=!0,gr=Ut&o?new Mr:void 0;for(xe.set(pe,Le),xe.set(Le,pe);++Qt<dt;){var mr=pe[Qt],Ir=Le[Qt];if(pt)var qr=We?pt(Ir,mr,Qt,Le,pe,xe):pt(mr,Ir,Qt,pe,Le,xe);if(qr!==void 0){if(qr)continue;or=!1;break}if(gr){if(!Te(Le,function(jr,nn){if(!gr.has(nn)&&(mr===jr||Ke(mr,jr,pt,Ut,xe)))return gr.add(nn)})){or=!1;break}}else if(!(mr===Ir||Ke(mr,Ir,pt,Ut,xe))){or=!1;break}}return xe.delete(pe),xe.delete(Le),or}function ti(pe,Le,Ke,pt,Ut,xe,We){switch(Ke){case R:if(pe.byteLength!=Le.byteLength||pe.byteOffset!=Le.byteOffset)return!1;pe=pe.buffer,Le=Le.buffer;case w:return!(pe.byteLength!=Le.byteLength||!pt(new Ie(pe),new Ie(Le)));case c:case f:case m:return au(+pe,+Le);case p:return pe.name==Le.name&&pe.message==Le.message;case T:case C:return pe==Le+"";case g:var dt=le;case v:var Tt=xe&s;if(dt||(dt=Ae),pe.size!=Le.size&&!Tt)return!1;var qt=We.get(pe);if(qt)return qt==Le;xe|=o,We.set(pe,Le);var Qt=Kr(dt(pe),dt(Le),pt,Ut,xe,We);return We.delete(pe),Qt;case x:if(ut)return ut.call(pe)==ut.call(Le)}return!1}function Mn(pe,Le,Ke,pt,Ut,xe){var We=Ut&s,dt=ri(pe),Tt=dt.length,qt=ri(Le),Qt=qt.length;if(Tt!=Qt&&!We)return!1;for(var or=Tt;or--;){var gr=dt[or];if(!(We?gr in Le:$e.call(Le,gr)))return!1}var mr=xe.get(pe);if(mr&&xe.get(Le))return mr==Le;var Ir=!0;xe.set(pe,Le),xe.set(Le,pe);for(var qr=We;++or<Tt;){gr=dt[or];var jr=pe[gr],nn=Le[gr];if(pt)var Zr=We?pt(nn,jr,gr,Le,pe,xe):pt(jr,nn,gr,pe,Le,xe);if(!(Zr===void 0?jr===nn||Ke(jr,nn,pt,Ut,xe):Zr)){Ir=!1;break}qr||(qr=gr=="constructor")}if(Ir&&!qr){var Ui=pe.constructor,Wo=Le.constructor;Ui!=Wo&&"constructor"in pe&&"constructor"in Le&&!(typeof Ui=="function"&&Ui instanceof Ui&&typeof Wo=="function"&&Wo instanceof Wo)&&(Ir=!1)}return xe.delete(pe),xe.delete(Le),Ir}function Ca(pe,Le){var Ke=pe.__data__;return Gn(Le)?Ke[typeof Le=="string"?"string":"hash"]:Ke.map}function Dl(pe){for(var Le=ri(pe),Ke=Le.length;Ke--;){var pt=Le[Ke],Ut=pe[pt];Le[Ke]=[pt,Ut,zs(Ut)]}return Le}function rs(pe,Le){var Ke=K(pe,Le);return eo(Ke)?Ke:void 0}var pi=Br;(_e&&pi(new _e(new ArrayBuffer(1)))!=R||we&&pi(new we)!=g||ee&&pi(ee.resolve())!=y||de&&pi(new de)!=v||be&&pi(new be)!=b)&&(pi=function(pe){var Le=Je.call(pe),Ke=Le==O?pe.constructor:void 0,pt=Ke?Is(Ke):void 0;if(pt)switch(pt){case Ne:return R;case Me:return g;case mt:return y;case St:return v;case De:return b}return Le});function Rl(pe,Le,Ke){Le=zn(Le,pe)?[Le]:er(Le);for(var pt,Ut=-1,We=Le.length;++Ut<We;){var xe=So(Le[Ut]);if(!(pt=pe!=null&&Ke(pe,xe)))break;pe=pe[xe]}if(pt)return pt;var We=pe?pe.length:0;return!!We&&Xr(We)&&sn(xe,We)&&(me(pe)||lc(pe))}function sn(pe,Le){return Le=Le??a,!!Le&&(typeof pe=="number"||Y.test(pe))&&pe>-1&&pe%1==0&&pe<Le}function zn(pe,Le){if(me(pe))return!1;var Ke=typeof pe;return Ke=="number"||Ke=="symbol"||Ke=="boolean"||pe==null||mn(pe)?!0:F.test(pe)||!X.test(pe)||Le!=null&&pe in Object(Le)}function Gn(pe){var Le=typeof pe;return Le=="string"||Le=="number"||Le=="symbol"||Le=="boolean"?pe!=="__proto__":pe===null}function Si(pe){return!!je&&je in pe}function Qs(pe){var Le=pe&&pe.constructor,Ke=typeof Le=="function"&&Le.prototype||ge;return pe===Ke}function zs(pe){return pe===pe&&!wr(pe)}function Xs(pe,Le){return function(Ke){return Ke==null?!1:Ke[pe]===Le&&(Le!==void 0||pe in Object(Ke))}}var ac=Go(function(pe){pe=kn(pe);var Le=[];return V.test(pe)&&Le.push(""),pe.replace(G,function(Ke,pt,Ut,xe){Le.push(Ut?xe.replace($,"$1"):pt||Ke)}),Le});function So(pe){if(typeof pe=="string"||mn(pe))return pe;var Le=pe+"";return Le=="0"&&1/pe==-1/0?"-0":Le}function Is(pe){if(pe!=null){try{return Qe.call(pe)}catch{}try{return pe+""}catch{}}return""}function Go(pe,Le){if(typeof pe!="function"||Le&&typeof Le!="function")throw new TypeError(n);var Ke=function(){var pt=arguments,Ut=Le?Le.apply(this,pt):pt[0],xe=Ke.cache;if(xe.has(Ut))return xe.get(Ut);var We=pe.apply(this,pt);return Ke.cache=xe.set(Ut,We),We};return Ke.cache=new(Go.Cache||et),Ke}Go.Cache=et;function au(pe,Le){return pe===Le||pe!==pe&&Le!==Le}function lc(pe){return ot(pe)&&$e.call(pe,"callee")&&(!Ve.call(pe,"callee")||Je.call(pe)==l)}var me=Array.isArray;function Be(pe){return pe!=null&&Xr(pe.length)&&!kt(pe)}function ot(pe){return rn(pe)&&Be(pe)}function kt(pe){var Le=wr(pe)?Je.call(pe):"";return Le==h||Le==A}function Xr(pe){return typeof pe=="number"&&pe>-1&&pe%1==0&&pe<=a}function wr(pe){var Le=typeof pe;return!!pe&&(Le=="object"||Le=="function")}function rn(pe){return!!pe&&typeof pe=="object"}function mn(pe){return typeof pe=="symbol"||rn(pe)&&Je.call(pe)==x}var $i=Oe?J(Oe):en;function kn(pe){return pe==null?"":Pt(pe)}function Qi(pe,Le,Ke){var pt=pe==null?void 0:Vr(pe,Le);return pt===void 0?Ke:pt}function so(pe,Le){return pe!=null&&Rl(pe,Le,Cn)}function ri(pe){return Be(pe)?$r(pe):oe(pe)}function zi(pe,Le){var Ke={};return Le=To(Le),Fr(pe,function(pt,Ut,xe){Ke[Ut]=Le(pt,Ut,xe)}),Ke}function to(pe){return pe}function qs(pe){return zn(pe)?se(So(pe)):lt(pe)}e.exports=zi})(ug,ug.exports)),ug.exports}var NBe=PBe();const LBe=Un(NBe);var KP,UX;function kBe(){if(UX)return KP;UX=1;var e=200,t="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Symbol]",a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,c=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,f=typeof self=="object"&&self&&self.Object===Object&&self,p=c||f||Function("return this")();function h(Re,it,et){switch(et.length){case 0:return Re.call(it);case 1:return Re.call(it,et[0]);case 2:return Re.call(it,et[0],et[1]);case 3:return Re.call(it,et[0],et[1],et[2])}return Re.apply(it,et)}function A(Re,it){var et=Re?Re.length:0;return!!et&&y(Re,it,0)>-1}function g(Re,it){for(var et=-1,Pe=Re?Re.length:0,st=Array(Pe);++et<Pe;)st[et]=it(Re[et],et,Re);return st}function m(Re,it){for(var et=-1,Pe=it.length,st=Re.length;++et<Pe;)Re[st+et]=it[et];return Re}function O(Re,it,et,Pe){for(var st=Re.length,gt=et+-1;++gt<st;)if(it(Re[gt],gt,Re))return gt;return-1}function y(Re,it,et){if(it!==it)return O(Re,T,et);for(var Pe=et-1,st=Re.length;++Pe<st;)if(Re[Pe]===it)return Pe;return-1}function T(Re){return Re!==Re}function v(Re,it){for(var et=-1,Pe=Array(Re);++et<Re;)Pe[et]=it(et);return Pe}function C(Re,it){return Re.has(it)}function x(Re,it){return Re?.[it]}function b(Re){var it=!1;if(Re!=null&&typeof Re.toString!="function")try{it=!!(Re+"")}catch{}return it}function w(Re,it){return function(et){return Re(it(et))}}var R=Array.prototype,I=Function.prototype,P=Object.prototype,k=p["__core-js_shared__"],N=(function(){var Re=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||"");return Re?"Symbol(src)_1."+Re:""})(),L=I.toString,M=P.hasOwnProperty,B=P.toString,H=RegExp("^"+L.call(M).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),j=p.Symbol,X=w(Object.getPrototypeOf,Object),F=P.propertyIsEnumerable,V=R.splice,G=j?j.isConcatSpreadable:void 0,D=Object.getOwnPropertySymbols,$=Math.max,U=_e(p,"Map"),Y=_e(Object,"create");function z(Re){var it=-1,et=Re?Re.length:0;for(this.clear();++it<et;){var Pe=Re[it];this.set(Pe[0],Pe[1])}}function Q(){this.__data__=Y?Y(null):{}}function W(Re){return this.has(Re)&&delete this.__data__[Re]}function q(Re){var it=this.__data__;if(Y){var et=it[Re];return et===t?void 0:et}return M.call(it,Re)?it[Re]:void 0}function Z(Re){var it=this.__data__;return Y?it[Re]!==void 0:M.call(it,Re)}function te(Re,it){var et=this.__data__;return et[Re]=Y&&it===void 0?t:it,this}z.prototype.clear=Q,z.prototype.delete=W,z.prototype.get=q,z.prototype.has=Z,z.prototype.set=te;function ae(Re){var it=-1,et=Re?Re.length:0;for(this.clear();++it<et;){var Pe=Re[it];this.set(Pe[0],Pe[1])}}function ne(){this.__data__=[]}function ue(Re){var it=this.__data__,et=ye(it,Re);if(et<0)return!1;var Pe=it.length-1;return et==Pe?it.pop():V.call(it,et,1),!0}function Oe(Re){var it=this.__data__,et=ye(it,Re);return et<0?void 0:it[et][1]}function Te(Re){return ye(this.__data__,Re)>-1}function se(Re,it){var et=this.__data__,Pe=ye(et,Re);return Pe<0?et.push([Re,it]):et[Pe][1]=it,this}ae.prototype.clear=ne,ae.prototype.delete=ue,ae.prototype.get=Oe,ae.prototype.has=Te,ae.prototype.set=se;function ie(Re){var it=-1,et=Re?Re.length:0;for(this.clear();++it<et;){var Pe=Re[it];this.set(Pe[0],Pe[1])}}function J(){this.__data__={hash:new z,map:new(U||ae),string:new z}}function K(Re){return Ee(this,Re).delete(Re)}function re(Re){return Ee(this,Re).get(Re)}function le(Re){return Ee(this,Re).has(Re)}function he(Re,it){return Ee(this,Re).set(Re,it),this}ie.prototype.clear=J,ie.prototype.delete=K,ie.prototype.get=re,ie.prototype.has=le,ie.prototype.set=he;function Ae(Re){var it=-1,et=Re?Re.length:0;for(this.__data__=new ie;++it<et;)this.add(Re[it])}function fe(Re){return this.__data__.set(Re,t),this}function Se(Re){return this.__data__.has(Re)}Ae.prototype.add=Ae.prototype.push=fe,Ae.prototype.has=Se;function ge(Re,it){var et=Ot(Re)||ut(Re)?v(Re.length,String):[],Pe=et.length,st=!!Pe;for(var gt in Re)st&&(gt=="length"||be(gt,Pe))||et.push(gt);return et}function ye(Re,it){for(var et=Re.length;et--;)if(nt(Re[et][0],it))return et;return-1}function je(Re,it,et,Pe){var st=-1,gt=A,Zt=!0,dr=Re.length,Mr=[],hn=it.length;if(!dr)return Mr;it.length>=e&&(gt=C,Zt=!1,it=new Ae(it));e:for(;++st<dr;){var dn=Re[st],An=dn;if(dn=dn!==0?dn:0,Zt&&An===An){for(var lr=hn;lr--;)if(it[lr]===An)continue e;Mr.push(dn)}else gt(it,An,Pe)||Mr.push(dn)}return Mr}function Qe(Re,it,et,Pe,st){var gt=-1,Zt=Re.length;for(et||(et=de),st||(st=[]);++gt<Zt;){var dr=Re[gt];et(dr)?m(st,dr):st[st.length]=dr}return st}function $e(Re,it,et){var Pe=it(Re);return Ot(Re)?Pe:m(Pe,et(Re))}function Je(Re){if(!Ye(Re)||Ne(Re))return!1;var it=Dt(Re)||b(Re)?H:l;return it.test(De(Re))}function rt(Re){if(!Ye(Re))return mt(Re);var it=Me(Re),et=[];for(var Pe in Re)Pe=="constructor"&&(it||!M.call(Re,Pe))||et.push(Pe);return et}function tt(Re,it){return Re=Object(Re),Ie(Re,it,function(et,Pe){return Pe in Re})}function Ie(Re,it,et){for(var Pe=-1,st=it.length,gt={};++Pe<st;){var Zt=it[Pe],dr=Re[Zt];et(dr,Zt)&&(gt[Zt]=dr)}return gt}function Ve(Re,it){return it=$(it===void 0?Re.length-1:it,0),function(){for(var et=arguments,Pe=-1,st=$(et.length-it,0),gt=Array(st);++Pe<st;)gt[Pe]=et[it+Pe];Pe=-1;for(var Zt=Array(it+1);++Pe<it;)Zt[Pe]=et[Pe];return Zt[it]=gt,h(Re,this,Zt)}}function He(Re){return $e(Re,yt,ee)}function Ee(Re,it){var et=Re.__data__;return Ge(it)?et[typeof it=="string"?"string":"hash"]:et.map}function _e(Re,it){var et=x(Re,it);return Je(et)?et:void 0}var we=D?w(D,Object):$t,ee=D?function(Re){for(var it=[];Re;)m(it,we(Re)),Re=X(Re);return it}:$t;function de(Re){return Ot(Re)||ut(Re)||!!(G&&Re&&Re[G])}function be(Re,it){return it=it??r,!!it&&(typeof Re=="number"||u.test(Re))&&Re>-1&&Re%1==0&&Re<it}function Ge(Re){var it=typeof Re;return it=="string"||it=="number"||it=="symbol"||it=="boolean"?Re!=="__proto__":Re===null}function Ne(Re){return!!N&&N in Re}function Me(Re){var it=Re&&Re.constructor,et=typeof it=="function"&&it.prototype||P;return Re===et}function mt(Re){var it=[];if(Re!=null)for(var et in Object(Re))it.push(et);return it}function St(Re){if(typeof Re=="string"||at(Re))return Re;var it=Re+"";return it=="0"&&1/Re==-1/0?"-0":it}function De(Re){if(Re!=null){try{return L.call(Re)}catch{}try{return Re+""}catch{}}return""}function nt(Re,it){return Re===it||Re!==Re&&it!==it}function ut(Re){return Mt(Re)&&M.call(Re,"callee")&&(!F.call(Re,"callee")||B.call(Re)==n)}var Ot=Array.isArray;function It(Re){return Re!=null&&Fe(Re.length)&&!Dt(Re)}function Mt(Re){return Xe(Re)&&It(Re)}function Dt(Re){var it=Ye(Re)?B.call(Re):"";return it==i||it==o}function Fe(Re){return typeof Re=="number"&&Re>-1&&Re%1==0&&Re<=r}function Ye(Re){var it=typeof Re;return!!Re&&(it=="object"||it=="function")}function Xe(Re){return!!Re&&typeof Re=="object"}function at(Re){return typeof Re=="symbol"||Xe(Re)&&B.call(Re)==s}function yt(Re){return It(Re)?ge(Re):rt(Re)}var vt=Ve(function(Re,it){return Re==null?{}:(it=g(Qe(it),St),tt(Re,je(He(Re),it)))});function $t(){return[]}return KP=vt,KP}var FBe=kBe();const MBe=Un(FBe),BBe=_.forwardRef((e,t)=>{const{type:r,VORTEX_MAIN_URL:n,ENTITY_ID:i,TESSERACT_MAIN_URL:o,FRONTEND_URL:s,INTEGRATION_DATA:a,viewOnly:l=!1,openIntegrationDrawer:u}=e,c=ct.useDispatch(),{workflow:f}=ct.useSelector(Q=>Q.workflows),{source:p=""}=f,[h,A]=_.useState({}),[g,m]=_.useState([]),[O,y]=_.useState([]),[T,v]=_.useState(!1),[C,x]=_.useState(!1),[b,w]=_.useState(!1),[R,I]=_.useState(null),P=_.useRef([]),{control:k,watch:N,setValue:L,trigger:M}=Rr(),B=p?.includes("commerce_"),H=p?.split("_"),j=H&&H.length>1?H[1]:null,X=H&&H.length>2?H.slice(2).join("_"):j,F=N("properties"),V=N("properties.fp_auth_id"),G=async()=>{if(B)m([{name:X,id:p?.toLowerCase()||""}]),L("properties.fp_auth_id",p?.toLowerCase()||"",{shouldValidate:!0});else{v(!0);try{const{data:Q}=await zt.get(Xt(o,"/v1/integrations/entity/FYND_PLATFORM?get_form_data=true"),{params:{page_size:999,current_page:1,type:"BOTH"}});m(ro(Q.data))}catch(Q){sr(Q,c)}finally{v(!1)}}},D=async Q=>{w(!0);try{const W=Xt(n,`/v1.0/${i}`,"/utility/events-config"),q=Q?{id:Q}:{},{data:Z}=await zt.get(W,{params:q});P.current=Z.data.event_configs;const te=Z.data.event_configs.map(ue=>({...ue,display_name:`${ue.display_name}_${ue.event_category}`})),ae=YP(te,"event_category"),ne={application:$(ae.application),company:$(ae.company)};A(ne)}catch(W){sr(W,c)}finally{w(!1)}},$=Q=>{if(!Q)return{};const W={},q=YP(Q,"event_name");return Object.keys(q).forEach(Z=>{const te=YP(q[Z],"version");W[Z]=LBe(te,ae=>ae.map(ne=>MBe(ne,"version"))),W[Z].versions=Object.keys(te).map(ae=>({text:`V${ae}`,value:ae}))}),W},U=async Q=>{x(!0);try{const W=Xt(n,`/v1.0/${i}`,`/utility/applications?id=${Q}`),{data:q}=await zt.get(W);y(q?.data?.map(Z=>({id:Z.id,name:Z.name})))}catch(W){sr(W,c)}finally{x(!1)}};_.useEffect(()=>{const{fp_auth_id:Q}=F;Q&&(p?.includes("commerce_")?D(""):D(Q))},[]),_.useEffect(()=>{G()},[]),_.useEffect(()=>{a?._id&&a?.meta?.entity==="FYND_PLATFORM"&&(G(),L("properties.fp_auth_id",a._id,{shouldValidate:!0}))},[a]),_.useEffect(()=>{const{fp_auth_id:Q}=F;F?.event_details?.event_category==="application"&&U(Q)},[V,F?.event_details?.event_category]),_.useEffect(()=>{if(!Et(F?.event_details?.event_name)&&!Et(F?.event_details?.event_category)&&!Et(h)){const{event_name:Q,event_category:W}=F?.event_details;I(h[W][Q])}},[h]),_.useEffect(()=>{const Q=F?.event_id;if(!Q?.length||!P.current.length||F?.events?.length>0)return;const W=Q.map(q=>P.current.find(Z=>Z.id===q)).filter(Boolean);W.length&&L("properties.events",W.map(q=>({slug:`${q.event_category}/${q.event_name}/${q.event_type}/v${q.version}`})))},[h]);const Y=Q=>Et(Q)?[]:F.event_details?.event_category==="application"?Object.keys(Q.application).map(W=>({title:W,value:W})):F.event_details?.event_category==="company"?Object.keys(Q.company).map(W=>({title:W,value:W})):[],z=N("properties.version")&&!Et(R)&&R[parseFloat(N("properties.version"))]?R[parseFloat(N("properties.version"))].map(Q=>({title:Q.event_type,value:Q.id,event_name:Q.event_name,event_type:Q.event_type,event_category:Q.event_category})):[];return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(Yt,{required:!0,name:"properties.fp_auth_id",control:k,meta:{options:yn(g),displayProps:{loading:T},displayName:"Fynd Platform Account",value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:o,FRONTEND_URL:s,ENTITY_ID:i,openIntegrationDrawer:u,addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd Platform account",authType:"FYND_PLATFORM",description:"Fynd Platform is a secure partner with Boltic. Your credentials are encrypted & can be removed at any time.",placeholder:"Select Fynd Platform Account"},validationRules:{required:"Fynd platform account is required"},id:r,viewOnly:l||B,handleChange:Q=>{const{value:W}=Q;W&&(p?.includes("commerce_")?D(""):D(W))}})}),F.fp_auth_id&&d.jsx(E.Divider,{}),F.fp_auth_id&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event_details.event_category",control:k,meta:{options:Zle,displayName:"Event Category",searchFieldPlaceholder:"Search",placeholder:"Select Event Category",displayProps:{loading:b}},validationRules:{required:"Event category is required"},viewOnly:l,id:r,handleChange:Q=>{const{value:W}=Q,q=W.split("_").pop();L("properties",{...F,event_details:{...F.event_details,event_category:q,event_name:""},event_id:[],events:[],application_id:[],version:[]}),I([])}})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event_details.event_name",control:k,meta:{options:Y(h),displayName:"Event Name",searchFieldPlaceholder:"Search",placeholder:"Select Event Name",displayProps:{loading:b}},validationRules:{required:"Event name is required"},viewOnly:l,id:r,handleChange:Q=>{const{value:W}=Q,q=F.event_details.event_category,Z=h[q][W].versions.length;L("properties",{...F,event_id:[],events:[],application_id:[],version:h[q][W].versions[Z-1].value}),M("properties.event_details"),I(h[q][W])}})})]})}),!Et(R?.versions)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.version",control:k,meta:{options:R.versions.map(Q=>({title:Q.text,value:Q.value})),displayName:"Version",searchFieldPlaceholder:"Search",placeholder:"Select Version",displayProps:{loading:b}},validationRules:{required:"Version is required"},viewOnly:l,handleChange:Q=>{const{value:W}=Q;L("properties",{...F,event_id:[],events:[],version:W,application_id:[]})}})}),!Et(z)&&!Et(F.event_details)&&!Et(F.version)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event_id",control:k,meta:{options:z,displayProps:{loading:b},displayName:"Events",searchFieldPlaceholder:"Search",placeholder:"Select Events"},renderFieldValue:Q=>Q.map(W=>W),validationRules:{validate:Q=>Q.length===0?"Events is required":!0},viewOnly:l,id:r,multiple:!0,placeholder:"Select Events",handleChange:Q=>{const{value:W}=Q,q=F.version,Z=W.map(ae=>{const ne=z.find(ue=>ue.value===ae);return{slug:`${ne?.event_category}/${ne?.event_name}/${ne?.event_type}/v${q}`}});L("properties.events",Z);const te=z.find(ae=>ae.value===W?.[0]);L("properties.event_details.event_type",te?.title)},getSelectedValue:Q=>Q.map(W=>z.find(q=>q.value===W)).filter(W=>W?.title)})}),F?.event_details?.event_category==="application"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.application_id",control:k,meta:{options:yn(O),displayName:"Applications",searchFieldPlaceholder:"Search",displayProps:{loading:C},placeholder:"Select Applications"},validationRules:{validate:Q=>Q.length===0?"Application is required":!0},multiple:!0,renderFieldValue:Q=>Q.map(W=>W),viewOnly:l,getSelectedValue:Q=>Q.map(W=>yn(O).find(q=>q.value===W)).filter(W=>W?.title),required:!0})})]})})]})}),jBe=_.forwardRef((e,t)=>{const{VORTEX_MAIN_URL:r,ENTITY_ID:n,type:i,id:o,isLoop:s=!1,suggestionsData:a,WORKFLOW_URLS:l,viewOnly:u=!1}=e,{GYRATE_MAIN_URL:c}=l,{control:f,watch:p,setValue:h,formState:{errors:A}}=Rr(),g=p("properties");return d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsx(gn,{required:!0,label:"Input Data"}),d.jsx(Aa,{id:o,field:"input_data",type:"functionActivity",title:"Input Data",viewOnly:u,isLoop:s,hideLabel:!0,name:"properties.input_data"})]}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.language",control:f,meta:{options:Jle,displayName:"Language",searchFieldPlaceholder:"Search language",description:_n(i,"method"),placeholder:"Select language"},handleChange:()=>{h("properties.func",'return { "hello": "world" }')},validationRules:{required:"Language is required"},viewOnly:u,id:i})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.func",control:f,rules:{required:"Error: Function is required. Please review your function syntax."},render:({field:m})=>d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Fi,{...m,required:!0,suggestionLabel:"Code",id:`${i}-${g.language}-func`,activityType:i,size:"xl",viewOnly:u,showSuggestions:!0,VORTEX_MAIN_URL:r,ENTITY_ID:n,language:g.language,suggestionsData:a,showExpandOption:!0,label:"Code",helperText:d.jsxs(E.Box,{children:["Need help? Refer to the",d.jsx(E.Link,{href:g.language==="python"?`${c}/integrations/Helpers/function/#python`:`${c}/integrations/Helpers/function/#javascript`,target:"_blank",children:d.jsx("span",{children:" Function Documentation "})}),"for examples, guidelines, and troubleshooting tips to write Javascript in your workflow."]}),error:!!A.properties?.func?.message,errorMsg:A.properties?.func?.message,handleChange:m.onChange})})})}),!s&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:u,type:i})})]})})}),$Be=Gi(jBe,""),ml=_.forwardRef(({id:e,type:t,isLoop:r=!1,viewOnly:n=!1,customSelectedTab:i,setCustomSelectedTab:o},s)=>{const{control:a,watch:l,setValue:u}=Rr(),{MCP_INTEGRATION_FORM:c}=aa(),f=l("properties.custom"),p=l("properties.custom.headers"),h=l("properties.custom.query_params"),A=l("properties.custom.state_params"),g=l("properties.custom.method");return _.useEffect(()=>{f&&(p&&!Array.isArray(p)&&typeof p=="object"&&u("properties.custom.headers",pc(p),{shouldValidate:!1,shouldDirty:!1}),h&&!Array.isArray(h)&&typeof h=="object"&&u("properties.custom.query_params",pc(h),{shouldValidate:!1,shouldDirty:!1}),A&&!Array.isArray(A)&&typeof A=="object"&&u("properties.custom.state_params",pc(A),{shouldValidate:!1,shouldDirty:!1}))},[f,p,h,A,u]),_.useEffect(()=>{if(c&&(g==="BOLTIC_AI"||g==="BOLTIC_AI_IGNORE"))return;const m=(QO||[]).map(T=>T.value),O=typeof g=="string"&&g.length?String(g).toLowerCase():"",y=O&&m.includes(O)?O:QO?.[0]?.value||"get";g!==y&&u("properties.custom.method",y,{shouldValidate:!1,shouldDirty:!1})},[g,u]),d.jsxs(d.Fragment,{children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.custom.method",control:a,meta:{options:QO,displayName:"Method",searchFieldPlaceholder:"Search Method",placeholder:"Select Method"},validationRules:{required:"Method is required",validate:m=>m!=null&&String(m).trim()!==""?!0:"Method is required"},viewOnly:n,id:t})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:!0,id:e,name:"properties.custom.endpoint",control:a,meta:{displayName:"URL",placeholder:rde(t)},validationRules:{required:"URL is required"},viewOnly:n,editorId:`${t}-custom-url-${r}`,showSuggestions:!0})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(ss,{variant:"full-width",tabs:xle,selectedTab:i,setSelectedTab:o})}),i==="Query Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.query_params",field:"query_params",type:t,title:"Query Params",viewOnly:n,isLoop:r})}),i==="State Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.state_params",field:"state_params",type:t,title:"State Params",viewOnly:n,isLoop:r})}),i==="Headers"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.headers",field:"headers",type:t,title:"Headers",viewOnly:n,isLoop:r})}),i==="Body"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.body",field:"body",type:t,title:"Body",viewOnly:n,isLoop:r,showKeyValuePair:!1})})]})});ml.displayName="CustomApiSection";const cg=e=>{const{control:t,name:r,label:n,placeholder:i,addNewButtonText:o,searchFieldPlaceholder:s,description:a,authType:l,options:u,isLoading:c,TESSERACT_MAIN_URL:f,FRONTEND_URL:p,ENTITY_ID:h,openIntegrationDrawer:A,viewOnly:g,isTokenRevoked:m,handleReconnect:O,handleChange:y,validationMessage:T,id:v}=e;return d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:r,control:t,renderValueUi:C=>{const x=u.find(b=>b.value===C);return d.jsx(tf,{isTokenRevoked:m,onReconnect:O,disabled:g,optionTitle:x?.title})},meta:{options:u,displayProps:{loading:c},displayName:n,value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:f,FRONTEND_URL:p,ENTITY_ID:h,openIntegrationDrawer:A,addNewButtonText:o,searchFieldPlaceholder:s,authType:l,description:a,placeholder:i},validationRules:{required:T},handleChange:y,viewOnly:g,id:v})})},ZP="FYND_AIPIM",UBe="blt-int.ai-pim",HBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(D=>D.loopActivity),T=i("properties"),v=T?.operation||"",C=T?.resource||"",x=_.useMemo(()=>{if(!C)return[];const D=`${C}.`;return gue.filter($=>$.value.startsWith(D)).sort(($,U)=>$.title.localeCompare(U.title))},[C]),[b,w]=_.useState([]),[R,I]=_.useState(!1),[P,k]=_.useState("Query Params"),N=yn(b),{isTokenRevoked:L,setTokenRevoked:M,handleReconnect:B}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),H=()=>{I(!0);const D={page_size:999,current_page:1,type:"BOTH"},$=Xt(l,`/v1/integrations/entity/${ZP}`);zt.get($,{params:D}).then(({data:U})=>{w(ro(U.data))}).catch(U=>{sr(U,r)}).finally(()=>{I(!1)})};_.useEffect(()=>{if(H(),T?.integration_slug||o("properties.integration_slug",UBe,{shouldValidate:!1}),!C&&v){const D=v.split(".")[0];D&&o("properties.resource",D,{shouldValidate:!1})}},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===ZP&&(A?.meta?.auth_status==="ACTIVE"&&M(!1),H(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const j={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},X=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:U.required,id:f,name:`properties.${D}`,control:n,type:U.type==="number"?"number":"text",meta:{displayName:$,placeholder:U.placeholder||`Enter ${$.toLowerCase()}`,description:U.description,displayType:U.type==="number"?"number":"text"},validationRules:U.required?{required:`${$} is required`}:{},viewOnly:m,editorId:`${c}-${D}-${p}`,showSuggestions:!0,isLoop:p})},D),F=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${D}`,control:n,rules:U.required?{required:`${$} is required`}:{},render:({field:Y})=>d.jsx(Fi,{...Y,...j,label:$,suggestionLabel:$,id:`${c}-${D}`,activityType:c,size:"md",helperText:U.description,errorMsg:s.properties?.[D]?.message,error:!!s.properties?.[D]?.message,handleChange:z=>Y.onChange(z),required:U.required})})},D),V=(D={})=>d.jsxs(d.Fragment,{children:[X("page_no","Page Number",{type:"number",placeholder:String(D.page??1)}),X("page_size","Page Size",{type:"number",placeholder:String(D.size??50)})]}),G=()=>v?v==="products.list_external"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound Connector ID",{required:!0}),V()]}):v==="products.get_meta"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound Connector ID",{required:!0}),X("product_id","Product ID",{required:!0})]}):v==="products.bulk_export"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound Connector ID",{required:!0}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.entity",control:n,meta:{options:Oue,displayName:"Entity Type",searchFieldPlaceholder:"Search entity",placeholder:"Select entity"},validationRules:{required:"Entity Type is required"},viewOnly:m,required:!0})})}),F("payload","Export Request",{description:"Bulk export request body."})]}):v==="templates.list"?V():v==="templates.get"||v==="templates.delete"||v==="templates.validation_schema"?X("template_id","Template ID",{required:!0}):v==="templates.create"?F("template","Template",{required:!0,description:"Template definition (name, slug, attributes, etc.)."}):v==="templates.update"?d.jsxs(d.Fragment,{children:[X("template_id","Template ID",{required:!0}),F("template","Template Update",{required:!0})]}):v==="attributes.list"?d.jsxs(d.Fragment,{children:[V(),X("tag","Filter by Tag")]}):v==="attributes.list_tags"?null:v==="attributes.create"?F("attribute","Attribute",{required:!0,description:"Attribute definition (name, slug, type, options, etc.)."}):v==="attributes.get"||v==="attributes.delete"?X("attribute_id","Attribute ID",{required:!0}):v==="attributes.update"?d.jsxs(d.Fragment,{children:[X("attribute_id","Attribute ID",{required:!0}),F("attribute","Attribute Update",{required:!0})]}):v==="categories.list"||v==="categories.list_mappings"?V():v==="categories.create"?F("category","Category",{required:!0,description:"Category definition (name, slug, parent_id, attributes, etc.)."}):v==="categories.get"||v==="categories.delete"?X("category_id","Category ID",{required:!0}):v==="categories.update"?d.jsxs(d.Fragment,{children:[X("category_id","Category ID",{required:!0}),F("category","Category Update",{required:!0})]}):v==="categories.create_mapping"?F("mapping","Mapping",{required:!0,description:"Category-mapping definition."}):v==="categories.get_mapping_by_code"?X("code","Mapping Code",{required:!0}):v==="inbound.list"?V():v==="inbound.create"?F("connector","Connector",{required:!0,description:"Inbound connector definition."}):v==="inbound.get"||v==="inbound.delete"?X("inbound_id","Inbound ID",{required:!0}):v==="inbound.update"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound ID",{required:!0}),F("connector","Connector Update",{required:!0})]}):v==="mapper.list"?V():v==="mapper.create"?F("mapper","Mapper",{required:!0,description:"Transform function definition (name, code, etc.)."}):v==="mapper.execute"?F("payload","Execution Input",{required:!0,description:"Mapper code + input data for sandbox execution."}):v==="mapper.get"||v==="mapper.delete"?X("mapper_id","Mapper ID",{required:!0}):v==="mapper.update"?d.jsxs(d.Fragment,{children:[X("mapper_id","Mapper ID",{required:!0}),F("mapper","Mapper Update",{required:!0})]}):v==="custom.custom_api"?d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:P,setCustomSelectedTab:k}):null:null;return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd AIPIM Account",placeholder:"Select Fynd AIPIM account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd AIPIM account",description:"Fynd AIPIM credentials are encrypted and can be removed at any time.",authType:ZP,options:N,isLoading:R,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:L,handleReconnect:B,handleChange:D=>{D.value&&M(!1)},validationMessage:"AI PIM account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.resource",control:n,meta:{options:mue,displayName:"Resource",searchFieldPlaceholder:"Search resource",description:"Select the AI PIM resource.",placeholder:"Select a resource"},validationRules:{required:"Resource is required"},handleChange:({value:D})=>{D!==C&&o("properties.operation","",{shouldValidate:!1})},viewOnly:m,required:!0})})}),T?.secret&&C&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:x,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:G()})})]})}),VBe=Gi(HBe,""),JP="FYND_COMMERCE_B2B",GBe="blt-int.commerce-b2b",WBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(V=>V.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const V={page_size:999,current_page:1,type:"BOTH"},G=Xt(l,`/v1/integrations/entity/${JP}`);zt.get(G,{params:V}).then(({data:D})=>{x(ro(D.data))}).catch(D=>{sr(D,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",GBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===JP&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:D.required,id:f,name:`properties.${V}`,control:n,type:D.type==="number"?"number":"text",multiline:D.multiline,meta:{displayName:G,placeholder:D.placeholder||`Enter ${G.toLowerCase()}`,description:D.description,displayType:D.type==="number"?"number":"text"},validationRules:D.required?{required:`${G} is required`}:{},viewOnly:m,editorId:`${c}-${V}-${p}`,showSuggestions:!0,isLoop:p})},V),j=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${V}`,control:n,rules:D.required?{required:`${G} is required`}:{},render:({field:$})=>d.jsx(Fi,{...$,...B,label:G,suggestionLabel:G,id:`${c}-${V}`,activityType:c,size:"md",helperText:D.description,errorMsg:s.properties?.[V]?.message,error:!!s.properties?.[V]?.message,handleChange:U=>$.onChange(U),required:D.required})})},V),X=()=>d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]}),F=()=>{if(!v)return null;const V=[{title:"True",value:"true"},{title:"False",value:"false"}],G=[{title:"Pending",value:"pending"},{title:"In Progress",value:"inprogress"},{title:"Success",value:"success"},{title:"Failed",value:"failed"},{title:"Validating",value:"validating"},{title:"Syncing",value:"syncing"}],D=[{title:"Submitted",value:"submitted"},{title:"Approved",value:"approved"},{title:"Rejected",value:"rejected"},{title:"Renegotiated by Seller",value:"renegotiated_by_seller"}],$=(U,Y,z,Q)=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:`properties.${U}`,control:n,meta:{options:z,displayName:Y,placeholder:`Select ${Y.toLowerCase()}`,description:Q},viewOnly:m})})},U);if(v==="best_price.list")return d.jsxs(d.Fragment,{children:[j("items","Items",{required:!0,description:"Array of items to fetch best prices for (item_id, slug, item_code, price.effective {min,max}, price.marked {min,max})."}),H("currency_code","Currency Code",{required:!0,placeholder:"INR"}),H("currency_symbol","Currency Symbol",{required:!0,placeholder:"₹"}),H("app_user_id","App User ID",{required:!0}),H("app_currency_code","Override App Currency Code"),H("app_country_code","Override App Country Code")]});if(v==="contract.list")return d.jsxs(d.Fragment,{children:[X(),$("is_active","Is Active",V),$("status","Status",G),$("unmask","Unmask Sensitive Fields",V,"When true, returns unmasked merchant_id / notification_email.")]});if(v==="contract.get")return d.jsxs(d.Fragment,{children:[H("contract_id","Contract ID",{required:!0,placeholder:"MongoDB ObjectId"}),$("unmask","Unmask Sensitive Fields",V)]});if(v==="contract.create"||v==="contract.update"){const U=v==="contract.update";return d.jsxs(d.Fragment,{children:[U&&H("contract_id","Contract ID",{required:!0}),H("name","Name",{required:!U,placeholder:"Contract Pricing Offer 1"}),j("store_id","Store IDs",{required:!U,description:"Array of integer store IDs the contract applies to."}),H("schedule_start","Schedule Start",{placeholder:"2026-03-17T11:00:00.000Z",required:!U}),H("schedule_end","Schedule End",{placeholder:"2026-03-18T11:00:00.000Z",required:!U}),H("uploaded_file_url","Uploaded File URL",{required:!U}),j("notification_email","Notification Emails",{description:"Array of emails to notify on frequency thresholds."}),j("notification_frequency","Notification Frequency (days)",{description:"Array of integer day intervals at which notification emails are sent."}),$("is_active","Is Active",V)]})}if(v==="contract.delete"||v==="contract.sync")return H("contract_id","Contract ID",{required:!0});if(v==="ladder.list")return d.jsxs(d.Fragment,{children:[X(),$("is_active","Is Active",V),$("status","Status",G)]});if(v==="ladder.get"||v==="ladder.delete"||v==="ladder.sync")return H("ladder_id","Ladder ID",{required:!0});if(v==="ladder.create"||v==="ladder.update"){const U=v==="ladder.update";return d.jsxs(d.Fragment,{children:[U&&H("ladder_id","Ladder ID",{required:!0}),H("name","Name",{required:!U,placeholder:"Testing Ladder"}),j("store_id","Store IDs",{required:!U,description:"Array of integer store IDs."}),j("store_name_code","Store Name Code",{description:'Map of store ID (string) → display name. e.g. { "137595": "Bangalore" }'}),H("schedule_start","Schedule Start",{placeholder:"2026-03-30T16:24:00.000Z",required:!U}),H("schedule_end","Schedule End",{placeholder:"2026-03-31T16:24:00.000Z",required:!U}),H("uploaded_file_url","Uploaded File URL",{required:!U}),$("is_active","Is Active",V)]})}return v==="quotation.list"?d.jsxs(d.Fragment,{children:[X(),$("status","Status",D),H("from_date","From Date",{description:"ISO 8601 timestamp."}),H("to_date","To Date",{description:"ISO 8601 timestamp."}),$("unmask","Unmask Sensitive Fields",V,"When true, returns unmasked user.email / user.phone.")]}):v==="quotation.get"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),$("unmask","Unmask Sensitive Fields",V)]}):v==="quotation.approve"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),j("quotes","Quotes",{description:"Per-line approval payload — each item carries final/seller_quoted prices."}),j("notes","Notes")]}):v==="quotation.reject"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),H("reason","Rejection Reason",{required:!0,multiline:!0}),j("notes","Notes")]}):v==="quotation.renegotiate"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),j("quotes","Renegotiated Quotes",{required:!0,description:"Per-line renegotiated prices."}),H("due_date","Due Date",{placeholder:"2025-01-20"}),j("notes","Notes")]}):v==="quotation.add_note"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),H("text","Note Text",{required:!0,multiline:!0})]}):v==="custom.custom_api"?d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:R,setCustomSelectedTab:I}):null};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd Commerce B2B Account",placeholder:"Select Fynd Commerce B2B account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd Commerce B2B account",description:"Fynd Commerce B2B credentials are encrypted and can be removed at any time.",authType:JP,options:P,isLoading:b,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:k,handleReconnect:L,handleChange:V=>{V.value&&N(!1)},validationMessage:"Commerce B2B account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:Eue,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the Commerce B2B resource and action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:F()})})]})}),QBe=Gi(WBe,""),$s=e=>{const{name:t,label:r,description:n,addItemLabel:i,itemLabel:o,newItem:s,renderItem:a,minItems:l=0,viewOnly:u=!1}=e,c=E.useTheme(),{control:f}=Rr(),{fields:p,append:h,remove:A}=KAe({control:f,name:t});return d.jsxs(E.Stack,{gap:1.25,sx:{width:"100%"},children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[d.jsx(gn,{label:r,description:n}),!u&&d.jsx(E.IconButton,{onClick:()=>h(s()),sx:{p:.75,border:`1px solid ${c.palette.grey.brainstem}`,fontSize:c.typography.mdNormal.fontSize},color:"primary","aria-label":i||`Add ${r}`,children:d.jsx(Ue,{src:"ic_plus",sx:{path:{fill:c.palette.primary.main}}})})]}),p.length===0&&d.jsx(E.Typography,{variant:"body2",color:"text.secondary",children:"No items yet — click + to add one."}),p.map((g,m)=>d.jsxs(E.Box,{sx:{border:`1px solid ${c.palette.grey.brainstem}`,borderRadius:1,p:1.5},children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",mb:1,children:[d.jsx(E.Typography,{variant:"subtitle2",children:o?.(m)||`${r.replace(/s$/,"")} ${m+1}`}),!u&&p.length>l&&d.jsx(E.Button,{size:"small",color:"error",onClick:()=>A(m),"aria-label":`Remove item ${m+1}`,children:"Remove"})]}),d.jsx(E.Grid,{container:!0,gap:1.5,children:a(m)})]},g.id)),!u&&p.length>0&&d.jsxs(E.Button,{onClick:()=>h(s()),variant:"outlined",size:"small",sx:{alignSelf:"flex-start"},children:["+ ",i||`Add ${r.replace(/s$/,"")}`]})]})},eN="FYND_ENGAGE",zBe="blt-int.engage",XBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(V=>V.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const V={page_size:999,current_page:1,type:"BOTH"},G=Xt(l,`/v1/integrations/entity/${eN}`);zt.get(G,{params:V}).then(({data:D})=>{x(ro(D.data))}).catch(D=>{sr(D,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",zBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===eN&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:D.xs??12,children:d.jsx(kr,{required:D.required,id:f,name:V,control:n,type:D.type==="number"?"number":"text",meta:{displayName:G,placeholder:D.placeholder||`Enter ${G.toLowerCase()}`,description:D.description,displayType:D.type==="number"?"number":"text"},validationRules:D.required?{required:`${G} is required`}:{},viewOnly:m,editorId:`${c}-${V}-${p}`,showSuggestions:!0,isLoop:p})},V),j=(V,G,D={})=>H(`properties.${V}`,G,D),X=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${V}`,control:n,rules:D.required?{required:`${G} is required`}:{},render:({field:$})=>d.jsx(Fi,{...$,...B,label:G,suggestionLabel:G,id:`${c}-${V}`,activityType:c,size:"md",helperText:D.description,errorMsg:s.properties?.[V]?.message,error:!!s.properties?.[V]?.message,handleChange:U=>$.onChange(U),required:D.required})})},V),F=()=>{if(!v)return null;if(v==="users.create")return d.jsxs(d.Fragment,{children:[j("external_id","External ID",{required:!0,description:"Your internal user identifier."}),j("name","Name"),j("email","Email"),j("phone","Phone",{placeholder:"+91XXXXXXXXXX"}),j("gender","Gender",{placeholder:"male / female / other"}),j("date_of_birth","Date of Birth",{placeholder:"YYYY-MM-DD"}),X("custom_attributes","Custom Attributes",{description:"Free-form JSON object for additional profile attributes."})]});if(v==="users.get"||v==="users.delete"||v==="users.tier_status"||v==="users.tier_journey")return j("user_id","User ID",{required:!0});if(v==="users.update")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("name","Name"),j("email","Email"),j("phone","Phone",{placeholder:"+91XXXXXXXXXX"}),j("gender","Gender",{placeholder:"male / female / other"}),j("date_of_birth","Date of Birth",{placeholder:"YYYY-MM-DD"}),X("custom_attributes","Custom Attributes",{description:"Free-form JSON object for additional profile attributes."})]});if(v==="users.points_history")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("page","Page",{type:"number",placeholder:"1"}),j("limit","Limit",{type:"number",placeholder:"50"})]});if(v==="users.apply_referral")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("referral_code","Referral Code",{required:!0})]});if(v==="tiers.list")return null;if(v==="tiers.get")return j("tier_id","Tier ID",{required:!0});if(v==="wallet.balance")return j("user_id","User ID",{required:!0});if(v==="wallet.transfer")return d.jsxs(d.Fragment,{children:[j("user_id","From User ID",{required:!0}),j("to_user_id","To User ID",{required:!0}),j("points","Points",{required:!0,type:"number"}),j("reason","Reason")]});if(v==="wallet.add_points")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("points","Points to Credit",{required:!0,type:"number"}),j("reason","Reason"),X("metadata","Metadata")]});if(v==="wallet.redeem_points")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("points","Points to Redeem",{required:!0,type:"number"}),j("reason","Reason")]});if(v==="events.publish")return d.jsxs(d.Fragment,{children:[j("event_name","Event Name",{required:!0}),j("user_id","User ID",{required:!0}),X("properties","Event Properties")]});const V=G=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx($s,{name:G,label:"Items",description:"Items in the order — one row per SKU.",addItemLabel:"Add item",itemLabel:D=>`Item ${D+1}`,newItem:()=>({item_id:"",sku_code:"",ean_identifier:"",article_id:"",quantity:"",amount:"",currency:"",return_period:""}),viewOnly:m,renderItem:D=>d.jsxs(d.Fragment,{children:[H(`${G}.${D}.item_id`,"Item ID",{required:!0,xs:6}),H(`${G}.${D}.sku_code`,"SKU Code",{xs:6}),H(`${G}.${D}.ean_identifier`,"EAN Identifier",{xs:6}),H(`${G}.${D}.article_id`,"Article ID",{xs:6}),H(`${G}.${D}.quantity`,"Quantity",{required:!0,type:"number",xs:4}),H(`${G}.${D}.amount`,"Amount",{required:!0,type:"number",xs:4}),H(`${G}.${D}.currency`,"Currency",{placeholder:"INR",xs:4}),H(`${G}.${D}.return_period`,"Return Period (days)",{type:"number"})]})})});if(v==="orders.create"||v==="orders.update"||v==="orders.calculate_loyalty"){const G=v==="orders.update";return d.jsxs(d.Fragment,{children:[j("order.transaction_id","Transaction ID",{required:!G,placeholder:"TXN-1"}),j("order.cart_id","Cart ID",{required:!G}),j("order.phoneNumber","Phone Number",{placeholder:"+91XXXXXXXXXX"}),j("order.order_amount","Order Amount",{required:!G,type:"number"}),j("order.currency","Currency",{placeholder:"INR",required:!G}),V("properties.order.items")]})}return v==="orders.get"?j("transaction_id","Transaction ID",{required:!0}):v==="orders.return"?d.jsxs(d.Fragment,{children:[j("return_payload.transaction_id","Transaction ID",{required:!0}),j("return_payload.trace_id","Trace ID"),j("return_payload.is_partial_refund_allowed","Allow Partial Refund",{placeholder:"true / false"}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx($s,{name:"properties.return_payload.return_items",label:"Return Items",addItemLabel:"Add return item",itemLabel:G=>`Return Item ${G+1}`,newItem:()=>({item_id:"",quantity:""}),viewOnly:m,renderItem:G=>d.jsxs(d.Fragment,{children:[H(`properties.return_payload.return_items.${G}.item_id`,"Item ID",{required:!0,xs:6}),H(`properties.return_payload.return_items.${G}.quantity`,"Quantity",{required:!0,type:"number",xs:6})]})})}),j("return_payload.meta.cart_id","Meta — Cart ID"),j("return_payload.meta.order_id","Meta — Order ID")]}):v==="orders.apply_discount"?d.jsxs(d.Fragment,{children:[j("payload.cart_id","Cart ID",{required:!0}),j("payload.phoneNumber","Phone Number"),j("payload.order_amount","Order Amount",{required:!0,type:"number"}),j("payload.currency","Currency",{placeholder:"INR"}),V("properties.payload.items")]}):v==="orders.award_points"?d.jsxs(d.Fragment,{children:[j("payload.transaction_id","Transaction ID",{required:!0}),j("payload.cart_id","Cart ID",{required:!0}),j("payload.order_amount","Order Amount",{required:!0,type:"number"}),j("payload.currency","Currency",{placeholder:"INR"}),V("properties.payload.items")]}):v==="orders.discount_rules"?X("filters","Filters"):v==="custom.custom_api"?d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:R,setCustomSelectedTab:I}):null};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd Engage Account",placeholder:"Select Fynd Engage account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd Engage account",description:"Fynd Engage credentials are encrypted and can be removed at any time.",authType:eN,options:P,isLoading:b,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:k,handleReconnect:L,handleChange:V=>{V.value&&N(!1)},validationMessage:"Engage account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:Aue,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the Engage resource and action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:F()})})]})}),qBe=Gi(XBe,""),tN="FYND_KONNECT",YBe="blt-int.konnect",KBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(F=>F.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const F={page_size:999,current_page:1,type:"BOTH"},V=Xt(l,`/v1/integrations/entity/${tN}`);zt.get(V,{params:F}).then(({data:G})=>{x(ro(G.data))}).catch(G=>{sr(G,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",YBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===tN&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(F,V,G={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:G.required,id:f,name:`properties.${F}`,control:n,type:G.type==="number"?"number":"text",meta:{displayName:V,placeholder:G.placeholder||`Enter ${V.toLowerCase()}`,description:G.description,displayType:G.type==="number"?"number":"text"},validationRules:G.required?{required:`${V} is required`}:{},viewOnly:m,editorId:`${c}-${F}-${p}`,showSuggestions:!0,isLoop:p})},F),j=(F,V,G={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${F}`,control:n,rules:G.required?{required:`${V} is required`}:{},render:({field:D})=>d.jsx(Fi,{...D,...B,label:V,suggestionLabel:V,id:`${c}-${F}`,activityType:c,size:"md",helperText:G.description,errorMsg:s.properties?.[F]?.message,error:!!s.properties?.[F]?.message,handleChange:$=>D.onChange($),required:G.required})})},F),X=()=>{if(!v)return null;switch(v){case"catalog.list_departments":case"catalog.list_brands":return d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"catalog.list_categories":return d.jsxs(d.Fragment,{children:[H("department_id","Department ID",{description:"Filter categories by department."}),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"catalog.list_attributes":case"catalog.list_hscodes":return null;case"catalog.list_templates":return d.jsxs(d.Fragment,{children:[H("department","Department"),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"catalog.list_tax_rules":return d.jsxs(d.Fragment,{children:[H("status","Status"),H("version_status","Version Status"),H("rule_name","Rule Name"),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"listings.count":return null;case"products.get":return d.jsxs(d.Fragment,{children:[H("name","Product Name"),H("slug","Slug"),H("item_code","Item Code(s)",{description:"Comma-separated list of item codes."}),H("sort_on","Sort On"),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"products.check_status":return H("trace_id","Trace ID",{required:!0,description:"Trace ID returned by a previous create / update / delete call."});case"products.create":return j("products","Products",{required:!0,description:"Bulk product payload (max 500 records)."});case"products.update":return j("products","Products",{required:!0,description:"Bulk product update payload (max 500 records)."});case"products.delete":return j("products","Products",{required:!0,description:"Bulk product delete payload identifying products to remove."});case"inventory.update":return j("inventory","Inventory Records",{required:!0,description:"Bulk inventory payload (max 500 records). Each record specifies SKU, location, and stock count."});case"pricing.update":return j("pricing","Pricing Records",{required:!0,description:"Bulk pricing payload (max 500 records). Each record sets MRP / ESP per SKU per location."});case"listings.list":return d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"}),H("from_date","From Date",{description:"ISO 8601 timestamp."}),H("to_date","To Date",{description:"ISO 8601 timestamp."}),H("sku","SKU Filter")]});case"orders.list":return d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"20"}),H("status","Status"),H("from_date","From Date",{description:"ISO 8601 timestamp."}),H("to_date","To Date",{description:"ISO 8601 timestamp."})]});case"orders.info":return H("shipment_id","Shipment ID",{required:!0});case"orders.cancel":return j("shipments","Shipments",{required:!0,description:"Cancellation payload (max 20 shipments)."});case"orders.confirm":return j("shipments","Shipments",{required:!0});case"orders.pack":return j("shipments","Shipments",{required:!0});case"orders.update_awb":return j("shipments","AWB Updates",{required:!0,description:"AWB / courier update payload."});case"orders.invoice_update":return j("invoices","Invoice Updates",{required:!0});case"orders.dispatch":return j("shipments","Shipments",{required:!0,description:"Shipments to mark as dispatched (max 20)."});case"orders.fetch_invoice":return j("shipments","Shipments",{required:!0,description:"Shipments to fetch customer invoices for (max 20)."});case"orders.shipping_labels":return j("shipments","Shipments",{required:!0,description:"Shipments to generate shipping labels for (max 20)."});case"orders.courier_details":return j("shipments","Shipments",{required:!0,description:"Shipments to fetch courier details for (max 20)."});case"orders.update_status":return j("shipments","Shipment Status Updates",{required:!0,description:"Shipment status update payload (max 20)."});case"orders.track":return d.jsxs(d.Fragment,{children:[H("awb_number","AWB Number"),H("shipment_id","Shipment ID")]});case"returns.create":return j("returns","Returns",{required:!0,description:"Returns / RTO payload (max 20 records)."});case"custom.custom_api":return d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:R,setCustomSelectedTab:I});default:return null}};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd Konnect Account",placeholder:"Select Fynd Konnect account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Konnect account",description:"Fynd Konnect credentials are encrypted and can be removed at any time.",authType:tN,options:P,isLoading:b,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:k,handleReconnect:L,handleChange:F=>{F.value&&N(!1)},validationMessage:"Konnect account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:hue,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the Konnect resource and action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:X()})})]})}),ZBe=Gi(KBe,""),rN="FYND_TMS",JBe="blt-int.fynd-tms",e7e=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(D=>D.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const D={page_size:999,current_page:1,type:"BOTH"},$=Xt(l,`/v1/integrations/entity/${rN}`);zt.get($,{params:D}).then(({data:U})=>{x(ro(U.data))}).catch(U=>{sr(U,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",JBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===rN&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:U.xs??12,children:d.jsx(kr,{required:U.required,id:f,name:D,control:n,type:U.type==="number"?"number":"text",meta:{displayName:$,placeholder:U.placeholder||`Enter ${$.toLowerCase()}`,description:U.description,displayType:U.type==="number"?"number":"text"},validationRules:U.required?{required:`${$} is required`}:{},viewOnly:m,editorId:`${c}-${D}-${p}`,showSuggestions:!0,isLoop:p})},D),j=(D,$,U={})=>H(`properties.${D}`,$,U),X=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:U.xs??12,children:d.jsx(pr,{name:D,control:n,rules:U.required?{required:`${$} is required`}:{},render:({field:Y})=>d.jsx(Fi,{...Y,...B,label:$,suggestionLabel:$,id:`${c}-${D}`,activityType:c,size:"md",helperText:U.description,placeholder:U.placeholder,handleChange:z=>Y.onChange(z),required:U.required})})},D),F=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${D}`,control:n,rules:U.required?{required:`${$} is required`}:{},render:({field:Y})=>d.jsx(Fi,{...Y,...B,label:$,suggestionLabel:$,id:`${c}-${D}`,activityType:c,size:"md",helperText:U.description,errorMsg:s.properties?.[D]?.message,error:!!s.properties?.[D]?.message,handleChange:z=>Y.onChange(z),required:U.required})})},D),V=()=>d.jsxs(d.Fragment,{children:[j("page","Page",{type:"number",placeholder:"1"}),j("size","Page Size",{type:"number",placeholder:"20"})]}),G=()=>v?v==="shipments.list"?d.jsxs(d.Fragment,{children:[V(),j("awb_number","AWB Numbers (comma separated)"),j("reference_id","Reference IDs"),j("order_id","Order IDs"),j("status_code","Status Codes"),j("created_from","Created From",{description:"ISO 8601 timestamp."}),j("created_to","Created To",{description:"ISO 8601 timestamp."}),j("pickup_serviceability_code","Pickup Serviceability Code"),j("drop_serviceability_code","Drop Serviceability Code"),j("dispatch_strategy","Dispatch Strategy"),j("hub_id","Hub IDs"),j("courier_identifier","Courier Identifier"),j("invoice_number","Invoice Number"),j("journey_type","Journey Type"),j("sort_field","Sort Field"),j("sort_order","Sort Order"),j("column","Columns")]}):v==="shipments.create"?d.jsxs(d.Fragment,{children:[j("identifier","Identifier",{description:"Optional batch identifier echoed back in the response."}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx($s,{name:"properties.data",label:"Shipments",description:"One ShipmentCreatePublic item per row.",addItemLabel:"Add shipment",itemLabel:D=>`Shipment ${D+1}`,newItem:()=>({reference_id:"",courier_identifier:"",journey_type:"",mps:"",length:"",width:"",height:"",weight:"",amount_to_collect:"",pickup_location:"",drop_location:"",rto_location:"",invoice:"",payment_method:"",packages:""}),viewOnly:m,renderItem:D=>d.jsxs(d.Fragment,{children:[H(`properties.data.${D}.reference_id`,"Reference ID",{placeholder:"REF-1",xs:6}),H(`properties.data.${D}.courier_identifier`,"Courier Identifier",{placeholder:"e.g. delhivery",xs:6}),H(`properties.data.${D}.journey_type`,"Journey Type",{placeholder:"forward / return",xs:6}),H(`properties.data.${D}.mps`,"Multi-Piece Shipment (MPS)",{placeholder:"true / false",xs:6}),H(`properties.data.${D}.length`,"Length",{type:"number",xs:3}),H(`properties.data.${D}.width`,"Width",{type:"number",xs:3}),H(`properties.data.${D}.height`,"Height",{type:"number",xs:3}),H(`properties.data.${D}.weight`,"Weight",{type:"number",xs:3}),H(`properties.data.${D}.amount_to_collect`,"Amount to Collect (COD)",{type:"number",placeholder:"0"}),X(`properties.data.${D}.pickup_location`,"Pickup Location",{required:!0,description:"Address + contact object.",placeholder:`{
|
|
505
|
+
`)+" "+U[1]:U[0]+$+" "+D.join(", ")+" "+U[1]}function v(D){return Array.isArray(D)}i.isArray=v;function C(D){return typeof D=="boolean"}i.isBoolean=C;function x(D){return D===null}i.isNull=x;function b(D){return D==null}i.isNullOrUndefined=b;function w(D){return typeof D=="number"}i.isNumber=w;function R(D){return typeof D=="string"}i.isString=R;function I(D){return typeof D=="symbol"}i.isSymbol=I;function P(D){return D===void 0}i.isUndefined=P;function k(D){return N(D)&&j(D)==="[object RegExp]"}i.isRegExp=k;function N(D){return typeof D=="object"&&D!==null}i.isObject=N;function L(D){return N(D)&&j(D)==="[object Date]"}i.isDate=L;function M(D){return N(D)&&(j(D)==="[object Error]"||D instanceof Error)}i.isError=M;function B(D){return typeof D=="function"}i.isFunction=B;function H(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}i.isPrimitive=H,i.isBuffer=r("./support/isBuffer");function j(D){return Object.prototype.toString.call(D)}function X(D){return D<10?"0"+D.toString(10):D.toString(10)}var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function V(){var D=new Date,$=[X(D.getHours()),X(D.getMinutes()),X(D.getSeconds())].join(":");return[D.getDate(),F[D.getMonth()],$].join(" ")}i.log=function(){},i.inherits=r("inherits"),i._extend=function(D,$){if(!$||!N($))return D;for(var U=Object.keys($),Y=U.length;Y--;)D[U[Y]]=$[U[Y]];return D};function G(D,$){return Object.prototype.hasOwnProperty.call(D,$)}}).call(this,r("_process"),typeof Ur<"u"?Ur:typeof self<"u"?self:typeof window<"u"?window:{})},{"./support/isBuffer":10,_process:14,inherits:9}],12:[function(r,n,i){},{}],13:[function(r,n,i){(function(o){function s(c,f){for(var p=0,h=c.length-1;h>=0;h--){var A=c[h];A==="."?c.splice(h,1):A===".."?(c.splice(h,1),p++):p&&(c.splice(h,1),p--)}if(f)for(;p--;p)c.unshift("..");return c}i.resolve=function(){for(var c="",f=!1,p=arguments.length-1;p>=-1&&!f;p--){var h=p>=0?arguments[p]:o.cwd();if(typeof h!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!h)continue;c=h+"/"+c,f=h.charAt(0)==="/"}return c=s(l(c.split("/"),function(A){return!!A}),!f).join("/"),(f?"/":"")+c||"."},i.normalize=function(c){var f=i.isAbsolute(c),p=u(c,-1)==="/";return c=s(l(c.split("/"),function(h){return!!h}),!f).join("/"),!c&&!f&&(c="."),c&&p&&(c+="/"),(f?"/":"")+c},i.isAbsolute=function(c){return c.charAt(0)==="/"},i.join=function(){var c=Array.prototype.slice.call(arguments,0);return i.normalize(l(c,function(f,p){if(typeof f!="string")throw new TypeError("Arguments to path.join must be strings");return f}).join("/"))},i.relative=function(c,f){c=i.resolve(c).substr(1),f=i.resolve(f).substr(1);function p(T){for(var v=0;v<T.length&&T[v]==="";v++);for(var C=T.length-1;C>=0&&T[C]==="";C--);return v>C?[]:T.slice(v,C-v+1)}for(var h=p(c.split("/")),A=p(f.split("/")),g=Math.min(h.length,A.length),m=g,O=0;O<g;O++)if(h[O]!==A[O]){m=O;break}for(var y=[],O=m;O<h.length;O++)y.push("..");return y=y.concat(A.slice(m)),y.join("/")},i.sep="/",i.delimiter=":",i.dirname=function(c){if(typeof c!="string"&&(c=c+""),c.length===0)return".";for(var f=c.charCodeAt(0),p=f===47,h=-1,A=!0,g=c.length-1;g>=1;--g)if(f=c.charCodeAt(g),f===47){if(!A){h=g;break}}else A=!1;return h===-1?p?"/":".":p&&h===1?"/":c.slice(0,h)};function a(c){typeof c!="string"&&(c=c+"");var f=0,p=-1,h=!0,A;for(A=c.length-1;A>=0;--A)if(c.charCodeAt(A)===47){if(!h){f=A+1;break}}else p===-1&&(h=!1,p=A+1);return p===-1?"":c.slice(f,p)}i.basename=function(c,f){var p=a(c);return f&&p.substr(-1*f.length)===f&&(p=p.substr(0,p.length-f.length)),p},i.extname=function(c){typeof c!="string"&&(c=c+"");for(var f=-1,p=0,h=-1,A=!0,g=0,m=c.length-1;m>=0;--m){var O=c.charCodeAt(m);if(O===47){if(!A){p=m+1;break}continue}h===-1&&(A=!1,h=m+1),O===46?f===-1?f=m:g!==1&&(g=1):f!==-1&&(g=-1)}return f===-1||h===-1||g===0||g===1&&f===h-1&&f===p+1?"":c.slice(f,h)};function l(c,f){if(c.filter)return c.filter(f);for(var p=[],h=0;h<c.length;h++)f(c[h],h,c)&&p.push(c[h]);return p}var u="ab".substr(-1)==="b"?function(c,f,p){return c.substr(f,p)}:function(c,f,p){return f<0&&(f=c.length+f),c.substr(f,p)}}).call(this,r("_process"))},{_process:14}],14:[function(r,n,i){var o=n.exports={},s,a;function l(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?s=setTimeout:s=l}catch{s=l}try{typeof clearTimeout=="function"?a=clearTimeout:a=u}catch{a=u}})();function c(v){if(s===setTimeout)return setTimeout(v,0);if((s===l||!s)&&setTimeout)return s=setTimeout,setTimeout(v,0);try{return s(v,0)}catch{try{return s.call(null,v,0)}catch{return s.call(this,v,0)}}}function f(v){if(a===clearTimeout)return clearTimeout(v);if((a===u||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(v);try{return a(v)}catch{try{return a.call(null,v)}catch{return a.call(this,v)}}}var p=[],h=!1,A,g=-1;function m(){!h||!A||(h=!1,A.length?p=A.concat(p):g=-1,p.length&&O())}function O(){if(!h){var v=c(m);h=!0;for(var C=p.length;C;){for(A=p,p=[];++g<C;)A&&A[g].run();g=-1,C=p.length}A=null,h=!1,f(v)}}o.nextTick=function(v){var C=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)C[x-1]=arguments[x];p.push(new y(v,C)),p.length===1&&!h&&c(O)};function y(v,C){this.fun=v,this.array=C}y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={};function T(){}o.on=T,o.addListener=T,o.once=T,o.off=T,o.removeListener=T,o.removeAllListeners=T,o.emit=T,o.prependListener=T,o.prependOnceListener=T,o.listeners=function(v){return[]},o.binding=function(v){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(v){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],15:[function(r,n,i){var o=r("escodegen").generate;n.exports=function(a,l,u){u||(u={});var c=!u.allowAccessToMethodsOnFunctions;l||(l={});var f={},p=(function h(A,g){if(A.type==="Literal")return A.value;if(A.type==="UnaryExpression"){var m=h(A.argument,g);return A.operator==="+"?+m:A.operator==="-"?-m:A.operator==="~"?~m:A.operator==="!"?!m:f}else if(A.type==="ArrayExpression"){for(var O=[],y=0,T=A.elements.length;y<T;y++){var v=h(A.elements[y],g);if(v===f)return f;O.push(v)}return O}else if(A.type==="ObjectExpression"){for(var C={},y=0;y<A.properties.length;y++){var x=A.properties[y],b=x.value===null?x.value:h(x.value,g);if(b===f)return f;C[x.key.value||x.key.name]=b}return C}else if(A.type==="BinaryExpression"||A.type==="LogicalExpression"){var w=A.operator;if(w==="&&"){var T=h(A.left);if(T===f)return f;if(!T)return T;var R=h(A.right);return R===f?f:R}else if(w==="||"){var T=h(A.left);if(T===f)return f;if(T)return T;var R=h(A.right);return R===f?f:R}var T=h(A.left,g);if(T===f)return f;var R=h(A.right,g);return R===f?f:w==="=="?T==R:w==="==="?T===R:w==="!="?T!=R:w==="!=="?T!==R:w==="+"?T+R:w==="-"?T-R:w==="*"?T*R:w==="/"?T/R:w==="%"?T%R:w==="<"?T<R:w==="<="?T<=R:w===">"?T>R:w===">="?T>=R:w==="|"?T|R:w==="&"?T&R:w==="^"?T^R:f}else{if(A.type==="Identifier")return{}.hasOwnProperty.call(l,A.name)?l[A.name]:f;if(A.type==="ThisExpression")return{}.hasOwnProperty.call(l,"this")?l.this:f;if(A.type==="CallExpression"){var I=h(A.callee,g);if(I===f||typeof I!="function")return f;var P=A.callee.object?h(A.callee.object,g):f;P===f&&(P=null);for(var k=[],y=0,T=A.arguments.length;y<T;y++){var v=h(A.arguments[y],g);if(v===f)return f;k.push(v)}return g?void 0:I.apply(P,k)}else if(A.type==="MemberExpression"){var C=h(A.object,g);if(C===f||typeof C=="function"&&c)return f;if(A.property.type==="Identifier"&&!A.computed)return s(A.property.name)?f:C[A.property.name];var x=h(A.property,g);return x===null||x===f||s(x)?f:C[x]}else if(A.type==="ConditionalExpression"){var m=h(A.test,g);return m===f?f:m?h(A.consequent):h(A.alternate,g)}else if(A.type==="ExpressionStatement"){var m=h(A.expression,g);return m===f?f:m}else{if(A.type==="ReturnStatement")return h(A.argument,g);if(A.type==="FunctionExpression"){var N=A.body.body,L={};Object.keys(l).forEach(function(D){L[D]=l[D]});for(var y=0;y<A.params.length;y++){var M=A.params[y];if(M.type=="Identifier")l[M.name]=null;else return f}for(var y in N)if(h(N[y],!0)===f)return f;l=L;var B=Object.keys(l),H=B.map(function(D){return l[D]});return Function(B.join(", "),"return "+o(A)).apply(null,H)}else if(A.type==="TemplateLiteral"){for(var j="",y=0;y<A.expressions.length;y++)j+=h(A.quasis[y],g),j+=h(A.expressions[y],g);return j+=h(A.quasis[y],g),j}else if(A.type==="TaggedTemplateExpression"){var X=h(A.tag,g),F=A.quasi,V=F.quasis.map(h),G=F.expressions.map(h);return X.apply(null,[V].concat(G))}else return A.type==="TemplateElement"?A.value.cooked:f}}})(a);return p===f?void 0:p};function s(a){return a==="constructor"||a==="__proto__"}},{escodegen:12}],jsonpath:[function(r,n,i){n.exports=r("./lib/index")},{"./lib/index":5}]},{},["jsonpath"])("jsonpath")})})(GP)),GP.exports}var pBe=fBe();const hBe=Un(pBe),ABe=e=>{try{return dBe(e),!0}catch(t){return t}},mBe=e=>{try{return hBe.query({},e),!0}catch(t){return t}},gBe=_.forwardRef((e,t)=>{const{type:r,isLoop:n,suggestionsData:i,id:o,viewOnly:s=!1}=e,{loopSuggestionsData:a={}}=ct.useSelector(m=>m.loopActivity),{watch:l,control:u,setValue:c,formState:{errors:f}}=Rr(),p=l("properties.from_type"),h=l("properties.to_type"),A=tue.filter(m=>!!m.visibleKey.find(O=>O===p)),g=m=>m==="json"?"json":m==="xml"?"xml":"html";return _.useEffect(()=>{h===""&&c("properties.query","")},[h]),d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.from_type",control:u,meta:{options:eue,displayName:"Convert from",searchFieldPlaceholder:"Search",description:"Choose the type of data you are starting with.",placeholder:"Select Convert from"},validationRules:{required:"Convert from is required"},handleChange:()=>{c("properties.to_type","")},viewOnly:s,required:!0})}),p&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.data",control:u,rules:{required:"Data is required"},render:({field:m})=>d.jsx(Fi,{...m,label:"Data",showSuggestions:!0,suggestionsData:n?a:i,id:`${r}-data`,size:"md",suggestionLabel:"Data",viewOnly:s,language:g(p?.toLowerCase()),showHtmlPreview:p?.toLowerCase()?.includes("html"),placeholder:"Enter the input data to be converted.",handleChange:O=>m.onChange(O),showExpandOption:!0,error:!!f.properties?.data?.message,errorMsg:f.properties?.data?.message,helperText:"Paste or enter the input data to be converted.",required:!0})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.to_type",control:u,meta:{options:A,displayName:"Convert to",searchFieldPlaceholder:"Search",description:"Choose the type you want to convert the data into.",placeholder:"Select Convert to"},validationRules:{required:"Convert to is required"},viewOnly:s,required:!0})}),h==="jsonata"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.query",control:u,rules:{validate:m=>m&&ABe(m)!==!0?"Error in JSONata expression. Please check the expression's syntax.":!0},render:({field:m})=>d.jsx(Fi,{...m,language:"javascript",suggestionLabel:"Query",placeholder:"Enter a JSONata / JSONPath query to transform the data",size:"md",suggestionsData:n?a:i,id:`${r}-query2`,showSuggestions:!0,viewOnly:s,handleChange:O=>{Et(O)||m.onChange(O)},label:"Query",helperText:"To know more about how to use jsonata, visit https://docs.jsonata.org/overview.html.",showExpandOption:!0,error:!!f.properties?.query?.message,errorMsg:f.properties?.query?.message})})}),h==="jsonpath"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.query",control:u,rules:{validate:m=>m&&mBe(m)!==!0?"Error in JSONPath expression. Please check the expression's syntax.":!0},render:({field:m})=>d.jsx(Fi,{...m,language:"javascript",placeholder:"Enter a JSONata / JSONPath query to transform the data",size:"md",suggestionsData:n?a:i,id:`${r}-query`,showSuggestions:!0,viewOnly:s,handleChange:O=>{Et(O)||m.onChange(O)},suggestionLabel:"Query",label:"Query",helperText:"To know more about how to use JSONPath, visit https://goessner.net/articles/JsonPath/",error:!!f.properties?.query?.message,errorMsg:f.properties?.query?.message,showExpandOption:!0})})}),h==="graphql"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{id:o,name:"properties.query_options",control:u,meta:{displayName:"Query Options",description:"Provide GraphQL-specific options if your query needs them.",placeholder:"Specify Query Options"},viewOnly:s,editorId:`${r}-query_options`})}),!n&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:s,type:r})})]})})}),EBe=Gi(gBe,"");var jo=(e=>(e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.OBJECT="object",e.ARRAY="array",e.NULL="null",e))(jo||{});const _X={string:"",boolean:!0,number:0,object:{},array:[],null:[]},wX=e=>e?.jsonGui??Eb.colors.jsonGui,WP=e=>{const t=wX(e);return[{value:"string",label:"abc",color:t.string,icon:"ic_string",name:"String"},{value:"number",label:"123",color:t.number,icon:"ic_number",name:"Number"},{value:"boolean",label:"true",color:t.boolean,icon:"ic_boolean",name:"Boolean"},{value:"array",label:"[]",color:t.array,icon:"ic_array",name:"Array"},{value:"object",label:"{}",color:t.object,icon:"ic_object",name:"Object"},{value:"null",label:"null",color:t.null,icon:"ic_null",name:"Null"}]},IX=e=>{const t=wX(e);return[{value:"string",label:"abc",color:t.string,icon:"ic_string",name:"String"},{value:"number",label:"123",color:t.number,icon:"ic_number",name:"Number"},{value:"boolean",label:"true",color:t.boolean,icon:"ic_boolean",name:"Boolean"},{value:"null",label:"null",color:t.null,icon:"ic_null",name:"Null"}]};WP(null),IX(null);const bT=e=>Object.prototype.toString.call(e).match(/\w+/g)?.[1].toLowerCase(),DX=(e,t,r)=>{const n=e.shift(),i=Object.keys(t);if(e.length)return DX(e,t[i[n]],r);t[i[n]]=r},RX=(e,t,r)=>(DX(t,r,e),r),PX=e=>e.split("-").slice(1),OBe=e=>e&&typeof e=="object",ag=_.createContext(null),QP=e=>{const{setEditObject:t,editObject:r,setTempData:n}=_.useContext(ag),i=E.useTheme(),o=WP(i.palette),{uniqueKey:s,sourceData:a,id:l,showSuggestions:u,excludePayloadSuggestions:c=!1,onChange:f,setIsEditing:p}=e,h=Array.isArray(a),[A,g]=_.useState({}),[m,O]=_.useState({}),[y,T]=_.useState(""),v={fontSize:"18px",marginRight:"5px"},C=(N,L)=>{m[N]=L,A[N]={},T(""),g({...A}),O({...m}),p?.(!0),n(L?M=>({...M,"":""}):M=>{const B={...M};return delete B[""],B})},x=()=>{g({}),O({}),T("")};_.useEffect(()=>{x()},[h]);const b=(N,L)=>{const M=N.target.value.trim();A[L].key=M,g({...A});const B=LP(M,a);T(B)},w=(N,L)=>{A[N].value=L,g({...A})},R=(N,L)=>{A[N].type=L,A[N].value=_X[L],g({...A})},I=(N,L)=>{switch(L){case jo.NULL:return null;case jo.BOOLEAN:return typeof N=="string"?N==="true":!!N;case jo.NUMBER:return Number(N);case jo.STRING:return String(N||"");default:return N||""}},P=(N,L)=>{const M=A[N];if(!M)return;const{key:B,value:H,type:j}=M,F=j===jo.OBJECT||j===jo.ARRAY?j===jo.ARRAY?[]:{}:I(H,j);if(!h){const V=LP(B,L);if(V){T(V);return}}h?L.push(F):L[B]=F,t({...r}),x(),n?.({...r}),p?.(!1)},k=N=>{switch(N){case jo.STRING:return d.jsx(E.Stack,{width:"150px",children:d.jsx(lo,{viewOnly:e.viewOnly,fullWidth:!0,onChange:L=>w(s,L.target.value),showSuggestion:u,id:l,placeholder:"value",editorId:`${l}-${N}-${s}`,"data-testid":`${l}-${N}-${s}`,excludePayloadSuggestions:c})});case jo.NUMBER:return d.jsx(E.Stack,{width:"150px",ml:-1.5,children:d.jsx(lo,{viewOnly:e.viewOnly,fullWidth:!0,type:"number",placeholder:"value",autoComplete:"off",onChange:L=>w(s,+L.target.value),"data-testid":`${l}-${N}-${s}`,excludePayloadSuggestions:c})});case jo.BOOLEAN:return d.jsx(E.Stack,{width:"150px",ml:-1.5,children:d.jsxs(E.Select,{disabled:e.viewOnly,size:"small",value:A[s]?.value!==!1,"data-testid":`${l}-${N}-${s}`,sx:{".MuiInputBase-inputSizeSmall":{height:"auto !important"}},onChange:L=>{const M=L.target.value==="true";w(s,M)},children:[d.jsx(E.MenuItem,{value:"true",children:"true"}),d.jsx(E.MenuItem,{value:"false",children:"false"})]})});default:return null}};return d.jsx(E.Box,{className:"addItem",width:"100%",children:m[s]?d.jsxs(E.Stack,{direction:"row",alignItems:y?"flex-start":"center",width:"100%",children:[!h&&d.jsxs(E.Stack,{sx:{position:"relative"},children:[d.jsx(lo,{viewOnly:e.viewOnly,fullWidth:!0,onChange:N=>b(N,s),showSuggestion:u,id:l,sx:{width:"130px"},placeholder:"key",editorId:`key-${s}`,"data-testid":`key-${s}`,error:!!y,excludePayloadSuggestions:c}),y&&d.jsx(E.Box,{sx:{position:"absolute",top:38,left:0,color:i.palette.error.main,fontSize:"0.75rem",lineHeight:1},children:d.jsx(E.FormHelperText,{"data-testid":`errorMsg-${s}`,error:!0,children:y})})]}),d.jsx(E.Select,{size:"small","data-testid":`select-type-${s}`,disabled:e.viewOnly,sx:{mx:1,mr:2.1,".MuiSelect-select":{padding:"10px 38px 10px 14px",fontSize:10},".MuiInputBase-inputSizeSmall":{height:"auto !important"},".MuiOutlinedInput-notchedOutline":{p:0,width:"120px"}},MenuProps:{PaperProps:{sx:{minWidth:"120px !important",marginLeft:"4px !important"}}},onChange:N=>R(s,N.target.value),value:A[s]?.type||jo.STRING,renderValue:N=>{const L=o.find(M=>M.value===N);return d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,children:[d.jsx(Ue,{src:L?.icon,width:14,height:14,sx:{marginRight:8,color:L?.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:L?.name})]})},children:o.map(N=>d.jsxs(E.MenuItem,{value:N.value,sx:{...vf,minHeight:"40px !important","@media (min-width: 600px)":{minHeight:"40px !important"}},children:[d.jsx(Ue,{src:N.icon,width:18,height:18,sx:{color:N.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:N.name})]},N.value))}),d.jsx("span",{className:"jsonValue",children:k(A[s]?.type||jo.STRING)}),d.jsxs(E.Stack,{direction:"row",spacing:1,ml:Et(r)?1:0,children:[d.jsx(E.IconButton,{size:"small",color:"primary",onClick:()=>{P(s,a),f&&f(r)},sx:{minWidth:0},"data-testid":`confirm-${s}`,disabled:!!y||e?.viewOnly,children:d.jsx(Ue,{src:"ic_done",width:16,height:16})}),d.jsx(E.IconButton,{"data-testid":`close-btn-${s}`,size:"small",onClick:()=>{C(s,!1),p?.(!1)},disabled:e?.viewOnly,sx:{minWidth:0},children:d.jsx(Ue,{width:16,height:16,src:"ic_close"})})]})]}):d.jsxs(E.Button,{variant:"text",disabled:e.viewOnly,"data-testid":"json-gui-add-btn",sx:{color:N=>N.palette.primary[60],mt:Et(r)?0:2,"&:hover":{backgroundColor:"transparent",color:N=>N.palette.primary[50],"& .MuiTypography-root":{color:N=>N.palette.primary[50]},"& svg path":{fill:N=>N.palette.primary[50]}}},disableFocusRipple:!0,disableTouchRipple:!0,disableRipple:!0,disableElevation:!0,onClick:()=>C(s,!0),children:[d.jsx(Ue,{src:"ic_plus",sx:{...v,path:{fill:"currentColor"}}}),d.jsx(E.Typography,{variant:"smNormal",sx:{alignItems:"center"},children:"Add"})]})},s)},zP={base:{transformOrigin:"center",transition:"transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)",mr:.5},right:{transform:"rotate(0deg)"},down:{transform:"rotate(90deg)"}};function XP({fieldValue:e,uniqueKey:t}){const{onChangeAllow:r,allowMap:n}=_.useContext(ag);if(!OBe(e))return d.jsx("span",{});const i=!!n[t];return d.jsx(E.IconButton,{onClick:()=>r(t),"data-testid":`collapse-${t}`,sx:{...zP.base,...i?zP.down:zP.right},children:d.jsx(Ue,{src:"ic_right_arrow"})})}function NX(e){const t=E.useTheme(),r=WP(t.palette);return d.jsx(ag.Consumer,{children:({onChangeType:n})=>d.jsx(E.Select,{size:"small","data-testid":`select-type-${e.uniqueKey}`,disabled:e.viewOnly,sx:{".MuiSelect-select":{fontSize:10},".MuiInputBase-inputSizeSmall":{height:"auto !important"},".MuiOutlinedInput-notchedOutline":{p:0}},onChange:i=>n(i.target.value,e.uniqueKey),value:bT(e.fieldValue),renderValue:i=>{const o=r.find(s=>s.value===i);return d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,children:[d.jsx(Ue,{src:o?.icon,width:14,height:14,sx:{marginRight:8,color:o?.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:o?.name})]})},children:r.map(i=>d.jsxs(E.MenuItem,{value:i.value,sx:{...vf},children:[d.jsx(Ue,{src:i.icon,width:18,height:18,sx:{color:i.color}}),d.jsx(E.Typography,{variant:"smMedium",color:"text.secondary",children:i.name})]},i.value))})})}function yBe(e){const{setIsEditing:t,fieldValue:r,parentUniqueKey:n,viewOnly:i,getValue:o,deepLevel:s,id:a,showSuggestions:l,excludePayloadSuggestions:u,onClickDelete:c,onChange:f}=e,{allowMap:p}=_.useContext(ag),h=200,[A,g]=_.useState(h);_.useEffect(()=>{g(h)},[r]);const m=r.slice(0,A),O=r.length>A;return d.jsxs(E.Box,{className:"arrayContent",children:[d.jsx(E.Box,{sx:{marginTop:"10px"},"data-testid":"arrayContent",children:m.map((y,T)=>{const v=`${n}-${T}`,C=bT(y),x=["object","array"].includes(C)&&!!p[v];return d.jsxs(E.Stack,{className:"indexLine",direction:"row",alignItems:"center",gap:1,justifyContent:"flex-start",flexWrap:x?"wrap":"nowrap",sx:{"& .jsonValue":{flex:x?"1 1 100%":"0 0 auto",width:x?"100%":"auto",minWidth:x?"auto":"150px"}},children:[["object","array"].includes(C)&&d.jsx(XP,{uniqueKey:v,fieldValue:y}),d.jsx(NX,{viewOnly:i,uniqueKey:v,fieldValue:y,fieldKey:`${T}`,sourceData:r,"data-testid":`tools-${v}`,type:"array"}),d.jsx("span",{className:"jsonValue",children:o(y,T,r,s+1,v)}),d.jsx(E.Stack,{ml:1,alignItems:"center",direction:"row","data-testid":`delete-${v}`,sx:x?{position:"absolute",right:260,top:4}:{position:"relative",ml:1},children:d.jsx(E.IconButton,{disabled:i,onClick:()=>c(T,r),sx:{ml:.5,"&:hover":{backgroundColor:"transparent"}},children:d.jsx(Ue,{src:"ic_delete"})})})]},v)})}),O&&d.jsxs(E.Stack,{direction:"row",alignItems:"center",gap:1,sx:{mt:1},"data-testid":`array-load-more-${n}`,children:[d.jsx(E.Button,{size:"small",variant:"outlined",onClick:()=>g(y=>Math.min(y+h,r.length)),sx:{textTransform:"none"},children:`Load ${Math.min(h,r.length-A)} more`}),d.jsx(E.Typography,{variant:"xsNormal",color:"text.secondary",children:`Showing ${A} of ${r.length}`})]}),d.jsx(E.Box,{children:d.jsx(QP,{viewOnly:i,uniqueKey:n,deepLevel:s,sourceData:r,id:a,showSuggestions:l,excludePayloadSuggestions:u,setIsEditing:t,onChange:f},n)})]})}function LX(e){const t=E.useTheme(),{editObject:r,setEditObject:n,id:i,showSuggestions:o,setTempData:s,tempData:a,excludePayloadSuggestions:l=!1,viewOnly:u=!1,onChange:c,setIsEditing:f}=e,[p,h]=_.useState({}),[A,g]=_.useState({}),[m,O]=_.useState(!0),[y,T]=_.useState(!1),v=200,[C,x]=_.useState(v);_.useEffect(()=>{x(v)},[r]);const b=F=>{n({...F}),c?.(F),s&&s({...F})};_.useEffect(()=>{const F=setTimeout(()=>{O(!1)},500);return()=>clearTimeout(F)},[]);const w=(F,V)=>{Array.isArray(V)?(V.splice(+F,1),c&&c(V)):(Reflect.deleteProperty(V,F),c&&c(V)),b(r)},R=(F,V)=>{const G=F===jo.NULL?null:_X[F],D=RX(G,PX(V),r);b(D)},I=(F,V,G,D)=>{const $=F.target.value.trim();if(V!==$){const Q=LP($,D);if(g(W=>({...W,[G]:Q})),Q)return}const U={};for(const Q in D)Object.prototype.hasOwnProperty.call(D,Q)&&(Q===V?U[F.target.value]=D[Q]:U[Q]=D[Q]);g(Q=>{const W={...Q};return delete W[G],W});const Y=PX(G);if(Y.length===1)b(U);else{Y.pop();const Q=RX(U,Y,r);b(Q)}},P=(F,V,G,D="")=>{G[V]=D==="number"?Number(F):F,b(r)},k=F=>!!(typeof F!="object"||F===null||Array.isArray(F)||Object.keys(F).length===0),N={position:"absolute",left:-4,width:"2px",height:"calc(100% - 22px)",borderLeft:`1px solid ${t.palette.grey.outlined.border}`,"&::after":{content:'""',position:"absolute",bottom:0,width:"20px",height:"1px",backgroundColor:t.palette.grey.outlined.border},zIndex:1},L={position:"absolute",left:8,width:"2px",height:"calc(100% - 76px)",borderLeft:`1px solid ${t.palette.grey.outlined.border}`,zIndex:0,"&::after":{content:'""',position:"absolute",bottom:0,width:"30px",height:"1px",backgroundColor:t.palette.grey.outlined.border}},M=(F,V,G,D,$)=>{const U=bT(F),Y={autoComplete:"off",onChange:W=>P(W.target.value,V,G),value:F},z={position:"relative",paddingLeft:0},Q=k(F);switch(U){case jo.ARRAY:return!p[$]?d.jsx(E.Typography,{component:"span",variant:"smMedium",sx:{color:t.palette.text.secondary,opacity:.7,display:"inline-flex",alignItems:"center",height:24,whiteSpace:"nowrap"},"data-testid":`array-collapsed-${V}`,children:`[${F.length} ${F.length===1?"item":"items"}]`}):d.jsxs(E.Stack,{sx:z,children:[d.jsx(E.Box,{sx:{...N,height:"calc(100% - 17px)"}}),d.jsx(yBe,{viewOnly:u,fieldValue:F,fieldKey:V,sourceData:G,deepLevel:D,parentUniqueKey:$,getValue:M,id:i,showSuggestions:o,onClickDelete:w,"data-testid":`array-${V}`,excludePayloadSuggestions:l,setIsEditing:f,onChange:b})]});case jo.OBJECT:{const W=!!p[$],q=Object.keys(F||{}).length;return W?d.jsxs(E.Stack,{sx:z,"data-testid":`object-${V}`,children:[d.jsx(E.Box,{sx:{...N,height:Q?"calc(100% - 10px)":N.height}}),d.jsx("span",{children:X(F,D+1,$)})]}):d.jsx(E.Typography,{component:"span",variant:"smMedium",sx:{color:t.palette.text.secondary,opacity:.7,display:"inline-flex",alignItems:"center",height:24,whiteSpace:"nowrap"},"data-testid":`object-collapsed-${V}`,children:`{${q} ${q===1?"key":"keys"}}`})}case jo.STRING:return d.jsx(lo,{"data-testid":`text-string-${V}`,sx:{width:"140px"},size:"xs",disabled:u,id:i,showSuggestions:o,excludePayloadSuggestions:l,...Y,placeholder:"value"});case jo.NUMBER:return d.jsx(lo,{id:i,size:"xs",disabled:u,type:"number",placeholder:F,autoComplete:"off",showSuggestions:o,excludePayloadSuggestions:l,value:F,sx:{width:"140px"},"data-testid":`text-number-${V}`,onBlur:W=>P(+W.target.value,V,G),onChange:W=>P(W.target.value===""?"":+W.target.value,V,G,"number")});case jo.BOOLEAN:return d.jsxs(E.Select,{disabled:u,size:"small",sx:{width:"140px","& .MuiSelect-select":{display:"flex",alignItems:"center",paddingTop:"6px",paddingBottom:"6px"},"& .MuiOutlinedInput-input":{display:"flex",alignItems:"center"}},value:F?"true":"false","data-testid":`text-boolean-${V}`,onChange:W=>P(W.target.value==="true",V,G),children:[d.jsx(E.MenuItem,{value:"true",children:"true"}),d.jsx(E.MenuItem,{value:"false",children:"false"})]})}},B=F=>{p[F]=!p[F],h({...p})},H=()=>{T(!y)},j=1,X=(F,V=j,G=`${V}`)=>{const D=Object.keys(F);if(!D.length)return d.jsx(E.Box,{"data-testid":`addItem-${G}`,mt:Et(r)?0:"9px",ml:Et(r)?0:3,children:d.jsx(QP,{viewOnly:u,uniqueKey:`${G}`,deepLevel:V,sourceData:F,id:i,showSuggestions:o,excludePayloadSuggestions:l,onChange:z=>{c&&c(z)},setIsEditing:f})});const $=V===j,U=$?D.slice(0,C):D,Y=$&&D.length>C;return d.jsxs(E.Stack,{className:"objectContent","data-testid":"objectContent",sx:{marginLeft:j===V?"15px":"10px",py:1.5},onClick:z=>z.stopPropagation(),children:[d.jsx(E.Box,{children:U.map((z,Q)=>{const W=`${G}-${Q}`,q=F[z],Z=bT(q),te=["object","array"].includes(Z)&&!!p[W];return d.jsxs(E.Stack,{className:"indexLine",direction:"row",alignItems:A[W]?"flex-start":"center",gap:1,justifyContent:"flex-start",flexWrap:te?"wrap":"nowrap",sx:{"& .jsonValue":{flex:te?"1 1 100%":"0 0 auto",width:te?"100%":"auto",minWidth:te?"auto":"150px"},"& .jsonKey":{flex:"0 0 auto",minWidth:"auto"}},children:[["object","array"].includes(Z)&&d.jsx(E.Box,{sx:{width:j===V?"18px":"",display:"inline-block"},children:d.jsx(XP,{uniqueKey:W,fieldValue:q})}),d.jsxs(E.Stack,{direction:"row",alignItems:A[W]?"flex-start":"center",justifyContent:"flex-start",className:"jsonKey",gap:1,children:[d.jsx(lo,{disabled:u,size:"xs",sx:{width:"130px"},id:i,placeholder:"key",value:z||"",tabIndex:Q+1,onChange:ae=>I(ae,z,W,F),"data-testid":`text-key-${z}`,error:!!A[W],errorMsg:A[W],helperText:A[W]}),d.jsx(NX,{viewOnly:u,uniqueKey:W,fieldValue:q,fieldKey:z,sourceData:F,"data-testid":`tools-${z}`,type:"object"})]}),d.jsx("span",{className:Z!=="number"&&Z!=="boolean"?"jsonValue":"",children:M(q,z,F,V,W)}),d.jsx("span",{children:d.jsx(E.Stack,{ml:1,alignItems:"center",direction:"row",sx:{position:"absolute",right:te?150:30,top:4},"data-testid":`delete-${z}`,children:d.jsx(E.IconButton,{disabled:u,onClick:()=>w(z,F),sx:{"& path":{fill:t.palette.neutral.solid.bg},"&:hover":{backgroundColor:"transparent","& path":{fill:t.palette.error[60]}}},children:d.jsx(Ue,{src:"ic_delete",sx:{"& path":{fill:t.palette.neutral.solid.bg}}})})})})]},W)})}),Y&&d.jsxs(E.Stack,{direction:"row",alignItems:"center",gap:1,sx:{mt:1,ml:2},"data-testid":`load-more-${G}`,children:[d.jsx(E.Button,{size:"small",variant:"outlined",onClick:()=>x(z=>Math.min(z+v,D.length)),sx:{textTransform:"none"},children:`Load ${Math.min(v,D.length-C)} more`}),d.jsx(E.Typography,{variant:"xsNormal",color:"text.secondary",children:`Showing ${C} of ${D.length}`})]}),d.jsx(E.Box,{"data-testid":`addItem-button-${G}`,ml:j===V?4.5:2,children:d.jsx(QP,{viewOnly:u,uniqueKey:G,deepLevel:V,sourceData:F,id:i,showSuggestions:o,excludePayloadSuggestions:l,onChange:z=>{c&&c(z)},setIsEditing:f},G)})]})};return d.jsx(ag.Provider,{value:{editObject:r,setEditObject:n,setTempData:s,onChangeType:R,onClickDelete:w,onChangeAllow:B,allowMap:p},children:m?d.jsx(E.Box,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"300px",children:d.jsx(E.CircularProgress,{})}):d.jsxs(E.Box,{sx:{width:"100%",position:"relative",minHeight:y||Et(a)?0:"100px",paddingTop:"2rem"},"data-testid":"root-collapsible-json",children:[!Et(r)&&d.jsx(E.Box,{onClick:H,"data-testid":"root-collapse-part",children:d.jsx(XP,{uniqueKey:"ROOT_KEY",fieldValue:r})}),!y&&!Et(r)&&d.jsx(E.Box,{sx:L}),!y&&X(r,1,"ROOT_KEY")]})})}const kX=_.lazy(()=>Promise.resolve().then(()=>nX)),FX=()=>d.jsx(E.Stack,{alignItems:"center",justifyContent:"center",sx:{p:2,minHeight:120},children:d.jsx(hi,{size:30})}),vBe=_.forwardRef(({data:e={},label:t,infoVisible:r=!1,viewOnly:n=!1,helperText:i,required:o=!1,suggestionsData:s,showSuggestions:a=!1,errorMsg:l="",id:u,excludePayloadSuggestions:c=!1,onChange:f,title:p="",isDynamic:h=!1,fullScreen:A=!1,handleValidate:g,name:m},O)=>{const[y,T]=_.useState("GUI"),[v,C]=_.useState("GUI"),[x,b]=_.useState("Static"),[w,R]=_.useState({}),[I,P]=_.useState(!0),[k,N]=_.useState(!0),[L,M]=_.useState(!1),[B,H]=_.useState({}),[j,X]=_.useState(""),[F,V]=_.useState({}),G=E.useTheme(),[D,$]=_.useState(!1),[U,Y]=_.useState(!1),[z,Q]=_.useState([]),W=_.useRef(!1),q=_.useCallback(he=>{const Ae=he.trim();return/^\{\{[^}]+\}\}$/.test(Ae)},[]),Z=_.useMemo(()=>typeof w=="string"&&q(w),[w,q]),te=[{title:"GUI",disabled:U||Z},{title:"Raw",disabled:U}],ae=_.useCallback(he=>{if(he==null||he==="")return{};if(typeof he=="string"){if(q(he))return he;try{return JSON.parse(he)}catch{return{}}}return Lo(he)},[q]);_.useEffect(()=>{const he=ae(e);if(R(he),H(he),V(he),typeof he=="string"&&q(he))X(he),W.current=!1,P(!1),N(!1),T("Raw"),C("Raw");else{const Ae=JSON.stringify(he,null,2);Ae==="{}"&&W.current?(X(""),W.current=!1):(X(Ae),W.current=!1)}},[e,ae,q]);const ne=_.useMemo(()=>nA(B),[B]),ue=_.useCallback(()=>{if(!ne){if(Q([]),g&&g([]),I)typeof F=="string"&&q(F)?X(F):X(JSON.stringify(F,null,2));else if(q(j))V(j),R(j),H(j);else try{const he=JSON.parse(j);V(he),R(he),H(he)}catch{}P(he=>!he)}},[ne,I,F,j,g,q]),Oe=_.useCallback(()=>{if(Q([]),g&&g([]),k)typeof w=="string"&&q(w)?X(w):X(JSON.stringify(w,null,2));else if(q(j))R(j),H(j),V(j);else try{const he=JSON.parse(j);R(he),H(he),V(he)}catch{}N(he=>!he)},[k,w,j,g,q]),Te=()=>{H(he=>{const Ae={...he};return delete Ae[""],Ae}),M(!L)},se=_.useCallback(he=>{const Ae=ae(he);R(Ae),H(Ae),V(Ae)},[ae]),ie=_.useCallback(he=>{W.current=he.trim()==="",X(he)},[]),J=_.useCallback(he=>{try{if(!he||he.trim()===""){se({}),f&&f({});return}if(q(he)){f&&f(he.trim());return}let Ae;if(typeof he=="string")try{Ae=JSON.parse(he)}catch{return}else Ae=he;se(Ae),f&&f(Ae)}catch{}},[se,f,q]),K=_.useCallback(()=>{hd(JSON.stringify(w,null,2),"Copied to clipboard"),$(!0),setTimeout(()=>$(!1),2e3)},[w]),re=_.useCallback(he=>{if(he&&he.length>0){const Ae=he.map(fe=>fe.message);Q(Ae)}else Q([]);g&&g(he)},[g]),le={border:"1px solid",borderColor:l?G.palette.error.main:G.palette.grey.outlined.border,borderRadius:2};return d.jsxs(E.Stack,{spacing:1,"data-testid":"json-gui",ref:O,children:[r&&d.jsx(TBe,{"data-testid":"json-info-msg",message:"We recommend you expand this editor to full view for the best experience."}),d.jsx(Co,{open:L,"data-testid":"json-gui-fullscreen-popup",handleClose:Te,title:t||"Global variables",content:d.jsxs(E.Stack,{sx:{width:"100%",height:"80vh"},children:[d.jsx(ss,{variant:"normal",tabs:[{title:"GUI"},{title:"Raw"}],selectedTab:v,sx:{height:24,width:"fit-content",ml:"auto",mb:1},setSelectedTab:()=>{Oe(),C(v==="GUI"?"Raw":"GUI")}}),d.jsxs(E.Box,{sx:{overflow:"auto",position:"relative",height:"100%",background:G.palette.background.paper,...k?{borderRadius:"4px",border:`1px solid ${G.palette.grey[200]}`,p:1}:{}},children:[k?d.jsx(E.Stack,{"data-testid":"json-gui-builder",sx:{"& .MuiPaper-root":{width:"100% !important",borderRadius:"8px !important"}},children:d.jsx(E.Stack,{sx:{width:"100%",height:"auto",position:"relative",top:"unset",left:"unset",zIndex:"auto",maxWidth:"1200px",overflow:typeof w=="object"&&Object.keys(w).length===0?"visible":"auto"},p:1,children:d.jsx(E.Stack,{children:d.jsx(E.Stack,{minHeight:typeof B=="object"&&Object.keys(B).length===1?50:"auto",children:typeof w=="object"&&typeof B=="object"&&d.jsx(LX,{viewOnly:n,editObject:w,setEditObject:R,setTempData:H,id:u,showSuggestions:a,tempData:B,excludePayloadSuggestions:c,onChange:he=>{V(he),f&&f(he)},setIsEditing:Y})})})})}):d.jsx(E.Box,{sx:{height:"100%",overflowY:n?"visible":"auto"},children:d.jsx(_.Suspense,{fallback:d.jsx(FX,{}),children:d.jsx(kX,{size:"lg",language:"json",viewOnly:n,handleChange:ie,handleBlur:J,value:j,id:"code-editor-gui-full",suggestionsData:s,required:o,enableJsonGuiValidation:!0,handleValidate:re,"data-testid":"json-gui-code-editor-full",sx:{border:"none"},height:"75vh",allowArrayAtRoot:!!(m&&m.endsWith("payload"))||!!(m&&m.includes(".payload"))})})}),d.jsx(E.Stack,{onClick:K,sx:{position:"absolute",top:6,right:6,cursor:"pointer"},children:d.jsx(E.Tooltip,{"data-testid":"json-copy-tooltip",title:D?"Copied!":"Copy JSON",children:d.jsx(E.IconButton,{"data-testid":"json-gui-copy",onClick:K,size:"small",children:d.jsx(Ue,{src:"ic_copy",width:15,height:15,sx:{path:{fill:G.palette.common.black}}})})})})]})]})}),d.jsxs(E.Stack,{children:[d.jsxs(E.Stack,{direction:"row",alignItems:"flex-end",justifyContent:"space-between",children:[d.jsx(gn,{label:t||"",required:o,description:i}),h&&d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],selectedTab:x,sx:{height:24},setSelectedTab:()=>{b(x==="Static"?"Dynamic":"Static")}})]}),I?d.jsxs(E.Stack,{children:[d.jsxs(E.Stack,{"data-testid":"json-gui-builder",sx:{...le},children:[d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,p:1.5,children:[d.jsx(E.Typography,{variant:"smNormal",children:p}),d.jsxs(E.Stack,{direction:"row",position:"relative",alignItems:"center",children:[d.jsx(ss,{variant:"normal",tabs:te,selectedTab:y,sx:{height:24},setSelectedTab:()=>{ue(),T(y==="GUI"?"Raw":"GUI")}}),A&&d.jsx(E.IconButton,{"data-testid":"json-gui-fullscreen-button",onClick:Te,sx:{ml:1,position:"absolute",top:44,right:0,zIndex:999},children:d.jsx(Ue,{src:"ic_maximize"})})]})]}),d.jsx(E.Divider,{}),d.jsx(E.Stack,{sx:{width:"100%",height:"auto",position:"relative",maxWidth:"600px",maxHeight:"calc(80vh - 306px)",overflow:"auto"},p:1,children:d.jsx(E.Stack,{children:typeof w=="object"&&typeof B=="object"&&d.jsx(LX,{viewOnly:n,editObject:w,setEditObject:R,setTempData:H,id:u,showSuggestions:a,tempData:B,excludePayloadSuggestions:c,onChange:he=>{V(he),f&&f(he)},setIsEditing:Y})})})]}),z.length>0?d.jsx(E.Box,{sx:{mt:1},children:z.map((he,Ae)=>d.jsx(E.FormHelperText,{error:!0,children:he},`validation-error-${he}-${Ae}`))}):l?d.jsx(E.FormHelperText,{error:!0,children:l}):null,i&&d.jsx(E.FormHelperText,{children:i})]}):d.jsxs(E.Box,{children:[d.jsxs(E.Box,{sx:{...le,opacity:n?.6:1},children:[d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,p:1.5,children:[d.jsx(E.Typography,{variant:"smNormal",children:p}),d.jsxs(E.Stack,{direction:"row",alignItems:"center",position:"relative",children:[d.jsx(ss,{variant:"normal",tabs:te,selectedTab:y,sx:{height:24},setSelectedTab:()=>{ue(),T(x==="GUI"?"Raw":"GUI")}}),A&&d.jsx(E.IconButton,{"data-testid":"json-gui-fullscreen-button",onClick:Te,sx:{ml:1,position:"absolute",top:44,right:0,zIndex:999},children:d.jsx(Ue,{src:"ic_maximize"})})]})]}),d.jsx(E.Divider,{}),d.jsx(E.Box,{sx:{height:"100%",overflowY:n?"visible":"auto"},children:d.jsx(_.Suspense,{fallback:d.jsx(FX,{}),children:d.jsx(kX,{size:"lg",language:"json",viewOnly:n,handleChange:ie,handleBlur:J,value:j,id:`code-editor-gui-${u}`,suggestionsData:s,error:!!l,required:o,enableJsonGuiValidation:!0,handleValidate:re,"data-testid":"json-gui-code-editor",showSuggestions:a,codeEditorStyles:{border:"none"},allowArrayAtRoot:!!(m&&m.endsWith("payload"))||!!(m&&m.includes(".payload"))})})})]}),z.length>0?d.jsx(E.Box,{sx:{mt:1},children:z.map((he,Ae)=>d.jsx(E.FormHelperText,{error:!0,children:he},`validation-error-${he}-${Ae}`))}):l?d.jsx(E.FormHelperText,{error:!0,children:l}):null,i&&d.jsx(E.FormHelperText,{children:i})]})]})]})}),TBe=({message:e})=>{const t=E.useTheme();return d.jsxs(E.Stack,{alignItems:"center",spacing:1,direction:"row",sx:{background:t.palette.success[10],borderRadius:2,border:"1px solid",borderColor:t.palette.success[40]},p:1,children:[d.jsx(Ue,{src:"ic_success",sx:{path:{fill:t.palette.success.main}}}),d.jsx(E.Typography,{variant:"xsMedium",children:e})]})},MX=Gi(vBe),Wu=e=>{const{name:t,label:r,viewOnly:n=!1,validationRules:i={},required:o=!1,id:s,description:a,error:l,suggestionsData:u,...c}=e,{trigger:f,control:p}=Rr(),h=_.useRef(null),A=_.useRef([]),g=_.useCallback(y=>{const T=y?.length>0?y.map(v=>v.message):[];A.current=T,f(t)},[t,f]),m=_.useCallback(async y=>{if(i.validate){const v=typeof i.validate=="function"?await i.validate(y):!0;if(v!==!0)return v}const T=A.current;return T.length>0?T[0]:!0},[i.validate]),O=_.useMemo(()=>({...i,validate:m}),[i,m]);return d.jsx(pr,{name:t,control:p,rules:O,render:({field:y,fieldState:{error:T}})=>d.jsx(MX,{...y,ref:h,label:r,data:y.value,viewOnly:n,suggestionsData:u,helperText:a,errorMsg:T?.message||l?.errorMsg,required:o,id:s,showSuggestions:!0,handleValidate:g,onChange:v=>{f(t),y.onChange(v)},...c})})},SBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{type:n,openIntegrationDrawer:i,TESSERACT_MAIN_URL:o,ENTITY_ID:s,FRONTEND_URL:a,INTEGRATION_DATA:l,viewOnly:u=!1,id:c}=e,[f,p]=_.useState([]),[h,A]=_.useState(!1),{control:g,watch:m,setValue:O,resetField:y}=Rr(),T=m("properties.auth_type"),v=()=>{A(!0);const C={page_size:999,current_page:1,type:"SOURCE"},x=Xt(o,"/v1/integrations/entity/AUTHENTICATION");zt.get(x,{params:C}).then(({data:b})=>{const w=ro(b.data,["integration_meta"]),R=dT(w);p(fT(R))}).catch(b=>{sr(b,r)}).finally(()=>{A(!1)})};return _.useEffect(()=>{v()},[]),_.useEffect(()=>{l?._id&&l?.meta?.entity==="AUTHENTICATION"&&(v(),O("properties.auth_id",l._id,{shouldValidate:!0}))},[l]),_.useEffect(()=>{!Et(T)&&T!==Nl.NONE?v():y("properties.auth_id")},[T]),d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.auth_type",control:g,meta:{options:zO,displayName:"Authentication Type",searchFieldPlaceholder:"Search authentication type",placeholder:"Select Authentication Type"},validationRules:{required:"Auth type is required"},id:"auth_type",viewOnly:u,required:!0,onChange:C=>{O("properties.auth_type",C.target.value),O("properties.auth_id","")}})}),T&&T!==Nl.NONE&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.auth_id",control:g,meta:{options:yn(f),displayProps:{loading:h},displayName:"Authentication",value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:o,FRONTEND_URL:a,ENTITY_ID:s,openIntegrationDrawer:i,addNewButtonText:"Add new",searchFieldPlaceholder:"Search authentication",authType:"AUTHENTICATION",placeholder:"Select Authentication"},validationRules:{required:"Authentication is required"},viewOnly:u,id:n,groupBy:"integration_meta.auth_type"})})]})}),d.jsx(E.Divider,{}),d.jsx(En,{children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Wu,{name:"properties.test_payload",control:g,label:"Test Trigger Payload",viewOnly:u,showSuggestions:!0,excludePayloadSuggestions:!0,id:c})})})]})}),xBe=_.forwardRef(({placeholder:e="",onChange:t,value:r,height:n="100%",width:i="100%",label:o="",required:s=!1,errorMsg:a,helperText:l="",nodeId:u="",name:c,isLoop:f,viewOnly:p=!1,hideLabel:h=!1},A)=>{const g=E.useTheme(),{MCP_INTEGRATION_FORM:m}=aa(),{getNodes:O}=Rt.useReactFlow(),{selectedActivityId:y,aiGeneratedFieldMap:T}=ct.useSelector(G=>G.canvas),v=ao(l),[C,x]=_.useState(""),b=_.useRef(null),w=_.useRef(null),[R,I]=_.useState(""),P=G=>{x(G.target.value)},k=()=>{if(C.trim()!==""){const D=[...Array.isArray(r)?r:[],C.trim().split(",")[0]],$=new Set(D);t([...$]),x("")}},N=G=>{G.preventDefault();const{keyCode:D}=G;[13,32,188].includes(D)&&k()},L=G=>()=>{typeof r=="object"&&Array.isArray(r)&&t(r.filter(D=>D!==G))},M=(G,D)=>{G?.stopPropagation?.(),G?.preventDefault?.(),Array.isArray(r)&&t(r.filter($=>$!==D))},B=G=>{G.keyCode===8&&C.trim()===""?Array.isArray(r)&&r.length>0&&L(r[r.length-1])():G.key==="Enter"&&G.preventDefault()},H=()=>{b.current?.focus()},j=G=>{G.stopPropagation()};_.useEffect(()=>(document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}),[]),_.useEffect(()=>{I(typeof r=="string"?"Dynamic":"Static")},[r]);const X=(()=>{const G=O()||[],D=String(u||""),$=G.find(W=>W?.selected),U=G.find(W=>String(W?.id)===D)||G.find(W=>String(W?.id)===String(y))||$,Y=String(U?.id||""),Q=(T||{})[Y]||(T||{})[String(y||"")]||(T||{})[D];return Q&&typeof Q=="object"?Q:{}})(),F=String(c||"").replace(/^properties\./,""),V=!!F&&F in X&&r!==void 0&&r!==null&&(typeof r!="string"||r.trim()!=="")&&(!Array.isArray(r)||r.length>0);return d.jsx(E.FormControl,{fullWidth:!0,children:d.jsxs(E.Stack,{children:[o&&!h&&d.jsxs(E.Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-end",children:[d.jsx(gn,{required:s,label:o,description:v}),!p&&!m&&d.jsx(E.Stack,{pb:.5,children:d.jsx(ss,{variant:"normal",tabs:[{title:"Static"},{title:"Dynamic"}],selectedTab:R,setSelectedTab:()=>{R==="Static"?(t(""),I("Dynamic")):(t([]),I("Static"))}})})]}),typeof r=="object"&&Array.isArray(r)?d.jsxs(d.Fragment,{children:[d.jsxs(E.Stack,{spacing:1,border:1,sx:{position:"relative",borderColor:a?g.palette.error.main:g.palette.grey[300],":focus-within":{border:`1px solid ${g.palette.neutral.plain}`,transition:"all 100ms ease-in"}},height:n,width:i,borderRadius:2,px:1,py:0,maxHeight:"20rem",overflow:"auto",onClick:H,children:[V&&d.jsx(E.Stack,{sx:{position:"absolute",right:"1px",top:1,bottom:1,width:"15%",minWidth:64,maxWidth:96,borderTopRightRadius:8,borderBottomRightRadius:8,pointerEvents:"none",zIndex:0,background:`linear-gradient(90deg, ${E.alpha(g.palette.primary[5],0)} 0%, ${E.alpha(g.palette.primary[5],.35)} 62%, ${E.alpha(g.palette.primary[5],.9)} 100%)`}}),V&&d.jsx(E.Stack,{sx:{position:"absolute",right:12,top:11,zIndex:3,pointerEvents:"none",width:18,height:18,alignItems:"center",justifyContent:"center"},children:d.jsx(Ue,{src:"ic_AI",width:18,height:18,sx:{display:"block","& svg path":{fill:`${g.palette.primary.main} !important`,fillOpacity:"1 !important"}}})}),d.jsxs(E.Stack,{direction:"row",flexWrap:"nowrap",gap:1,alignItems:"center",ref:w,sx:{maxWidth:"100%",overflow:"hidden",minHeight:40,pr:V?4.75:0,position:"relative",zIndex:1},children:[(()=>{if(!r||!Array.isArray(r)||r.length===0)return null;const{visible:G,extra:D,hiddenSelections:$}=Ub(r||[],w);return d.jsxs(d.Fragment,{children:[G.map((U,Y)=>d.jsx(E.Chip,{label:U,disabled:p,deleteIcon:d.jsx(Ue,{sx:{"& svg":{width:16,height:16}},src:"ic_close"}),onDelete:L(U),sx:{flex:"0 0 auto",minWidth:"40px"}},`input-chip-${U}-${Y}`)),D>0&&d.jsx(Bw,{hiddenSelections:$,extra:D,handleChipDelete:M})]})})(),d.jsx(E.InputBase,{ref:A,fullWidth:!0,autoComplete:"off",placeholder:e,value:C,onChange:P,inputRef:b,onKeyUp:N,readOnly:p,disabled:p,onKeyDown:B,onBlur:()=>k(),sx:{"&.MuiInput-root":{border:"none",flex:1},"& .MuiInputBase-input":{padding:"4px"},":focus":{border:"none"},":focus-within":{border:"none",transition:"none",boxShadow:"none"},":active":{backgroundColor:"transparent"}}})]})]}),a&&d.jsx(E.FormHelperText,{error:!0,children:a})]}):d.jsx(lo,{id:u,language:"plaintext",required:!0,value:r,isLoop:f,viewOnly:p,editorId:`${u}-${c}`,showSuggestions:!0,placeholder:e,handleChange:G=>{t(G)},errorMsg:a,loading:null})]})})}),Qc=vc(xBe),BX=({field:e,type:t,nodeId:r,isLoop:n,viewOnly:i})=>{const o=E.useTheme(),{watch:s,control:a,setValue:l}=Rr(),u=s(e),c=p=>{l(e,u.filter((h,A)=>p!==A))},f=_.useMemo(()=>u?.map((p,h)=>`${r}-${t}-${Date.now()}-${h}`),[r,t,u?.length]);return d.jsx(d.Fragment,{children:u&&u?.map((p,h)=>d.jsxs(E.Grid,{container:!0,sx:{mb:1,py:1},alignItems:"flex-end",justifyContent:"space-between",children:[d.jsx(E.Grid,{item:!0,xs:11,children:d.jsx(kr,{autoFocus:!0,id:r,name:`${e}.${h}`,control:a,meta:{displayName:`Attachment ${h+1}`,description:_n(t,"attachments"),placeholder:`Attachment ${h+1}`},editorId:`${t}-attachment_${h}`,isLoop:n,viewOnly:i})}),d.jsx(E.Grid,{item:!0,xs:.5,sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:u.length>0&&d.jsx(E.IconButton,{sx:{p:.75,width:28,height:28,"& path":{fill:o.palette.neutral.solid.bg},"&:hover path":{fill:o.palette.error[60]},"&:hover":{backgroundColor:"transparent"}},disabled:i,onClick:()=>c(h),children:d.jsx(Ue,{src:"ic_delete",width:20,height:20})})})]},f[h]))})},bBe=e=>{const{field:t,viewOnly:r}=e,{watch:n,setValue:i,unregister:o}=Rr(),{setFieldControlState:s}=aa(),a=n(t),[l,u]=_.useState("BOLTIC_AI"),c=_.useRef([]);_.useEffect(()=>{a==="BOLTIC_AI"||a==="BOLTIC_AI_IGNORE"?u(a):Array.isArray(a)&&u("specific")},[a]);const f=p=>{const h=p.target.value;if(u(h),s(t,h),h==="specific"){const A=Array.isArray(a)&&a.length>0?a:c.current.length>0?c.current:[""];i(t,A)}else Array.isArray(a)&&(c.current=a,a.forEach((A,g)=>{o?.(`${t}.${g}`)}),o?.(t)),i(t,h)};return d.jsxs(E.Stack,{spacing:1.5,mt:.5,children:[d.jsx(E.FormControl,{fullWidth:!0,disabled:r,children:d.jsxs(E.Select,{value:l,onChange:f,children:[d.jsx(E.MenuItem,{sx:{py:.8},value:"BOLTIC_AI",children:"Have AI generate a value for this field"}),d.jsx(E.MenuItem,{sx:{py:.8},value:"BOLTIC_AI_IGNORE",children:"Do not include a value for this field"}),d.jsx(E.MenuItem,{sx:{py:.8},value:"specific",children:"Set a specific value for this field"})]})}),l==="specific"&&d.jsx(BX,{...e})]})},qP=e=>{const{MCP_INTEGRATION_FORM:t}=aa();return t?d.jsx(bBe,{...e}):d.jsx(BX,{...e})},CBe=_.forwardRef((e,t)=>{const{VORTEX_MAIN_URL:r,ENTITY_ID:n,TESSERACT_MAIN_URL:i,WORKFLOW_URLS:o,type:s,id:a,isLoop:l,FRONTEND_URL:u,suggestionsData:c,INTEGRATION_DATA:f,viewOnly:p=!1,openIntegrationDrawer:h}=e,A=ct.useDispatch(),g=E.useTheme(),{control:m,setValue:O,watch:y,getValues:T,formState:{errors:v}}=Rr(),{BOLTIC_EMAIL_DOMAIN:C}=o,x=y("properties"),[b,w]=_.useState([]),[R,I]=_.useState(!1),{loopSuggestionsData:P={}}=ct.useSelector(X=>X.loopActivity),k=_.useCallback(()=>{I(!0);const X={page_size:999,current_page:1,type:"DESTINATION"},F=Xt(i,"/v1/integrations/entity/EMAIL");zt.get(F,{params:X}).then(({data:V})=>{w(ro(V.data))}).catch(V=>{sr(V,A)}).finally(()=>{I(!1)})},[]),N=C?.split(",").map(X=>({title:`@${X.trim()}`,value:`@${X.trim()}`})),[L,M]=_.useState(()=>x.from?`@${x.from?.split("@")[1]}`:N[0]?.value),[B,H]=_.useState(()=>x.from?.split("@")[0]||"");_.useEffect(()=>{k()},[]),_.useEffect(()=>{f?._id&&f?.meta?.entity==="EMAIL"&&(k(),O("properties.email_auth_id",f._id,{shouldValidate:!0}))},[f]);const j=X=>{O(`properties.${X}`,[...T(`properties.${X}`)||[],""])};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:x.integration_slug==="blt-int.boltic-email"?d.jsxs(E.Stack,{direction:"row",children:[d.jsx(E.Box,{sx:{width:"60%"},children:d.jsx(kr,{id:a,name:"properties.from",control:m,meta:{displayName:"From",description:_n(s,"from"),renderFieldValue:()=>B},viewOnly:p,editorId:`${s}-from`,showSuggestions:!0,isLoop:l,handleChange:X=>{const{value:F}=X;O("properties.from",`${F}${L}`),H(F)},sx:{"& .MuiPaper-root":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"}}})}),d.jsx(E.Box,{sx:{width:"40%"},children:d.jsx(Yt,{name:"properties.from",control:m,meta:{options:N,displayName:"Domain",searchFieldPlaceholder:"Search Domain"},viewOnly:p,id:s,renderFieldValue:()=>L,handleChange:X=>{const{value:F}=X;O("properties.from",`${B}${F}`),M(F)},sx:{"& .MuiOutlinedInput-notchedOutline":{borderTopLeftRadius:0,borderBottomLeftRadius:0}}})})]}):d.jsx(Yt,{required:!0,name:"properties.email_auth_id",control:m,meta:{options:yn(b),displayProps:{loading:R},displayName:"Email Account",value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:i,FRONTEND_URL:u,ENTITY_ID:n,openIntegrationDrawer:h,addNewButtonText:"Add new account",searchFieldPlaceholder:"Search email account",authType:"EMAIL",description:"Select Email secret here.",placeholder:"Select Email Account"},validationRules:{required:"Email account is required"},viewOnly:p,id:s})})})}),(x.email_auth_id||x.integration_slug==="blt-int.boltic-email")&&d.jsx(E.Divider,{}),(x.email_auth_id||x.integration_slug==="blt-int.boltic-email")&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:!0,id:a,name:"properties.subject",control:m,meta:{displayName:"Subject",description:"Enter the subject to send in the email.",placeholder:"Type or add suggestion"},validationRules:{required:"Subject is required"},viewOnly:p,editorId:`${s}-subject-${l}`,showSuggestions:!0,isLoop:l})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.to",control:m,rules:{required:"To is required",validate:X=>Array.isArray(X)&&!X.every(V=>fu(V))?"To must have all the valid emails":!0},render:({field:X})=>d.jsx(Qc,{...X,required:!0,nodeId:a,label:"To",name:"to",viewOnly:p,isLoop:l,placeholder:"Enter email",onChange:F=>{X.onChange(typeof F=="string"?F:[...F])},errorMsg:v.properties?.to?.message})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.email_template",control:m,rules:{required:"Email body is required"},render:({field:X})=>d.jsx(Fi,{...X,label:"Email body",suggestionLabel:"Email body",id:`${s}-email_template`,activityType:s,VORTEX_MAIN_URL:r,ENTITY_ID:n,size:"md",viewOnly:p,showSuggestions:!0,language:"html",suggestionsData:l?P:c,showExpandOption:!0,showHtmlPreview:!0,errorMsg:v.properties?.email_template?.message,error:!!v.properties?.email_template?.message,handleChange:F=>{X.onChange(F)},required:!0})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.cc",control:m,rules:{validate:X=>Array.isArray(X)&&!X.every(V=>fu(V))?"Cc must have all the valid emails":!0},render:({field:X})=>d.jsx(Qc,{...X,nodeId:a,label:"Cc",name:"cc",viewOnly:p,placeholder:"Enter email",isLoop:l,onChange:F=>{X.onChange(typeof F=="string"?F:[...F])},errorMsg:v.properties?.cc?.message})})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.bcc",control:m,rules:{validate:X=>Array.isArray(X)&&!X.every(V=>fu(V))?"Bcc must have all the valid emails":!0},render:({field:X})=>d.jsx(Qc,{...X,nodeId:a,label:"Bcc",name:"bcc",isLoop:l,viewOnly:p,placeholder:"Enter email",onChange:F=>{X.onChange(typeof F=="string"?F:[...F])},errorMsg:v.properties?.bcc?.message})})}),d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsxs(E.Box,{sx:{display:"flex",alignItems:"center"},children:[d.jsx(E.FormControl,{fullWidth:!0,sx:{"& > .MuiStack-root > .MuiStack-root":{pb:0}},children:d.jsx(gn,{label:"Attachments",description:"The maximum attachment limit is 25Mb"})}),d.jsx(E.IconButton,{disabled:p,onClick:()=>j("attachments"),sx:{float:"right",p:.75,border:X=>`1px solid ${X.palette.grey.brainstem}`,fontSize:X=>X.typography.mdNormal.fontSize},color:"primary",children:d.jsx(Ue,{src:"ic_plus",width:g.icons.md,height:g.icons.md,sx:{svg:{path:{fill:g.palette.primary.main}}}})})]}),d.jsx(qP,{nodeId:a,type:s,isLoop:l,viewOnly:p,field:"properties.attachments"})]}),!l&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:p,type:s})})]})})]})}),_Be=Gi(CBe),wBe=_.forwardRef((e,t)=>{const{workflow:r}=ct.useSelector(x=>x.workflows),n=ct.useDispatch(),{type:i,VORTEX_MAIN_URL:o,ENTITY_ID:s,suggestionsData:a,viewOnly:l=!1,id:u}=e,[c,f]=_.useState([]),[p,h]=_.useState(!1),{control:A,setValue:g,watch:m}=Rr(),O=m("properties"),y=E.useTheme(),T=m("properties.child_workflow_id"),v=m("properties.child_workflow_name"),C=async(x="")=>{h(!0);const b={include:["scheduled","published"],limit:100,page:1,name:x};r&&(b.draft_id=r?.id);const w=Xt(o,`/v1.0/${s}/workflows`);zt.get(w,{params:b}).then(({data:R})=>{f(()=>T&&!R.data.find(I=>I.id===T)?[{id:T,name:v,version:O.version},...R.data]:R.data)}).catch(R=>{sr(R,n)}).finally(()=>{h(!1)})};return _.useEffect(()=>{C()},[]),_.useEffect(()=>{if(!T)g("properties",{...O,child_workflow_id:"",version:"",child_workflow_name:""});else{const x=c.find(b=>b.id===T);g("properties",{...O,version:x?.version,child_workflow_name:x?.name})}},[T]),d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.child_workflow_id",control:A,meta:{options:yn(c),displayName:"Workflow",searchFieldPlaceholder:"Search workflow",description:"Select the child workflow that you want to run",displayProps:{loading:p},placeholder:"Select Workflow"},validationRules:{required:"Workflow is required"},viewOnly:l,id:"child_workflow_id",handleChange:x=>{const{value:b}=x;if(b===""){const w=m("properties");g("properties",{...w,child_workflow_id:"",child_workflow_name:"",version:""})}},renderValueUi:x=>{if(!x)return d.jsx(E.Typography,{sx:{fontSize:"14px",color:y.palette.neutral.solid.bg,fontFamily:"inherit",":hover":{color:y.palette.neutral.main}},children:"Select Workflow"});const b=yn(c)?.find(w=>w?.value===x);return d.jsxs(E.Stack,{direction:"row",gap:1,children:[d.jsx(E.Typography,{sx:{fontSize:"14px",color:y.palette.text.primary,fontFamily:"inherit",...uu,maxWidth:"95%"},children:b?.title}),d.jsx(E.Chip,{sx:{fontSize:11},size:"small",label:`v${b?.version}`})]})},renderOption:(x,b)=>{const{title:w,value:R,version:I}=b;return d.jsx(E.MenuItem,{value:R,sx:{p:"8px !important",mx:1,height:"auto","&.Mui-selected":{"& .MuiTypography-root":{color:y.palette.primary.main}}},children:d.jsxs(E.Stack,{width:"100%",direction:"row",flexWrap:"wrap",sx:{...vf,gap:1},children:[d.jsx(E.Typography,{sx:{fontSize:"1rem",fontWeight:400,color:y.palette.text.primary,whiteSpace:"normal",wordBreak:"break-word",maxWidth:"88%"},children:w}),d.jsx(E.Chip,{sx:{fontSize:11},size:"small",label:`v${I}`})]})},R)}})})})}),O.child_workflow_id&&d.jsx(E.Divider,{}),O.child_workflow_id&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Wu,{name:"properties.payload",label:"Payload",viewOnly:l,id:u,suggestionsData:a,fullScreen:!0,showSuggestions:!0,helperText:"Provide the data needed for the child workflow, which will be available under the 'payload' property in the child workflow. This should always be an object. If you provide an array, only the first element will be used.",validationRules:{required:"Payload is required"}})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:l,type:i})})]})})]})}),IBe=Gi(wBe,"");var lg={exports:{}};lg.exports;var jX;function DBe(){return jX||(jX=1,(function(e,t){var r=200,n="Expected a function",i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Function]",A="[object GeneratorFunction]",g="[object Map]",m="[object Number]",O="[object Object]",y="[object Promise]",T="[object RegExp]",v="[object Set]",C="[object String]",x="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",R="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",k="[object Int8Array]",N="[object Int16Array]",L="[object Int32Array]",M="[object Uint8Array]",B="[object Uint8ClampedArray]",H="[object Uint16Array]",j="[object Uint32Array]",X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,V=/^\./,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,D=/[\\^$.*+?()[\]{}|]/g,$=/\\(\\)?/g,U=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,z={};z[I]=z[P]=z[k]=z[N]=z[L]=z[M]=z[B]=z[H]=z[j]=!0,z[l]=z[u]=z[w]=z[c]=z[R]=z[f]=z[p]=z[h]=z[g]=z[m]=z[O]=z[T]=z[v]=z[C]=z[b]=!1;var Q=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,W=typeof self=="object"&&self&&self.Object===Object&&self,q=Q||W||Function("return this")(),Z=t&&!t.nodeType&&t,te=Z&&!0&&e&&!e.nodeType&&e,ae=te&&te.exports===Z,ne=ae&&Q.process,ue=(function(){try{return ne&&ne.binding("util")}catch{}})(),Oe=ue&&ue.isTypedArray;function Te(xe,We,dt,Tt){for(var qt=-1,Qt=xe?xe.length:0;++qt<Qt;){var or=xe[qt];We(Tt,or,dt(or),xe)}return Tt}function se(xe,We){for(var dt=-1,Tt=xe?xe.length:0;++dt<Tt;)if(We(xe[dt],dt,xe))return!0;return!1}function ie(xe){return function(We){return We?.[xe]}}function J(xe,We){for(var dt=-1,Tt=Array(xe);++dt<xe;)Tt[dt]=We(dt);return Tt}function K(xe){return function(We){return xe(We)}}function re(xe,We){return xe?.[We]}function le(xe){var We=!1;if(xe!=null&&typeof xe.toString!="function")try{We=!!(xe+"")}catch{}return We}function he(xe){var We=-1,dt=Array(xe.size);return xe.forEach(function(Tt,qt){dt[++We]=[qt,Tt]}),dt}function Ae(xe,We){return function(dt){return xe(We(dt))}}function fe(xe){var We=-1,dt=Array(xe.size);return xe.forEach(function(Tt){dt[++We]=Tt}),dt}var Se=Array.prototype,ge=Function.prototype,ye=Object.prototype,je=q["__core-js_shared__"],Qe=(function(){var xe=/[^.]+$/.exec(je&&je.keys&&je.keys.IE_PROTO||"");return xe?"Symbol(src)_1."+xe:""})(),$e=ge.toString,Je=ye.hasOwnProperty,rt=ye.toString,tt=RegExp("^"+$e.call(Je).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=q.Symbol,Ve=q.Uint8Array,He=ye.propertyIsEnumerable,Ee=Se.splice,_e=Ae(Object.keys,Object),we=Gn(q,"DataView"),ee=Gn(q,"Map"),de=Gn(q,"Promise"),be=Gn(q,"Set"),Ge=Gn(q,"WeakMap"),Ne=Gn(Object,"create"),Me=Be(we),mt=Be(ee),St=Be(de),De=Be(be),nt=Be(Ge),ut=Ie?Ie.prototype:void 0,Ot=ut?ut.valueOf:void 0,It=ut?ut.toString:void 0;function Mt(xe){var We=-1,dt=xe?xe.length:0;for(this.clear();++We<dt;){var Tt=xe[We];this.set(Tt[0],Tt[1])}}function Dt(){this.__data__=Ne?Ne(null):{}}function Fe(xe){return this.has(xe)&&delete this.__data__[xe]}function Ye(xe){var We=this.__data__;if(Ne){var dt=We[xe];return dt===i?void 0:dt}return Je.call(We,xe)?We[xe]:void 0}function Xe(xe){var We=this.__data__;return Ne?We[xe]!==void 0:Je.call(We,xe)}function at(xe,We){var dt=this.__data__;return dt[xe]=Ne&&We===void 0?i:We,this}Mt.prototype.clear=Dt,Mt.prototype.delete=Fe,Mt.prototype.get=Ye,Mt.prototype.has=Xe,Mt.prototype.set=at;function yt(xe){var We=-1,dt=xe?xe.length:0;for(this.clear();++We<dt;){var Tt=xe[We];this.set(Tt[0],Tt[1])}}function vt(){this.__data__=[]}function $t(xe){var We=this.__data__,dt=vr(We,xe);if(dt<0)return!1;var Tt=We.length-1;return dt==Tt?We.pop():Ee.call(We,dt,1),!0}function Re(xe){var We=this.__data__,dt=vr(We,xe);return dt<0?void 0:We[dt][1]}function it(xe){return vr(this.__data__,xe)>-1}function et(xe,We){var dt=this.__data__,Tt=vr(dt,xe);return Tt<0?dt.push([xe,We]):dt[Tt][1]=We,this}yt.prototype.clear=vt,yt.prototype.delete=$t,yt.prototype.get=Re,yt.prototype.has=it,yt.prototype.set=et;function Pe(xe){var We=-1,dt=xe?xe.length:0;for(this.clear();++We<dt;){var Tt=xe[We];this.set(Tt[0],Tt[1])}}function st(){this.__data__={hash:new Mt,map:new(ee||yt),string:new Mt}}function gt(xe){return sn(this,xe).delete(xe)}function Zt(xe){return sn(this,xe).get(xe)}function dr(xe){return sn(this,xe).has(xe)}function Mr(xe,We){return sn(this,xe).set(xe,We),this}Pe.prototype.clear=st,Pe.prototype.delete=gt,Pe.prototype.get=Zt,Pe.prototype.has=dr,Pe.prototype.set=Mr;function hn(xe){var We=-1,dt=xe?xe.length:0;for(this.__data__=new Pe;++We<dt;)this.add(xe[We])}function dn(xe){return this.__data__.set(xe,i),this}function An(xe){return this.__data__.has(xe)}hn.prototype.add=hn.prototype.push=dn,hn.prototype.has=An;function lr(xe){this.__data__=new yt(xe)}function _r(){this.__data__=new yt}function wn(xe){return this.__data__.delete(xe)}function Ft(xe){return this.__data__.get(xe)}function Jt(xe){return this.__data__.has(xe)}function $r(xe,We){var dt=this.__data__;if(dt instanceof yt){var Tt=dt.__data__;if(!ee||Tt.length<r-1)return Tt.push([xe,We]),this;dt=this.__data__=new Pe(Tt)}return dt.set(xe,We),this}lr.prototype.clear=_r,lr.prototype.delete=wn,lr.prototype.get=Ft,lr.prototype.has=Jt,lr.prototype.set=$r;function Cr(xe,We){var dt=rn(xe)||wr(xe)?J(xe.length,String):[],Tt=dt.length,qt=!!Tt;for(var Qt in xe)Je.call(xe,Qt)&&!(qt&&(Qt=="length"||zs(Qt,Tt)))&&dt.push(Qt);return dt}function vr(xe,We){for(var dt=xe.length;dt--;)if(Xr(xe[dt][0],We))return dt;return-1}function Fr(xe,We,dt,Tt){return Vr(xe,function(qt,Qt,or){We(Tt,qt,dt(qt),or)}),Tt}var Vr=Ca(Cn),Br=Dl();function Cn(xe,We){return xe&&Br(xe,We,Ke)}function Sn(xe,We){We=Xs(We,xe)?[We]:ti(We);for(var dt=0,Tt=We.length;xe!=null&&dt<Tt;)xe=xe[me(We[dt++])];return dt&&dt==Tt?xe:void 0}function Ln(xe){return rt.call(xe)}function Ti(xe,We){return xe!=null&&We in Object(xe)}function eo(xe,We,dt,Tt,qt){return xe===We?!0:xe==null||We==null||!so(xe)&&!ri(We)?xe!==xe&&We!==We:en(xe,We,eo,dt,Tt,qt)}function en(xe,We,dt,Tt,qt,Qt){var or=rn(xe),gr=rn(We),mr=u,Ir=u;or||(mr=Si(xe),mr=mr==l?O:mr),gr||(Ir=Si(We),Ir=Ir==l?O:Ir);var qr=mr==O&&!le(xe),jr=Ir==O&&!le(We),nn=mr==Ir;if(nn&&!qr)return Qt||(Qt=new lr),or||to(xe)?rs(xe,We,dt,Tt,qt,Qt):pi(xe,We,mr,dt,Tt,qt,Qt);if(!(qt&s)){var Zr=qr&&Je.call(xe,"__wrapped__"),Ui=jr&&Je.call(We,"__wrapped__");if(Zr||Ui){var Wo=Zr?xe.value():xe,Ds=Ui?We.value():We;return Qt||(Qt=new lr),dt(Wo,Ds,Tt,qt,Qt)}}return nn?(Qt||(Qt=new lr),Rl(xe,We,dt,Tt,qt,Qt)):!1}function To(xe,We,dt,Tt){var qt=dt.length,Qt=qt;if(xe==null)return!Qt;for(xe=Object(xe);qt--;){var or=dt[qt];if(or[2]?or[1]!==xe[or[0]]:!(or[0]in xe))return!1}for(;++qt<Qt;){or=dt[qt];var gr=or[0],mr=xe[gr],Ir=or[1];if(or[2]){if(mr===void 0&&!(gr in xe))return!1}else{var qr=new lr,jr;if(!(jr===void 0?eo(Ir,mr,Tt,o|s,qr):jr))return!1}}return!0}function oe(xe){if(!so(xe)||So(xe))return!1;var We=kn(xe)||le(xe)?tt:U;return We.test(Be(xe))}function Ce(xe){return ri(xe)&&Qi(xe.length)&&!!z[rt.call(xe)]}function ze(xe){return typeof xe=="function"?xe:xe==null?pt:typeof xe=="object"?rn(xe)?er(xe[0],xe[1]):Pt(xe):Ut(xe)}function lt(xe){if(!Is(xe))return _e(xe);var We=[];for(var dt in Object(xe))Je.call(xe,dt)&&dt!="constructor"&&We.push(dt);return We}function Pt(xe){var We=zn(xe);return We.length==1&&We[0][2]?au(We[0][0],We[0][1]):function(dt){return dt===xe||To(dt,xe,We)}}function er(xe,We){return Xs(xe)&&Go(We)?au(me(xe),We):function(dt){var Tt=pe(dt,xe);return Tt===void 0&&Tt===We?Le(dt,xe):eo(We,Tt,void 0,o|s)}}function Yr(xe){return function(We){return Sn(We,xe)}}function Kr(xe){if(typeof xe=="string")return xe;if(zi(xe))return It?It.call(xe):"";var We=xe+"";return We=="0"&&1/xe==-1/0?"-0":We}function ti(xe){return rn(xe)?xe:lc(xe)}function Mn(xe,We){return function(dt,Tt){var qt=rn(dt)?Te:Fr,Qt={};return qt(dt,xe,ze(Tt),Qt)}}function Ca(xe,We){return function(dt,Tt){if(dt==null)return dt;if(!mn(dt))return xe(dt,Tt);for(var qt=dt.length,Qt=-1,or=Object(dt);++Qt<qt&&Tt(or[Qt],Qt,or)!==!1;);return dt}}function Dl(xe){return function(We,dt,Tt){for(var qt=-1,Qt=Object(We),or=Tt(We),gr=or.length;gr--;){var mr=or[++qt];if(dt(Qt[mr],mr,Qt)===!1)break}return We}}function rs(xe,We,dt,Tt,qt,Qt){var or=qt&s,gr=xe.length,mr=We.length;if(gr!=mr&&!(or&&mr>gr))return!1;var Ir=Qt.get(xe);if(Ir&&Qt.get(We))return Ir==We;var qr=-1,jr=!0,nn=qt&o?new hn:void 0;for(Qt.set(xe,We),Qt.set(We,xe);++qr<gr;){var Zr=xe[qr],Ui=We[qr];if(Tt)var Wo=or?Tt(Ui,Zr,qr,We,xe,Qt):Tt(Zr,Ui,qr,xe,We,Qt);if(Wo!==void 0){if(Wo)continue;jr=!1;break}if(nn){if(!se(We,function(Ds,Xi){if(!nn.has(Xi)&&(Zr===Ds||dt(Zr,Ds,Tt,qt,Qt)))return nn.add(Xi)})){jr=!1;break}}else if(!(Zr===Ui||dt(Zr,Ui,Tt,qt,Qt))){jr=!1;break}}return Qt.delete(xe),Qt.delete(We),jr}function pi(xe,We,dt,Tt,qt,Qt,or){switch(dt){case R:if(xe.byteLength!=We.byteLength||xe.byteOffset!=We.byteOffset)return!1;xe=xe.buffer,We=We.buffer;case w:return!(xe.byteLength!=We.byteLength||!Tt(new Ve(xe),new Ve(We)));case c:case f:case m:return Xr(+xe,+We);case p:return xe.name==We.name&&xe.message==We.message;case T:case C:return xe==We+"";case g:var gr=he;case v:var mr=Qt&s;if(gr||(gr=fe),xe.size!=We.size&&!mr)return!1;var Ir=or.get(xe);if(Ir)return Ir==We;Qt|=o,or.set(xe,We);var qr=rs(gr(xe),gr(We),Tt,qt,Qt,or);return or.delete(xe),qr;case x:if(Ot)return Ot.call(xe)==Ot.call(We)}return!1}function Rl(xe,We,dt,Tt,qt,Qt){var or=qt&s,gr=Ke(xe),mr=gr.length,Ir=Ke(We),qr=Ir.length;if(mr!=qr&&!or)return!1;for(var jr=mr;jr--;){var nn=gr[jr];if(!(or?nn in We:Je.call(We,nn)))return!1}var Zr=Qt.get(xe);if(Zr&&Qt.get(We))return Zr==We;var Ui=!0;Qt.set(xe,We),Qt.set(We,xe);for(var Wo=or;++jr<mr;){nn=gr[jr];var Ds=xe[nn],Xi=We[nn];if(Tt)var gf=or?Tt(Xi,Ds,nn,We,xe,Qt):Tt(Ds,Xi,nn,xe,We,Qt);if(!(gf===void 0?Ds===Xi||dt(Ds,Xi,Tt,qt,Qt):gf)){Ui=!1;break}Wo||(Wo=nn=="constructor")}if(Ui&&!Wo){var Wx=xe.constructor,Qx=We.constructor;Wx!=Qx&&"constructor"in xe&&"constructor"in We&&!(typeof Wx=="function"&&Wx instanceof Wx&&typeof Qx=="function"&&Qx instanceof Qx)&&(Ui=!1)}return Qt.delete(xe),Qt.delete(We),Ui}function sn(xe,We){var dt=xe.__data__;return ac(We)?dt[typeof We=="string"?"string":"hash"]:dt.map}function zn(xe){for(var We=Ke(xe),dt=We.length;dt--;){var Tt=We[dt],qt=xe[Tt];We[dt]=[Tt,qt,Go(qt)]}return We}function Gn(xe,We){var dt=re(xe,We);return oe(dt)?dt:void 0}var Si=Ln;(we&&Si(new we(new ArrayBuffer(1)))!=R||ee&&Si(new ee)!=g||de&&Si(de.resolve())!=y||be&&Si(new be)!=v||Ge&&Si(new Ge)!=b)&&(Si=function(xe){var We=rt.call(xe),dt=We==O?xe.constructor:void 0,Tt=dt?Be(dt):void 0;if(Tt)switch(Tt){case Me:return R;case mt:return g;case St:return y;case De:return v;case nt:return b}return We});function Qs(xe,We,dt){We=Xs(We,xe)?[We]:ti(We);for(var Tt,qt=-1,or=We.length;++qt<or;){var Qt=me(We[qt]);if(!(Tt=xe!=null&&dt(xe,Qt)))break;xe=xe[Qt]}if(Tt)return Tt;var or=xe?xe.length:0;return!!or&&Qi(or)&&zs(Qt,or)&&(rn(xe)||wr(xe))}function zs(xe,We){return We=We??a,!!We&&(typeof xe=="number"||Y.test(xe))&&xe>-1&&xe%1==0&&xe<We}function Xs(xe,We){if(rn(xe))return!1;var dt=typeof xe;return dt=="number"||dt=="symbol"||dt=="boolean"||xe==null||zi(xe)?!0:F.test(xe)||!X.test(xe)||We!=null&&xe in Object(We)}function ac(xe){var We=typeof xe;return We=="string"||We=="number"||We=="symbol"||We=="boolean"?xe!=="__proto__":xe===null}function So(xe){return!!Qe&&Qe in xe}function Is(xe){var We=xe&&xe.constructor,dt=typeof We=="function"&&We.prototype||ye;return xe===dt}function Go(xe){return xe===xe&&!so(xe)}function au(xe,We){return function(dt){return dt==null?!1:dt[xe]===We&&(We!==void 0||xe in Object(dt))}}var lc=kt(function(xe){xe=qs(xe);var We=[];return V.test(xe)&&We.push(""),xe.replace(G,function(dt,Tt,qt,Qt){We.push(qt?Qt.replace($,"$1"):Tt||dt)}),We});function me(xe){if(typeof xe=="string"||zi(xe))return xe;var We=xe+"";return We=="0"&&1/xe==-1/0?"-0":We}function Be(xe){if(xe!=null){try{return $e.call(xe)}catch{}try{return xe+""}catch{}}return""}var ot=Mn(function(xe,We,dt){Je.call(xe,dt)?xe[dt].push(We):xe[dt]=[We]});function kt(xe,We){if(typeof xe!="function"||We&&typeof We!="function")throw new TypeError(n);var dt=function(){var Tt=arguments,qt=We?We.apply(this,Tt):Tt[0],Qt=dt.cache;if(Qt.has(qt))return Qt.get(qt);var or=xe.apply(this,Tt);return dt.cache=Qt.set(qt,or),or};return dt.cache=new(kt.Cache||Pe),dt}kt.Cache=Pe;function Xr(xe,We){return xe===We||xe!==xe&&We!==We}function wr(xe){return $i(xe)&&Je.call(xe,"callee")&&(!He.call(xe,"callee")||rt.call(xe)==l)}var rn=Array.isArray;function mn(xe){return xe!=null&&Qi(xe.length)&&!kn(xe)}function $i(xe){return ri(xe)&&mn(xe)}function kn(xe){var We=so(xe)?rt.call(xe):"";return We==h||We==A}function Qi(xe){return typeof xe=="number"&&xe>-1&&xe%1==0&&xe<=a}function so(xe){var We=typeof xe;return!!xe&&(We=="object"||We=="function")}function ri(xe){return!!xe&&typeof xe=="object"}function zi(xe){return typeof xe=="symbol"||ri(xe)&&rt.call(xe)==x}var to=Oe?K(Oe):Ce;function qs(xe){return xe==null?"":Kr(xe)}function pe(xe,We,dt){var Tt=xe==null?void 0:Sn(xe,We);return Tt===void 0?dt:Tt}function Le(xe,We){return xe!=null&&Qs(xe,We,Ti)}function Ke(xe){return mn(xe)?Cr(xe):lt(xe)}function pt(xe){return xe}function Ut(xe){return Xs(xe)?ie(me(xe)):Yr(xe)}e.exports=ot})(lg,lg.exports)),lg.exports}var RBe=DBe();const YP=Un(RBe);var ug={exports:{}};ug.exports;var $X;function PBe(){return $X||($X=1,(function(e,t){var r=200,n="Expected a function",i="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Function]",A="[object GeneratorFunction]",g="[object Map]",m="[object Number]",O="[object Object]",y="[object Promise]",T="[object RegExp]",v="[object Set]",C="[object String]",x="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",R="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",k="[object Int8Array]",N="[object Int16Array]",L="[object Int32Array]",M="[object Uint8Array]",B="[object Uint8ClampedArray]",H="[object Uint16Array]",j="[object Uint32Array]",X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,V=/^\./,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,D=/[\\^$.*+?()[\]{}|]/g,$=/\\(\\)?/g,U=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,z={};z[I]=z[P]=z[k]=z[N]=z[L]=z[M]=z[B]=z[H]=z[j]=!0,z[l]=z[u]=z[w]=z[c]=z[R]=z[f]=z[p]=z[h]=z[g]=z[m]=z[O]=z[T]=z[v]=z[C]=z[b]=!1;var Q=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,W=typeof self=="object"&&self&&self.Object===Object&&self,q=Q||W||Function("return this")(),Z=t&&!t.nodeType&&t,te=Z&&!0&&e&&!e.nodeType&&e,ae=te&&te.exports===Z,ne=ae&&Q.process,ue=(function(){try{return ne&&ne.binding("util")}catch{}})(),Oe=ue&&ue.isTypedArray;function Te(pe,Le){for(var Ke=-1,pt=pe?pe.length:0;++Ke<pt;)if(Le(pe[Ke],Ke,pe))return!0;return!1}function se(pe){return function(Le){return Le?.[pe]}}function ie(pe,Le){for(var Ke=-1,pt=Array(pe);++Ke<pe;)pt[Ke]=Le(Ke);return pt}function J(pe){return function(Le){return pe(Le)}}function K(pe,Le){return pe?.[Le]}function re(pe){var Le=!1;if(pe!=null&&typeof pe.toString!="function")try{Le=!!(pe+"")}catch{}return Le}function le(pe){var Le=-1,Ke=Array(pe.size);return pe.forEach(function(pt,Ut){Ke[++Le]=[Ut,pt]}),Ke}function he(pe,Le){return function(Ke){return pe(Le(Ke))}}function Ae(pe){var Le=-1,Ke=Array(pe.size);return pe.forEach(function(pt){Ke[++Le]=pt}),Ke}var fe=Array.prototype,Se=Function.prototype,ge=Object.prototype,ye=q["__core-js_shared__"],je=(function(){var pe=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return pe?"Symbol(src)_1."+pe:""})(),Qe=Se.toString,$e=ge.hasOwnProperty,Je=ge.toString,rt=RegExp("^"+Qe.call($e).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tt=q.Symbol,Ie=q.Uint8Array,Ve=ge.propertyIsEnumerable,He=fe.splice,Ee=he(Object.keys,Object),_e=rs(q,"DataView"),we=rs(q,"Map"),ee=rs(q,"Promise"),de=rs(q,"Set"),be=rs(q,"WeakMap"),Ge=rs(Object,"create"),Ne=Is(_e),Me=Is(we),mt=Is(ee),St=Is(de),De=Is(be),nt=tt?tt.prototype:void 0,ut=nt?nt.valueOf:void 0,Ot=nt?nt.toString:void 0;function It(pe){var Le=-1,Ke=pe?pe.length:0;for(this.clear();++Le<Ke;){var pt=pe[Le];this.set(pt[0],pt[1])}}function Mt(){this.__data__=Ge?Ge(null):{}}function Dt(pe){return this.has(pe)&&delete this.__data__[pe]}function Fe(pe){var Le=this.__data__;if(Ge){var Ke=Le[pe];return Ke===i?void 0:Ke}return $e.call(Le,pe)?Le[pe]:void 0}function Ye(pe){var Le=this.__data__;return Ge?Le[pe]!==void 0:$e.call(Le,pe)}function Xe(pe,Le){var Ke=this.__data__;return Ke[pe]=Ge&&Le===void 0?i:Le,this}It.prototype.clear=Mt,It.prototype.delete=Dt,It.prototype.get=Fe,It.prototype.has=Ye,It.prototype.set=Xe;function at(pe){var Le=-1,Ke=pe?pe.length:0;for(this.clear();++Le<Ke;){var pt=pe[Le];this.set(pt[0],pt[1])}}function yt(){this.__data__=[]}function vt(pe){var Le=this.__data__,Ke=Cr(Le,pe);if(Ke<0)return!1;var pt=Le.length-1;return Ke==pt?Le.pop():He.call(Le,Ke,1),!0}function $t(pe){var Le=this.__data__,Ke=Cr(Le,pe);return Ke<0?void 0:Le[Ke][1]}function Re(pe){return Cr(this.__data__,pe)>-1}function it(pe,Le){var Ke=this.__data__,pt=Cr(Ke,pe);return pt<0?Ke.push([pe,Le]):Ke[pt][1]=Le,this}at.prototype.clear=yt,at.prototype.delete=vt,at.prototype.get=$t,at.prototype.has=Re,at.prototype.set=it;function et(pe){var Le=-1,Ke=pe?pe.length:0;for(this.clear();++Le<Ke;){var pt=pe[Le];this.set(pt[0],pt[1])}}function Pe(){this.__data__={hash:new It,map:new(we||at),string:new It}}function st(pe){return Ca(this,pe).delete(pe)}function gt(pe){return Ca(this,pe).get(pe)}function Zt(pe){return Ca(this,pe).has(pe)}function dr(pe,Le){return Ca(this,pe).set(pe,Le),this}et.prototype.clear=Pe,et.prototype.delete=st,et.prototype.get=gt,et.prototype.has=Zt,et.prototype.set=dr;function Mr(pe){var Le=-1,Ke=pe?pe.length:0;for(this.__data__=new et;++Le<Ke;)this.add(pe[Le])}function hn(pe){return this.__data__.set(pe,i),this}function dn(pe){return this.__data__.has(pe)}Mr.prototype.add=Mr.prototype.push=hn,Mr.prototype.has=dn;function An(pe){this.__data__=new at(pe)}function lr(){this.__data__=new at}function _r(pe){return this.__data__.delete(pe)}function wn(pe){return this.__data__.get(pe)}function Ft(pe){return this.__data__.has(pe)}function Jt(pe,Le){var Ke=this.__data__;if(Ke instanceof at){var pt=Ke.__data__;if(!we||pt.length<r-1)return pt.push([pe,Le]),this;Ke=this.__data__=new et(pt)}return Ke.set(pe,Le),this}An.prototype.clear=lr,An.prototype.delete=_r,An.prototype.get=wn,An.prototype.has=Ft,An.prototype.set=Jt;function $r(pe,Le){var Ke=me(pe)||lc(pe)?ie(pe.length,String):[],pt=Ke.length,Ut=!!pt;for(var xe in pe)$e.call(pe,xe)&&!(Ut&&(xe=="length"||sn(xe,pt)))&&Ke.push(xe);return Ke}function Cr(pe,Le){for(var Ke=pe.length;Ke--;)if(au(pe[Ke][0],Le))return Ke;return-1}var vr=Yr();function Fr(pe,Le){return pe&&vr(pe,Le,ri)}function Vr(pe,Le){Le=zn(Le,pe)?[Le]:er(Le);for(var Ke=0,pt=Le.length;pe!=null&&Ke<pt;)pe=pe[So(Le[Ke++])];return Ke&&Ke==pt?pe:void 0}function Br(pe){return Je.call(pe)}function Cn(pe,Le){return pe!=null&&Le in Object(pe)}function Sn(pe,Le,Ke,pt,Ut){return pe===Le?!0:pe==null||Le==null||!wr(pe)&&!rn(Le)?pe!==pe&&Le!==Le:Ln(pe,Le,Sn,Ke,pt,Ut)}function Ln(pe,Le,Ke,pt,Ut,xe){var We=me(pe),dt=me(Le),Tt=u,qt=u;We||(Tt=pi(pe),Tt=Tt==l?O:Tt),dt||(qt=pi(Le),qt=qt==l?O:qt);var Qt=Tt==O&&!re(pe),or=qt==O&&!re(Le),gr=Tt==qt;if(gr&&!Qt)return xe||(xe=new An),We||$i(pe)?Kr(pe,Le,Ke,pt,Ut,xe):ti(pe,Le,Tt,Ke,pt,Ut,xe);if(!(Ut&s)){var mr=Qt&&$e.call(pe,"__wrapped__"),Ir=or&&$e.call(Le,"__wrapped__");if(mr||Ir){var qr=mr?pe.value():pe,jr=Ir?Le.value():Le;return xe||(xe=new An),Ke(qr,jr,pt,Ut,xe)}}return gr?(xe||(xe=new An),Mn(pe,Le,Ke,pt,Ut,xe)):!1}function Ti(pe,Le,Ke,pt){var Ut=Ke.length,xe=Ut;if(pe==null)return!xe;for(pe=Object(pe);Ut--;){var We=Ke[Ut];if(We[2]?We[1]!==pe[We[0]]:!(We[0]in pe))return!1}for(;++Ut<xe;){We=Ke[Ut];var dt=We[0],Tt=pe[dt],qt=We[1];if(We[2]){if(Tt===void 0&&!(dt in pe))return!1}else{var Qt=new An,or;if(!(or===void 0?Sn(qt,Tt,pt,o|s,Qt):or))return!1}}return!0}function eo(pe){if(!wr(pe)||Si(pe))return!1;var Le=kt(pe)||re(pe)?rt:U;return Le.test(Is(pe))}function en(pe){return rn(pe)&&Xr(pe.length)&&!!z[Je.call(pe)]}function To(pe){return typeof pe=="function"?pe:pe==null?to:typeof pe=="object"?me(pe)?ze(pe[0],pe[1]):Ce(pe):qs(pe)}function oe(pe){if(!Qs(pe))return Ee(pe);var Le=[];for(var Ke in Object(pe))$e.call(pe,Ke)&&Ke!="constructor"&&Le.push(Ke);return Le}function Ce(pe){var Le=Dl(pe);return Le.length==1&&Le[0][2]?Xs(Le[0][0],Le[0][1]):function(Ke){return Ke===pe||Ti(Ke,pe,Le)}}function ze(pe,Le){return zn(pe)&&zs(Le)?Xs(So(pe),Le):function(Ke){var pt=Qi(Ke,pe);return pt===void 0&&pt===Le?so(Ke,pe):Sn(Le,pt,void 0,o|s)}}function lt(pe){return function(Le){return Vr(Le,pe)}}function Pt(pe){if(typeof pe=="string")return pe;if(mn(pe))return Ot?Ot.call(pe):"";var Le=pe+"";return Le=="0"&&1/pe==-1/0?"-0":Le}function er(pe){return me(pe)?pe:ac(pe)}function Yr(pe){return function(Le,Ke,pt){for(var Ut=-1,xe=Object(Le),We=pt(Le),dt=We.length;dt--;){var Tt=We[++Ut];if(Ke(xe[Tt],Tt,xe)===!1)break}return Le}}function Kr(pe,Le,Ke,pt,Ut,xe){var We=Ut&s,dt=pe.length,Tt=Le.length;if(dt!=Tt&&!(We&&Tt>dt))return!1;var qt=xe.get(pe);if(qt&&xe.get(Le))return qt==Le;var Qt=-1,or=!0,gr=Ut&o?new Mr:void 0;for(xe.set(pe,Le),xe.set(Le,pe);++Qt<dt;){var mr=pe[Qt],Ir=Le[Qt];if(pt)var qr=We?pt(Ir,mr,Qt,Le,pe,xe):pt(mr,Ir,Qt,pe,Le,xe);if(qr!==void 0){if(qr)continue;or=!1;break}if(gr){if(!Te(Le,function(jr,nn){if(!gr.has(nn)&&(mr===jr||Ke(mr,jr,pt,Ut,xe)))return gr.add(nn)})){or=!1;break}}else if(!(mr===Ir||Ke(mr,Ir,pt,Ut,xe))){or=!1;break}}return xe.delete(pe),xe.delete(Le),or}function ti(pe,Le,Ke,pt,Ut,xe,We){switch(Ke){case R:if(pe.byteLength!=Le.byteLength||pe.byteOffset!=Le.byteOffset)return!1;pe=pe.buffer,Le=Le.buffer;case w:return!(pe.byteLength!=Le.byteLength||!pt(new Ie(pe),new Ie(Le)));case c:case f:case m:return au(+pe,+Le);case p:return pe.name==Le.name&&pe.message==Le.message;case T:case C:return pe==Le+"";case g:var dt=le;case v:var Tt=xe&s;if(dt||(dt=Ae),pe.size!=Le.size&&!Tt)return!1;var qt=We.get(pe);if(qt)return qt==Le;xe|=o,We.set(pe,Le);var Qt=Kr(dt(pe),dt(Le),pt,Ut,xe,We);return We.delete(pe),Qt;case x:if(ut)return ut.call(pe)==ut.call(Le)}return!1}function Mn(pe,Le,Ke,pt,Ut,xe){var We=Ut&s,dt=ri(pe),Tt=dt.length,qt=ri(Le),Qt=qt.length;if(Tt!=Qt&&!We)return!1;for(var or=Tt;or--;){var gr=dt[or];if(!(We?gr in Le:$e.call(Le,gr)))return!1}var mr=xe.get(pe);if(mr&&xe.get(Le))return mr==Le;var Ir=!0;xe.set(pe,Le),xe.set(Le,pe);for(var qr=We;++or<Tt;){gr=dt[or];var jr=pe[gr],nn=Le[gr];if(pt)var Zr=We?pt(nn,jr,gr,Le,pe,xe):pt(jr,nn,gr,pe,Le,xe);if(!(Zr===void 0?jr===nn||Ke(jr,nn,pt,Ut,xe):Zr)){Ir=!1;break}qr||(qr=gr=="constructor")}if(Ir&&!qr){var Ui=pe.constructor,Wo=Le.constructor;Ui!=Wo&&"constructor"in pe&&"constructor"in Le&&!(typeof Ui=="function"&&Ui instanceof Ui&&typeof Wo=="function"&&Wo instanceof Wo)&&(Ir=!1)}return xe.delete(pe),xe.delete(Le),Ir}function Ca(pe,Le){var Ke=pe.__data__;return Gn(Le)?Ke[typeof Le=="string"?"string":"hash"]:Ke.map}function Dl(pe){for(var Le=ri(pe),Ke=Le.length;Ke--;){var pt=Le[Ke],Ut=pe[pt];Le[Ke]=[pt,Ut,zs(Ut)]}return Le}function rs(pe,Le){var Ke=K(pe,Le);return eo(Ke)?Ke:void 0}var pi=Br;(_e&&pi(new _e(new ArrayBuffer(1)))!=R||we&&pi(new we)!=g||ee&&pi(ee.resolve())!=y||de&&pi(new de)!=v||be&&pi(new be)!=b)&&(pi=function(pe){var Le=Je.call(pe),Ke=Le==O?pe.constructor:void 0,pt=Ke?Is(Ke):void 0;if(pt)switch(pt){case Ne:return R;case Me:return g;case mt:return y;case St:return v;case De:return b}return Le});function Rl(pe,Le,Ke){Le=zn(Le,pe)?[Le]:er(Le);for(var pt,Ut=-1,We=Le.length;++Ut<We;){var xe=So(Le[Ut]);if(!(pt=pe!=null&&Ke(pe,xe)))break;pe=pe[xe]}if(pt)return pt;var We=pe?pe.length:0;return!!We&&Xr(We)&&sn(xe,We)&&(me(pe)||lc(pe))}function sn(pe,Le){return Le=Le??a,!!Le&&(typeof pe=="number"||Y.test(pe))&&pe>-1&&pe%1==0&&pe<Le}function zn(pe,Le){if(me(pe))return!1;var Ke=typeof pe;return Ke=="number"||Ke=="symbol"||Ke=="boolean"||pe==null||mn(pe)?!0:F.test(pe)||!X.test(pe)||Le!=null&&pe in Object(Le)}function Gn(pe){var Le=typeof pe;return Le=="string"||Le=="number"||Le=="symbol"||Le=="boolean"?pe!=="__proto__":pe===null}function Si(pe){return!!je&&je in pe}function Qs(pe){var Le=pe&&pe.constructor,Ke=typeof Le=="function"&&Le.prototype||ge;return pe===Ke}function zs(pe){return pe===pe&&!wr(pe)}function Xs(pe,Le){return function(Ke){return Ke==null?!1:Ke[pe]===Le&&(Le!==void 0||pe in Object(Ke))}}var ac=Go(function(pe){pe=kn(pe);var Le=[];return V.test(pe)&&Le.push(""),pe.replace(G,function(Ke,pt,Ut,xe){Le.push(Ut?xe.replace($,"$1"):pt||Ke)}),Le});function So(pe){if(typeof pe=="string"||mn(pe))return pe;var Le=pe+"";return Le=="0"&&1/pe==-1/0?"-0":Le}function Is(pe){if(pe!=null){try{return Qe.call(pe)}catch{}try{return pe+""}catch{}}return""}function Go(pe,Le){if(typeof pe!="function"||Le&&typeof Le!="function")throw new TypeError(n);var Ke=function(){var pt=arguments,Ut=Le?Le.apply(this,pt):pt[0],xe=Ke.cache;if(xe.has(Ut))return xe.get(Ut);var We=pe.apply(this,pt);return Ke.cache=xe.set(Ut,We),We};return Ke.cache=new(Go.Cache||et),Ke}Go.Cache=et;function au(pe,Le){return pe===Le||pe!==pe&&Le!==Le}function lc(pe){return ot(pe)&&$e.call(pe,"callee")&&(!Ve.call(pe,"callee")||Je.call(pe)==l)}var me=Array.isArray;function Be(pe){return pe!=null&&Xr(pe.length)&&!kt(pe)}function ot(pe){return rn(pe)&&Be(pe)}function kt(pe){var Le=wr(pe)?Je.call(pe):"";return Le==h||Le==A}function Xr(pe){return typeof pe=="number"&&pe>-1&&pe%1==0&&pe<=a}function wr(pe){var Le=typeof pe;return!!pe&&(Le=="object"||Le=="function")}function rn(pe){return!!pe&&typeof pe=="object"}function mn(pe){return typeof pe=="symbol"||rn(pe)&&Je.call(pe)==x}var $i=Oe?J(Oe):en;function kn(pe){return pe==null?"":Pt(pe)}function Qi(pe,Le,Ke){var pt=pe==null?void 0:Vr(pe,Le);return pt===void 0?Ke:pt}function so(pe,Le){return pe!=null&&Rl(pe,Le,Cn)}function ri(pe){return Be(pe)?$r(pe):oe(pe)}function zi(pe,Le){var Ke={};return Le=To(Le),Fr(pe,function(pt,Ut,xe){Ke[Ut]=Le(pt,Ut,xe)}),Ke}function to(pe){return pe}function qs(pe){return zn(pe)?se(So(pe)):lt(pe)}e.exports=zi})(ug,ug.exports)),ug.exports}var NBe=PBe();const LBe=Un(NBe);var KP,UX;function kBe(){if(UX)return KP;UX=1;var e=200,t="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Symbol]",a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,c=typeof Ur=="object"&&Ur&&Ur.Object===Object&&Ur,f=typeof self=="object"&&self&&self.Object===Object&&self,p=c||f||Function("return this")();function h(Re,it,et){switch(et.length){case 0:return Re.call(it);case 1:return Re.call(it,et[0]);case 2:return Re.call(it,et[0],et[1]);case 3:return Re.call(it,et[0],et[1],et[2])}return Re.apply(it,et)}function A(Re,it){var et=Re?Re.length:0;return!!et&&y(Re,it,0)>-1}function g(Re,it){for(var et=-1,Pe=Re?Re.length:0,st=Array(Pe);++et<Pe;)st[et]=it(Re[et],et,Re);return st}function m(Re,it){for(var et=-1,Pe=it.length,st=Re.length;++et<Pe;)Re[st+et]=it[et];return Re}function O(Re,it,et,Pe){for(var st=Re.length,gt=et+-1;++gt<st;)if(it(Re[gt],gt,Re))return gt;return-1}function y(Re,it,et){if(it!==it)return O(Re,T,et);for(var Pe=et-1,st=Re.length;++Pe<st;)if(Re[Pe]===it)return Pe;return-1}function T(Re){return Re!==Re}function v(Re,it){for(var et=-1,Pe=Array(Re);++et<Re;)Pe[et]=it(et);return Pe}function C(Re,it){return Re.has(it)}function x(Re,it){return Re?.[it]}function b(Re){var it=!1;if(Re!=null&&typeof Re.toString!="function")try{it=!!(Re+"")}catch{}return it}function w(Re,it){return function(et){return Re(it(et))}}var R=Array.prototype,I=Function.prototype,P=Object.prototype,k=p["__core-js_shared__"],N=(function(){var Re=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||"");return Re?"Symbol(src)_1."+Re:""})(),L=I.toString,M=P.hasOwnProperty,B=P.toString,H=RegExp("^"+L.call(M).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),j=p.Symbol,X=w(Object.getPrototypeOf,Object),F=P.propertyIsEnumerable,V=R.splice,G=j?j.isConcatSpreadable:void 0,D=Object.getOwnPropertySymbols,$=Math.max,U=_e(p,"Map"),Y=_e(Object,"create");function z(Re){var it=-1,et=Re?Re.length:0;for(this.clear();++it<et;){var Pe=Re[it];this.set(Pe[0],Pe[1])}}function Q(){this.__data__=Y?Y(null):{}}function W(Re){return this.has(Re)&&delete this.__data__[Re]}function q(Re){var it=this.__data__;if(Y){var et=it[Re];return et===t?void 0:et}return M.call(it,Re)?it[Re]:void 0}function Z(Re){var it=this.__data__;return Y?it[Re]!==void 0:M.call(it,Re)}function te(Re,it){var et=this.__data__;return et[Re]=Y&&it===void 0?t:it,this}z.prototype.clear=Q,z.prototype.delete=W,z.prototype.get=q,z.prototype.has=Z,z.prototype.set=te;function ae(Re){var it=-1,et=Re?Re.length:0;for(this.clear();++it<et;){var Pe=Re[it];this.set(Pe[0],Pe[1])}}function ne(){this.__data__=[]}function ue(Re){var it=this.__data__,et=ye(it,Re);if(et<0)return!1;var Pe=it.length-1;return et==Pe?it.pop():V.call(it,et,1),!0}function Oe(Re){var it=this.__data__,et=ye(it,Re);return et<0?void 0:it[et][1]}function Te(Re){return ye(this.__data__,Re)>-1}function se(Re,it){var et=this.__data__,Pe=ye(et,Re);return Pe<0?et.push([Re,it]):et[Pe][1]=it,this}ae.prototype.clear=ne,ae.prototype.delete=ue,ae.prototype.get=Oe,ae.prototype.has=Te,ae.prototype.set=se;function ie(Re){var it=-1,et=Re?Re.length:0;for(this.clear();++it<et;){var Pe=Re[it];this.set(Pe[0],Pe[1])}}function J(){this.__data__={hash:new z,map:new(U||ae),string:new z}}function K(Re){return Ee(this,Re).delete(Re)}function re(Re){return Ee(this,Re).get(Re)}function le(Re){return Ee(this,Re).has(Re)}function he(Re,it){return Ee(this,Re).set(Re,it),this}ie.prototype.clear=J,ie.prototype.delete=K,ie.prototype.get=re,ie.prototype.has=le,ie.prototype.set=he;function Ae(Re){var it=-1,et=Re?Re.length:0;for(this.__data__=new ie;++it<et;)this.add(Re[it])}function fe(Re){return this.__data__.set(Re,t),this}function Se(Re){return this.__data__.has(Re)}Ae.prototype.add=Ae.prototype.push=fe,Ae.prototype.has=Se;function ge(Re,it){var et=Ot(Re)||ut(Re)?v(Re.length,String):[],Pe=et.length,st=!!Pe;for(var gt in Re)st&&(gt=="length"||be(gt,Pe))||et.push(gt);return et}function ye(Re,it){for(var et=Re.length;et--;)if(nt(Re[et][0],it))return et;return-1}function je(Re,it,et,Pe){var st=-1,gt=A,Zt=!0,dr=Re.length,Mr=[],hn=it.length;if(!dr)return Mr;it.length>=e&&(gt=C,Zt=!1,it=new Ae(it));e:for(;++st<dr;){var dn=Re[st],An=dn;if(dn=dn!==0?dn:0,Zt&&An===An){for(var lr=hn;lr--;)if(it[lr]===An)continue e;Mr.push(dn)}else gt(it,An,Pe)||Mr.push(dn)}return Mr}function Qe(Re,it,et,Pe,st){var gt=-1,Zt=Re.length;for(et||(et=de),st||(st=[]);++gt<Zt;){var dr=Re[gt];et(dr)?m(st,dr):st[st.length]=dr}return st}function $e(Re,it,et){var Pe=it(Re);return Ot(Re)?Pe:m(Pe,et(Re))}function Je(Re){if(!Ye(Re)||Ne(Re))return!1;var it=Dt(Re)||b(Re)?H:l;return it.test(De(Re))}function rt(Re){if(!Ye(Re))return mt(Re);var it=Me(Re),et=[];for(var Pe in Re)Pe=="constructor"&&(it||!M.call(Re,Pe))||et.push(Pe);return et}function tt(Re,it){return Re=Object(Re),Ie(Re,it,function(et,Pe){return Pe in Re})}function Ie(Re,it,et){for(var Pe=-1,st=it.length,gt={};++Pe<st;){var Zt=it[Pe],dr=Re[Zt];et(dr,Zt)&&(gt[Zt]=dr)}return gt}function Ve(Re,it){return it=$(it===void 0?Re.length-1:it,0),function(){for(var et=arguments,Pe=-1,st=$(et.length-it,0),gt=Array(st);++Pe<st;)gt[Pe]=et[it+Pe];Pe=-1;for(var Zt=Array(it+1);++Pe<it;)Zt[Pe]=et[Pe];return Zt[it]=gt,h(Re,this,Zt)}}function He(Re){return $e(Re,yt,ee)}function Ee(Re,it){var et=Re.__data__;return Ge(it)?et[typeof it=="string"?"string":"hash"]:et.map}function _e(Re,it){var et=x(Re,it);return Je(et)?et:void 0}var we=D?w(D,Object):$t,ee=D?function(Re){for(var it=[];Re;)m(it,we(Re)),Re=X(Re);return it}:$t;function de(Re){return Ot(Re)||ut(Re)||!!(G&&Re&&Re[G])}function be(Re,it){return it=it??r,!!it&&(typeof Re=="number"||u.test(Re))&&Re>-1&&Re%1==0&&Re<it}function Ge(Re){var it=typeof Re;return it=="string"||it=="number"||it=="symbol"||it=="boolean"?Re!=="__proto__":Re===null}function Ne(Re){return!!N&&N in Re}function Me(Re){var it=Re&&Re.constructor,et=typeof it=="function"&&it.prototype||P;return Re===et}function mt(Re){var it=[];if(Re!=null)for(var et in Object(Re))it.push(et);return it}function St(Re){if(typeof Re=="string"||at(Re))return Re;var it=Re+"";return it=="0"&&1/Re==-1/0?"-0":it}function De(Re){if(Re!=null){try{return L.call(Re)}catch{}try{return Re+""}catch{}}return""}function nt(Re,it){return Re===it||Re!==Re&&it!==it}function ut(Re){return Mt(Re)&&M.call(Re,"callee")&&(!F.call(Re,"callee")||B.call(Re)==n)}var Ot=Array.isArray;function It(Re){return Re!=null&&Fe(Re.length)&&!Dt(Re)}function Mt(Re){return Xe(Re)&&It(Re)}function Dt(Re){var it=Ye(Re)?B.call(Re):"";return it==i||it==o}function Fe(Re){return typeof Re=="number"&&Re>-1&&Re%1==0&&Re<=r}function Ye(Re){var it=typeof Re;return!!Re&&(it=="object"||it=="function")}function Xe(Re){return!!Re&&typeof Re=="object"}function at(Re){return typeof Re=="symbol"||Xe(Re)&&B.call(Re)==s}function yt(Re){return It(Re)?ge(Re):rt(Re)}var vt=Ve(function(Re,it){return Re==null?{}:(it=g(Qe(it),St),tt(Re,je(He(Re),it)))});function $t(){return[]}return KP=vt,KP}var FBe=kBe();const MBe=Un(FBe),BBe=_.forwardRef((e,t)=>{const{type:r,VORTEX_MAIN_URL:n,ENTITY_ID:i,TESSERACT_MAIN_URL:o,FRONTEND_URL:s,INTEGRATION_DATA:a,viewOnly:l=!1,openIntegrationDrawer:u}=e,c=ct.useDispatch(),{workflow:f}=ct.useSelector(Q=>Q.workflows),{source:p=""}=f,[h,A]=_.useState({}),[g,m]=_.useState([]),[O,y]=_.useState([]),[T,v]=_.useState(!1),[C,x]=_.useState(!1),[b,w]=_.useState(!1),[R,I]=_.useState(null),P=_.useRef([]),{control:k,watch:N,setValue:L,trigger:M}=Rr(),B=p?.includes("commerce_"),H=p?.split("_"),j=H&&H.length>1?H[1]:null,X=H&&H.length>2?H.slice(2).join("_"):j,F=N("properties"),V=N("properties.fp_auth_id"),G=async()=>{if(B)m([{name:X,id:p?.toLowerCase()||""}]),L("properties.fp_auth_id",p?.toLowerCase()||"",{shouldValidate:!0});else{v(!0);try{const{data:Q}=await zt.get(Xt(o,"/v1/integrations/entity/FYND_PLATFORM?get_form_data=true"),{params:{page_size:999,current_page:1,type:"BOTH"}});m(ro(Q.data))}catch(Q){sr(Q,c)}finally{v(!1)}}},D=async Q=>{w(!0);try{const W=Xt(n,`/v1.0/${i}`,"/utility/events-config"),q=Q?{id:Q}:{},{data:Z}=await zt.get(W,{params:q});P.current=Z.data.event_configs;const te=Z.data.event_configs.map(ue=>({...ue,display_name:`${ue.display_name}_${ue.event_category}`})),ae=YP(te,"event_category"),ne={application:$(ae.application),company:$(ae.company)};A(ne)}catch(W){sr(W,c)}finally{w(!1)}},$=Q=>{if(!Q)return{};const W={},q=YP(Q,"event_name");return Object.keys(q).forEach(Z=>{const te=YP(q[Z],"version");W[Z]=LBe(te,ae=>ae.map(ne=>MBe(ne,"version"))),W[Z].versions=Object.keys(te).map(ae=>({text:`V${ae}`,value:ae}))}),W},U=async Q=>{x(!0);try{const W=Xt(n,`/v1.0/${i}`,`/utility/applications?id=${Q}`),{data:q}=await zt.get(W);y(q?.data?.map(Z=>({id:Z.id,name:Z.name})))}catch(W){sr(W,c)}finally{x(!1)}};_.useEffect(()=>{const{fp_auth_id:Q}=F;Q&&(p?.includes("commerce_")?D(""):D(Q))},[]),_.useEffect(()=>{G()},[]),_.useEffect(()=>{a?._id&&a?.meta?.entity==="FYND_PLATFORM"&&(G(),L("properties.fp_auth_id",a._id,{shouldValidate:!0}))},[a]),_.useEffect(()=>{const{fp_auth_id:Q}=F;F?.event_details?.event_category==="application"&&U(Q)},[V,F?.event_details?.event_category]),_.useEffect(()=>{if(!Et(F?.event_details?.event_name)&&!Et(F?.event_details?.event_category)&&!Et(h)){const{event_name:Q,event_category:W}=F?.event_details;I(h[W][Q])}},[h]),_.useEffect(()=>{const Q=F?.event_id;if(!Q?.length||!P.current.length||F?.events?.length>0)return;const W=Q.map(q=>P.current.find(Z=>Z.id===q)).filter(Boolean);W.length&&L("properties.events",W.map(q=>({slug:`${q.event_category}/${q.event_name}/${q.event_type}/v${q.version}`})))},[h]);const Y=Q=>Et(Q)?[]:F.event_details?.event_category==="application"?Object.keys(Q.application).map(W=>({title:W,value:W})):F.event_details?.event_category==="company"?Object.keys(Q.company).map(W=>({title:W,value:W})):[],z=N("properties.version")&&!Et(R)&&R[parseFloat(N("properties.version"))]?R[parseFloat(N("properties.version"))].map(Q=>({title:Q.event_type,value:Q.id,event_name:Q.event_name,event_type:Q.event_type,event_category:Q.event_category})):[];return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsx(Yt,{required:!0,name:"properties.fp_auth_id",control:k,meta:{options:yn(g),displayProps:{loading:T},displayName:"Fynd Platform Account",value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:o,FRONTEND_URL:s,ENTITY_ID:i,openIntegrationDrawer:u,addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd Platform account",authType:"FYND_PLATFORM",description:"Fynd Platform is a secure partner with Boltic. Your credentials are encrypted & can be removed at any time.",placeholder:"Select Fynd Platform Account"},validationRules:{required:"Fynd platform account is required"},id:r,viewOnly:l||B,handleChange:Q=>{const{value:W}=Q;W&&(p?.includes("commerce_")?D(""):D(W))}})}),F.fp_auth_id&&d.jsx(E.Divider,{}),F.fp_auth_id&&d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event_details.event_category",control:k,meta:{options:Zle,displayName:"Event Category",searchFieldPlaceholder:"Search",placeholder:"Select Event Category",displayProps:{loading:b}},validationRules:{required:"Event category is required"},viewOnly:l,id:r,handleChange:Q=>{const{value:W}=Q,q=W.split("_").pop();L("properties",{...F,event_details:{...F.event_details,event_category:q,event_name:""},event_id:[],events:[],application_id:[],version:[]}),I([])}})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event_details.event_name",control:k,meta:{options:Y(h),displayName:"Event Name",searchFieldPlaceholder:"Search",placeholder:"Select Event Name",displayProps:{loading:b}},validationRules:{required:"Event name is required"},viewOnly:l,id:r,handleChange:Q=>{const{value:W}=Q,q=F.event_details.event_category,Z=h[q][W].versions.length;L("properties",{...F,event_id:[],events:[],application_id:[],version:h[q][W].versions[Z-1].value}),M("properties.event_details"),I(h[q][W])}})})]})}),!Et(R?.versions)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.version",control:k,meta:{options:R.versions.map(Q=>({title:Q.text,value:Q.value})),displayName:"Version",searchFieldPlaceholder:"Search",placeholder:"Select Version",displayProps:{loading:b}},validationRules:{required:"Version is required"},viewOnly:l,handleChange:Q=>{const{value:W}=Q;L("properties",{...F,event_id:[],events:[],version:W,application_id:[]})}})}),!Et(z)&&!Et(F.event_details)&&!Et(F.version)&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.event_id",control:k,meta:{options:z,displayProps:{loading:b},displayName:"Events",searchFieldPlaceholder:"Search",placeholder:"Select Events"},renderFieldValue:Q=>Q.map(W=>W),validationRules:{validate:Q=>Q.length===0?"Events is required":!0},viewOnly:l,id:r,multiple:!0,placeholder:"Select Events",handleChange:Q=>{const{value:W}=Q,q=F.version,Z=W.map(ae=>{const ne=z.find(ue=>ue.value===ae);return{slug:`${ne?.event_category}/${ne?.event_name}/${ne?.event_type}/v${q}`}});L("properties.events",Z);const te=z.find(ae=>ae.value===W?.[0]);L("properties.event_details.event_type",te?.title)},getSelectedValue:Q=>Q.map(W=>z.find(q=>q.value===W)).filter(W=>W?.title)})}),F?.event_details?.event_category==="application"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{name:"properties.application_id",control:k,meta:{options:yn(O),displayName:"Applications",searchFieldPlaceholder:"Search",displayProps:{loading:C},placeholder:"Select Applications"},validationRules:{validate:Q=>Q.length===0?"Application is required":!0},multiple:!0,renderFieldValue:Q=>Q.map(W=>W),viewOnly:l,getSelectedValue:Q=>Q.map(W=>yn(O).find(q=>q.value===W)).filter(W=>W?.title),required:!0})})]})})]})}),jBe=_.forwardRef((e,t)=>{const{VORTEX_MAIN_URL:r,ENTITY_ID:n,type:i,id:o,isLoop:s=!1,suggestionsData:a,WORKFLOW_URLS:l,viewOnly:u=!1}=e,{GYRATE_MAIN_URL:c}=l,{control:f,watch:p,setValue:h,formState:{errors:A}}=Rr(),g=p("properties");return d.jsx(En,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsxs(E.Grid,{item:!0,xs:12,children:[d.jsx(gn,{required:!0,label:"Input Data"}),d.jsx(Aa,{id:o,field:"input_data",type:"functionActivity",title:"Input Data",viewOnly:u,isLoop:s,hideLabel:!0,name:"properties.input_data"})]}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.language",control:f,meta:{options:Jle,displayName:"Language",searchFieldPlaceholder:"Search language",description:_n(i,"method"),placeholder:"Select language"},handleChange:()=>{h("properties.func",'return { "hello": "world" }')},validationRules:{required:"Language is required"},viewOnly:u,id:i})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:"properties.func",control:f,rules:{required:"Error: Function is required. Please review your function syntax."},render:({field:m})=>d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Fi,{...m,required:!0,suggestionLabel:"Code",id:`${i}-${g.language}-func`,activityType:i,size:"xl",viewOnly:u,showSuggestions:!0,VORTEX_MAIN_URL:r,ENTITY_ID:n,language:g.language,suggestionsData:a,showExpandOption:!0,label:"Code",helperText:d.jsxs(E.Box,{children:["Need help? Refer to the",d.jsx(E.Link,{href:g.language==="python"?`${c}/integrations/Helpers/function/#python`:`${c}/integrations/Helpers/function/#javascript`,target:"_blank",children:d.jsx("span",{children:" Function Documentation "})}),"for examples, guidelines, and troubleshooting tips to write Javascript in your workflow."]}),error:!!A.properties?.func?.message,errorMsg:A.properties?.func?.message,handleChange:m.onChange})})})}),!s&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Mi,{viewOnly:u,type:i})})]})})}),$Be=Gi(jBe,""),ml=_.forwardRef(({id:e,type:t,isLoop:r=!1,viewOnly:n=!1,customSelectedTab:i,setCustomSelectedTab:o},s)=>{const{control:a,watch:l,setValue:u}=Rr(),{MCP_INTEGRATION_FORM:c}=aa(),f=l("properties.custom"),p=l("properties.custom.headers"),h=l("properties.custom.query_params"),A=l("properties.custom.state_params"),g=l("properties.custom.method");return _.useEffect(()=>{f&&(p&&!Array.isArray(p)&&typeof p=="object"&&u("properties.custom.headers",pc(p),{shouldValidate:!1,shouldDirty:!1}),h&&!Array.isArray(h)&&typeof h=="object"&&u("properties.custom.query_params",pc(h),{shouldValidate:!1,shouldDirty:!1}),A&&!Array.isArray(A)&&typeof A=="object"&&u("properties.custom.state_params",pc(A),{shouldValidate:!1,shouldDirty:!1}))},[f,p,h,A,u]),_.useEffect(()=>{if(c&&(g==="BOLTIC_AI"||g==="BOLTIC_AI_IGNORE"))return;const m=(QO||[]).map(T=>T.value),O=typeof g=="string"&&g.length?String(g).toLowerCase():"",y=O&&m.includes(O)?O:QO?.[0]?.value||"get";g!==y&&u("properties.custom.method",y,{shouldValidate:!1,shouldDirty:!1})},[g,u]),d.jsxs(d.Fragment,{children:[d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:"properties.custom.method",control:a,meta:{options:QO,displayName:"Method",searchFieldPlaceholder:"Search Method",placeholder:"Select Method"},validationRules:{required:"Method is required",validate:m=>m!=null&&String(m).trim()!==""?!0:"Method is required"},viewOnly:n,id:t})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:!0,id:e,name:"properties.custom.endpoint",control:a,meta:{displayName:"URL",placeholder:rde(t)},validationRules:{required:"URL is required"},viewOnly:n,editorId:`${t}-custom-url-${r}`,showSuggestions:!0})}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(ss,{variant:"full-width",tabs:xle,selectedTab:i,setSelectedTab:o})}),i==="Query Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.query_params",field:"query_params",type:t,title:"Query Params",viewOnly:n,isLoop:r})}),i==="State Params"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.state_params",field:"state_params",type:t,title:"State Params",viewOnly:n,isLoop:r})}),i==="Headers"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.headers",field:"headers",type:t,title:"Headers",viewOnly:n,isLoop:r})}),i==="Body"&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Aa,{id:e,name:"properties.custom.body",field:"body",type:t,title:"Body",viewOnly:n,isLoop:r,showKeyValuePair:!1})})]})});ml.displayName="CustomApiSection";const cg=e=>{const{control:t,name:r,label:n,placeholder:i,addNewButtonText:o,searchFieldPlaceholder:s,description:a,authType:l,options:u,isLoading:c,TESSERACT_MAIN_URL:f,FRONTEND_URL:p,ENTITY_ID:h,openIntegrationDrawer:A,viewOnly:g,isTokenRevoked:m,handleReconnect:O,handleChange:y,validationMessage:T,id:v}=e;return d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(Yt,{required:!0,name:r,control:t,renderValueUi:C=>{const x=u.find(b=>b.value===C);return d.jsx(tf,{isTokenRevoked:m,onReconnect:O,disabled:g,optionTitle:x?.title})},meta:{options:u,displayProps:{loading:c},displayName:n,value:"",htmlProps:{showAddNew:!0},TESSERACT_MAIN_URL:f,FRONTEND_URL:p,ENTITY_ID:h,openIntegrationDrawer:A,addNewButtonText:o,searchFieldPlaceholder:s,authType:l,description:a,placeholder:i},validationRules:{required:T},handleChange:y,viewOnly:g,id:v})})},ZP="FYND_AIPIM",UBe="blt-int.fynd-aipim",HBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(D=>D.loopActivity),T=i("properties"),v=T?.operation||"",C=T?.resource||"",x=_.useMemo(()=>{if(!C)return[];const D=`${C}.`;return gue.filter($=>$.value.startsWith(D)).sort(($,U)=>$.title.localeCompare(U.title))},[C]),[b,w]=_.useState([]),[R,I]=_.useState(!1),[P,k]=_.useState("Query Params"),N=yn(b),{isTokenRevoked:L,setTokenRevoked:M,handleReconnect:B}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),H=()=>{I(!0);const D={page_size:999,current_page:1,type:"BOTH"},$=Xt(l,`/v1/integrations/entity/${ZP}`);zt.get($,{params:D}).then(({data:U})=>{w(ro(U.data))}).catch(U=>{sr(U,r)}).finally(()=>{I(!1)})};_.useEffect(()=>{if(H(),T?.integration_slug||o("properties.integration_slug",UBe,{shouldValidate:!1}),!C&&v){const D=v.split(".")[0];D&&o("properties.resource",D,{shouldValidate:!1})}},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===ZP&&(A?.meta?.auth_status==="ACTIVE"&&M(!1),H(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const j={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},X=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:U.required,id:f,name:`properties.${D}`,control:n,type:U.type==="number"?"number":"text",meta:{displayName:$,placeholder:U.placeholder||`Enter ${$.toLowerCase()}`,description:U.description,displayType:U.type==="number"?"number":"text"},validationRules:U.required?{required:`${$} is required`}:{},viewOnly:m,editorId:`${c}-${D}-${p}`,showSuggestions:!0,isLoop:p})},D),F=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${D}`,control:n,rules:U.required?{required:`${$} is required`}:{},render:({field:Y})=>d.jsx(Fi,{...Y,...j,label:$,suggestionLabel:$,id:`${c}-${D}`,activityType:c,size:"md",helperText:U.description,errorMsg:s.properties?.[D]?.message,error:!!s.properties?.[D]?.message,handleChange:z=>Y.onChange(z),required:U.required})})},D),V=(D={})=>d.jsxs(d.Fragment,{children:[X("page_no","Page Number",{type:"number",placeholder:String(D.page??1)}),X("page_size","Page Size",{type:"number",placeholder:String(D.size??50)})]}),G=()=>v?v==="products.list_external"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound Connector ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),V()]}):v==="products.get_meta"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound Connector ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),X("product_id","Product ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"})]}):v==="products.bulk_export"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound Connector ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.entity",control:n,meta:{options:Oue,displayName:"Entity Type",searchFieldPlaceholder:"Search entity",placeholder:"Select entity"},validationRules:{required:"Entity Type is required"},viewOnly:m,required:!0})})}),F("payload","Export Request",{description:"Bulk export request body."})]}):v==="templates.list"?V():v==="templates.get"||v==="templates.delete"||v==="templates.validation_schema"?X("template_id","Template ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}):v==="templates.create"?F("template","Template",{required:!0,description:"Template definition (name, slug, attributes, etc.)."}):v==="templates.update"?d.jsxs(d.Fragment,{children:[X("template_id","Template ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),F("template","Template Update",{required:!0})]}):v==="attributes.list"?d.jsxs(d.Fragment,{children:[V(),X("tag","Filter by Tag",{placeholder:"e.g. apparel, electronics"})]}):v==="attributes.list_tags"?null:v==="attributes.create"?F("attribute","Attribute",{required:!0,description:"Attribute definition (name, slug, type, options, etc.)."}):v==="attributes.get"||v==="attributes.delete"?X("attribute_id","Attribute ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}):v==="attributes.update"?d.jsxs(d.Fragment,{children:[X("attribute_id","Attribute ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),F("attribute","Attribute Update",{required:!0})]}):v==="categories.list"||v==="categories.list_mappings"?V():v==="categories.create"?F("category","Category",{required:!0,description:"Category definition (name, slug, parent_id, attributes, etc.)."}):v==="categories.get"||v==="categories.delete"?X("category_id","Category ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}):v==="categories.update"?d.jsxs(d.Fragment,{children:[X("category_id","Category ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),F("category","Category Update",{required:!0})]}):v==="categories.create_mapping"?F("mapping","Mapping",{required:!0,description:"Category-mapping definition."}):v==="categories.get_mapping_by_code"?X("code","Mapping Code",{required:!0,placeholder:"e.g. category_apparel_main"}):v==="inbound.list"?V():v==="inbound.create"?F("connector","Connector",{required:!0,description:"Inbound connector definition."}):v==="inbound.get"||v==="inbound.delete"?X("inbound_id","Inbound ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}):v==="inbound.update"?d.jsxs(d.Fragment,{children:[X("inbound_id","Inbound ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),F("connector","Connector Update",{required:!0})]}):v==="mapper.list"?V():v==="mapper.create"?F("mapper","Mapper",{required:!0,description:"Transform function definition (name, code, etc.)."}):v==="mapper.execute"?F("payload","Execution Input",{required:!0,description:"Mapper code + input data for sandbox execution."}):v==="mapper.get"||v==="mapper.delete"?X("mapper_id","Mapper ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}):v==="mapper.update"?d.jsxs(d.Fragment,{children:[X("mapper_id","Mapper ID",{required:!0,placeholder:"e.g. 64f3a2b1c8d9e10001234567"}),F("mapper","Mapper Update",{required:!0})]}):v==="custom.custom_api"?d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:P,setCustomSelectedTab:k}):null:null;return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd AIPIM Account",placeholder:"Select Fynd AIPIM account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd AIPIM account",description:"Fynd AIPIM credentials are encrypted and can be removed at any time.",authType:ZP,options:N,isLoading:R,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:L,handleReconnect:B,handleChange:D=>{D.value&&M(!1)},validationMessage:"AI PIM account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.resource",control:n,meta:{options:mue,displayName:"Resource",searchFieldPlaceholder:"Search resource",description:"Select the AI PIM resource.",placeholder:"Select a resource"},validationRules:{required:"Resource is required"},handleChange:({value:D})=>{D!==C&&o("properties.operation","",{shouldValidate:!1})},viewOnly:m,required:!0})})}),T?.secret&&C&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:x,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:G()})})]})}),VBe=Gi(HBe,""),JP="FYND_COMMERCE_B2B",GBe="blt-int.commerce-b2b",WBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(V=>V.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const V={page_size:999,current_page:1,type:"BOTH"},G=Xt(l,`/v1/integrations/entity/${JP}`);zt.get(G,{params:V}).then(({data:D})=>{x(ro(D.data))}).catch(D=>{sr(D,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",GBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===JP&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:D.required,id:f,name:`properties.${V}`,control:n,type:D.type==="number"?"number":"text",multiline:D.multiline,meta:{displayName:G,placeholder:D.placeholder||`Enter ${G.toLowerCase()}`,description:D.description,displayType:D.type==="number"?"number":"text"},validationRules:D.required?{required:`${G} is required`}:{},viewOnly:m,editorId:`${c}-${V}-${p}`,showSuggestions:!0,isLoop:p})},V),j=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${V}`,control:n,rules:D.required?{required:`${G} is required`}:{},render:({field:$})=>d.jsx(Fi,{...$,...B,label:G,suggestionLabel:G,id:`${c}-${V}`,activityType:c,size:"md",helperText:D.description,errorMsg:s.properties?.[V]?.message,error:!!s.properties?.[V]?.message,handleChange:U=>$.onChange(U),required:D.required})})},V),X=()=>d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]}),F=()=>{if(!v)return null;const V=[{title:"True",value:"true"},{title:"False",value:"false"}],G=[{title:"Pending",value:"pending"},{title:"In Progress",value:"inprogress"},{title:"Success",value:"success"},{title:"Failed",value:"failed"},{title:"Validating",value:"validating"},{title:"Syncing",value:"syncing"}],D=[{title:"Submitted",value:"submitted"},{title:"Approved",value:"approved"},{title:"Rejected",value:"rejected"},{title:"Renegotiated by Seller",value:"renegotiated_by_seller"}],$=(U,Y,z,Q)=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:`properties.${U}`,control:n,meta:{options:z,displayName:Y,placeholder:`Select ${Y.toLowerCase()}`,description:Q},viewOnly:m})})},U);if(v==="best_price.list")return d.jsxs(d.Fragment,{children:[j("items","Items",{required:!0,description:"Array of items to fetch best prices for (item_id, slug, item_code, price.effective {min,max}, price.marked {min,max})."}),H("currency_code","Currency Code",{required:!0,placeholder:"INR"}),H("currency_symbol","Currency Symbol",{required:!0,placeholder:"₹"}),H("app_user_id","App User ID",{required:!0}),H("app_currency_code","Override App Currency Code"),H("app_country_code","Override App Country Code")]});if(v==="contract.list")return d.jsxs(d.Fragment,{children:[X(),$("is_active","Is Active",V),$("status","Status",G),$("unmask","Unmask Sensitive Fields",V,"When true, returns unmasked merchant_id / notification_email.")]});if(v==="contract.get")return d.jsxs(d.Fragment,{children:[H("contract_id","Contract ID",{required:!0,placeholder:"MongoDB ObjectId"}),$("unmask","Unmask Sensitive Fields",V)]});if(v==="contract.create"||v==="contract.update"){const U=v==="contract.update";return d.jsxs(d.Fragment,{children:[U&&H("contract_id","Contract ID",{required:!0}),H("name","Name",{required:!U,placeholder:"Contract Pricing Offer 1"}),j("store_id","Store IDs",{required:!U,description:"Array of integer store IDs the contract applies to."}),H("schedule_start","Schedule Start",{placeholder:"2026-03-17T11:00:00.000Z",required:!U}),H("schedule_end","Schedule End",{placeholder:"2026-03-18T11:00:00.000Z",required:!U}),H("uploaded_file_url","Uploaded File URL",{required:!U}),j("notification_email","Notification Emails",{description:"Array of emails to notify on frequency thresholds."}),j("notification_frequency","Notification Frequency (days)",{description:"Array of integer day intervals at which notification emails are sent."}),$("is_active","Is Active",V)]})}if(v==="contract.delete"||v==="contract.sync")return H("contract_id","Contract ID",{required:!0});if(v==="ladder.list")return d.jsxs(d.Fragment,{children:[X(),$("is_active","Is Active",V),$("status","Status",G)]});if(v==="ladder.get"||v==="ladder.delete"||v==="ladder.sync")return H("ladder_id","Ladder ID",{required:!0});if(v==="ladder.create"||v==="ladder.update"){const U=v==="ladder.update";return d.jsxs(d.Fragment,{children:[U&&H("ladder_id","Ladder ID",{required:!0}),H("name","Name",{required:!U,placeholder:"Testing Ladder"}),j("store_id","Store IDs",{required:!U,description:"Array of integer store IDs."}),j("store_name_code","Store Name Code",{description:'Map of store ID (string) → display name. e.g. { "137595": "Bangalore" }'}),H("schedule_start","Schedule Start",{placeholder:"2026-03-30T16:24:00.000Z",required:!U}),H("schedule_end","Schedule End",{placeholder:"2026-03-31T16:24:00.000Z",required:!U}),H("uploaded_file_url","Uploaded File URL",{required:!U}),$("is_active","Is Active",V)]})}return v==="quotation.list"?d.jsxs(d.Fragment,{children:[X(),$("status","Status",D),H("from_date","From Date",{description:"ISO 8601 timestamp."}),H("to_date","To Date",{description:"ISO 8601 timestamp."}),$("unmask","Unmask Sensitive Fields",V,"When true, returns unmasked user.email / user.phone.")]}):v==="quotation.get"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),$("unmask","Unmask Sensitive Fields",V)]}):v==="quotation.approve"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),j("quotes","Quotes",{description:"Per-line approval payload — each item carries final/seller_quoted prices."}),j("notes","Notes")]}):v==="quotation.reject"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),H("reason","Rejection Reason",{required:!0,multiline:!0}),j("notes","Notes")]}):v==="quotation.renegotiate"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),j("quotes","Renegotiated Quotes",{required:!0,description:"Per-line renegotiated prices."}),H("due_date","Due Date",{placeholder:"2025-01-20"}),j("notes","Notes")]}):v==="quotation.add_note"?d.jsxs(d.Fragment,{children:[H("quote_request_id","Quote Request ID",{required:!0}),H("text","Note Text",{required:!0,multiline:!0})]}):v==="custom.custom_api"?d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:R,setCustomSelectedTab:I}):null};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd Commerce B2B Account",placeholder:"Select Fynd Commerce B2B account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd Commerce B2B account",description:"Fynd Commerce B2B credentials are encrypted and can be removed at any time.",authType:JP,options:P,isLoading:b,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:k,handleReconnect:L,handleChange:V=>{V.value&&N(!1)},validationMessage:"Commerce B2B account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:Eue,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the Commerce B2B resource and action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:F()})})]})}),QBe=Gi(WBe,""),$s=e=>{const{name:t,label:r,description:n,addItemLabel:i,itemLabel:o,newItem:s,renderItem:a,minItems:l=0,viewOnly:u=!1}=e,c=E.useTheme(),{control:f}=Rr(),{fields:p,append:h,remove:A}=KAe({control:f,name:t});return d.jsxs(E.Stack,{gap:1.25,sx:{width:"100%"},children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[d.jsx(gn,{label:r,description:n}),!u&&d.jsx(E.IconButton,{onClick:()=>h(s()),sx:{p:.75,border:`1px solid ${c.palette.grey.brainstem}`,fontSize:c.typography.mdNormal.fontSize},color:"primary","aria-label":i||`Add ${r}`,children:d.jsx(Ue,{src:"ic_plus",sx:{path:{fill:c.palette.primary.main}}})})]}),p.length===0&&d.jsx(E.Typography,{variant:"body2",color:"text.secondary",children:"No items yet — click + to add one."}),p.map((g,m)=>d.jsxs(E.Box,{sx:{border:`1px solid ${c.palette.grey.brainstem}`,borderRadius:1,p:1.5},children:[d.jsxs(E.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",mb:1,children:[d.jsx(E.Typography,{variant:"subtitle2",children:o?.(m)||`${r.replace(/s$/,"")} ${m+1}`}),!u&&p.length>l&&d.jsx(E.Button,{size:"small",color:"error",onClick:()=>A(m),"aria-label":`Remove item ${m+1}`,children:"Remove"})]}),d.jsx(E.Grid,{container:!0,gap:1.5,children:a(m)})]},g.id)),!u&&p.length>0&&d.jsxs(E.Button,{onClick:()=>h(s()),variant:"outlined",size:"small",sx:{alignSelf:"flex-start"},children:["+ ",i||`Add ${r.replace(/s$/,"")}`]})]})},eN="FYND_ENGAGE",zBe="blt-int.engage",XBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(V=>V.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const V={page_size:999,current_page:1,type:"BOTH"},G=Xt(l,`/v1/integrations/entity/${eN}`);zt.get(G,{params:V}).then(({data:D})=>{x(ro(D.data))}).catch(D=>{sr(D,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",zBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===eN&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:D.xs??12,children:d.jsx(kr,{required:D.required,id:f,name:V,control:n,type:D.type==="number"?"number":"text",meta:{displayName:G,placeholder:D.placeholder||`Enter ${G.toLowerCase()}`,description:D.description,displayType:D.type==="number"?"number":"text"},validationRules:D.required?{required:`${G} is required`}:{},viewOnly:m,editorId:`${c}-${V}-${p}`,showSuggestions:!0,isLoop:p})},V),j=(V,G,D={})=>H(`properties.${V}`,G,D),X=(V,G,D={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${V}`,control:n,rules:D.required?{required:`${G} is required`}:{},render:({field:$})=>d.jsx(Fi,{...$,...B,label:G,suggestionLabel:G,id:`${c}-${V}`,activityType:c,size:"md",helperText:D.description,errorMsg:s.properties?.[V]?.message,error:!!s.properties?.[V]?.message,handleChange:U=>$.onChange(U),required:D.required})})},V),F=()=>{if(!v)return null;if(v==="users.create")return d.jsxs(d.Fragment,{children:[j("external_id","External ID",{required:!0,description:"Your internal user identifier."}),j("name","Name"),j("email","Email"),j("phone","Phone",{placeholder:"+91XXXXXXXXXX"}),j("gender","Gender",{placeholder:"male / female / other"}),j("date_of_birth","Date of Birth",{placeholder:"YYYY-MM-DD"}),X("custom_attributes","Custom Attributes",{description:"Free-form JSON object for additional profile attributes."})]});if(v==="users.get"||v==="users.delete"||v==="users.tier_status"||v==="users.tier_journey")return j("user_id","User ID",{required:!0});if(v==="users.update")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("name","Name"),j("email","Email"),j("phone","Phone",{placeholder:"+91XXXXXXXXXX"}),j("gender","Gender",{placeholder:"male / female / other"}),j("date_of_birth","Date of Birth",{placeholder:"YYYY-MM-DD"}),X("custom_attributes","Custom Attributes",{description:"Free-form JSON object for additional profile attributes."})]});if(v==="users.points_history")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("page","Page",{type:"number",placeholder:"1"}),j("limit","Limit",{type:"number",placeholder:"50"})]});if(v==="users.apply_referral")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("referral_code","Referral Code",{required:!0})]});if(v==="tiers.list")return null;if(v==="tiers.get")return j("tier_id","Tier ID",{required:!0});if(v==="wallet.balance")return j("user_id","User ID",{required:!0});if(v==="wallet.transfer")return d.jsxs(d.Fragment,{children:[j("user_id","From User ID",{required:!0}),j("to_user_id","To User ID",{required:!0}),j("points","Points",{required:!0,type:"number"}),j("reason","Reason")]});if(v==="wallet.add_points")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("points","Points to Credit",{required:!0,type:"number"}),j("reason","Reason"),X("metadata","Metadata")]});if(v==="wallet.redeem_points")return d.jsxs(d.Fragment,{children:[j("user_id","User ID",{required:!0}),j("points","Points to Redeem",{required:!0,type:"number"}),j("reason","Reason")]});if(v==="events.publish")return d.jsxs(d.Fragment,{children:[j("event_name","Event Name",{required:!0}),j("user_id","User ID",{required:!0}),X("properties","Event Properties")]});const V=G=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx($s,{name:G,label:"Items",description:"Items in the order — one row per SKU.",addItemLabel:"Add item",itemLabel:D=>`Item ${D+1}`,newItem:()=>({item_id:"",sku_code:"",ean_identifier:"",article_id:"",quantity:"",amount:"",currency:"",return_period:""}),viewOnly:m,renderItem:D=>d.jsxs(d.Fragment,{children:[H(`${G}.${D}.item_id`,"Item ID",{required:!0,xs:6}),H(`${G}.${D}.sku_code`,"SKU Code",{xs:6}),H(`${G}.${D}.ean_identifier`,"EAN Identifier",{xs:6}),H(`${G}.${D}.article_id`,"Article ID",{xs:6}),H(`${G}.${D}.quantity`,"Quantity",{required:!0,type:"number",xs:4}),H(`${G}.${D}.amount`,"Amount",{required:!0,type:"number",xs:4}),H(`${G}.${D}.currency`,"Currency",{placeholder:"INR",xs:4}),H(`${G}.${D}.return_period`,"Return Period (days)",{type:"number"})]})})});if(v==="orders.create"||v==="orders.update"||v==="orders.calculate_loyalty"){const G=v==="orders.update";return d.jsxs(d.Fragment,{children:[j("order.transaction_id","Transaction ID",{required:!G,placeholder:"TXN-1"}),j("order.cart_id","Cart ID",{required:!G}),j("order.phoneNumber","Phone Number",{placeholder:"+91XXXXXXXXXX"}),j("order.order_amount","Order Amount",{required:!G,type:"number"}),j("order.currency","Currency",{placeholder:"INR",required:!G}),V("properties.order.items")]})}return v==="orders.get"?j("transaction_id","Transaction ID",{required:!0}):v==="orders.return"?d.jsxs(d.Fragment,{children:[j("return_payload.transaction_id","Transaction ID",{required:!0}),j("return_payload.trace_id","Trace ID"),j("return_payload.is_partial_refund_allowed","Allow Partial Refund",{placeholder:"true / false"}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx($s,{name:"properties.return_payload.return_items",label:"Return Items",addItemLabel:"Add return item",itemLabel:G=>`Return Item ${G+1}`,newItem:()=>({item_id:"",quantity:""}),viewOnly:m,renderItem:G=>d.jsxs(d.Fragment,{children:[H(`properties.return_payload.return_items.${G}.item_id`,"Item ID",{required:!0,xs:6}),H(`properties.return_payload.return_items.${G}.quantity`,"Quantity",{required:!0,type:"number",xs:6})]})})}),j("return_payload.meta.cart_id","Meta — Cart ID"),j("return_payload.meta.order_id","Meta — Order ID")]}):v==="orders.apply_discount"?d.jsxs(d.Fragment,{children:[j("payload.cart_id","Cart ID",{required:!0}),j("payload.phoneNumber","Phone Number"),j("payload.order_amount","Order Amount",{required:!0,type:"number"}),j("payload.currency","Currency",{placeholder:"INR"}),V("properties.payload.items")]}):v==="orders.award_points"?d.jsxs(d.Fragment,{children:[j("payload.transaction_id","Transaction ID",{required:!0}),j("payload.cart_id","Cart ID",{required:!0}),j("payload.order_amount","Order Amount",{required:!0,type:"number"}),j("payload.currency","Currency",{placeholder:"INR"}),V("properties.payload.items")]}):v==="orders.discount_rules"?X("filters","Filters"):v==="custom.custom_api"?d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:R,setCustomSelectedTab:I}):null};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd Engage Account",placeholder:"Select Fynd Engage account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Fynd Engage account",description:"Fynd Engage credentials are encrypted and can be removed at any time.",authType:eN,options:P,isLoading:b,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:k,handleReconnect:L,handleChange:V=>{V.value&&N(!1)},validationMessage:"Engage account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:Aue,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the Engage resource and action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:F()})})]})}),qBe=Gi(XBe,""),tN="FYND_KONNECT",YBe="blt-int.konnect",KBe=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(F=>F.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const F={page_size:999,current_page:1,type:"BOTH"},V=Xt(l,`/v1/integrations/entity/${tN}`);zt.get(V,{params:F}).then(({data:G})=>{x(ro(G.data))}).catch(G=>{sr(G,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",YBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===tN&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(F,V,G={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(kr,{required:G.required,id:f,name:`properties.${F}`,control:n,type:G.type==="number"?"number":"text",meta:{displayName:V,placeholder:G.placeholder||`Enter ${V.toLowerCase()}`,description:G.description,displayType:G.type==="number"?"number":"text"},validationRules:G.required?{required:`${V} is required`}:{},viewOnly:m,editorId:`${c}-${F}-${p}`,showSuggestions:!0,isLoop:p})},F),j=(F,V,G={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${F}`,control:n,rules:G.required?{required:`${V} is required`}:{},render:({field:D})=>d.jsx(Fi,{...D,...B,label:V,suggestionLabel:V,id:`${c}-${F}`,activityType:c,size:"md",helperText:G.description,errorMsg:s.properties?.[F]?.message,error:!!s.properties?.[F]?.message,handleChange:$=>D.onChange($),required:G.required})})},F),X=()=>{if(!v)return null;switch(v){case"catalog.list_departments":case"catalog.list_brands":return d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"catalog.list_categories":return d.jsxs(d.Fragment,{children:[H("department_id","Department ID",{description:"Filter categories by department."}),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"catalog.list_attributes":case"catalog.list_hscodes":return null;case"catalog.list_templates":return d.jsxs(d.Fragment,{children:[H("department","Department"),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"catalog.list_tax_rules":return d.jsxs(d.Fragment,{children:[H("status","Status"),H("version_status","Version Status"),H("rule_name","Rule Name"),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"listings.count":return null;case"products.get":return d.jsxs(d.Fragment,{children:[H("name","Product Name"),H("slug","Slug"),H("item_code","Item Code(s)",{description:"Comma-separated list of item codes."}),H("sort_on","Sort On"),H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"})]});case"products.check_status":return H("trace_id","Trace ID",{required:!0,description:"Trace ID returned by a previous create / update / delete call."});case"products.create":return j("products","Products",{required:!0,description:"Bulk product payload (max 500 records)."});case"products.update":return j("products","Products",{required:!0,description:"Bulk product update payload (max 500 records)."});case"products.delete":return j("products","Products",{required:!0,description:"Bulk product delete payload identifying products to remove."});case"inventory.update":return j("inventory","Inventory Records",{required:!0,description:"Bulk inventory payload (max 500 records). Each record specifies SKU, location, and stock count."});case"pricing.update":return j("pricing","Pricing Records",{required:!0,description:"Bulk pricing payload (max 500 records). Each record sets MRP / ESP per SKU per location."});case"listings.list":return d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"50"}),H("from_date","From Date",{description:"ISO 8601 timestamp."}),H("to_date","To Date",{description:"ISO 8601 timestamp."}),H("sku","SKU Filter")]});case"orders.list":return d.jsxs(d.Fragment,{children:[H("page_no","Page Number",{type:"number",placeholder:"1"}),H("page_size","Page Size",{type:"number",placeholder:"20"}),H("status","Status"),H("from_date","From Date",{description:"ISO 8601 timestamp."}),H("to_date","To Date",{description:"ISO 8601 timestamp."})]});case"orders.info":return H("shipment_id","Shipment ID",{required:!0});case"orders.cancel":return j("shipments","Shipments",{required:!0,description:"Cancellation payload (max 20 shipments)."});case"orders.confirm":return j("shipments","Shipments",{required:!0});case"orders.pack":return j("shipments","Shipments",{required:!0});case"orders.update_awb":return j("shipments","AWB Updates",{required:!0,description:"AWB / courier update payload."});case"orders.invoice_update":return j("invoices","Invoice Updates",{required:!0});case"orders.dispatch":return j("shipments","Shipments",{required:!0,description:"Shipments to mark as dispatched (max 20)."});case"orders.fetch_invoice":return j("shipments","Shipments",{required:!0,description:"Shipments to fetch customer invoices for (max 20)."});case"orders.shipping_labels":return j("shipments","Shipments",{required:!0,description:"Shipments to generate shipping labels for (max 20)."});case"orders.courier_details":return j("shipments","Shipments",{required:!0,description:"Shipments to fetch courier details for (max 20)."});case"orders.update_status":return j("shipments","Shipment Status Updates",{required:!0,description:"Shipment status update payload (max 20)."});case"orders.track":return d.jsxs(d.Fragment,{children:[H("awb_number","AWB Number"),H("shipment_id","Shipment ID")]});case"returns.create":return j("returns","Returns",{required:!0,description:"Returns / RTO payload (max 20 records)."});case"custom.custom_api":return d.jsx(ml,{id:f,type:c,isLoop:p,viewOnly:m,customSelectedTab:R,setCustomSelectedTab:I});default:return null}};return d.jsxs(E.Stack,{gap:2.5,children:[d.jsx(Ei,{children:d.jsxs(E.Grid,{container:!0,gap:1.5,children:[d.jsx(cg,{control:n,name:"properties.secret",label:"Fynd Konnect Account",placeholder:"Select Fynd Konnect account",addNewButtonText:"Add new account",searchFieldPlaceholder:"Search Konnect account",description:"Fynd Konnect credentials are encrypted and can be removed at any time.",authType:tN,options:P,isLoading:b,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O,viewOnly:m,isTokenRevoked:k,handleReconnect:L,handleChange:F=>{F.value&&N(!1)},validationMessage:"Konnect account is required",id:c}),T?.secret&&d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(E.FormControl,{fullWidth:!0,children:d.jsx(Yt,{name:"properties.operation",control:n,meta:{options:hue,displayName:"Operation",searchFieldPlaceholder:"Search operation",description:"Select the Konnect resource and action to perform.",placeholder:"Select an operation"},validationRules:{required:"Operation is required"},viewOnly:m,required:!0})})})]})}),T?.secret&&v&&d.jsx(E.Divider,{}),T?.secret&&v&&d.jsx(En,{children:d.jsx(E.Grid,{container:!0,gap:1.5,children:X()})})]})}),ZBe=Gi(KBe,""),rN="FYND_TMS",JBe="blt-int.fynd-tms",e7e=_.forwardRef((e,t)=>{const r=ct.useDispatch(),{control:n,watch:i,setValue:o,formState:{errors:s}}=Rr(),{ENTITY_ID:a,TESSERACT_MAIN_URL:l,FRONTEND_URL:u,type:c,id:f,isLoop:p=!1,suggestionsData:h,INTEGRATION_DATA:A,VORTEX_MAIN_URL:g,viewOnly:m=!1,openIntegrationDrawer:O}=e,{loopSuggestionsData:y={}}=ct.useSelector(D=>D.loopActivity),T=i("properties"),v=T?.operation||"",[C,x]=_.useState([]),[b,w]=_.useState(!1),[R,I]=_.useState("Query Params"),P=yn(C),{isTokenRevoked:k,setTokenRevoked:N,handleReconnect:L}=Al({credentialId:T?.secret||"",TESSERACT_MAIN_URL:l,FRONTEND_URL:u,ENTITY_ID:a,openIntegrationDrawer:O}),M=()=>{w(!0);const D={page_size:999,current_page:1,type:"BOTH"},$=Xt(l,`/v1/integrations/entity/${rN}`);zt.get($,{params:D}).then(({data:U})=>{x(ro(U.data))}).catch(U=>{sr(U,r)}).finally(()=>{w(!1)})};_.useEffect(()=>{M(),T?.integration_slug||o("properties.integration_slug",JBe,{shouldValidate:!1})},[]),_.useEffect(()=>{A?._id&&A?.meta?.entity===rN&&(A?.meta?.auth_status==="ACTIVE"&&N(!1),M(),o("properties.secret",A._id,{shouldValidate:!0}))},[A]);const B={VORTEX_MAIN_URL:g,ENTITY_ID:a,viewOnly:m,showSuggestions:!0,language:"json",showExpandOption:!0,suggestionsData:p?y:h},H=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:U.xs??12,children:d.jsx(kr,{required:U.required,id:f,name:D,control:n,type:U.type==="number"?"number":"text",meta:{displayName:$,placeholder:U.placeholder||`Enter ${$.toLowerCase()}`,description:U.description,displayType:U.type==="number"?"number":"text"},validationRules:U.required?{required:`${$} is required`}:{},viewOnly:m,editorId:`${c}-${D}-${p}`,showSuggestions:!0,isLoop:p})},D),j=(D,$,U={})=>H(`properties.${D}`,$,U),X=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:U.xs??12,children:d.jsx(pr,{name:D,control:n,rules:U.required?{required:`${$} is required`}:{},render:({field:Y})=>d.jsx(Fi,{...Y,...B,label:$,suggestionLabel:$,id:`${c}-${D}`,activityType:c,size:"md",helperText:U.description,placeholder:U.placeholder,handleChange:z=>Y.onChange(z),required:U.required})})},D),F=(D,$,U={})=>d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx(pr,{name:`properties.${D}`,control:n,rules:U.required?{required:`${$} is required`}:{},render:({field:Y})=>d.jsx(Fi,{...Y,...B,label:$,suggestionLabel:$,id:`${c}-${D}`,activityType:c,size:"md",helperText:U.description,errorMsg:s.properties?.[D]?.message,error:!!s.properties?.[D]?.message,handleChange:z=>Y.onChange(z),required:U.required})})},D),V=()=>d.jsxs(d.Fragment,{children:[j("page","Page",{type:"number",placeholder:"1"}),j("size","Page Size",{type:"number",placeholder:"20"})]}),G=()=>v?v==="shipments.list"?d.jsxs(d.Fragment,{children:[V(),j("awb_number","AWB Numbers (comma separated)"),j("reference_id","Reference IDs"),j("order_id","Order IDs"),j("status_code","Status Codes"),j("created_from","Created From",{description:"ISO 8601 timestamp."}),j("created_to","Created To",{description:"ISO 8601 timestamp."}),j("pickup_serviceability_code","Pickup Serviceability Code"),j("drop_serviceability_code","Drop Serviceability Code"),j("dispatch_strategy","Dispatch Strategy"),j("hub_id","Hub IDs"),j("courier_identifier","Courier Identifier"),j("invoice_number","Invoice Number"),j("journey_type","Journey Type"),j("sort_field","Sort Field"),j("sort_order","Sort Order"),j("column","Columns")]}):v==="shipments.create"?d.jsxs(d.Fragment,{children:[j("identifier","Identifier",{description:"Optional batch identifier echoed back in the response."}),d.jsx(E.Grid,{item:!0,xs:12,children:d.jsx($s,{name:"properties.data",label:"Shipments",description:"One ShipmentCreatePublic item per row.",addItemLabel:"Add shipment",itemLabel:D=>`Shipment ${D+1}`,newItem:()=>({reference_id:"",courier_identifier:"",journey_type:"",mps:"",length:"",width:"",height:"",weight:"",amount_to_collect:"",pickup_location:"",drop_location:"",rto_location:"",invoice:"",payment_method:"",packages:""}),viewOnly:m,renderItem:D=>d.jsxs(d.Fragment,{children:[H(`properties.data.${D}.reference_id`,"Reference ID",{placeholder:"REF-1",xs:6}),H(`properties.data.${D}.courier_identifier`,"Courier Identifier",{placeholder:"e.g. delhivery",xs:6}),H(`properties.data.${D}.journey_type`,"Journey Type",{placeholder:"forward / return",xs:6}),H(`properties.data.${D}.mps`,"Multi-Piece Shipment (MPS)",{placeholder:"true / false",xs:6}),H(`properties.data.${D}.length`,"Length",{type:"number",xs:3}),H(`properties.data.${D}.width`,"Width",{type:"number",xs:3}),H(`properties.data.${D}.height`,"Height",{type:"number",xs:3}),H(`properties.data.${D}.weight`,"Weight",{type:"number",xs:3}),H(`properties.data.${D}.amount_to_collect`,"Amount to Collect (COD)",{type:"number",placeholder:"0"}),X(`properties.data.${D}.pickup_location`,"Pickup Location",{required:!0,description:"Address + contact object.",placeholder:`{
|
|
506
506
|
"name": "Warehouse",
|
|
507
507
|
"address": "...",
|
|
508
508
|
"pincode": "400001",
|