From cd2e8e9f2269e8d4b4b434e41b88787baa40464f Mon Sep 17 00:00:00 2001 From: Ponnarasi Date: Mon, 5 May 2025 13:58:38 +0530 Subject: [PATCH 1/2] added empty option in basepath --- dist/config-import-bundle.js | 2 +- dist/log.bundle-sizes.rest-import-ui.txt | 66 ++++++++++++------------ dist/rest-import-bundle.css.map | 2 +- dist/rest-import-bundle.js | 2 +- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/dist/config-import-bundle.js b/dist/config-import-bundle.js index 7777be3..e98cb69 100644 --- a/dist/config-import-bundle.js +++ b/dist/config-import-bundle.js @@ -106,5 +106,5 @@ &:nth-of-type(even) { background-color: #f3f3f3; } -`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"e65358f",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:02:52 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.ConfigImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},providerConf:{},layout:"ConfigLayout",configs:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); +`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"f79a664",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:19:32 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.ConfigImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},providerConf:{},layout:"ConfigLayout",configs:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); //# sourceMappingURL=config-import-bundle.js.map \ No newline at end of file diff --git a/dist/log.bundle-sizes.rest-import-ui.txt b/dist/log.bundle-sizes.rest-import-ui.txt index c5ab79e..7d62cfa 100644 --- a/dist/log.bundle-sizes.rest-import-ui.txt +++ b/dist/log.bundle-sizes.rest-import-ui.txt @@ -1,65 +1,65 @@ -@mui/icons-material: 5.93 MB (54.3%) -@mui/material: 1.28 MB (11.7%) -@mui/base: 387.29 KB (3.46%) +@mui\icons-material: 5.93 MB (54.3%) +@mui\material: 1.28 MB (11.7%) +@mui\base: 387.29 KB (3.46%) lodash: 239.44 KB (2.14%) core-js-pure: 172.67 KB (1.54%) -@mui/system: 161.76 KB (1.45%) +@mui\system: 161.76 KB (1.45%) immutable: 139.01 KB (1.24%) react-dom: 129.98 KB (1.16%) js-yaml: 105.01 KB (0.939%) axios: 87.01 KB (0.778%) -i18next: 82.68 KB (0.740%) -@popperjs/core: 68.84 KB (0.616%) -buffer: 56.99 KB (0.510%) -react-transition-group: 55.52 KB (0.497%) -@emotion/cache: 40.02 KB (0.358%) +i18next: 82.68 KB (0.739%) +@popperjs\core: 68.84 KB (0.616%) +buffer: 56.99 KB (0.509%) +react-transition-group: 55.52 KB (0.496%) +@emotion\cache: 40.02 KB (0.358%) react-redux: 36.88 KB (0.330%) -@mui/utils: 34.3 KB (0.307%) +@mui\utils: 34.3 KB (0.307%) react-i18next: 25.61 KB (0.229%) x2js: 24.59 KB (0.220%) -stylis: 23.54 KB (0.211%) -@emotion/react: 23.27 KB (0.208%) -@emotion/styled: 19 KB (0.170%) +stylis: 23.54 KB (0.210%) +@emotion\react: 23.27 KB (0.208%) +@emotion\styled: 19 KB (0.170%) sha.js: 18.57 KB (0.166%) redux: 16.37 KB (0.146%) url-parse: 16.23 KB (0.145%) -@emotion/serialize: 13.35 KB (0.119%) +@emotion\serialize: 13.35 KB (0.119%) js-base64: 10.11 KB (0.0904%) -reselect: 8.85 KB (0.0792%) +reselect: 8.85 KB (0.0791%) react: 7.98 KB (0.0714%) redux-immutable: 5.43 KB (0.0486%) process: 5.29 KB (0.0473%) -@emotion/sheet: 4.66 KB (0.0417%) +@emotion\sheet: 4.66 KB (0.0417%) scheduler: 4.33 KB (0.0387%) -@emotion/is-prop-valid: 4.33 KB (0.0387%) +@emotion\is-prop-valid: 4.33 KB (0.0387%) deep-extend: 4.19 KB (0.0375%) base64-js: 3.84 KB (0.0343%) -@mui/styled-engine: 3.55 KB (0.0318%) -@mui/private-theming: 3.5 KB (0.0314%) +@mui\styled-engine: 3.55 KB (0.0317%) +@mui\private-theming: 3.5 KB (0.0313%) css.escape: 3.08 KB (0.0275%) -@babel/runtime-corejs3: 3 KB (0.0269%) +@babel\runtime-corejs3: 3 KB (0.0269%) serialize-error: 2.93 KB (0.0262%) -hoist-non-react-statics: 2.68 KB (0.0240%) +hoist-non-react-statics: 2.68 KB (0.0239%) prop-types: 2.6 KB (0.0233%) querystringify: 2.5 KB (0.0224%) react-is: 2.4 KB (0.0215%) ieee754: 2.1 KB (0.0188%) html-parse-stringify: 2.09 KB (0.0187%) -@emotion/utils: 1.72 KB (0.0154%) +@emotion\utils: 1.72 KB (0.0154%) safe-buffer: 1.63 KB (0.0146%) -@babel/runtime: 1.63 KB (0.0146%) -@emotion/hash: 1.62 KB (0.0145%) +@babel\runtime: 1.63 KB (0.0146%) +@emotion\hash: 1.62 KB (0.0145%) clipboard-copy: 1.61 KB (0.0144%) -dom-helpers: 1.57 KB (0.0141%) +dom-helpers: 1.57 KB (0.0140%) randombytes: 1.54 KB (0.0138%) -@braintree/sanitize-url: 1.38 KB (0.0123%) +@braintree\sanitize-url: 1.38 KB (0.0123%) use-sync-external-store: 1.28 KB (0.0115%) -@emotion/unitless: 924 B (0.00807%) -inherits: 753 B (0.00658%) -requires-port: 753 B (0.00658%) -@emotion/use-insertion-effect-with-fallbacks: 472 B (0.00412%) -@emotion/weak-memoize: 379 B (0.00331%) +@emotion\unitless: 924 B (0.00807%) +inherits: 753 B (0.00657%) +requires-port: 753 B (0.00657%) +@emotion\use-insertion-effect-with-fallbacks: 472 B (0.00412%) +@emotion\weak-memoize: 379 B (0.00331%) clsx: 374 B (0.00327%) void-elements: 338 B (0.00295%) -@emotion/memoize: 202 B (0.00176%) -: 1.67 MB (15.3%) +@emotion\memoize: 202 B (0.00176%) +: 1.68 MB (15.3%) diff --git a/dist/rest-import-bundle.css.map b/dist/rest-import-bundle.css.map index 4839527..7273610 100644 --- a/dist/rest-import-bundle.css.map +++ b/dist/rest-import-bundle.css.map @@ -1 +1 @@ -{"version":3,"file":"rest-import-bundle.css","mappings":"AACE,kBACE,sBAEA,SADA,SACA,CAEF,0CAGE,eADA,eACA,CAEF,qBACE,yBACA,qBAEF,wBAGE,mBAFA,aACA,sBACA,CAEF,qCACE,yBAEF,+BAaE,mBAHA,qBAFA,SANA,cAUA,uBANA,OAGA,YAEA,WARA,eAIA,QAFA,MAJA,aAGA,UASA,CAEF,6BACE,UAEF,0BACE,mBAEF,6BAEE,yBACA,gCAFA,YAEA,CACA,uCAEE,yBACA,yBAKA,kBAHA,cADA,eAEA,qBACA,yBACA,CAEF,+BAEE,cADA,cACA,CAEF,4CACE,iBACA,+DACE,2BAKJ,kCACE,eAGJ,oEAQE,sBAEA,qBALA,kBAEA,gBAEA,cAHA,cAIA,CAEF,mCACE,W","sources":["webpack://@wavemaker/rest-client-ui/./src/index.scss"],"sourcesContent":[".rest-import-ui {\n * {\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n }\n html,\n body {\n max-width: 100vw;\n font-size:13px;\n }\n .box {\n background-color: lightblue;\n border: 1px solid red;\n }\n .cmnflx {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .cardcontainer:hover {\n border: 2px solid #1794ef;\n }\n .loadingScreen {\n width: \"100%\";\n height: \"100%\";\n position: fixed;\n z-index: 10;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: auto;\n background: rgba(0, 0, 0, 0.5);\n opacity: 0.9;\n justify-content: center;\n align-items: center;\n }\n .text-danger {\n color: red;\n }\n :disabled {\n cursor: not-allowed; /* or 'default' or any other cursor style */\n }\n .rest-header{\n padding: 15px;\n background-color: #faf8f9;\n border-bottom: 1px solid #dfdfdf;\n .test-btn{\n font-size:13px;\n background-color: #1794ef;\n border: 1px solid #108ce7;\n font-size: 13px;\n color: #f3f4f4;\n padding: 2px 10px 3px;\n text-transform: capitalize;\n border-radius: 2px;\n }\n p{\n font-size:12px;\n color:rgb(33, 33, 33);\n }\n .service-input{\n margin-left:30px;\n input.Mui-disabled{\n background-color:rgba(168, 168, 168, 0.15);\n }\n }\n }\n .rest-tabs{\n button{\n font-size:13px;\n }\n }\n .form-control-select, .url-input div{\n -webkit-border-radius: 2px;\n -moz-border-radius: 2px;\n -ms-border-radius: 2px;\n -o-border-radius: 2px;\n border-radius: 2px;\n font-size: 11px;\n box-shadow: none;\n background-color: #fff;\n color: #212121;\n border-color: #d3d3d3;\n }\n .service-base-path{\n width: 12em;\n }\n\n\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"rest-import-bundle.css","mappings":"AACE,kBACE,sBAEA,SADA,SACA,CAEF,0CAGE,eADA,eACA,CAEF,qBACE,yBACA,qBAEF,wBAGE,mBAFA,aACA,sBACA,CAEF,qCACE,yBAEF,+BAaE,mBAHA,qBAFA,SANA,cAUA,uBANA,OAGA,YAEA,WARA,eAIA,QAFA,MAJA,aAGA,UASA,CAEF,6BACE,UAEF,0BACE,mBAEF,6BAEE,yBACA,gCAFA,YAEA,CACA,uCAEE,yBACA,yBAKA,kBAHA,cADA,eAEA,qBACA,yBACA,CAEF,+BAEE,cADA,cACA,CAEF,4CACE,iBACA,+DACE,2BAKJ,kCACE,eAGJ,oEAQE,sBAEA,qBALA,kBAEA,gBAEA,cAHA,cAIA,CAEF,mCACE,W","sources":["webpack://@wavemaker/rest-client-ui/./src/index.scss"],"sourcesContent":[".rest-import-ui {\r\n * {\r\n box-sizing: border-box;\r\n padding: 0;\r\n margin: 0;\r\n }\r\n html,\r\n body {\r\n max-width: 100vw;\r\n font-size:13px;\r\n }\r\n .box {\r\n background-color: lightblue;\r\n border: 1px solid red;\r\n }\r\n .cmnflx {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n .cardcontainer:hover {\r\n border: 2px solid #1794ef;\r\n }\r\n .loadingScreen {\r\n width: \"100%\";\r\n height: \"100%\";\r\n position: fixed;\r\n z-index: 10;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n margin: auto;\r\n background: rgba(0, 0, 0, 0.5);\r\n opacity: 0.9;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n .text-danger {\r\n color: red;\r\n }\r\n :disabled {\r\n cursor: not-allowed; /* or 'default' or any other cursor style */\r\n }\r\n .rest-header{\r\n padding: 15px;\r\n background-color: #faf8f9;\r\n border-bottom: 1px solid #dfdfdf;\r\n .test-btn{\r\n font-size:13px;\r\n background-color: #1794ef;\r\n border: 1px solid #108ce7;\r\n font-size: 13px;\r\n color: #f3f4f4;\r\n padding: 2px 10px 3px;\r\n text-transform: capitalize;\r\n border-radius: 2px;\r\n }\r\n p{\r\n font-size:12px;\r\n color:rgb(33, 33, 33);\r\n }\r\n .service-input{\r\n margin-left:30px;\r\n input.Mui-disabled{\r\n background-color:rgba(168, 168, 168, 0.15);\r\n }\r\n }\r\n }\r\n .rest-tabs{\r\n button{\r\n font-size:13px;\r\n }\r\n }\r\n .form-control-select, .url-input div{\r\n -webkit-border-radius: 2px;\r\n -moz-border-radius: 2px;\r\n -ms-border-radius: 2px;\r\n -o-border-radius: 2px;\r\n border-radius: 2px;\r\n font-size: 11px;\r\n box-shadow: none;\r\n background-color: #fff;\r\n color: #212121;\r\n border-color: #d3d3d3;\r\n }\r\n .service-base-path{\r\n width: 12em;\r\n }\r\n\r\n\r\n}\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/rest-import-bundle.js b/dist/rest-import-bundle.js index c8bde12..2f3c815 100644 --- a/dist/rest-import-bundle.js +++ b/dist/rest-import-bundle.js @@ -106,5 +106,5 @@ &:nth-of-type(even) { background-color: #f3f3f3; } -`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"e65358f",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:02:26 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.RestImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},configModal:!1,providerConf:{},urls:null,layout:"BaseLayout",maxDisplayedTags:null,filter:null,configs:{},custom:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout,filter:o.filter},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf,dom_id:o.dom_id}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); +`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"f79a664",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:18:28 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.RestImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},configModal:!1,providerConf:{},urls:null,layout:"BaseLayout",maxDisplayedTags:null,filter:null,configs:{},custom:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout,filter:o.filter},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf,dom_id:o.dom_id}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); //# sourceMappingURL=rest-import-bundle.js.map \ No newline at end of file From 77d7e7029b501a475697441170a16686fe9c4bef Mon Sep 17 00:00:00 2001 From: PonnarasiA Date: Mon, 5 May 2025 08:31:06 +0000 Subject: [PATCH 2/2] New version --- dist/config-import-bundle.js | 2 +- dist/log.bundle-sizes.rest-import-ui.txt | 66 ++++++++++++------------ dist/rest-import-bundle.css.map | 2 +- dist/rest-import-bundle.js | 2 +- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/dist/config-import-bundle.js b/dist/config-import-bundle.js index e98cb69..d3b7365 100644 --- a/dist/config-import-bundle.js +++ b/dist/config-import-bundle.js @@ -106,5 +106,5 @@ &:nth-of-type(even) { background-color: #f3f3f3; } -`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"f79a664",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:19:32 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.ConfigImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},providerConf:{},layout:"ConfigLayout",configs:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); +`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"4b00657",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:30:40 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.ConfigImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},providerConf:{},layout:"ConfigLayout",configs:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); //# sourceMappingURL=config-import-bundle.js.map \ No newline at end of file diff --git a/dist/log.bundle-sizes.rest-import-ui.txt b/dist/log.bundle-sizes.rest-import-ui.txt index 7d62cfa..c5ab79e 100644 --- a/dist/log.bundle-sizes.rest-import-ui.txt +++ b/dist/log.bundle-sizes.rest-import-ui.txt @@ -1,65 +1,65 @@ -@mui\icons-material: 5.93 MB (54.3%) -@mui\material: 1.28 MB (11.7%) -@mui\base: 387.29 KB (3.46%) +@mui/icons-material: 5.93 MB (54.3%) +@mui/material: 1.28 MB (11.7%) +@mui/base: 387.29 KB (3.46%) lodash: 239.44 KB (2.14%) core-js-pure: 172.67 KB (1.54%) -@mui\system: 161.76 KB (1.45%) +@mui/system: 161.76 KB (1.45%) immutable: 139.01 KB (1.24%) react-dom: 129.98 KB (1.16%) js-yaml: 105.01 KB (0.939%) axios: 87.01 KB (0.778%) -i18next: 82.68 KB (0.739%) -@popperjs\core: 68.84 KB (0.616%) -buffer: 56.99 KB (0.509%) -react-transition-group: 55.52 KB (0.496%) -@emotion\cache: 40.02 KB (0.358%) +i18next: 82.68 KB (0.740%) +@popperjs/core: 68.84 KB (0.616%) +buffer: 56.99 KB (0.510%) +react-transition-group: 55.52 KB (0.497%) +@emotion/cache: 40.02 KB (0.358%) react-redux: 36.88 KB (0.330%) -@mui\utils: 34.3 KB (0.307%) +@mui/utils: 34.3 KB (0.307%) react-i18next: 25.61 KB (0.229%) x2js: 24.59 KB (0.220%) -stylis: 23.54 KB (0.210%) -@emotion\react: 23.27 KB (0.208%) -@emotion\styled: 19 KB (0.170%) +stylis: 23.54 KB (0.211%) +@emotion/react: 23.27 KB (0.208%) +@emotion/styled: 19 KB (0.170%) sha.js: 18.57 KB (0.166%) redux: 16.37 KB (0.146%) url-parse: 16.23 KB (0.145%) -@emotion\serialize: 13.35 KB (0.119%) +@emotion/serialize: 13.35 KB (0.119%) js-base64: 10.11 KB (0.0904%) -reselect: 8.85 KB (0.0791%) +reselect: 8.85 KB (0.0792%) react: 7.98 KB (0.0714%) redux-immutable: 5.43 KB (0.0486%) process: 5.29 KB (0.0473%) -@emotion\sheet: 4.66 KB (0.0417%) +@emotion/sheet: 4.66 KB (0.0417%) scheduler: 4.33 KB (0.0387%) -@emotion\is-prop-valid: 4.33 KB (0.0387%) +@emotion/is-prop-valid: 4.33 KB (0.0387%) deep-extend: 4.19 KB (0.0375%) base64-js: 3.84 KB (0.0343%) -@mui\styled-engine: 3.55 KB (0.0317%) -@mui\private-theming: 3.5 KB (0.0313%) +@mui/styled-engine: 3.55 KB (0.0318%) +@mui/private-theming: 3.5 KB (0.0314%) css.escape: 3.08 KB (0.0275%) -@babel\runtime-corejs3: 3 KB (0.0269%) +@babel/runtime-corejs3: 3 KB (0.0269%) serialize-error: 2.93 KB (0.0262%) -hoist-non-react-statics: 2.68 KB (0.0239%) +hoist-non-react-statics: 2.68 KB (0.0240%) prop-types: 2.6 KB (0.0233%) querystringify: 2.5 KB (0.0224%) react-is: 2.4 KB (0.0215%) ieee754: 2.1 KB (0.0188%) html-parse-stringify: 2.09 KB (0.0187%) -@emotion\utils: 1.72 KB (0.0154%) +@emotion/utils: 1.72 KB (0.0154%) safe-buffer: 1.63 KB (0.0146%) -@babel\runtime: 1.63 KB (0.0146%) -@emotion\hash: 1.62 KB (0.0145%) +@babel/runtime: 1.63 KB (0.0146%) +@emotion/hash: 1.62 KB (0.0145%) clipboard-copy: 1.61 KB (0.0144%) -dom-helpers: 1.57 KB (0.0140%) +dom-helpers: 1.57 KB (0.0141%) randombytes: 1.54 KB (0.0138%) -@braintree\sanitize-url: 1.38 KB (0.0123%) +@braintree/sanitize-url: 1.38 KB (0.0123%) use-sync-external-store: 1.28 KB (0.0115%) -@emotion\unitless: 924 B (0.00807%) -inherits: 753 B (0.00657%) -requires-port: 753 B (0.00657%) -@emotion\use-insertion-effect-with-fallbacks: 472 B (0.00412%) -@emotion\weak-memoize: 379 B (0.00331%) +@emotion/unitless: 924 B (0.00807%) +inherits: 753 B (0.00658%) +requires-port: 753 B (0.00658%) +@emotion/use-insertion-effect-with-fallbacks: 472 B (0.00412%) +@emotion/weak-memoize: 379 B (0.00331%) clsx: 374 B (0.00327%) void-elements: 338 B (0.00295%) -@emotion\memoize: 202 B (0.00176%) -: 1.68 MB (15.3%) +@emotion/memoize: 202 B (0.00176%) +: 1.67 MB (15.3%) diff --git a/dist/rest-import-bundle.css.map b/dist/rest-import-bundle.css.map index 7273610..4839527 100644 --- a/dist/rest-import-bundle.css.map +++ b/dist/rest-import-bundle.css.map @@ -1 +1 @@ -{"version":3,"file":"rest-import-bundle.css","mappings":"AACE,kBACE,sBAEA,SADA,SACA,CAEF,0CAGE,eADA,eACA,CAEF,qBACE,yBACA,qBAEF,wBAGE,mBAFA,aACA,sBACA,CAEF,qCACE,yBAEF,+BAaE,mBAHA,qBAFA,SANA,cAUA,uBANA,OAGA,YAEA,WARA,eAIA,QAFA,MAJA,aAGA,UASA,CAEF,6BACE,UAEF,0BACE,mBAEF,6BAEE,yBACA,gCAFA,YAEA,CACA,uCAEE,yBACA,yBAKA,kBAHA,cADA,eAEA,qBACA,yBACA,CAEF,+BAEE,cADA,cACA,CAEF,4CACE,iBACA,+DACE,2BAKJ,kCACE,eAGJ,oEAQE,sBAEA,qBALA,kBAEA,gBAEA,cAHA,cAIA,CAEF,mCACE,W","sources":["webpack://@wavemaker/rest-client-ui/./src/index.scss"],"sourcesContent":[".rest-import-ui {\r\n * {\r\n box-sizing: border-box;\r\n padding: 0;\r\n margin: 0;\r\n }\r\n html,\r\n body {\r\n max-width: 100vw;\r\n font-size:13px;\r\n }\r\n .box {\r\n background-color: lightblue;\r\n border: 1px solid red;\r\n }\r\n .cmnflx {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n .cardcontainer:hover {\r\n border: 2px solid #1794ef;\r\n }\r\n .loadingScreen {\r\n width: \"100%\";\r\n height: \"100%\";\r\n position: fixed;\r\n z-index: 10;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n margin: auto;\r\n background: rgba(0, 0, 0, 0.5);\r\n opacity: 0.9;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n .text-danger {\r\n color: red;\r\n }\r\n :disabled {\r\n cursor: not-allowed; /* or 'default' or any other cursor style */\r\n }\r\n .rest-header{\r\n padding: 15px;\r\n background-color: #faf8f9;\r\n border-bottom: 1px solid #dfdfdf;\r\n .test-btn{\r\n font-size:13px;\r\n background-color: #1794ef;\r\n border: 1px solid #108ce7;\r\n font-size: 13px;\r\n color: #f3f4f4;\r\n padding: 2px 10px 3px;\r\n text-transform: capitalize;\r\n border-radius: 2px;\r\n }\r\n p{\r\n font-size:12px;\r\n color:rgb(33, 33, 33);\r\n }\r\n .service-input{\r\n margin-left:30px;\r\n input.Mui-disabled{\r\n background-color:rgba(168, 168, 168, 0.15);\r\n }\r\n }\r\n }\r\n .rest-tabs{\r\n button{\r\n font-size:13px;\r\n }\r\n }\r\n .form-control-select, .url-input div{\r\n -webkit-border-radius: 2px;\r\n -moz-border-radius: 2px;\r\n -ms-border-radius: 2px;\r\n -o-border-radius: 2px;\r\n border-radius: 2px;\r\n font-size: 11px;\r\n box-shadow: none;\r\n background-color: #fff;\r\n color: #212121;\r\n border-color: #d3d3d3;\r\n }\r\n .service-base-path{\r\n width: 12em;\r\n }\r\n\r\n\r\n}\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"rest-import-bundle.css","mappings":"AACE,kBACE,sBAEA,SADA,SACA,CAEF,0CAGE,eADA,eACA,CAEF,qBACE,yBACA,qBAEF,wBAGE,mBAFA,aACA,sBACA,CAEF,qCACE,yBAEF,+BAaE,mBAHA,qBAFA,SANA,cAUA,uBANA,OAGA,YAEA,WARA,eAIA,QAFA,MAJA,aAGA,UASA,CAEF,6BACE,UAEF,0BACE,mBAEF,6BAEE,yBACA,gCAFA,YAEA,CACA,uCAEE,yBACA,yBAKA,kBAHA,cADA,eAEA,qBACA,yBACA,CAEF,+BAEE,cADA,cACA,CAEF,4CACE,iBACA,+DACE,2BAKJ,kCACE,eAGJ,oEAQE,sBAEA,qBALA,kBAEA,gBAEA,cAHA,cAIA,CAEF,mCACE,W","sources":["webpack://@wavemaker/rest-client-ui/./src/index.scss"],"sourcesContent":[".rest-import-ui {\n * {\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n }\n html,\n body {\n max-width: 100vw;\n font-size:13px;\n }\n .box {\n background-color: lightblue;\n border: 1px solid red;\n }\n .cmnflx {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .cardcontainer:hover {\n border: 2px solid #1794ef;\n }\n .loadingScreen {\n width: \"100%\";\n height: \"100%\";\n position: fixed;\n z-index: 10;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: auto;\n background: rgba(0, 0, 0, 0.5);\n opacity: 0.9;\n justify-content: center;\n align-items: center;\n }\n .text-danger {\n color: red;\n }\n :disabled {\n cursor: not-allowed; /* or 'default' or any other cursor style */\n }\n .rest-header{\n padding: 15px;\n background-color: #faf8f9;\n border-bottom: 1px solid #dfdfdf;\n .test-btn{\n font-size:13px;\n background-color: #1794ef;\n border: 1px solid #108ce7;\n font-size: 13px;\n color: #f3f4f4;\n padding: 2px 10px 3px;\n text-transform: capitalize;\n border-radius: 2px;\n }\n p{\n font-size:12px;\n color:rgb(33, 33, 33);\n }\n .service-input{\n margin-left:30px;\n input.Mui-disabled{\n background-color:rgba(168, 168, 168, 0.15);\n }\n }\n }\n .rest-tabs{\n button{\n font-size:13px;\n }\n }\n .form-control-select, .url-input div{\n -webkit-border-radius: 2px;\n -moz-border-radius: 2px;\n -ms-border-radius: 2px;\n -o-border-radius: 2px;\n border-radius: 2px;\n font-size: 11px;\n box-shadow: none;\n background-color: #fff;\n color: #212121;\n border-color: #d3d3d3;\n }\n .service-base-path{\n width: 12em;\n }\n\n\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/rest-import-bundle.js b/dist/rest-import-bundle.js index 2f3c815..6d1dcfc 100644 --- a/dist/rest-import-bundle.js +++ b/dist/rest-import-bundle.js @@ -106,5 +106,5 @@ &:nth-of-type(even) { background-color: #f3f3f3; } -`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"f79a664",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:18:28 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.RestImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},configModal:!1,providerConf:{},urls:null,layout:"BaseLayout",maxDisplayedTags:null,filter:null,configs:{},custom:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout,filter:o.filter},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf,dom_id:o.dom_id}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); +`,PS={fontWeight:700,paddingTop:5,paddingBottom:5,border:"1px solid #ccc"},NS={paddingTop:8,paddingBottom:8,border:"1px solid #ccc"};function LS({value:e,setValue:t,from:n,apiURL:r,changeapiURL:o,headerParams:i,queryParams:a,pathParams:s,handleToastError:l,restImportConfig:u,setAlertMsg:p,multipartParams:d,handleHeaderParamsContentTypeChange:f}){const h=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=h.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=h.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:m}=Xa(),g={UITypes:[{value:"boolean",label:m("BOOLEAN")},{value:"date",label:m("DATE")},{value:"date-time",label:m("DATE")+m("TIME")},{value:"double",label:m("DOUBLE")},{value:"float",label:m("FLOAT")},{value:"int32",label:m("INTEGER")},{value:"int64",label:m("LONG")},{value:"string",label:m("STRING")}],ServerSideProperties:[{value:"DATE",label:m("CURRENT")+" "+m("DATE")},{value:"DATETIME",label:m("CURRENT")+" "+m("DATE")+m("TIME")},{value:"TIME",label:m("CURRENT")+" "+m("TIME")},{value:"TIMESTAMP",label:m("CURRENT")+" "+m("TIMESTAMP")},{value:"USER_ID",label:m("LOGGEDIN")+" "+m("USERID")},{value:"USER_NAME",label:m("LOGGEDIN")+" "+m("USERNAME")}]},v=new Map([["DATE",ES(!1,!1)],["DATETIME",ES(!0,!1)],["TIME",ES(!1,!0)],["TIMESTAMP",Math.floor(Date.now()/1e3).toString()],["USER_ID",u.loggenInUserId||""],["USER_NAME",u.loggenInUserName||""]]),y=[{value:"accept",label:"Accept"},{value:"accept-charset",label:"Accept-Charset"},{value:"accept-encoding",label:"Accept-Encoding"},{value:"accept-language",label:"Accept-Language"},{value:"authorization",label:"Authorization"},{value:"content-length",label:"Content-Length"},{value:"content-type",label:"Content-Type"},{value:"cookie",label:"Cookie"},{value:"origin",label:"Origin"},{value:"referer",label:"Referer"},{value:"user-agent",label:"User-Agent"}],b=(n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n)})),t(o)};function E(){p(!1);const u=e[e.length-1],c=[...e],f=xS(c,"name"),h=()=>{let e=[];return e=CS([u],"header"===n?[...a,...d,...s]:[...i,...d,...s],"name"),e};if(""!==u.name&&""!==u.type&&""!==u.value){if("header"===n&&f.length>0)return l({message:`parameter "${f[0].name}" already exists`,type:"error"});if(h().length>0)return l({message:`parameter "${h()[0].name}" already exists`,type:"error"});if("query"===n&&0===h().length){const e=u.value.split(","),t=e.filter(((t,n)=>t&&e.indexOf(t)===n));if(r){const e=OS(r);if(e.some((e=>e.name===u.name))){const n=e.findIndex((e=>e.name===u.name)),r=AS([...e[n].value.split(","),...t]);e[n].value=r,c[c.findIndex((e=>e.name===u.name))].value=r,c.pop()}else e.push({name:u.name,value:t.join(","),type:"string"}),c[c.findIndex((e=>e.name===u.name))].value=t.join(",");const n=TS(e),i=r.split("?")[0];o(i+n)}else{const e=c.findIndex((e=>e.name===u.name));if(e!==c.length-1){const n=AS([...c[e].value.split(","),...t]);c[e].value=n,c.pop()}else c[c.findIndex((e=>e.name===u.name))].value=t.join(",")}}0===h().length&&c.push({name:"",value:"",type:"string"}),t(c)}else l({message:m("MANDATORY_ALERT"),type:"error"})}const S=i=>{const a=[...e];if("query"===n){let e="";if(r){let n=OS(r);if(n&&i!==a.length-1){const s=AS(a[i].value.split(","));n[n.findIndex((e=>e.name===a[i].name))].value=s,a[i].value=s,e=TS(n);const l=r.split("?")[0];o(l+e),t(a)}}}else a.forEach((e=>{"Content-Type"===e.name&&""!==e.value.trim()&&f(e.value)}))};return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:h},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"},"data-testid":"subheaders"},c.createElement(lv,{style:PS,align:"left"},m("NAME")),c.createElement(lv,{style:PS,align:"left"},m("TYPE")),c.createElement(lv,{style:PS,align:"left"},m("TEST")+" "+m("VALUE")),c.createElement(lv,{style:PS,align:"left"},m("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((i,a)=>c.createElement(IS,{key:a},c.createElement(lv,{style:NS,width:"32.5%",align:"left"},a!==e.length-1?c.createElement(Kf,null,i.name):c.createElement(yS,{fullWidth:!0,size:"small",disabled:a!==e.length-1,inputValue:i.name,onInputChange:(n,r)=>{((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(r,a)},freeSolo:!0,options:"query"===n?[]:y.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-name"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"30%",align:"left"},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(Qd,{MenuProps:{PaperProps:{style:{height:"300px"}}},name:"wm-webservice-param-type",onChange:i=>((i,a)=>{const s=[...e];s.forEach(((e,t)=>{if(t===a)if(g.ServerSideProperties.find((e=>e.value===i.target.value))){if("query"===n){var s,l;let n="";const a=OS(r);a&&(null===(s=a[t])||void 0===s?void 0:s.name)===e.name&&(null===(l=a[t])||void 0===l?void 0:l.value)===e.value?(a[t].value=v.get(i.target.value),n=TS(a)):n=TS(a);const u=r.split("?")[0];o(u+n)}e.type=i.target.value,e.value=v.get(i.target.value)}else e.type=i.target.value})),t(s)})(i,a),value:i.type,"data-testid":"param-type"},c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("UI_TYPES")),g.UITypes.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("SERVER")+" "+m("SIDE")+" "+m("PROPERTIES")),g.ServerSideProperties.map((e=>c.createElement(lf,{title:e.label,key:e.value,value:e.value},e.label))),c.createElement(HE,{sx:{fontWeight:700,color:"black"}},m("APPENVIRONMENT")+m("PROPERTIES")," "),function(){var e;const t=[];return u.appEnvVariables.length>0?null===(e=u.appEnvVariables)||void 0===e||e.forEach((e=>{t.push(c.createElement(lf,{title:e.name,key:e.name,value:e.name},e.name))})):t.push(c.createElement(lf,{key:m("NO_PROPERTIES_FOUND"),disabled:!0},m("NO_PROPERTIES_FOUND"))),t}()))),c.createElement(lv,{style:NS,width:"32.5%",align:"left"},"Content-Type"!==i.name?c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"param-value",size:"small",onBlur:()=>S(a),onChange:e=>b(e.target.value,a),value:i.value}):c.createElement(yS,{fullWidth:!0,size:"small",inputValue:i.value,onBlur:()=>S(a),onInputChange:(e,t)=>{b(t,a)},freeSolo:!0,options:"query"===n?[]:mw.map((e=>e.label)),renderInput:e=>c.createElement(If,rs()({name:"wm-webservice-param-value"},e,{InputLabelProps:{children:""}}))})),c.createElement(lv,{style:NS,width:"5%",align:"center"},a===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:E,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(i){const a=[...e];if("query"===n&&r){let e="",t=OS(r);if(t&&t.some((e=>e.name===a[i].name))){t=t.filter((e=>e.name!==a[i].name)),e=TS(t);const n=r.split("?")[0];o(n+e)}}a.splice(i,1),t(a)}(a),style:{cursor:"pointer"}}))))))))}function MS({value:e,setValue:t,handleToastError:n,headerParams:r,queryParams:o,pathParams:i,setAlertMsg:a}){const s=(0,c.useRef)(null);(0,c.useEffect)((()=>{var e;const t=()=>{const e=s.current;if(e){const t=e.querySelector("tbody");if(t){const n=t.getElementsByTagName("tr"),r=n[n.length-1],o=e.getBoundingClientRect();r.getBoundingClientRect().bottom{var e;null===(e=s.current)||void 0===e||e.removeEventListener("scroll",t)}}),[e]);const{t:l}=Xa();function u(){a(!1);const s=e[e.length-1],u=[...e],c=xS(u,"name"),p=()=>{let e=[];return e=CS([s],[...r,...o,...i],"name"),e};if(""!==s.name&&""!==s.type&&""!==s.value){if(c.length>0)return n({message:`parameter "${c[0].name}" already exists`,type:"error"});if(p().length>0)return n({message:`parameter "${p()[0].name}" already exists`,type:"error"});u.push({name:"",value:"",type:"file",filename:"",contentType:"file"}),t(u)}else n({message:l("MANDATORY_ALERT"),type:"error"})}return c.createElement(Zg,{sx:{maxHeight:"35vh"},component:Ol},c.createElement(Bg,{ref:s,"data-testid":"multipart-table"},c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},l("NAME")),c.createElement(lv,{style:PS,align:"left"},l("TYPE")),c.createElement(lv,{style:PS,align:"left"},l("TEST")+" "+l("VALUE")),c.createElement(lv,{style:PS,align:"left"},l("ACTIONS")))),c.createElement(hv,{sx:{maxHeight:"35vh",overflowY:"auto"}},e.map(((n,r)=>c.createElement(IS,{key:r},c.createElement(lv,{width:"32.5%",style:NS,align:"left"},r!==e.length-1?c.createElement(Kf,null,n.name):c.createElement(If,{name:"wm-webservice-param-name",fullWidth:!0,disabled:r!==e.length-1,size:"small",value:n.name,onChange:n=>((n,r)=>{const o=[...e];null!==n?o.forEach(((e,t)=>{t===r&&(e.name=n)})):o.forEach(((e,t)=>{t===r&&(e.name="")})),t(o)})(n.target.value,r),"data-testid":"multipart-name"})),c.createElement(lv,{width:"30%",style:NS},c.createElement(Uu,{size:"small",fullWidth:!0},c.createElement(bf,null,l("SELECT")+" "+l("TYPE")),c.createElement(Qd,{name:"wm-webservice-param-type",sx:{"& .MuiSelect-select ":{textAlign:"left"}},onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.type="file"===n.target.value?"file":"string",e.value="",e.filename="",e.contentType=n.target.value)})),t(o)})(n,r),value:n.contentType,label:l("SELECT")+" "+l("TYPE"),"data-testid":"multipart-type"},c.createElement(lf,{title:l("FILE"),value:"file"},l("FILE")),c.createElement(lf,{title:l("TEXT"),value:"text"},l("TEXT")),c.createElement(lf,{title:l("PLAINTEXT"),value:"text/plain"},l("PLAINTEXT")),c.createElement(lf,{title:l("JSON")+" ("+l("APPLICATION/JSON")+")",value:"application/json"},l("JSON")+" ("+l("APPLICATION/JSON")+")")))),c.createElement(lv,{width:"32.5%",style:NS,align:"left"},"file"===n.type?c.createElement(c.Fragment,null,c.createElement(If,{variant:"outlined",size:"small",fullWidth:!0,sx:{"& .MuiInputBase-input:hover":{cursor:"pointer !important"}},value:n.filename??"","data-testid":"test-value",onClick:()=>function(e){var t;null===(t=document.getElementById("file-selector-"+e))||void 0===t||t.click()}(r),InputProps:{readOnly:!0,endAdornment:c.createElement(yu,{component:"label"},c.createElement(RS,null))}})," ",c.createElement("input",{id:"file-selector-"+r,type:"file",style:{display:"none"},onChange:n=>{((n,r)=>{const o=n.target.files;if(o&&o.length>0){const n=[...e];n.forEach(((e,t)=>{t===r&&(e.filename=o[0].name,e.value=o[0],e.contentType="file")})),t(n)}})(n,r)}})):c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,size:"small",onChange:n=>((n,r)=>{const o=[...e];o.forEach(((e,t)=>{t===r&&(e.value=n,e.filename="")})),t(o)})(n.target.value,r),value:n.value})),c.createElement(lv,{width:"5%",style:NS,align:"center"},r===e.length-1?c.createElement(bS.Z,{name:"wm-webservice-add-param",onClick:u,sx:{cursor:"pointer"}}):c.createElement("i",{className:"wms wms-delete","aria-label":"wm-webservice-remove-param",onClick:()=>function(n){const r=[...e];r.splice(n,1),t(r)}(r),style:{cursor:"pointer"}}))))))))}var ZS=o(74721),DS=o(48764).Buffer;const jS="function"==typeof btoa,US="function"==typeof DS,zS=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),FS=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),BS=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(FS),String.fromCharCode.bind(String)),$S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),WS=e=>{let t,n,r,o,i="";const a=e.length%3;for(let a=0;a255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=FS[t>>18&63]+FS[t>>12&63]+FS[t>>6&63]+FS[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},HS=jS?e=>btoa(e):US?e=>DS.from(e,"binary").toString("base64"):WS,VS=US?e=>DS.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?BS(192|t>>>6)+BS(128|63&t):BS(224|t>>>12&15)+BS(128|t>>>6&63)+BS(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return BS(240|t>>>18&7)+BS(128|t>>>12&63)+BS(128|t>>>6&63)+BS(128|63&t)},KS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,YS=e=>e.replace(KS,qS),GS=US?e=>DS.from(e,"utf8").toString("base64"):zS?e=>VS(zS.encode(e)):e=>HS(YS(e)),JS=(e,t=!1)=>t?$S(GS(e)):GS(e),XS=({editorRef:e,initialValue:t,url:n,editorLanguage:r,viewMode:o})=>{const i=Is("(min-width:1600px)"),[a,s]=(0,c.useState)(null);function l(t){setTimeout((()=>{var t;null==e||null===(t=e.current)||void 0===t||t.layout()}),0)}return(0,c.useEffect)((()=>{const o=()=>{window.require(["vs/editor/editor.main"],(()=>{const n=window.monaco.editor.create(e.current,{value:t&&"json"===r?JSON.stringify(JSON.parse(t),void 0,2):t,language:r,theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on"});e.current=n,s(n.getModel())})),window.addEventListener("resize",l),window.addEventListener("refreshMonacoLayout",l)};return(async()=>{if(window.monaco)o();else{const e=document.createElement("script");e.src=n||"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.44.0/min/vs/loader.min.js",e.onload=o,document.body.appendChild(e)}})(),()=>{window.removeEventListener("resize",l),window.removeEventListener("refreshMonacoLayout",l)}}),[]),(0,c.useEffect)((()=>{if(a&&r){const e=a.getLanguageId();switch(r){case"json":"json"!==e&&window.monaco.editor.setModelLanguage(a,"json");break;case"xml":case"plaintext":"xml"!==e&&window.monaco.editor.setModelLanguage(a,"xml")}}}),[r,a]),c.createElement(c.Fragment,null,c.createElement("div",{className:"monaco_editor",style:{height:i?"65vh":o?"50vh":"55vh",width:"99%"}},c.createElement("div",{className:"monaco_editor_content",ref:e,style:{height:"100%"}})))};function QS(e){return e.substring(2).toLowerCase()}function ew(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:i="onTouchEnd"}=e,a=c.useRef(!1),s=c.useRef(null),l=c.useRef(!1),u=c.useRef(!1);c.useEffect((()=>(setTimeout((()=>{l.current=!0}),0),()=>{l.current=!1})),[]);const p=(0,Bu.Z)(t.ref,s),d=(0,Dc.Z)((e=>{const t=u.current;u.current=!1;const r=(0,Zc.Z)(s.current);if(!l.current||!s.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth-1:!r.documentElement.contains(e.target)||s.current.contains(e.target),i||!n&&t||o(e)})),f=e=>n=>{u.current=!0;const r=t.props[e];r&&r(n)},h={ref:p};return!1!==i&&(h[i]=f(i)),c.useEffect((()=>{if(!1!==i){const e=QS(i),t=(0,Zc.Z)(s.current),n=()=>{a.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}}),[d,i]),!1!==r&&(h[r]=f(r)),c.useEffect((()=>{if(!1!==r){const e=QS(r),t=(0,Zc.Z)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}}),[d,r]),(0,vs.jsx)(c.Fragment,{children:c.cloneElement(t,h)})}function tw(e){return(0,$s.Z)("MuiSnackbarContent",e)}(0,ll.Z)("MuiSnackbarContent",["root","message","action"]);const nw=["action","className","message","role"],rw=(0,tl.ZP)(Ol,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,t)=>t.root})((({theme:e})=>{const t="light"===e.palette.mode?.8:.98,n=(0,El._4)(e.palette.background.default,t);return(0,as.Z)({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(n),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:n,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})})),ow=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0"}),iw=(0,tl.ZP)("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),aw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:i,role:a="alert"}=n,s=(0,ss.Z)(n,nw),l=n,u=(e=>{const{classes:t}=e;return(0,Bs.Z)({root:["root"],action:["action"],message:["message"]},tw,t)})(l);return(0,vs.jsxs)(rw,(0,as.Z)({role:a,square:!0,elevation:6,className:(0,ls.Z)(u.root,o),ownerState:l,ref:t},s,{children:[(0,vs.jsx)(ow,{className:u.message,ownerState:l,children:i}),r?(0,vs.jsx)(iw,{className:u.action,ownerState:l,children:r}):null]}))}));function sw(e){return(0,$s.Z)("MuiSnackbar",e)}(0,ll.Z)("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const lw=["onEnter","onExited"],uw=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],cw=(0,tl.ZP)("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${(0,Sl.Z)(n.anchorOrigin.vertical)}${(0,Sl.Z)(n.anchorOrigin.horizontal)}`]]}})((({theme:e,ownerState:t})=>(0,as.Z)({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},"top"===t.anchorOrigin.vertical?{top:8}:{bottom:8},"left"===t.anchorOrigin.horizontal&&{justifyContent:"flex-start"},"right"===t.anchorOrigin.horizontal&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:(0,as.Z)({},"top"===t.anchorOrigin.vertical?{top:24}:{bottom:24},"center"===t.anchorOrigin.horizontal&&{left:"50%",right:"auto",transform:"translateX(-50%)"},"left"===t.anchorOrigin.horizontal&&{left:24,right:"auto"},"right"===t.anchorOrigin.horizontal&&{right:24,left:"auto"})}))),pw=c.forwardRef((function(e,t){const n=(0,nl.Z)({props:e,name:"MuiSnackbar"}),r=al(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:i,anchorOrigin:{vertical:a,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:u,className:p,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:h=!1,message:m,open:g,TransitionComponent:v=kc,transitionDuration:y=o,TransitionProps:{onEnter:b,onExited:E}={}}=n,S=(0,ss.Z)(n.TransitionProps,lw),w=(0,ss.Z)(n,uw),x=(0,as.Z)({},n,{anchorOrigin:{vertical:a,horizontal:s},autoHideDuration:l,disableWindowBlurListener:h,TransitionComponent:v,transitionDuration:y}),_=(e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${(0,Sl.Z)(n.vertical)}${(0,Sl.Z)(n.horizontal)}`]};return(0,Bs.Z)(r,sw,t)})(x),{getRootProps:C,onClickAway:O}=function(e){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:i}=e,a=c.useRef();c.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||null==r||r(e,"escapeKeyDown")}}),[o,r]);const s=(0,Dc.Z)(((e,t)=>{null==r||r(e,t)})),l=(0,Dc.Z)((e=>{r&&null!=e&&(clearTimeout(a.current),a.current=setTimeout((()=>{s(null,"timeout")}),e))}));c.useEffect((()=>(o&&l(t),()=>{clearTimeout(a.current)})),[o,t,l]);const u=()=>{clearTimeout(a.current)},p=c.useCallback((()=>{null!=t&&l(null!=i?i:.5*t)}),[t,i,l]),d=e=>t=>{const n=e.onBlur;null==n||n(t),p()},f=e=>t=>{const n=e.onFocus;null==n||n(t),u()},h=e=>t=>{const n=e.onMouseEnter;null==n||n(t),u()},m=e=>t=>{const n=e.onMouseLeave;null==n||n(t),p()};return c.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",p),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",u)}}),[n,p,o]),{getRootProps:(t={})=>{const n=Hu(e),r=(0,as.Z)({},n,t);return(0,as.Z)({role:"presentation"},r,{onBlur:d(r),onFocus:f(r),onMouseEnter:h(r),onMouseLeave:m(r)})},onClickAway:e=>{null==r||r(e,"clickaway")}}}((0,as.Z)({},x)),[T,A]=c.useState(!0),k=Yu({elementType:cw,getSlotProps:C,externalForwardedProps:w,ownerState:x,additionalProps:{ref:t},className:[_.root,p]});return!g&&T?null:(0,vs.jsx)(ew,(0,as.Z)({onClickAway:O},d,{children:(0,vs.jsx)(cw,(0,as.Z)({},k,{children:(0,vs.jsx)(v,(0,as.Z)({appear:!0,in:g,timeout:y,direction:"top"===a?"down":"up",onEnter:(e,t)=>{A(!1),b&&b(e,t)},onExited:e=>{A(!0),E&&E(e)}},S,{children:u||(0,vs.jsx)(aw,(0,as.Z)({message:m,action:i},f))}))}))}))}));var dw=o(27098),fw=o.n(dw);function hw(e){const{children:t,value:n,index:r,...o}=e;return c.createElement("div",rs()({role:"tabpanel",hidden:n!==r},o,{style:{margin:"10px"}}),n===r&&c.createElement(_s,null,t))}const mw=[{label:"application/json",value:"application/json"},{label:"application/octet-stream",value:"application/octet-stream"},{label:"application/pdf",value:"application/pdf"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"multipart/form-data",value:"multipart/form-data"},{label:"text/html",value:"text/html"},{label:"text/plain",value:"text/plain"},{label:"text/xml",value:"text/xml"}];function gw({language:e,restImportConfig:t}){var n,r,o,i,a;const s=(0,Es.Z)({typography:{fontSize:13,fontFamily:"roboto"},components:{MuiAutocomplete:{styleOverrides:{listbox:{fontSize:"11px"}}},MuiSelect:{styleOverrides:{select:{"&.Mui-disabled":{cursor:"not-allowed"}}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused fieldset":{borderColor:"#1794ef",borderWidth:"1px"}}}}},MuiOutlinedInput:{styleOverrides:{root:{"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#1794ef",borderWidth:"1px"},fontSize:"12px"}}},MuiMenuItem:{styleOverrides:{root:{"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:"#f5f5f5"},"&.Mui-selected, &.Mui-selected:focus":{backgroundColor:"#1794ef",color:"#ffffff"},fontSize:"12px"}}},MuiTypography:{styleOverrides:{root:{fontSize:"12px"}}},MuiTableCell:{styleOverrides:{head:{color:"#333",fontSize:"12px",padding:"5px"}}},MuiTableRow:{styleOverrides:{root:{fontSize:"13px",padding:"5px"}}},MuiInputLabel:{styleOverrides:{root:{fontSize:"11px"}}}}}),l=Is("(min-width:1600px)"),u={name:"",value:"",type:"string"},p={name:"",value:"",type:"file",filename:"",contentType:"file"},{t:d,i18n:f}=Xa(),[h,m]=(0,c.useState)((null==t?void 0:t.url)||""),[g,v]=(0,c.useState)((null==t?void 0:t.httpMethod)||"GET"),[y,b]=(0,c.useState)(!0===(null==t?void 0:t.useProxy)),[E,S]=(0,c.useState)(t.withCredentials||!1),[w,x]=(0,c.useState)(0),[_,C]=(0,c.useState)(0),[O,T]=(0,c.useState)((null==t||null===(n=t.httpAuth)||void 0===n?void 0:n.type)||"NONE"),[A,k]=(0,c.useState)(!1),[R,I]=(0,c.useState)((null==t||null===(r=t.headerParams)||void 0===r?void 0:r.concat(u))||[u]),[P,N]=(0,c.useState)((null==t||null===(o=t.queryParams)||void 0===o?void 0:o.concat(u))||[u]),[L,M]=(0,c.useState)((null==t?void 0:t.bodyParams)||""),[Z,D]=(0,c.useState)((null==t||null===(i=t.multipartParams)||void 0===i?void 0:i.concat(p))||[p]),[j,U]=(0,c.useState)([]),[z,F]=(0,c.useState)((null==t?void 0:t.contentType)||"application/json"),[B,$]=(0,c.useState)(!1),[W,H]=(0,c.useState)(mw),[V,q]=(0,c.useState)(""),[K,Y]=(0,c.useState)({headers:t.setResponseHeaders,data:t.setResponse||void 0}),[G,J]=(0,c.useState)((null==t?void 0:t.userName)||""),[X,Q]=(0,c.useState)((null==t?void 0:t.userPassword)||""),[ee,te]=(0,c.useState)(!1),[ne,re]=(0,c.useState)(null===(a=t.httpAuth)||void 0===a?void 0:a.providerId),[oe,ie]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),[le,ue]=(0,c.useState)(t.setServiceName||""),[ce,pe]=(0,c.useState)(!0),de=(0,c.useRef)(null),[fe,he]=(0,c.useState)({type:"error",message:""}),[me,ge]=(0,c.useState)(!1),[ve,ye]=(0,c.useState)((null==t?void 0:t.responseType)||"json"),[be,Ee]=(0,c.useState)({selectedProvider:{providerId:"",clientId:"",authorizationUrl:"",accessTokenUrl:"",sendAccessTokenAs:"",accessTokenParamName:"",scopes:[],oAuth2Pkce:{enabled:!0,challengeMethod:""},oauth2Flow:"AUTHORIZATION_CODE",isConfigured:!1},providerAuthURL:"",providerList:[],configOpen:!1,providerOpen:!1,isConfigured:!1});var Se=[],we=!0;const[xe,_e]=(0,c.useState)(null==t?void 0:t.urlBasePath),[Ce,Oe]=(0,c.useState)([]),[Te,Ae]=(0,c.useState)(!(null!=t&&t.viewMode)),[ke,Re]=(0,c.useState)((null==t?void 0:t.settingsDetailsResponse)||{});(0,c.useEffect)((()=>{if(!window.google){const e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,document.head.appendChild(e)}null!=t&&t.contentType&&Ue(t.contentType)}),[]),(0,c.useEffect)((()=>{re(be.selectedProvider.providerId)}),[be.selectedProvider]),(0,c.useEffect)((()=>{f.changeLanguage(e),je(null,_)}),[K]),(0,c.useEffect)((()=>{Ie(h)}),[h]);const Ie=e=>{try{const n=new(is())(e).pathname.split("/").filter(Boolean),r=n.findIndex((e=>{const t=decodeURIComponent(e);return t.includes("{")||t.includes("}")})),o=-1===r?n:n.slice(0,r),i=["empty"];for(let e=0;e0&&_e(null!=t&&t.urlBasePath?null==t?void 0:t.urlBasePath:i[1]),Oe(i)}catch(e){console.error("Invalid URL:",e),Oe([])}},Pe=(e,t)=>{Ee((n=>({...n,[e]:t})))},Ne=(e,t)=>{"clickaway"!==t&&ge(!1)};function Le(e,n){return"default"===t.error.errorMethod&&(he({type:e.type,message:e.message}),e.message&&se(!0),t.error.errorMessageTimeout&&setTimeout((()=>{se(!1)}),t.error.errorMessageTimeout)),"toast"===t.error.errorMethod?(he({type:e.type,message:e.message}),void ge(!0)):"customFunction"===t.error.errorMethod?t.error.errorFunction(e.message,n):void 0}const Me=()=>k(!1),Ze=e=>m(e),De=(e,t)=>x(t),je=(e,n)=>{0===n?t.hideMonacoEditor(!1):t.hideMonacoEditor(!0),C(n)},Ue=e=>{if(e&&!W.find((t=>t.value===e))){const t=[...W];t.push({label:e,value:e}),H(t),$(!1),F(e),q("")}else e&&W.find((t=>t.value===e))?($(!1),F(e),q("")):Le({message:"Please add a custom content type",type:"error"})};function ze(e,n){var r;const o=(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html",i={providerId:be.selectedProvider.providerId,suffix:".access_token",requestSourceType:"WEB",flow:e};let a,s=be.selectedProvider.authorizationUrl.split("?");a=1===s.length?"?":s.length>1&&""!==s[1]?"&":"";return be.selectedProvider.authorizationUrl+a+"client_id="+be.selectedProvider.clientId+"&redirect_uri="+o+"&state="+encodeURIComponent(JSON.stringify(i))+"&scope="+encodeURIComponent(n)+"&response_type="+("implicit"===e?"token":"code")}const Fe=async()=>{try{if(!(h.length>0))throw new Error(d("VALID_URL_ALERT"));{se(!1);let u={},c=h;const p="multipart/form-data"===z;if(!function(e){return/^(https?:\/\/(www\.)?|www\.)([^\s/?.#]+\.?)+(\/[^\s]*)?$/i.test(e)}(encodeURI(c)))throw new Error(d("VALID_URL_ALERT"));{if(R.forEach(((e,t)=>{if(e.name&&e.value){if("Authorization"===e.name&&u.Authorization)throw new Error('Parameter "Authorization" already exists');u[e.name]=e.value,t===R.length-1&&I([...R,{name:"",value:"",type:"string"}])}})),j.forEach((e=>{if(""===e.value.trim())throw new Error(d("PATHPARAMSALERT"));c=c.replace(`{${e.name}}`,e.value)})),(e=>{if(P&&P[P.length-1].name&&P[P.length-1].value){const t=P[P.length-1].name,n=P[P.length-1].value,r=[...P],o=n.split(","),i=o.filter(((e,t)=>e&&o.indexOf(e)===t));if(0!==CS([{name:t,value:n,type:"string"}],[...R,...j],"name").length)throw new Error(`parameter "${t}" already exists`);{const n=OS(e);if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),o=AS([...n[e].value.split(","),...i]);n[e].value=o,r[r.findIndex((e=>e.name===t))].value=o,r[r.length-1]={name:"",type:"string",value:""}}else n.push({name:t,value:i.join(","),type:"string"}),r.push({name:"",type:"string",value:""});const o=TS(n),a=e.split("?")[0];m(e=a+o),N(r)}}})(c),"BASIC"===O){if(""===G.trim())throw new Error("Please enter a username for basic authentication");if(""===X.trim())throw new Error("Please enter a password for basic authentication");u.Authorization="Basic "+JS(G+":"+X)}if("OAUTH2"===O){var e;if(""===be.selectedProvider.providerId)return Le({message:"Please select a provider",type:"error"});let w;const x=be.selectedProvider.clientId;let _=(null==t||null===(e=t.proxy_conf)||void 0===e?void 0:e.base_path)+`oauth2/${be.selectedProvider.providerId}/callback`;const C="code",T="eyJtb2RlIjoiZGVzaWduVGltZSIsInByb2plY3RJZCI6IldNUFJKMmM5MTgwODg4OWE5NjQwMDAxOGExYzE0YjBhNzI4YTQifQ==",A=be.selectedProvider.scopes.length>0?be.selectedProvider.scopes.map((e=>e.value)).join(" "):"";let k;const M=window.localStorage.getItem(`${ne}.access_token`);if(!M){var n,r;if(be.selectedProvider.oAuth2Pkce&&null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled)if("google"===be.selectedProvider.providerId){var o;if(window&&null!==(o=window)&&void 0!==o&&o.google){var i,a;(null===(i=window)||void 0===i||null===(a=i.google)||void 0===a?void 0:a.accounts.oauth2.initTokenClient({client_id:x,scope:A,callback:e=>{e&&e.access_token&&(u.Authorization="Bearer "+e.access_token,Ke(u),te(!1))},error_callback:e=>{if("popup_closed"===e.type){const e=window.localStorage.getItem(`${ne}.access_token`)||null;u.Authorization="Bearer null",null!==e&&Ke(u),te(!1)}}})).requestAccessToken()}}else{const U=be.selectedProvider.oAuth2Pkce.challengeMethod;w=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(e=>("0"+e.toString(16)).substr(-2))).join("")}();const F=Uint8Array.from(w.split("").map((e=>e.charCodeAt(0))));window.crypto.subtle.digest("SHA-256",F).then((e=>{const t="S256"===U?Je(e):w,n=ze("pkce",A)+"&code_challenge="+t+"&code_challenge_method="+U;k=window.open(n,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600")})).catch((e=>{console.error("Error calculating code challenge:",e)}))}else"IMPLICIT"===be.selectedProvider.oauth2Flow?k=window.open(ze("implicit",A),"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"):(be.selectedProvider.authorizationUrl+`?client_id=${x}&redirect_uri=${_}&response_type=${C}&state=${T}&scope=${A}`,k=window.open(be.providerAuthURL,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0,width=400,height=600"));if("google"===be.selectedProvider.providerId&&!be.selectedProvider.oAuth2Pkce||"google"!==be.selectedProvider.providerId){const B=setInterval((()=>{var e;null!==(e=k)&&void 0!==e&&e.closed&&(clearInterval(B),Be({data:{errors:{error:[{parameters:[{code:401,message:"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",status:"UNAUTHENTICATED"}]}]}},config:void 0,headers:{"Content-Type":"application/json"},status:401,statusText:""},{url:""}))}),1e3),$=async e=>{const t=window.localStorage.getItem(`${ne}.access_token`)||null;var n,r;t?(null!==(n=be.selectedProvider)&&void 0!==n&&null!==(r=n.oAuth2Pkce)&&void 0!==r&&r.enabled?(Xe(t,w),te(!1)):(u.Authorization=`Bearer ${t}`,Ke(u)),clearInterval(B),window.removeEventListener("message",$)):e.data.code&&(clearInterval(B),Xe(e.data.code,w),te(!1),window.removeEventListener("message",$))};window.addEventListener("message",$)}return}u.Authorization=`Bearer ${M}`}function f(){const e={endpointAddress:encodeURI(c),method:g,contentType:z,requestBody:p?"":L,headers:u,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne}};if(!p)return e;const t=v();e.multiParamInfoList=Se,e.headers["Content-Type"]=z;const n=new Blob([JSON.stringify(e)],{type:"application/json"});return t.append("wm_httpRequestDetails",n),t}function v(){const e=new FormData;return Se=[],Z.forEach(((t,n)=>{t.name&&t.value&&("file"===t.type?(e.append(t.name,new Blob([t.value],{type:"application/json"}),t.filename),Se.push({name:t.name,type:"file",list:!0,contentType:void 0,testValue:void 0})):(e.append(t.name,"text"===t.contentType?t.value:new Blob([t.value],{type:t.contentType})),Se.push({name:t.name,type:t.type,list:!1,testValue:t.value,contentType:"text"===t.contentType?void 0:t.contentType}))),n===Z.length-1&&""!==t.name.trim()&&t.value&&D([...Z,{name:"",value:"",type:"file",contentType:"file"}])})),e}let b={};var s,l;if(y)b={url:(null==t||null===(s=t.proxy_conf)||void 0===s?void 0:s.base_path)+(null==t||null===(l=t.proxy_conf)||void 0===l?void 0:l.proxy_path),data:f(),method:"POST",headers:{"Content-Type":p?z:"application/json"},withCredentials:!0,useProxy:y};else b={url:c,headers:{...u,"Content-Type":p?"multipart/form-data":u["Content-Type"]},method:g,data:p?v():L,authDetails:"NONE"===O?null:"BASIC"===O?{type:"BASIC"}:{type:"OAUTH2",providerId:ne},useProxy:y,withCredentials:E};te(!0);const S=await fE(b);if(S.status>=200&&S.status<300){if(ne&&(401===S.status||401===S.data.statusCode))return Ge(b);const W=await Ve(b,S);W&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==W?void 0:W.serviceId),ue(null==W?void 0:W.serviceId)),Be(S,b,W))}else pe(!0),Ae(!0),Be(S,b);te(!1)}}}catch(H){te(!1),Le({message:H.message,type:"error"})}};function Be(e,n,r){let o;var i,a,s,l,u,c,p,f,m,g,v;if(pe(!1),Ae(!1),y)e.status>=200&&e.status<300?e.data.statusCode>=200&&e.data.statusCode<300?o={data:$e(e.data.responseBody),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers}:(o={data:$e(e.data.responseBody)||JSON.stringify(null==e||null===(m=e.data)||void 0===m||null===(g=m.errors)||void 0===g||null===(v=g.error[0])||void 0===v?void 0:v.parameters[0],void 0,2),status:null==e?void 0:e.data.statusCode,headers:null==e?void 0:e.data.headers},Le({message:wS.get(null==e?void 0:e.data.statusCode),type:"error"},e)):o={data:JSON.stringify(null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(s=a.errors)||void 0===s||null===(l=s.error[0])||void 0===l?void 0:l.parameters[0],void 0,2)||(null==e||null===(u=e.response)||void 0===u?void 0:u.data.status)+" "+wS.get(null==e||null===(c=e.response)||void 0===c?void 0:c.data.status),status:null==e||null===(p=e.response)||void 0===p?void 0:p.data.status,headers:null==e||null===(f=e.response)||void 0===f?void 0:f.headers};else if(e.status>=200&&e.status<300)o={data:$e(null==e?void 0:e.data),status:null==e?void 0:e.status,headers:null==e?void 0:e.headers};else if(void 0!==e.response){var b,E,S;o={data:(null==e?void 0:e.response.status)+" "+wS.get(null===(b=e.response)||void 0===b?void 0:b.status),status:null==e?void 0:e.response.status,headers:null===(E=e.response)||void 0===E?void 0:E.headers},Le({message:wS.get(null===(S=e.response)||void 0===S?void 0:S.status),type:"error"},e)}else{var w,x;const t=(null==e||null===(w=e.response)||void 0===w?void 0:w.data.status)+" "+wS.get(null==e||null===(x=e.response)||void 0===x?void 0:x.data.status);o={data:"ERR_NETWORK"===e.code?d("CORS_ERROR_MESSAGE"):t,status:e.code,headers:{}}}de.current.setValue(o.data),Y(o),n.url=h,te(!1),t.handleResponse(n,o,r)}function $e(e){const{isValid:t,jsonString:n}=We(e);if(t)return ye("json"),n;return 0===(new DOMParser).parseFromString(e,"application/xml").getElementsByTagName("parsererror").length?(ye("xml"),e):(ye("plaintext"),e)}function We(e){let t=e,n=!0;try{"string"==typeof e?t=JSON.stringify(JSON.parse(e),void 0,2):"object"==typeof e&&(t=JSON.stringify(JSON.parse(JSON.stringify(e)),void 0,2))}catch(e){n=!1}return{isValid:n,jsonString:t}}function He(e){let t=new(fw())({emptyNodeForm:"object",attributePrefix:"",enableToStringFunc:!1}).xml2js(e);if(t){t=t[Object.keys(t)[0]]}return t}async function Ve(e,n){const r=n.headers,o={};R.length>1&&(null==R||R.forEach((e=>{""!==e.name&&""!==e.value&&(o[e.name]=e.value)})));const i={authDetails:y?null==e?void 0:e.data.authDetails:null==e?void 0:e.authDetails,contentType:z,method:g,endpointAddress:h,headers:o,multiParamInfoList:Se,sampleHttpResponseDetails:{headers:y?n.data.headers:r,responseBody:y?n.data.responseBody:JSON.stringify(null==n?void 0:n.data),convertedResponse:We(n.data.responseBody).isValid?null:JSON.stringify(He(n.data.responseBody)),statusCode:null==n?void 0:n.status},requestBody:L,urlBasePath:Te?null:xe},a={url:t.proxy_conf.base_path+t.proxy_conf.settingsUpload,data:i,method:"POST",withCredentials:!0},s=await fE(a);if(n.status>=200&&n.status<300){let l=s.data;Re(l);const u=qe(l).paramaters,c=qe(l).firstKey,p=qe(l).secondKey,d=[...R],f=[...P],m=[...Z],v=[...j];function b(e,t,n){const r=function(e){let t="BASIC";return t=["boolean","date","date-time","double","float","int32","int64","string"].includes(e)?"BASIC":["DATE","DATETIME","TIME","TIMESTAMP","USER_ID","USER_NAME"].includes(e)?"SERVER":"ENVIRONMENT",t}(t.type);"SERVER"===r?("HEADER"===n&&(e.items.type=t.type),e["x-WM-VARIABLE_KEY"]="DATETIME"===t.type?"DATE_TIME":t.type,e["x-WM-VARIABLE_TYPE"]="SERVER",e.format=t.type):"ENVIRONMENT"===r?(e["x-WM-VARIABLE_KEY"]=t.type,e["x-WM-VARIABLE_TYPE"]="APP_ENVIRONMENT",e.format="__APP_ENV__"+t.type):"BASIC"===r&&(e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT",e["x-WM-EDITABLE"]=!1,e.format=t.type)}return u&&u.length>0&&u.forEach((e=>{if("header"===e.in){for(let t=0;te.name===m[n].name)))||void 0===t?void 0:t.type;e.format="file"===r?"array":"string",e["x-WM-VARIABLE_KEY"]="",e["x-WM-VARIABLE_TYPE"]="PROMPT","array"===e.type&&(e.items.type=r)}})),v.length>0&&v.forEach((e=>{u.push({in:"path",type:"string",name:e.name,format:"string",required:!0,"x-WM-VARIABLE_KEY":"","x-WM-VARIABLE_TYPE":"PROMPT"})})),l.swagger.paths[c][p].parameters=u,l.proxySettings={mobile:y?"PROXY":"DIRECT",web:y?"PROXY":"DIRECT",withCredentials:E},l.serviceId=""!==le.trim()&&t.viewMode?le:l.serviceId,l}Le({message:"Failed to get settings upload response",type:"error"},s)}function qe(e){const t=e.swagger.paths,[n]=Object.keys(t),r=t[n],[o]=Object.keys(r);return{paramaters:r[o].parameters||[],firstKey:n,secondKey:o}}const Ke=async e=>{var n,r;const o={url:h,headers:e,method:g,data:L,authDetails:{type:"OAUTH2",providerId:ne}},i=(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.proxy_path),a=y?{url:i,data:{endpointAddress:h,method:g,contentType:z,requestBody:L,headers:e,authDetails:{type:"OAUTH2",providerId:ne}},method:"POST",headers:{"Content-Type":"application/json"},withCredentials:!0}:o;te(!0);const s=await fE(a);if(s.status>=200&&s.status<300)if(200===s.data.statusCode){const e=await Ve(a,s);e&&(pe(!1),Ae(!1),t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),Be(s,a,e))}else 401===s.data.statusCode&&we?Ge(a):Ye(a,s);else Ye(a,s);te(!1)};function Ye(e,t){pe(!0),Be(t,e)}function Ge(e){we?(window.localStorage.removeItem(`${ne}.access_token`),we=!1,Fe()):Ye(e,K)}const Je=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xe=async(e,n)=>{var r;const o={grant_type:"authorization_code",code:e,client_id:be.selectedProvider.clientId,code_verifier:n,redirect_uri:(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.base_path)+"studio/oAuthCallback.html"},i={url:be.selectedProvider.accessTokenUrl,headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:o};let a={};null==R||R.forEach((e=>{e.name&&e.value&&(a[e.name]=e.value)}));const s=await fE(i);200===s.status?(a.Authorization="Bearer "+s.data.access_token,window.localStorage.setItem(be.selectedProvider.providerId+".access_token",s.data.access_token),Ke(a)):(a.Authorization="Bearer null",Ke(a))};return c.createElement(Fs,{theme:s},c.createElement(ol,{sx:{height:"97vh"},className:"rest-import-ui"},ee&&c.createElement(RE,null),c.createElement(bl,{className:"cmnflx",container:!0},c.createElement(bl,{item:!0,md:12},ae&&c.createElement(Iu,{sx:{py:0},severity:null==fe?void 0:fe.type,"data-testid":"default-error",onClose:()=>se(!1)},fe.message)),c.createElement(bl,{sx:{border:t.viewMode?"2px solid #ccc":"none",padding:t.viewMode?3:0},item:!0,md:12,className:"rest-header"},c.createElement(ol,{spacing:5,direction:"row",display:"flex",justifyContent:"space-between",alignItems:"center"},c.createElement(Uu,{disabled:t.viewMode,sx:{minWidth:120,color:"red"},size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-webservice-http-method","data-testid":"http-method",value:g,sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},disabled:t.viewMode,onChange:e=>{v(e.target.value),De(0,0),D([p]),F("application/json")}},["GET","POST","DELETE","HEAD","PATCH","PUT"].map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))),c.createElement(If,{onBlur:()=>{(()=>{try{let e=SS(h.split("?")[0],"{","}");if(e.length>0){const t=[],n=e=>{let n=!0;for(const r of j)if(r.name===e&&!t.some((t=>t.name===e))){t.push({name:e,value:r.value}),n=!1;break}return n};e.forEach((e=>{if(!e)throw new Error("Please enter a valid path parameter");if(n(e)){if(t.some((t=>t.name===e)))throw new Error("Path parameters cannot have duplicates");t.push({name:e,value:""})}}));const r=OS(h),o=CS(t,[...R,...r],"name");if(o.length>0){let e=h,n="";U(_S(t,o,"name")),o.forEach(((t,r)=>{const i=t.name;n+=r!==o.length-1?`${i},`:i,e=e.replace(`/{${i}}`,"")})),m(e),Le({message:`Parameters cannot have duplicates, removed the duplicates[${n}]`,type:"error"})}else U(t)}else U([])}catch(e){Le({message:e.message,type:"error"})}})(),(()=>{try{if(""!==h){const e=null==h?void 0:h.split("?")[1],t=null==e?void 0:e.split("&");if((null==t?void 0:t.length)>0){const e=t.map((e=>({name:e.split("=")[0],value:e.split("=")[1]})));let n=[];const r=(e,t)=>{let r=!0;for(const o of P)if(o.name===e){if(n.some((t=>t.name===e))){const o=n.findIndex((t=>t.name===e)),i=AS([...n[o].value.split(","),...t.split(",")]);n[o].value=i,r=!1;break}{const i=AS(t.split(","));n.push({name:e,value:i,type:o.type}),r=!1;break}}return r};e.forEach((e=>{const t=e.name,o=e.value;if(!t||!o)throw new Error("Please enter a valid query parameter");if(r(t,o))if(n.some((e=>e.name===t))){const e=n.findIndex((e=>e.name===t)),r=AS([...n[e].value.split(","),...o.split(",")]);n[e].value=r}else{const e=AS(o.split(","));n.push({name:t,value:e,type:"string"})}}));const o=SS(h.split("?")[0],"{","}").map((e=>({name:e}))),i=CS(n,[...R,...o],"name");if(i.length>0){let e="";const t=_S(n,i,"name");t.push({name:"",value:"",type:"string"}),N(t),i.forEach(((t,n)=>{const r=t.name;e+=n!==i.length-1?`${r},`:r}));const r=TS(t),o=h.split("?")[0];m(o+r),Le({message:`Queries cannot have duplicates, removed the duplicates[${e}]`,type:"error"})}else{n.push({name:"",value:"",type:"string"}),N(n);const e=TS(n),t=h.split("?")[0];m(t+e)}}else N([{name:"",value:"",type:"string"}])}else N([{name:"",value:"",type:"string"}])}catch(e){Le({message:e.message,type:"error"})}})()},className:"url-input",name:"wm-webservice-sample-url",autoFocus:!0,value:h,onChange:e=>m(e.target.value.trim()),size:"small",fullWidth:!0}),c.createElement(Bf,{className:"test-btn",name:"wm-webservice-sample-test",onClick:Fe,variant:"contained"},d("TEST"))),c.createElement(bl,{mt:2,container:!0},c.createElement(bl,{item:!0,md:4},c.createElement(ol,{sx:{cursor:"pointer"},display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("SERVICE_NAME")),c.createElement(If,{value:le,className:"url-input service-input",name:"wm-webservice-service-name",sx:{backgroundColor:t.viewMode?"#eeeced":"none","& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:t.viewMode?"#000":"none"}},onChange:e=>{ue(e.target.value),t.getServiceName(e.target.value)},disabled:ce||t.viewMode,size:"small"}))),c.createElement(bl,{item:!0,md:3,px:1},c.createElement(ol,{sx:{cursor:"pointer"},spacing:2,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,{sx:{marginRight:"15px"}},d("BASE_PATH")),c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select service-base-path",name:"wm-base-path","data-testid":"base-path",value:xe,title:xe,disabled:Te,onChange:async e=>{if(_e(e.target.value),0!==Object.keys(ke).length||t.viewMode){var n,r;let o=ke;o.httpRequestDetails.urlBasePath=e.target.value;const i={url:(null==t||null===(n=t.proxy_conf)||void 0===n?void 0:n.base_path)+(null==t||null===(r=t.proxy_conf)||void 0===r?void 0:r.updateSwagger),method:"POST",data:o,headers:{"Content-Type":"application/json"},withCredentials:!0},a=await fE(i);if(a.status>=200&&a.status<300){const e=a.data;t.viewMode||(t.getServiceName(null==e?void 0:e.serviceId),ue(null==e?void 0:e.serviceId)),t.handleUpdateSwaggerResponse(e)}else console.log("Received an unexpected response:",a)}}},Ce.map((e=>c.createElement(lf,{key:e,title:e,value:e},e))))))),c.createElement(bl,{item:!0,md:2},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("USE_PROXY")),c.createElement(lh,{name:"wm-webservice-use-proxy","data-testid":"proxy-switch",checked:y,onChange:e=>{t.getUseProxy(e.target.checked),b(e.target.checked),e.target.checked&&S(!e.target.checked)}}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("USEPROXY_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))),!y&&c.createElement(bl,{item:!0,md:3},c.createElement(ol,{display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("WITH_CREDENTIALS")),c.createElement(lh,{name:"wm-webservice-with-credentials","data-testid":"with-credentials",checked:E,onChange:e=>S(e.target.checked)}),c.createElement(Qm,{title:c.createElement("span",{dangerouslySetInnerHTML:{__html:d("WITH_CREDENTIALS_TOOLTIP")},style:{fontSize:"13px"}})},c.createElement("i",{className:"wms wms-help"})))))),c.createElement(bl,{sx:{overflowY:"auto",overflowX:"hidden"},height:l?"85vh":"80vh",item:!0,md:12,className:"rest-content"},c.createElement(_s,{"data-testid":"request-config-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"rest-tabs",sx:{minHeight:"30px",height:"45px"},value:w,onChange:De},c.createElement(Pg,{title:"wm-rest-authorization-params-header",label:d("AUTHORIZATION")}),c.createElement(Pg,{title:"wm-rest-headers-params-header",label:d("HEADER")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-body-params-header",label:d("BODY")+" "+d("PARAMS"),disabled:"GET"===g}),c.createElement(Pg,{title:"wm-rest-query-params-header",label:d("QUERY")+" "+d("PARAMS")}),c.createElement(Pg,{title:"wm-rest-path-params-header",label:d("PATH")+" "+d("PARAMS")}))),c.createElement(_s,{className:"rest-tabs-content",sx:{border:"1px solid #ccc"}},c.createElement(hw,{value:w,index:0},c.createElement(bl,{spacing:2,container:!0},c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("HTTP")+" "+d("AUTHENTICATION"))),c.createElement(bl,{item:!0,md:9},c.createElement(Uu,{size:"small"},c.createElement(Qd,{className:"form-control-select",name:"wm-rest-http-auth","data-testid":"http-auth",value:O,onChange:e=>T(e.target.value)},["NONE","BASIC","OAUTH2"].map((e=>c.createElement(lf,{key:e,title:d(e),value:e},"OAUTH2"===e?"OAuth 2.0":d(e))))))),"BASIC"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("USER_NAME"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_user"},c.createElement(ol,{direction:"row"},c.createElement(If,{sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-username",value:G,onChange:e=>J(e.target.value),size:"small"}),c.createElement("i",{title:d("USER_NAME"),className:"wms wms-help"}))),c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("PASSWORD"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_pw"},c.createElement(ol,{direction:"row"},c.createElement(If,{type:"password",sx:{fontSize:"11px",width:"20em"},name:"wm-webservice-advanced-password",value:X,onChange:e=>Q(e.target.value),size:"small"}),c.createElement("i",{title:d("PASSWORD"),className:"wms wms-help"})))),"OAUTH2"===O&&c.createElement(c.Fragment,null,c.createElement(bl,{item:!0,md:3,className:"input_label"},c.createElement(Kf,{sx:{margin:"10px"}},d("OAuth")+" "+d("PROVIDER"))),c.createElement(bl,{item:!0,md:9,className:"select_basic_provider"},c.createElement(ol,{spacing:2,direction:"row"},c.createElement(If,{disabled:!ne,sx:{backgroundColor:ne?"lightgray":"white",fontSize:"11px"},size:"small","data-testid":"provider-name",value:ne,label:ne?"":d("NO")+" "+d("PROVIDER")+" "+d("SELECTED_YET")}),ne&&c.createElement("i",{onClick:()=>ie(!0),title:d("Edit Provider"),className:"wms wms-edit"}),c.createElement(Bf,{className:"select_provider_btn",name:"wm-webservice-select-provider",onClick:()=>k(!0),variant:"contained","data-testid":"select-provider"},ne?d("CHANGE_PROVIDER"):d("SELECT")+"/"+d("ADD")+" "+d("PROVIDER"))))))),c.createElement(hw,{value:w,index:1},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"header",headerParams:R,queryParams:P,pathParams:j,value:R,setValue:e=>{I(e)},apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:2},c.createElement(ol,{spacing:1},c.createElement(ol,{spacing:10,display:"flex",alignItems:"center",direction:"row"},c.createElement(Kf,null,d("CONTENT")+" "+d("TYPE")),c.createElement(ol,{spacing:3,display:"flex",alignItems:"center",direction:"row"},c.createElement(Uu,{size:"small",sx:{width:"20em"}},c.createElement(Qd,{name:"wm-webservice-content-type",value:z,onChange:e=>{R.forEach((t=>{"Content-Type"===t.name&&(t.value=e.target.value)})),F(e.target.value)},"data-testid":"select-content-type"},W.map((e=>c.createElement(lf,{title:e.value,key:e.value,value:e.value},d(e.label)))))),c.createElement("i",{title:d("Choose appropriate content type"),className:"wms wms-help"}),B?c.createElement(ol,{direction:"row"},c.createElement(If,{name:"wm-webservice-new-content-type",value:V,onChange:e=>q(e.target.value),size:"small","data-testid":"custom-type-field"}),c.createElement("i",{onClick:()=>{q(""),$(!1)},title:d("CLOSE"),className:"wms wms-close"}),c.createElement("i",{onClick:()=>Ue(V),title:d("ADD"),className:"wms wms-done"})):c.createElement("i",{onClick:()=>$(!0),title:d("CUSTOM_CONTENT_TYPE"),className:"wms wms-plus"}))),"multipart/form-data"===z?c.createElement(MS,{setAlertMsg:se,headerParams:R,queryParams:P,pathParams:j,handleToastError:Le,value:Z,setValue:e=>D(e)}):c.createElement(sd,{name:"wm-webservice-body-type",style:{padding:2},value:L,onChange:e=>M(e.target.value),minRows:8,placeholder:d("REQUEST")+" "+d("BODY")+":"+d("REQUEST_BODY_PLACEHOLDER")}))),c.createElement(hw,{value:w,index:3},c.createElement(LS,{handleHeaderParamsContentTypeChange:Ue,multipartParams:Z,setAlertMsg:se,restImportConfig:t,handleToastError:Le,from:"query",headerParams:R,queryParams:P,pathParams:j,value:P,setValue:e=>N(e),apiURL:h,changeapiURL:Ze})),c.createElement(hw,{value:w,index:4},j.length>0?c.createElement(Zg,{component:Ol},c.createElement(Bg,null,c.createElement(Yg,null,c.createElement(nv,{sx:{backgroundColor:"#d4e6f1"}},c.createElement(lv,{style:PS,align:"left"},d("NAME")),c.createElement(lv,{style:PS,align:"left"},d("TYPE")),c.createElement(lv,{style:PS,align:"left"},d("VALUE")))),c.createElement(hv,null,j.map(((e,t)=>c.createElement(IS,{key:t},c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,{"data-testid":"path-param-label"},e.name)),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(mf,null,d("String"))),c.createElement(lv,{style:NS,width:"33%",align:"left"},c.createElement(If,{name:"wm-webservice-param-value",fullWidth:!0,"data-testid":"path-param-value",value:e.value,onChange:e=>((e,t)=>{const n=[...j];n.map(((n,r)=>(r===t&&(n.value=e),n))),U(n)})(e.target.value,t),size:"small"})))))))):c.createElement(ol,{p:2,spacing:1,direction:"row",sx:{backgroundColor:"#d9edf7"}},c.createElement(ZS.Z,{sx:{height:18,width:18,color:"#31708f",mt:.5}}),c.createElement(ol,null,c.createElement(Kf,null,d("NO_PATH_PARAMS"),d("NO_PATH_PARAMS_DESC")),c.createElement(Kf,null,'e.g. For URL "http:wavemaker.com/projects/{pid}/?mode=json", "pid" is the path param.',"(",c.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://docs.wavemaker.com/learn/app-development/services/web-services/rest-services/"},d("MORE_INFO")),")")))))),c.createElement(_s,{"data-testid":"response-block",sx:{width:"100%"}},c.createElement(_s,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:"#f3f5f6"}},c.createElement(Og,{className:"response_tabs",sx:{fontSize:"13px"},value:_,onChange:je},c.createElement(Pg,{label:d("RESPONSE")+" "+d("BODY")}),c.createElement(Pg,{label:d("RESPONSE")+" "+d("HEADER")})))),c.createElement("div",{style:{display:0===_?"block":"none"}},c.createElement(XS,{viewMode:t.viewMode,url:t.monacoEditorURL,editorRef:de,initialValue:K.data,editorLanguage:ve})),1===_&&c.createElement(ol,{overflow:"auto",sx:{backgroundColor:"rgb(40, 42, 54)",color:"white"},width:"100%",direction:"row"},void 0!==K&&c.createElement(Zg,{style:{height:null!=t&&t.responseBlockHeight?(null==t?void 0:t.responseBlockHeight)/1.2+"px":"300px"}},c.createElement(Bg,{className:"rest-client-response-header"},c.createElement(hv,{sx:{padding:40}},Object.keys(K.headers).map((e=>c.createElement(nv,{key:e},c.createElement(lv,{align:"left",sx:{color:"white",width:"30%",borderBottom:"none",padding:"5px"}},e," :"),c.createElement(lv,{align:"left",sx:{color:"white",borderBottom:"none",padding:"5px",width:"70%",wordWrap:"break-word",wordBreak:"break-word"}},K.headers[e])))))))))),c.createElement(NE,{handleOpen:A,providerConfig:be,updateProviderConfig:Pe,handleClose:Me,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(PE,{currentProviderConfig:be.selectedProvider,handleOpen:oe,restImportConfig:t,updateProviderConfig:Pe,handleClose:()=>{ie(!1)},handleParentModalClose:Me,providerConfig:be,proxyObj:t,isCustomErrorFunc:"customFunction"===t.error.errorMethod,customFunction:t.error.errorFunction,handleSuccessCallback:Le}),c.createElement(pw,{anchorOrigin:{vertical:"top",horizontal:"right"},open:me,autoHideDuration:t.error.errorMessageTimeout,onClose:Ne},c.createElement(Iu,{"data-testid":"alertMessage",onClose:Ne,severity:null==fe?void 0:fe.type},null==fe?void 0:fe.message)),c.createElement("div",{style:{position:"relative",height:"0px"}},c.createElement(If,{sx:{position:"absolute",left:-1e4,top:-1e4},"data-testid":"mock-response",value:0===_?K.data:JSON.stringify(K.headers),disabled:!0}))))}function vw(){return[Gi,Yi,Bi,me,{components:{App:Ji,RestImport:gw,ConfigModel:PE,BaseLayout:es,ConfigLayout:ts}}]}function yw(){return[vw]}const bw=o(6024),Ew={},Sw=Ew;bw.keys().forEach((function(e){if("./index.js"===e)return;let t=bw(e);Ew[U(e)]=t.default?t.default:t}));const{GIT_DIRTY:ww,GIT_COMMIT:xw,PACKAGE_VERSION:_w,BUILD_TIME:Cw}={PACKAGE_VERSION:"0.0.21",GIT_COMMIT:"4b00657",GIT_DIRTY:!0,BUILD_TIME:"Mon, 05 May 2025 08:30:16 GMT"};function Ow(e){b.versions=b.versions||{},b.versions.RestImport={version:_w,gitRevision:xw,gitDirty:ww,buildTimestamp:Cw};const t={dom_id:null,domNode:null,spec:{},url:"",language:window.navigator.language,config:{},configModal:!1,providerConf:{},urls:null,layout:"BaseLayout",maxDisplayedTags:null,filter:null,configs:{},custom:{},requestInterceptor:e=>e,responseInterceptor:e=>e,queryConfigEnabled:!1,presets:[yw],plugins:[],pluginsOptions:{pluginLoadType:"legacy"},initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}};let n=e.queryConfigEnabled?(()=>{let e={},t=b.location.search;if(!t)return{};if(""!=t){let n=t.substr(1).split("&");for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(t=n[t].split("="),e[decodeURIComponent(t[0])]=t[1]&&decodeURIComponent(t[1])||"")}return e})():{};const r=e.domNode;delete e.domNode;const o=u()({},t,e,n),i={system:{configs:o.configs},plugins:o.presets,pluginsOptions:o.pluginsOptions,state:u()({layout:{layout:o.layout,filter:o.filter},spec:{spec:"",url:o.url,value:o.value,objval:o.objval,language:o.language,config:o.config,configModal:o.configModal,providerConf:o.providerConf,dom_id:o.dom_id}},o.initialState)};if(o.initialState)for(var a in o.initialState)Object.prototype.hasOwnProperty.call(o.initialState,a)&&void 0===o.initialState[a]&&delete i.state[a];var s=new W(i);s.register([o.plugins,()=>({fn:o.fn,components:o.components,state:o.state})]);var l=s.getSystem();const c=e=>{let t=l.specSelectors.getLocalConfig?l.specSelectors.getLocalConfig():{},i=u()({},t,o,e||{},n);if(r&&(i.domNode=r),s.setConfigs(i),null!==e&&(!n.url&&"object"==typeof i.spec&&Object.keys(i.spec).length?(l.specActions.updateUrl(""),l.specActions.updateLoadingStatus("success"),l.specActions.updateSpec(JSON.stringify(i.spec))):l.specActions.download&&i.url&&!i.urls&&(l.specActions.updateUrl(i.url),l.specActions.download(i.url))),i.domNode)l.render(i.domNode,"App");else if(i.dom_id){let e=document.querySelector(i.dom_id);l.render(e,"App")}else null===i.dom_id||null===i.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return l},p=n.config||o.configUrl;return p&&l.specActions&&l.specActions.getConfigByUrl?(l.specActions.getConfigByUrl({url:p,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},c),l):c()}Ow.presets={apis:yw},Ow.plugins=Sw;const Tw=Ow})(),i=i.default})())); //# sourceMappingURL=rest-import-bundle.js.map \ No newline at end of file