import{h as i,C as U,k as t,l as w,_ as F,o as B,p as $,s as W,t as T,U as z,W as Z,q as E,r as G,w as Q,x as Y,g as J,B as K,i as k,j as X,R as ee}from"./entry_page.js";import{P as te,B as ne,l as oe,k as re,T as ae,E as se,h as ie,j as le,b as A,M as ue,m as ce,u as de,s as pe,a as fe,d as me,C as O,e as ge,S as Ce,f as he,g as I,i as xe}from"./usePlatform.CccaKgdX.js";import{L as be,E as ve}from"./ErrorBoundary.CMbo_g5V.js";import{P as _}from"./toUpper.CSgHQ22Z.js";import"./Search.oqroxkAU.js";const ye=({tab:e})=>{const d=i.useContext(U),[a,s]=i.useState(!0),p=i.useRef(null),b=()=>new Promise(l=>{const h=e?.customTab?.src?d?.[e?.customTab?.src]:void 0;if(h?.type==="tab"){const f=h.component;l(f)}else e.customTab?.type==="external"&&F(()=>import(`${B()}/custom/${e.customTab.src}.js`),[],import.meta.url).then(f=>{const m=f.default;l(m)})});return i.useEffect(()=>{b().then(l=>{p.current&&(new l(e,p.current).render(),s(!1))})},[]),t.jsxs(t.Fragment,{children:[a&&w._("Loading..."),t.jsx("div",{ref:p,style:{visibility:a?"hidden":"visible"}})]})},je=E.div`
    margin-left: 270px !important;
    width: 150px;
`;function q({serviceName:e}){const d=i.useRef(),[a,s]=i.useState(null),[p,b]=i.useState(!1),[l,h]=i.useState({});i.useEffect(()=>{const u=new AbortController;return $({endpointUrl:W(`settings/${encodeURIComponent(e)}`),handleError:!0,signal:u.signal,callbackOnError:g=>{u.signal.aborted||s(g)}}).catch(g=>{if(u.signal.aborted)return null;throw g}).then(g=>{g&&h(g.entry[0].content)}),()=>{u.abort()}},[e]);const f=u=>{d.current.handleSubmit(u)},m=u=>{b(u)};if(a)throw a;return Object.keys(l).length?t.jsxs(t.Fragment,{children:[t.jsx(U.Consumer,{children:u=>t.jsx(te.Consumer,{children:g=>t.jsx(ne,{ref:d,page:T,stanzaName:e,serviceName:"settings",mode:oe,currentServiceState:l,handleFormSubmit:m,pageContext:g,customComponentContext:u})})}),t.jsx(je,{children:t.jsx(z,{className:"saveBtn",label:w._("Save"),onClick:f,loading:p})})]}):t.jsx(Z,{size:"medium"})}q.propTypes={serviceName:_.string.isRequired};function N({selectedTab:e,updateIsPageOpen:d}){const[a,s]=i.useState({open:!1}),p=e.style===re;i.useEffect(()=>{p&&d(!!a.open)},[d,p,a]);const b=()=>{s({...a,open:!0,mode:A,formLabel:e.formTitle?`Add ${e.formTitle}`:`Add ${e.title}`})},l=()=>{s({...a,open:!1})},h=()=>t.jsx(le,{page:T,open:a.open,handleRequestClose:l,returnFocus:()=>{},serviceName:e.name,mode:A,formLabel:a.formLabel}),f=(y,j)=>{const v=e?.formTitle||e.title;s({...a,open:!0,stanzaName:y.name,formLabel:j===ue?`Clone ${v}`:`Update ${v}`,mode:j})},m=()=>{s({...a,open:!1})},u=()=>t.jsx(se,{open:a.open,handleRequestClose:m,serviceName:e.name,stanzaName:a.stanzaName,mode:a.mode,formLabel:a.formLabel,page:T}),g=()=>t.jsx("div",{style:p&&a.open?{display:"none"}:{display:"block"},children:t.jsx(ie,{page:T,serviceName:e.name,handleRequestModalOpen:()=>b(),handleOpenPageStyleDialog:f})});return t.jsxs(ae,{value:null,children:[p&&a.open&&u(),g(),!p&&a.open&&h()]})}N.propTypes={selectedTab:_.object,updateIsPageOpen:_.func};const we=i.memo(N);var R={exports:{}},L;function Ee(){return L||(L=1,(()=>{var e={};e.n=o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return e.d(r,{a:r}),r},e.d=(o,r)=>{for(var c in r)e.o(r,c)&&!e.o(o,c)&&Object.defineProperty(o,c,{enumerable:!0,get:r[c]})},e.o=(o,r)=>Object.prototype.hasOwnProperty.call(o,r),e.r=o=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var d={};e.r(d),e.d(d,{default:()=>v});const a=G();var s=e.n(a);const p=Q(),b=Y();var l=e.n(b);function h(o,r){if(o==null)return{};var c,C,n=f(o,r);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(o);for(C=0;C<x.length;C++)c=x[C],r.indexOf(c)===-1&&{}.propertyIsEnumerable.call(o,c)&&(n[c]=o[c])}return n}function f(o,r){if(o==null)return{};var c={};for(var C in o)if({}.hasOwnProperty.call(o,C)){if(r.indexOf(C)!==-1)continue;c[C]=o[C]}return c}var m=new Map;m.set("outlined",(function(){return s().createElement(s().Fragment,null,s().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.94008 2C8.11165 2 7.44008 2.67157 7.44008 3.5V9H5.47861C4.11314 9 3.45783 10.676 4.46119 11.6022L10.9824 17.6218C11.557 18.1521 12.4426 18.1521 13.0172 17.6217L19.5384 11.6022C20.5417 10.676 19.8864 9 18.5209 9H16.5553V3.5C16.5553 2.67157 15.8838 2 15.0553 2H8.94008ZM9.44008 11V4H14.5553V11H17.2421L11.9998 15.8391L6.75743 11H9.44008Z"}),s().createElement("path",{d:"M4 20C3.44772 20 3 20.4477 3 21C3 21.5523 3.44772 22 4 22H20C20.5523 22 21 21.5523 21 21C21 20.4477 20.5523 20 20 20H4Z"}))})),m.set("filled",(function(){return s().createElement(s().Fragment,null,s().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.94008 2C8.11165 2 7.44008 2.67157 7.44008 3.5V9H5.47861C4.11314 9 3.45783 10.676 4.46119 11.6022L10.9824 17.6218C11.557 18.1521 12.4426 18.1521 13.0172 17.6217L19.5384 11.6022C20.5417 10.676 19.8864 9 18.5209 9H16.5553V3.5C16.5553 2.67157 15.8838 2 15.0553 2H8.94008Z"}),s().createElement("path",{d:"M4 20C3.44772 20 3 20.4477 3 21C3 21.5523 3.44772 22 4 22H20C20.5523 22 21 21.5523 21 21C21 20.4477 20.5523 20 20 20H4Z"}))}));var u=["default","outlined","filled"],g=function(r){return u.indexOf(r)>=0},y=function(r){return r==="default"||r&&!g(r)?"outlined":r},j=function(r){var c=r.children,C=r.variant,n=C===void 0?"default":C,x=h(r,["children","variant"]),D=y(n),M="arrowbroadunderbardown-".concat(D),S=(0,a.useContext)(p.IconContext),P=m.get(D);if(S&&P){var H=S.toRender,V=S.addIcon;if(V(M,P()),!H)return null}return s().createElement(l(),x,c,S?s().createElement("use",{href:"#".concat(M)}):!!P&&P())};const v=j;R.exports=d})()),R.exports}var Se=Ee();const Pe=J(Se);function Te(e){return t.jsx(K,{target:"_blank",to:e.fileUrl,download:e.fileNameAfterDownload,"data-test":"downloadButton",icon:t.jsx(Pe,{}),children:e.children})}const Oe=B().replace("js/build","openapi.json");function Re(){return t.jsx(Te,{fileUrl:Oe,fileNameAfterDownload:"openapi.json",children:"OpenAPI.json"})}const _e=E(ce.Typography)`
    font-size: 0.8em;
`,De=()=>{const e=k();if(e?.meta?.hideUCCVersion)return null;const d=e?.meta?._uccVersion??null;return t.jsxs(_e,{as:"span",title:"Splunk Add-On UCC framework is a framework to generate UI-based Splunk add-ons. It includes UI, REST handlers, Modular inputs, OAuth and Alert action templates.","data-test":"ucc-credit",children:["Made with"," ",t.jsx(be,{to:"https://splunk.github.io/addonfactory-ucc-generator/",openInNewContext:!0,children:"UCC"})," ",d]})},Me=E.div`
    display: inline-flex;
    align-items: center;
    justify-content: end;
    flex-wrap: wrap;
    gap: 0.4rem;
`,Ae=E(O.Row)`
    padding: 5px 0px;

    .dropdown {
        text-align: right;
    }

    .input_button {
        text-align: right;
        margin-right: 0px;
    }
`,Le=E(I)`
    flex-wrap: wrap;
`;function Ne(){const e=k();X(e.pages.configuration,"Configuration page not found in global config");const{title:d,description:a,subDescription:s,tabs:p}=e.pages.configuration,b=de(e,"configuration"),l=p.filter(n=>!pe(n.hideForPlatform,b)),h=i.useMemo(()=>l.map(n=>n.name),[l]),f=i.useRef(!1),[m,u]=i.useState(l[0].name),[g,y]=i.useState(!1),v=fe()?.get("tab");i.useEffect(()=>{v&&h.includes(v)&&v!==m&&u(v)},[v,h,m]),i.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const o=i.useCallback((n,{selectedTabId:x})=>{f.current&&x&&(u(x),y(!1))},[]),r=n=>{f.current&&y(n)},c=n=>ee.createElement(ye,{tab:n}),C=n=>{let x;return n?.customTab?x=c(n):x=n?.table?t.jsx(we,{selectedTab:n,updateIsPageOpen:r},n.name):t.jsx(q,{serviceName:n.name},n.name),t.jsx("div",{style:n.name!==m?{display:"none"}:{display:"block"},id:`${n.name}Tab`,children:x},n.name)};return t.jsx(ve,{children:t.jsxs(me,{platform:b,children:[t.jsxs("div",{style:g?{display:"none"}:{display:"block"},children:[t.jsx(O,{gutter:8,children:t.jsxs(Ae,{children:[t.jsxs(O.Column,{span:9,children:[t.jsx(ge,{children:w._(d)}),t.jsx(Ce,{children:w._(a||"")}),t.jsx(he,{text:s?.text||"",links:s?.links})]}),t.jsx(O.Column,{span:3,style:{textAlignLast:"right"},children:t.jsxs(Me,{children:[t.jsx(De,{}),t.jsx(Re,{})]})})]})}),t.jsx(Le,{activeTabId:m,onChange:o,children:l.map(n=>t.jsx(I.Tab,{label:w._(n.title),tabId:n.name},n.name))})]}),l.map(n=>C(n)),t.jsx(xe,{position:"top-right"})]})})}export{Ne as default};
