import{r as Xe,a as Ze,b as et,c as tt,d as nt,e as rt,f as at,g as De,h as C,i as Ae,j as Oe,k as i,U as Ce,l as H,m as ot,v as Te,q as Re,u as it,n as st,P as se}from"./entry_page.js";import{P as lt,s as de,u as ut,a as ct,M as Ee,b as W,c as ft,d as mt,T as dt,C as le,e as pt,S as vt,f as gt,g as we,h as Ie,i as yt,E as bt,j as ht,k as St}from"./usePlatform.CFP4tBzQ.js";import{r as xt,P as Pt}from"./Search.BNBTqs0I.js";import{M as te,D as jt}from"./Menu.BxkNNSpG.js";import{E as Ot}from"./ErrorBoundary.xJor3Ppq.js";import"./Search.CUubiSTp.js";var me={exports:{}},Ne;function Ct(){return Ne||(Ne=1,(()=>{var a={};a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var S={};a.r(S),a.d(S,{Panel:()=>v,default:()=>Ge});const c=Xe();var T=a.n(c);const E=Ze(),g=et();var s=a.n(g);const U=tt(),$=nt;var M=a.n($);const x=rt();var P=a.n(x);const D=at();var j=M()(P()).withConfig({displayName:"SlidingPanelsStyles__StyledBox",componentId:"su6isq-0"})(["overflow:hidden;position:relative;"]),F=M()(E.animated.div).withConfig({displayName:"SlidingPanelsStyles__StyledAnimatedDiv",componentId:"su6isq-1"})(["",";",";"],D.mixins.reset("block"),D.mixins.clearfix());function K(e,t){e&&(typeof e=="function"?e(t):e.current=t)}function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function A(e,t){return J(e)||G(e,t)||Q(e,t)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Q(e,t){if(e){if(typeof e=="string")return z(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(e,t):void 0}}function z(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function G(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,f,m,y,O=[],b=!0,h=!1;try{if(m=(n=n.call(e)).next,t!==0)for(;!(b=(r=m.call(n)).done)&&(O.push(r.value),O.length!==t);b=!0);}catch(w){h=!0,f=w}finally{try{if(!b&&n.return!=null&&(y=n.return(),Object(y)!==y))return}finally{if(h)throw f}}return O}}function J(e){if(Array.isArray(e))return e}function Y(e,t){if(e==null)return{};var n,r,f=V(e,t);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(e);for(r=0;r<m.length;r++)n=m[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(f[n]=e[n])}return f}function V(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var d={children:s().node,elementRef:s().oneOfType([s().func,s().object]),onMount:s().func,onUnmount:s().func,panelId:s().oneOfType([s().string,s().number]).isRequired};function u(e){var t=e.children,n=e.elementRef,r=e.onMount,f=e.onUnmount,m=e.panelId,y=Y(e,["children","elementRef","onMount","onUnmount","panelId"]),O=(0,c.useState)(null),b=A(O,2),h=b[0],w=b[1],ee=(0,c.useCallback)((function(oe){w(oe),K(n,oe)}),[n]);return(0,c.useEffect)((function(){return r?.(h,m),function(){f?.(m)}}),[r,f,h,m]),T().createElement(F,B({"data-test":"panel","data-test-panel-id":m},y,{ref:ee}),t)}u.propTypes=d;const v=u;function o(e){"@babel/helpers - typeof";return o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(e)}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(null,arguments)}function R(e,t){return re(e)||ne(e,t)||X(e,t)||_()}function _(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X(e,t){if(e){if(typeof e=="string")return Z(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}function Z(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ne(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,f,m,y,O=[],b=!0,h=!1;try{if(m=(n=n.call(e)).next,t!==0)for(;!(b=(r=m.call(n)).done)&&(O.push(r.value),O.length!==t);b=!0);}catch(w){h=!0,f=w}finally{try{if(!b&&n.return!=null&&(y=n.return(),Object(y)!==y))return}finally{if(h)throw f}}return O}}function re(e){if(Array.isArray(e))return e}function ae(e,t){if(e==null)return{};var n,r,f=ke(e,t);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(e);for(r=0;r<m.length;r++)n=m[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(f[n]=e[n])}return f}function ke(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(f){return Object.getOwnPropertyDescriptor(e,f).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pe(Object(n),!0).forEach((function(r){ve(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function ve(e,t,n){return(t=qe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(e){var t=Le(e,"string");return o(t)=="symbol"?t:t+""}function Le(e,t){if(o(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(o(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ue={activePanelId:s().oneOfType([s().string,s().number]).isRequired,children:s().node,elementRef:s().oneOfType([s().func,s().object]),innerClassName:s().string,innerStyle:s().object,onAnimationEnd:s().func,outerClassName:s().string,outerStyle:s().object,transition:s().oneOf(["forward","backward"])},$e={enter:{x:"0px"},initial:{x:"0px"}},Be=function(t,n){var r="".concat(t,"px"),f="".concat(t*-1,"px"),m=n==="forward"?r:f,y=n==="forward"?f:r;return{from:{x:m},leave:{position:"absolute",x:y}}},Fe=function(t){return Object.values(t).reduce((function(n,r){return r?.tagName==="DIV"?Math.max(n,r.clientWidth):n}),0)},ze=function(t){var n=t.validChildren,r=t.innerClassName,f=t.innerStyle,m=t.onMount,y=t.onUnmount;return n.map((function(O){return function(b){var h=b.style,w=(0,c.cloneElement)(O,{onMount:m,onUnmount:y}),ee=(0,c.useMemo)((function(){return k(k({},f),h)}),[h]);return T().createElement(F,{style:ee,className:r},w)}}))};function ue(e){var t=e.activePanelId,n=e.children,r=e.elementRef,f=e.innerClassName,m=e.innerStyle,y=e.onAnimationEnd,O=e.outerClassName,b=e.outerStyle,h=e.transition,w=h===void 0?"forward":h,ee=ae(e,["activePanelId","children","elementRef","innerClassName","innerStyle","onAnimationEnd","outerClassName","outerStyle","transition"]),oe=(0,c.useState)(0),ge=R(oe,2),ce=ge[0],Ve=ge[1],We=(0,c.useState)([]),ye=R(We,2),He=ye[0],Ke=ye[1],Qe=(0,c.useState)({}),be=R(Qe,2),he=be[0],Se=be[1],fe=(0,E.useSpringRef)(),ie=(0,c.useMemo)((function(){return c.Children.toArray(n).filter(c.isValidElement)}),[n]),xe=(0,c.useMemo)((function(){return Fe(he)}),[he]),Je=(0,c.useMemo)((function(){return Be(xe,w)}),[xe,w]),Ye=(0,U.useAnimationTransition)(ce,k(k(k({ref:fe},$e),Je),{},{onRest:function(){y?.()}}));(0,c.useEffect)((function(){}),[ce]),(0,c.useEffect)((function(){fe.start()}),[fe,ce]),(0,c.useEffect)((function(){var I=ie.findIndex((function(q){var N=q.props;return N.panelId===t}));Ve(I)}),[t,ie]);var Pe=(0,c.useCallback)((function(I,q){I!=null&&q!=null&&Se((function(N){return k(k({},N),{},ve({},q,I))}))}),[]),je=(0,c.useCallback)((function(I){Se((function(q){var N=k({},q);return delete N[I],N}))}),[]);return(0,c.useMemo)((function(){Ke(ze({validChildren:ie,onMount:Pe,onUnmount:je,innerClassName:f,innerStyle:m}))}),[ie,Pe,je,f,m]),T().createElement(j,p({className:O,"data-test-active-panel-id":t,"data-test":"sliding-panels",elementRef:r,style:b},ee),Ye((function(I,q){var N=He[q];return N?T().createElement(N,{style:I}):null})))}ue.propTypes=Ue,ue.Panel=v;const Ge=ue;me.exports=S})()),me.exports}var Tt=Ct();const Me=De(Tt);var Et=xt();const wt=De(Et);function It(){const a=C.useContext(lt);if(!a)throw new Error("usePageContext must be used within <PageContextProvider />");return a}const Nt=Re.span`
    color: ${Te.brandColorD20};
    font-size: ${Te.fontSizeSmall};
    font-weight: 500;
`,L="main_panel";function _e({handleRequestOpen:a}){const[S,c]=C.useState(L),[T,E]=C.useState("forward"),[g,s]=C.useState(!1),[U,$]=C.useState(!0),{pages:M}=Ae(),x=It(),{inputs:P}=M;Oe(P);const D="groupsMenu"in P?P.groupsMenu:void 0,[j,F]=C.useState(P.services);C.useEffect(()=>{F(P.services.filter(d=>!de(d.hideForPlatform,x.platform)))},[P.services,x.platform]);const K=["clickAway","escapeKey","offScreen","toggleClick"],B=i.jsx(Ce,{id:"addInputBtn",label:H._("Create New Input"),isMenu:!0});C.useEffect(()=>{U||(s(!1),$(!0))},[U]);const A=({reason:d})=>{s(!K.includes(d))},l=()=>{s(!0)},Q=(d,u)=>d.map(v=>v?.hasSubmenu?i.jsx(te.Item,{hasSubmenu:!0,onClick:()=>{c(v.name),E("forward")},children:v.title},v.name):i.jsxs(te.Item,{onClick:()=>{a({serviceName:v.name,groupName:u}),$(!1)},children:[v.title,i.jsxs(Nt,{children:[" ",v.subTitle]})]},v.name)),z=()=>i.jsxs(i.Fragment,{children:[i.jsx(te.Item,{startAdornment:i.jsx(wt,{}),onClick:()=>{c(L),E("backward")},children:"Back"}),i.jsx(te.Divider,{})]}),G=d=>Object.keys(d).map(u=>i.jsx(Me.Panel,{panelId:u,children:i.jsxs(te,{children:[u!==L&&z(),Q(d[u],u)]})},u)),J=C.useMemo(()=>{const d={[L]:[]};return D?D.forEach(u=>{if(u?.groupServices)d[u.groupName]=[],u.groupServices.forEach(v=>{const o=j.find(p=>p.name===v);o&&d[u.groupName].push({name:v,hasSubmenu:!1,title:o?.title||"",subTitle:o?.subTitle})}),d[u.groupName].length>0&&d[L].push({name:u.groupName,title:u.groupTitle,hasSubmenu:!0});else{const v=j.find(o=>o.name===u.groupName);v&&d[L].push({name:u.groupName,title:u.groupTitle,subTitle:v?.subTitle,hasSubmenu:!1})}}):d[L]=j.map(u=>({name:u.name,title:u.title,subTitle:u.subTitle,hasSubmenu:!1})),G(d)},[j]),Y=()=>i.jsx(jt,{toggle:B,open:g,onRequestClose:A,onRequestOpen:l,children:i.jsx(Me,{activePanelId:S,transition:T,style:{width:"210px"},children:J})}),V=()=>i.jsx(Ce,{label:ot(100),id:"addInputBtn",onClick:()=>{a({serviceName:j[0].name})}});return Oe(j),j.length===1?V():Y()}_e.propTypes={handleRequestOpen:Pt.func};const Mt=Re(le.Row)`
    padding: 5px 0px;

    .title_menu_column {
        width: auto !important;
    }

    .page_subtitle {
        min-height: 20px;
    }

    .dropdown {
        text-align: right;
    }
`;function Dt(a){return a!==void 0&&"description"in a}function At(a){return a!==void 0&&"table"in a}function $t(){const[a,S]=C.useState({open:!1}),c=Ae(),T=ut(c,"inputs"),E=c.pages.inputs;let g=[],s,U,$,M;E&&(At(E)?({services:g,title:s,table:U,description:$,subDescription:M}=E,g=g.filter(o=>!de(o.hideForPlatform,T))):({services:g,title:s}=E,g=g.filter(o=>!de(o.hideForPlatform,T))));const x=!U,[P,D]=C.useState(g[0].name),j=g.find(o=>o.name===P),F=Dt(j),K=[Ee,W,ft],B=g.map(o=>o.name),A=it(),l=ct();C.useEffect(()=>{Q(),z()},[st().search]);const Q=()=>{const o=g.find(p=>p.name===l.get("service"));l&&o&&K.includes(l.get("action")||"")&&!a.open?l.get("action")!==W&&a.stanzaName?S({...a,open:!0,isInputPageStyle:!0,serviceName:l.get("service")||"",mode:l.get("action")||""}):S({...a,open:!0,isInputPageStyle:!0,serviceName:l.get("service")||"",formLabel:`Create ${o?.title}`,mode:W}):(!l.get("service")||!l.get("action"))&&a.open&&a.isInputPageStyle&&S({...a,open:!1})},z=()=>{l&&B.includes(l.get("service")||"")&&D(l.get("service")||"")},G=({serviceName:o,groupName:p,input:R})=>{const _=g.find(re=>re.name===o),X=_?.title,Z=_?.formTitle,ne=_?.style===St;if(S({...a,open:!0,serviceName:o,mode:W,formLabel:Z?`Add ${Z}`:`Add ${X}`,isInputPageStyle:ne,groupName:p}),ne){l.set("service",o),l.set("action",W);const ae=R||(p&&p!==L?p:null)||o;ae?l.set("input",ae):l.delete("input"),A({search:l.toString()})}},J=()=>{S({...a,open:!1})},Y=()=>a.serviceName&&i.jsx(ht,{page:se,open:a.open,handleRequestClose:J,returnFocus:()=>{},serviceName:a.serviceName,mode:W,formLabel:a.formLabel,groupName:a.groupName}),V=(o,p)=>{const R=g.find(X=>X.name===o.serviceName),_=R?.formTitle||R?.title;S({...a,open:!0,isInputPageStyle:!0,serviceName:o.serviceName,stanzaName:o.name,formLabel:p===Ee?`Clone ${_}`:`Update ${_}`,mode:p}),l.set("service",o.serviceName),l.set("action",p),A({search:l.toString()})},d=()=>{S({...a,open:!1}),x||l.delete("service"),l.delete("action"),A({search:l.toString()})},u=()=>a.serviceName&&a.mode?i.jsx(bt,{handleRequestClose:d,serviceName:a.serviceName,stanzaName:a.stanzaName,mode:a.mode,formLabel:a.formLabel,page:se,groupName:a.groupName}):null,v=C.useCallback((o,{selectedTabId:p})=>{p&&(D(p),l.delete("action"),l.set("service",p),A({search:l.toString()}))},[P]);return i.jsx(Ot,{children:i.jsx(mt,{platform:T,children:i.jsxs(dt,{children:[a.isInputPageStyle&&a.open?u():null,i.jsxs("div",{style:a.isInputPageStyle&&a.open?{display:"none"}:{display:"block"},children:[i.jsx(le,{gutter:8,children:i.jsxs(Mt,{children:[i.jsxs(le.Column,{className:x?"title_menu_column":"",span:9,children:[i.jsx(pt,{children:x?H._(j?.title||""):H._(s||"")}),i.jsx(vt,{className:x?"pageSubtitle":void 0,children:x?H._(F?j?.description:""):H._($||"")}),i.jsx(gt,{text:M?.text||"",links:M?.links})]}),i.jsx(le.Column,{className:x?"title_menu_column":"dropdown",span:3,children:!x&&i.jsx(_e,{handleRequestOpen:G})})]})}),x?i.jsxs(i.Fragment,{children:[i.jsx(we,{activeTabId:P,onChange:v,children:g.map(o=>i.jsx(we.Tab,{label:H._(o.title),tabId:o.name},o.name))}),g.map(o=>i.jsx("div",{style:o.name!==P?{display:"none"}:{display:"block"},id:`${o.name}Tab`,children:i.jsx(Ie,{page:se,serviceName:o.name,handleRequestModalOpen:()=>G({serviceName:o.name}),handleOpenPageStyleDialog:V})},o.name))]}):i.jsx(Ie,{page:se,handleOpenPageStyleDialog:V,displayActionBtnAllRows:!0}),i.jsx(yt,{position:"top-right"}),!a.isInputPageStyle&&a.open?Y():null]})]})})})}export{$t as default};
