aiware-js 1.0.0-master.747 → 1.0.0-master.748

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js-core.esm.js CHANGED
@@ -1483,4 +1483,4 @@ createScheduledJob(input:{
1483
1483
  }
1484
1484
  `)}),n},[]).join("\r\n")}
1485
1485
  }
1486
- `,l={entityId:t,entityType:e};try{a=yield baseGraphQLApi({query:s,operationName:n,variables:l,graphEndpoint:u,token:d})}catch(e){i=!0}if(a.errors){if(0===(o=a.errors.filter(({message:e})=>e.includes(' does not exist in "AuthPermissionType" enum.')).map(({message:e})=>{var t='Value "',n=e.substring(t.length).indexOf('"');return e.substring(t.length,t.length+n)})).length)throw i=!0,a={},new Error((null==(f=(a.errors||[])[0])?void 0:f.message)||"Error")}else i=!0}const c=a.data||{};return Object.keys(c).map(e=>{var t=e.split("__");return 3===t.length?{fetchedTargetEntityType:t[0],fetchedTargetGroupType:t[1],fetchedTargetAction:t[2],hasPermission:c[e][0].hasPermission}:{fetchedTargetEntityType:t[0],fetchedTargetAction:t[1],hasPermission:c[e][0].hasPermission}}).reduce((e,t)=>{var n=t.fetchedTargetGroupType||t.fetchedTargetEntityType;return t.hasPermission&&(e[n]||(e[n]={}),e[n][t.fetchedTargetAction]=t.hasPermission),e},{})})}function getMyRights(t){return __awaiter(this,void 0,void 0,function*(){var e="getMyRights";return(yield baseGraphQLApiWithError(Object.assign({query:"\n query getMyRights {\n myRights {\n operations\n }\n }\n ",operationName:e},t))).myRights.operations})}const selectPermissionsByEntity=(t,n,r)=>e=>{return t&&n&&(e=e[namespace].permissionsByObject[t])&&e[n]?e[n][r||t]:void 0},selectMyRights=e=>e[namespace].rights;var index=Object.freeze({__proto__:null,selectPermissionsByEntity:selectPermissionsByEntity,selectMyRights:selectMyRights});function*fetchObjectPermissions(t){var{entityId:t,entityType:n}=t.payload,i=yield select(selectApiConfigs$2),e=yield select(graphEndpointSelector),o=yield select(sessionTokenSelector),a=yield select(selectIsOLPEnabled),r=yield select(selectPermissionsByEntity(n,t));if(!r||"success"!==r.status&&"pending"!==r.status){yield put(actions.fetchObjectPermissionsStarted({entityId:t,entityType:n}));try{let r={};if(a)r=yield call$i(getObjectPermissions,e,o,{entityType:n,entityId:t});else{let e=yield select(selectMyRights);if("success"!==e.status&&"pending"!==e.status){yield put(actions.fetchMyRightsStarted);try{var s=yield call$i(getMyRights,i);yield put(actions.fetchMyRightsSucceeded(s)),e=yield select(selectMyRights)}catch(e){throw yield put(actions.fetchMyRightsFailed),e}}else"pending"===e.status&&(yield take([actions.fetchMyRightsFailed,actions.fetchMyRightsSucceeded]),e=yield select(selectMyRights));const l=e["myRights"];getPermissionTypesToQuery(n).forEach(n=>{var{action:e,resource:t}=n.targetActions.reduce((e,t)=>(e.action[t.targetAction]=convertPermissionsToRights(t.resource||n.targetObjectType,t.targetAction,l),e.resource=t.resource,e),{action:{}});r[t||n.targetObjectType]=e})}yield put(actions.fetchObjectPermissionsSucceeded({entityId:t,entityType:n,permissions:r}))}catch(e){actions.fetchObjectPermissionsFailed({entityId:t,entityType:n})}}}function*watchPermissionsStart(){yield takeEvery$1(actions.fetchObjectPermissionsStart.type,fetchObjectPermissions)}function*rootSaga(){yield all([watchPermissionsStart()])}function getPermissionsModule(){return{id:namespace,reducerMap:{[namespace]:permissionsReducer},sagas:[rootSaga],initialActions:[]}}const useOrganizationPermissions=e=>{const t=react.exports.useRef(),n=useDispatch(),r=null==(o=useSelector(userSelector$2).organization)?void 0:o.organizationId,i=useSelector(selectPermissionsByEntity(EAuthResourceType.Organization,String(r),e));react.exports.useEffect(()=>{!r||i&&"failure"!==i.status&&"idle"!==i.status&&t.current===r||(t.current=r,n(actions.fetchObjectPermissionsStart({entityType:EAuthResourceType.Organization,entityId:String(r)})))},[n,r,i]);var o=react.exports.useCallback(e=>{return!isPermissionLoading(i)&&hasPermission(i,e)},[i]);return{permissions:i,hasPermission:o}},rateLimiter=new RateLimiter,checkAndDecodeBase64String=t=>{if(null==t||!t.trim())return t;try{return window.btoa(window.atob(t))==t?window.atob(t):t}catch(e){return t}};function SnackbarRenderer(){return jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getSnackbarModule()]},{children:jsxRuntime.exports.jsx(CustomSnackbar,{})}))}))}store$4.addModules([getWidgetsModule(),getPanelsModule(registry,registryLookup),getDataModule(),getConfigModule(),getAuthModule(),getPermissionsModule()]);let hasLoaded=!1;const AppBarPreLoader=()=>{var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&!hasLoaded&&(hasLoaded=!0,setTimeout(()=>{store$4.addModules([getAppbarPanelModule()])},0)),null};function ApplicationDialogPreLoader(){var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&hasLoaded?jsxRuntime.exports.jsx(ApplicationDialog,{}):null}const authHelpers={updateToken(e){e?store$4.dispatch(updateTokenRequest({token:e})):console.error("[AiWARE JS]: Please provide a valid token!")},logout(e){"function"==typeof e?(e(),setTimeout(()=>{store$4.dispatch(logout())},1e3)):store$4.dispatch(logout())},reportAppActivity(e){rateLimiter.checkIfCanCall(e)&&store$4.dispatch(updateActivityStatus$1())}};function PortalRenderer(){return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment,{children:[jsxRuntime.exports.jsx(SupportCenterPixel,{}),jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AppBarPreLoader,{})}))]})}function ApplicationDialogRenderer(){return jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment,{children:jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ApplicationDialogPreLoader,{})})}))})}const ThemeInitializer=()=>(useTheme(),null),root=getElement("aiWARE"),reactDOMroot=(root.classList.add("aiware-el"),client$1.createRoot(root)),mountWidget=("_auth"===window.name?handleImplicitRedirect(window.location.hash,window.opener):reactDOMroot.render(jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsxs(AIWareThemeProvider$1,{children:[jsxRuntime.exports.jsx(PortalRenderer,{}),jsxRuntime.exports.jsx(SnackbarRenderer,{}),jsxRuntime.exports.jsx(ApplicationDialogRenderer,{}),jsxRuntime.exports.jsx(ThemeInitializer,{})]})})),(e,t)=>{var n=getUniqueID(),{name:e,elementId:r,config:i}=e;return e&&r&&i||console.error("[aiwarejs-error]: `mountWidget` function should include all the following params: name, elementId, config"),store$4.dispatch(mountWidget$1({elementId:r,widgetName:e,widgetConfig:i,widgetId:n,onComplete:t})),n}),unmountWidget=e=>(store$4.dispatch(unmountWidget$1(e)),!0),mountPanel=(e,t)=>{const n=e.panelId||getUniqueID();var{microFrontend:e,panelConfig:r}=e;store$4.dispatch(mountPanel$1({microFrontend:e,panelId:n,panelConfig:r}));const i=[...(null==(e=null==r?void 0:r.header)?void 0:e.actions)||[],...(null==(e=null==r?void 0:r.footer)?void 0:e.actions)||[]].filter(e=>e.submit).map(e=>e.action);r={id:n,sagas:[function*(){yield takeEvery$1(i.map(e=>e.type),function*(){var e=(yield select(e=>e.data.find(e=>e.id===n)))["data"];t&&t(e)})}]};return store$4.addModule(r),n},unmountPanel=e=>(store$4.dispatch(unmountPanel$1(e)),!0),hidePanel=e=>(store$4.dispatch(hidePanel$1(e)),!0),unmountAllPanel=()=>{store$4.dispatch(unmountAllPanel$1(""))};function init(e,t){var n;validateConfig(e)&&(n=e["authToken"],n=checkAndDecodeBase64String(n||""),store$4.dispatch(getInitConfig(Object.assign(Object.assign({},e),{authToken:n,onComplete:t}))))}function helpCenter(){var e=new HelpCenter$2({actions:{setCustomKnowledgeBaseUrlAction:setCustomKnowledgeBaseUrl,setCustomDocsUrlAction:setCustomDocsUrl,updateSelectedTabAction:updateSelectedTab}});return{openKnowledgeBasePanel:e.openKnowledgeBasePanel.bind(e),openDocsPanel:e.openDocsPanel.bind(e)}}function dataCenter(){var e=new DataCenter$1;return{openImporterPanel:e.openImporterPanel.bind(e)}}function handleEvents(){function n(e){if(!e||"string"!=typeof e)throw new SdkError("Please provide a valid event name!");if(!SdkEvents[e])throw new SdkError("Unknown event: "+e)}return{on:function(e,t){n(e),sdkEventManager.on.call(sdkEventManager,e,t)},off:function(e){n(e),sdkEventManager.off.call(sdkEventManager,e)}}}const mountPanelForResponse=e=>mountPanelForResponse$1(e,store$4),aiwareEvents=handleEvents();window&&(window.aiWare_initTesting=()=>{window.aiWare_store=store$4,window.aiWare_theme={darkTheme:darkTheme$1,lightTheme:lightTheme$1}},window.aiware={init:init,auth:authHelpers,helpCenter:helpCenter(),dataCenter:dataCenter(),on:aiwareEvents.on,off:aiwareEvents.off,hidePanel:hidePanel,unmountPanel:unmountPanel,store:store$4,registry:registry,registerComponent:registerComponent,AvailableWidgets:AvailableWidgets,mountPanelAction:mountPanel$1,unmountPanelAction:unmountPanel$1,hidePanelAction:hidePanel$1,updatePanelMicroFrontendPropsAction:updatePanelMicroFrontendProps,setData:setData,mountWidget:mountWidget,mountPanel:mountPanel,mountPanelForResponse:mountPanelForResponse,unmountWidget:unmountWidget,version:"sdk_release_version",commit:"59c26d064",releaseDate:"2023-07-27T17:19:28.338Z"});export{createReducer as $,AIWareIntlProvider as A,Box$1 as B,FormControl$1 as C,TextField$1 as D,classNames as E,FormattedMessage$1 as F,Grid$1 as G,resetPasswordRequest as H,InputLabel$1 as I,InputAdornment$1 as J,IconButton$1 as K,LoadingButton$1 as L,Select$1 as M,Location as N,OutlinedInput$1 as O,Provider$2 as P,MenuItem$1 as Q,Routes as R,Switch$1 as S,Typography$1 as T,Button$1 as U,Divider$1 as V,createTheme$1 as W,systemStyled as X,useThemeProps$1 as Y,createAction as Z,_extends$2 as _,generateUtilityClasses as a,Popper$1 as a$,createSlice as a0,ENGINE_OWNER_TYPES as a1,ENGINE_FILTER_TYPES as a2,DynamicModuleLoader as a3,preferredLanguageSelector as a4,baseUrlSelector as a5,rootApiSelector as a6,sessionTokenSelector as a7,graphEndpointSelector as a8,controllerNodeRedImageSelector as a9,fetchTemplateGallery as aA,isRevisionsExistOnServerRequest as aB,FormLabel$1 as aC,default_1$b as aD,FormGroup$1 as aE,FormControlLabel$1 as aF,Checkbox$1 as aG,fetchTemplateGalleryFallback as aH,Card$1 as aI,CardContent$1 as aJ,img$m as aK,CardActions$1 as aL,flowStyles as aM,NoResults as aN,CircularProgress$1 as aO,img$c as aP,Dialog$1 as aQ,setApiEndpoint as aR,TableContainer$1 as aS,Table$1 as aT,TableHead$1 as aU,TableRow$1 as aV,TableCell$1 as aW,TableSortLabel$1 as aX,TableBody$1 as aY,img$h as aZ,default_1 as a_,controllerUrlSelector as aa,automateControllerUrlSelector as ab,flowCenterDialogSelector as ac,automateUrlSelector as ad,Portal$1 as ae,flowCenterDialogReducer as af,List$2 as ag,ListItem$1 as ah,ListItemIcon$1 as ai,ListItemText$1 as aj,flowCenterDialogAction as ak,all as al,img$o as am,img$p as an,img$r as ao,img$s as ap,Tooltip$1 as aq,img$i as ar,img$H as as,Skeleton$1 as at,takeLatest$1 as au,fetchAllTags as av,put as aw,select as ax,fetchFlows as ay,call$i as az,styled$1 as b,FormHelperText$2 as b$,ClickAwayListener as b0,Fade$1 as b1,img$t as b2,img$q as b3,img$R as b4,img$D as b5,DialogTitle$1 as b6,DialogContent$1 as b7,DialogActions$1 as b8,Snackbar$1 as b9,React5 as bA,TransitionGroup$1 as bB,connect$1 as bC,Bookmark as bD,EngineFlagIcons as bE,createAsyncThunk as bF,withStyles as bG,getConfigModule as bH,getAuthModule as bI,getSnackbarModule as bJ,AIWareCacheProvider as bK,img$S as bL,img$e as bM,img$d as bN,isEmpty_1 as bO,Backdrop$1 as bP,getDefaultMiddleware as bQ,isNil_1 as bR,UpDown as bS,Icon$1 as bT,get_1 as bU,map_1 as bV,keys_1 as bW,RadioGroup$1 as bX,Avatar$1 as bY,img$x as bZ,baseGraphQLApi as b_,default_1$6 as ba,img$j as bb,img$l as bc,img$V as bd,Tabs$2 as be,Tab$2 as bf,deleteEngine as bg,fetchEngine as bh,img$k as bi,AIWareFormatMessage as bj,FormattedDate as bk,fetchVeritoneGraphQLApi as bl,useTheme as bm,KeyboardArrowRight as bn,KeyboardArrowLeft as bo,useId as bp,InputUnstyled as bq,isHostComponent as br,getDefaultExportFromNamespaceIfNotNamed as bs,commonjsRequire as bt,reactDom as bu,Transition$1 as bv,_defineProperty$1 as bw,__awaiter$d as bx,__generator$2 as by,__spread as bz,Paper$1 as c,isArray_1 as c$,img$g as c0,StyledEngineProvider as c1,ThemeProvider as c2,lightTheme$1 as c3,CssBaseline as c4,Hide as c5,has_1 as c6,showMessage as c7,MessageSeverity as c8,Radio$2 as c9,mountPanel$1 as cA,DialogContentText$1 as cB,userSelector$2 as cC,MoreVert$1 as cD,Menu$1 as cE,Edit as cF,Upload as cG,Delete as cH,CustomTabs as cI,useBackupImg as cJ,img$1A as cK,validate as cL,configSelector as cM,baseGraphQLApiWithError as cN,VerifiedFilled as cO,Add as cP,ExpandLess as cQ,ExpandMore as cR,Collapse$1 as cS,img$17 as cT,Filter$1 as cU,DynamicTable as cV,useTheme$3 as cW,getThemeProps as cX,useEnhancedEffect$1 as cY,React as cZ,_arrayPush as c_,createSvgIcon$2 as ca,_createCompounder as cb,_baseIteratee as cc,isArrayLike_1 as cd,toInteger_1 as ce,_typeof$4 as cf,_assertThisInitialized$1 as cg,_setPrototypeOf$3 as ch,_toPropertyKey as ci,_inheritsLoose$2 as cj,hoistNonReactStatics_cjs as ck,commonjsGlobal$1 as cl,combineReducers as cm,createSelector$1 as cn,fork as co,AIWareThemeProvider$1 as cp,Stack$4 as cq,Close$1 as cr,FullscreenExit as cs,Fullscreen as ct,TabPanel as cu,default_1$8 as cv,unmountPanel$1 as cw,AvailableComponents as cx,delay$1 as cy,hidePanel$1 as cz,capitalize$2 as d,_Symbol as d$,_baseToString as d0,_baseTrim as d1,_castSlice as d2,_stringToArray as d3,toString_1 as d4,ReactIs as d5,upperFirst_1 as d6,isString_1 as d7,_baseGet as d8,_baseSlice as d9,useTheme$2 as dA,useControlled as dB,useEventCallback as dC,ButtonBase$1 as dD,useForkRef as dE,getDefaultExportFromCjs as dF,_root as dG,isObject_1 as dH,MoreHor as dI,takeEvery$1 as dJ,EngineCategoryIcons as dK,selectApiConfigs$2 as dL,Chip$1 as dM,Badge$1 as dN,panelsSelector as dO,tabsClasses$1 as dP,AlarmTwo as dQ,EditList as dR,usePreviousProps$1 as dS,setRef as dT,inputClasses$1 as dU,inputBaseClasses$1 as dV,outlinedInputClasses$1 as dW,filledInputClasses$1 as dX,ClearIcon as dY,ArrowDropDownIcon as dZ,_arrayMap as d_,_castPath as da,_toKey as db,_isIndex as dc,channel$1 as dd,useIntl as de,VideoCamera as df,Image$1 as dg,Sound as dh,Description as di,toNumber_1 as dj,ProgressStepper as dk,size_1 as dl,take as dm,CurlyBraces as dn,UnknownDocument as dp,sdkEventManager as dq,SdkEvents as dr,SdkError as ds,EngineClassIcons as dt,Mode2 as du,EngineModeIcons as dv,DeploymentModelIcons as dw,guid as dx,forceReflow as dy,alpha as dz,_objectWithoutPropertiesLoose$2 as e,index as e$,isArguments_1 as e0,_baseEach as e1,_arrayFilter as e2,_getNative as e3,eq_1 as e4,_Uint8Array as e5,_overArg as e6,_isPrototype as e7,isObjectLike_1 as e8,_baseGetTag as e9,img$L as eA,img$1y as eB,img$K as eC,authSelector as eD,ListItemAvatar$1 as eE,emphasize as eF,useSlotProps as eG,_arraySome as eH,EntityType as eI,injectIntl as eJ,ErrorBoundary$1 as eK,EPermissionAction as eL,Process as eM,Information as eN,Download as eO,NewFolder as eP,SpecialFolder as eQ,User as eR,Source as eS,Search$1 as eT,selectIsOLPEnabled as eU,ListItemSecondaryAction$1 as eV,getLibraryModule as eW,cmsUrlSelector as eX,betaFeaturesSelector as eY,SearchStructuredData as eZ,Grow$1 as e_,_arrayLikeKeys as ea,isBuffer$3 as eb,isFunction_1 as ec,isTypedArray_1 as ed,_Stack as ee,_baseFor as ef,identity_1 as eg,_isIterateeCall as eh,isSymbol_1 as ei,_baseMap as ej,_baseUnary as ek,memoizeOne as el,createBox$1 as em,StepperContext$1 as en,StepContext$1 as eo,SvgIcon$1 as ep,StepConnector$1 as eq,_Set as er,_setToArray as es,_SetCache as et,_cacheHas as eu,img$O as ev,img$N as ew,img$1w as ex,img$1v as ey,img$1u as ez,clsx as f,SecurityGroup as f$,actions as f0,hasPermission as f1,UserAddFilled as f2,Popover$1 as f3,MenuList$1 as f4,MoveFolder as f5,EAuthResourceType as f6,Slide$1 as f7,img$a as f8,selectPanelByPanelName as f9,selectOrgId as fA,navSectionStyles as fB,selectIsUserAdmin as fC,AvatarGroup$1 as fD,ErrorState$2 as fE,NullState$2 as fF,Group as fG,PermissionChangedAction as fH,Lock as fI,useOrganizationPermissions as fJ,EAuthSubResourceType as fK,AddGroup as fL,initialConfigSelector as fM,ConfirmationModal as fN,EnumHelpers as fO,formatBytes as fP,LinearProgress$1 as fQ,NotInterested as fR,mountPanelForResponse$1 as fS,tableStyles as fT,ArrowDown as fU,ArrowUp as fV,useInterval as fW,Iam as fX,contextMenuStyles as fY,safeFormatMessage as fZ,Users as f_,FullScreenContainer as fa,isPermissionLoading as fb,Settings$2 as fc,Hamburger as fd,List as fe,convertEntityToAuthResource as ff,selectUserOrgEdgeVersion as fg,EditAttributes as fh,gqlIntrospection as fi,ProcessingDetail as fj,img$w as fk,img$y as fl,img$4 as fm,FilterRemove as fn,CheckCircle as fo,FolderOpen as fp,Voice as fq,useDoubleClick as fr,FolderFilled as fs,Time as ft,img$z as fu,Undefined as fv,PodcastSource as fw,YoutubeSource as fx,TVSource as fy,RadioSource as fz,generateUtilityClass as g,ArrowBack as g$,getOrganizationPanelModule as g0,Lock2 as g1,EApplicationConfigLevel as g2,NoApps as g3,EApplicationConfigType as g4,green$1 as g5,md5 as g6,selectIsSuperAdmin as g7,organizations_selector as g8,actions$5 as g9,compile as gA,Check as gB,FormattedRelativeTime$1 as gC,BottomQueue as gD,TopQueue as gE,Pause as gF,Cancel as gG,Folder as gH,Hidden as gI,setDuration as gJ,resetDuration as gK,toFinite_1 as gL,_baseForOwn as gM,_arrayReduce as gN,hasIn_1 as gO,useSyncExternalStoreExports as gP,getTabPanelWidthBySize as gQ,Packages as gR,Resources$1 as gS,selectUserCanCreatePackage as gT,Engines as gU,PackagesAvatar as gV,actionChannel as gW,cancelled as gX,flush$3 as gY,cancel as gZ,FlowCenter2 as g_,AddUser as ga,selectors as gb,LibraryDropdown as gc,Remove as gd,Save as ge,Input$3 as gf,getElement as gg,client$1 as gh,Copy as gi,ArrowForward as gj,Modal$1 as gk,_baseIsEqual as gl,Slider$1 as gm,_getSymbols as gn,stubArray_1 as go,_baseGetAllKeys as gp,_getTag as gq,_nodeUtil as gr,_getAllKeys as gs,_castFunction as gt,Article as gu,Task as gv,View as gw,_objectSpread2 as gx,serialize as gy,stringify$2 as gz,composeClasses as h,img$v as h0,FlowTemplate as h1,Schema as h2,registry as h3,registerComponent as h4,AvailableWidgets as h5,updatePanelMicroFrontendProps as h6,setData as h7,root as h8,mountWidget as h9,unmountWidget as ha,mountPanel as hb,unmountPanel as hc,hidePanel as hd,unmountAllPanel as he,init as hf,aiwareEvents as hg,createSvgIcon$1 as i,jsxRuntime as j,interopRequireDefault as k,Route as l,makeStyles as m,useDispatch as n,useSelector as o,authStatusSelector as p,authContextSelector as q,react as r,store$4 as s,AuthContext as t,useThemeProps as u,lodash as v,Alert$1 as w,useNavigate as x,useLocation as y,authErrorMessage as z};
1486
+ `,l={entityId:t,entityType:e};try{a=yield baseGraphQLApi({query:s,operationName:n,variables:l,graphEndpoint:u,token:d})}catch(e){i=!0}if(a.errors){if(0===(o=a.errors.filter(({message:e})=>e.includes(' does not exist in "AuthPermissionType" enum.')).map(({message:e})=>{var t='Value "',n=e.substring(t.length).indexOf('"');return e.substring(t.length,t.length+n)})).length)throw i=!0,a={},new Error((null==(f=(a.errors||[])[0])?void 0:f.message)||"Error")}else i=!0}const c=a.data||{};return Object.keys(c).map(e=>{var t=e.split("__");return 3===t.length?{fetchedTargetEntityType:t[0],fetchedTargetGroupType:t[1],fetchedTargetAction:t[2],hasPermission:c[e][0].hasPermission}:{fetchedTargetEntityType:t[0],fetchedTargetAction:t[1],hasPermission:c[e][0].hasPermission}}).reduce((e,t)=>{var n=t.fetchedTargetGroupType||t.fetchedTargetEntityType;return t.hasPermission&&(e[n]||(e[n]={}),e[n][t.fetchedTargetAction]=t.hasPermission),e},{})})}function getMyRights(t){return __awaiter(this,void 0,void 0,function*(){var e="getMyRights";return(yield baseGraphQLApiWithError(Object.assign({query:"\n query getMyRights {\n myRights {\n operations\n }\n }\n ",operationName:e},t))).myRights.operations})}const selectPermissionsByEntity=(t,n,r)=>e=>{return t&&n&&(e=e[namespace].permissionsByObject[t])&&e[n]?e[n][r||t]:void 0},selectMyRights=e=>e[namespace].rights;var index=Object.freeze({__proto__:null,selectPermissionsByEntity:selectPermissionsByEntity,selectMyRights:selectMyRights});function*fetchObjectPermissions(t){var{entityId:t,entityType:n}=t.payload,i=yield select(selectApiConfigs$2),e=yield select(graphEndpointSelector),o=yield select(sessionTokenSelector),a=yield select(selectIsOLPEnabled),r=yield select(selectPermissionsByEntity(n,t));if(!r||"success"!==r.status&&"pending"!==r.status){yield put(actions.fetchObjectPermissionsStarted({entityId:t,entityType:n}));try{let r={};if(a)r=yield call$i(getObjectPermissions,e,o,{entityType:n,entityId:t});else{let e=yield select(selectMyRights);if("success"!==e.status&&"pending"!==e.status){yield put(actions.fetchMyRightsStarted);try{var s=yield call$i(getMyRights,i);yield put(actions.fetchMyRightsSucceeded(s)),e=yield select(selectMyRights)}catch(e){throw yield put(actions.fetchMyRightsFailed),e}}else"pending"===e.status&&(yield take([actions.fetchMyRightsFailed,actions.fetchMyRightsSucceeded]),e=yield select(selectMyRights));const l=e["myRights"];getPermissionTypesToQuery(n).forEach(n=>{var{action:e,resource:t}=n.targetActions.reduce((e,t)=>(e.action[t.targetAction]=convertPermissionsToRights(t.resource||n.targetObjectType,t.targetAction,l),e.resource=t.resource,e),{action:{}});r[t||n.targetObjectType]=e})}yield put(actions.fetchObjectPermissionsSucceeded({entityId:t,entityType:n,permissions:r}))}catch(e){actions.fetchObjectPermissionsFailed({entityId:t,entityType:n})}}}function*watchPermissionsStart(){yield takeEvery$1(actions.fetchObjectPermissionsStart.type,fetchObjectPermissions)}function*rootSaga(){yield all([watchPermissionsStart()])}function getPermissionsModule(){return{id:namespace,reducerMap:{[namespace]:permissionsReducer},sagas:[rootSaga],initialActions:[]}}const useOrganizationPermissions=e=>{const t=react.exports.useRef(),n=useDispatch(),r=null==(o=useSelector(userSelector$2).organization)?void 0:o.organizationId,i=useSelector(selectPermissionsByEntity(EAuthResourceType.Organization,String(r),e));react.exports.useEffect(()=>{!r||i&&"failure"!==i.status&&"idle"!==i.status&&t.current===r||(t.current=r,n(actions.fetchObjectPermissionsStart({entityType:EAuthResourceType.Organization,entityId:String(r)})))},[n,r,i]);var o=react.exports.useCallback(e=>{return!isPermissionLoading(i)&&hasPermission(i,e)},[i]);return{permissions:i,hasPermission:o}},rateLimiter=new RateLimiter,checkAndDecodeBase64String=t=>{if(null==t||!t.trim())return t;try{return window.btoa(window.atob(t))==t?window.atob(t):t}catch(e){return t}};function SnackbarRenderer(){return jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getSnackbarModule()]},{children:jsxRuntime.exports.jsx(CustomSnackbar,{})}))}))}store$4.addModules([getWidgetsModule(),getPanelsModule(registry,registryLookup),getDataModule(),getConfigModule(),getAuthModule(),getPermissionsModule()]);let hasLoaded=!1;const AppBarPreLoader=()=>{var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&!hasLoaded&&(hasLoaded=!0,setTimeout(()=>{store$4.addModules([getAppbarPanelModule()])},0)),null};function ApplicationDialogPreLoader(){var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&hasLoaded?jsxRuntime.exports.jsx(ApplicationDialog,{}):null}const authHelpers={updateToken(e){e?store$4.dispatch(updateTokenRequest({token:e})):console.error("[AiWARE JS]: Please provide a valid token!")},logout(e){"function"==typeof e?(e(),setTimeout(()=>{store$4.dispatch(logout())},1e3)):store$4.dispatch(logout())},reportAppActivity(e){rateLimiter.checkIfCanCall(e)&&store$4.dispatch(updateActivityStatus$1())}};function PortalRenderer(){return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment,{children:[jsxRuntime.exports.jsx(SupportCenterPixel,{}),jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AppBarPreLoader,{})}))]})}function ApplicationDialogRenderer(){return jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment,{children:jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ApplicationDialogPreLoader,{})})}))})}const ThemeInitializer=()=>(useTheme(),null),root=getElement("aiWARE"),reactDOMroot=(root.classList.add("aiware-el"),client$1.createRoot(root)),mountWidget=("_auth"===window.name?handleImplicitRedirect(window.location.hash,window.opener):reactDOMroot.render(jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsxs(AIWareThemeProvider$1,{children:[jsxRuntime.exports.jsx(PortalRenderer,{}),jsxRuntime.exports.jsx(SnackbarRenderer,{}),jsxRuntime.exports.jsx(ApplicationDialogRenderer,{}),jsxRuntime.exports.jsx(ThemeInitializer,{})]})})),(e,t)=>{var n=getUniqueID(),{name:e,elementId:r,config:i}=e;return e&&r&&i||console.error("[aiwarejs-error]: `mountWidget` function should include all the following params: name, elementId, config"),store$4.dispatch(mountWidget$1({elementId:r,widgetName:e,widgetConfig:i,widgetId:n,onComplete:t})),n}),unmountWidget=e=>(store$4.dispatch(unmountWidget$1(e)),!0),mountPanel=(e,t)=>{const n=e.panelId||getUniqueID();var{microFrontend:e,panelConfig:r}=e;store$4.dispatch(mountPanel$1({microFrontend:e,panelId:n,panelConfig:r}));const i=[...(null==(e=null==r?void 0:r.header)?void 0:e.actions)||[],...(null==(e=null==r?void 0:r.footer)?void 0:e.actions)||[]].filter(e=>e.submit).map(e=>e.action);r={id:n,sagas:[function*(){yield takeEvery$1(i.map(e=>e.type),function*(){var e=(yield select(e=>e.data.find(e=>e.id===n)))["data"];t&&t(e)})}]};return store$4.addModule(r),n},unmountPanel=e=>(store$4.dispatch(unmountPanel$1(e)),!0),hidePanel=e=>(store$4.dispatch(hidePanel$1(e)),!0),unmountAllPanel=()=>{store$4.dispatch(unmountAllPanel$1(""))};function init(e,t){var n;validateConfig(e)&&(n=e["authToken"],n=checkAndDecodeBase64String(n||""),store$4.dispatch(getInitConfig(Object.assign(Object.assign({},e),{authToken:n,onComplete:t}))))}function helpCenter(){var e=new HelpCenter$2({actions:{setCustomKnowledgeBaseUrlAction:setCustomKnowledgeBaseUrl,setCustomDocsUrlAction:setCustomDocsUrl,updateSelectedTabAction:updateSelectedTab}});return{openKnowledgeBasePanel:e.openKnowledgeBasePanel.bind(e),openDocsPanel:e.openDocsPanel.bind(e)}}function dataCenter(){var e=new DataCenter$1;return{openImporterPanel:e.openImporterPanel.bind(e)}}function handleEvents(){function n(e){if(!e||"string"!=typeof e)throw new SdkError("Please provide a valid event name!");if(!SdkEvents[e])throw new SdkError("Unknown event: "+e)}return{on:function(e,t){n(e),sdkEventManager.on.call(sdkEventManager,e,t)},off:function(e){n(e),sdkEventManager.off.call(sdkEventManager,e)}}}const mountPanelForResponse=e=>mountPanelForResponse$1(e,store$4),aiwareEvents=handleEvents();window&&(window.aiWare_initTesting=()=>{window.aiWare_store=store$4,window.aiWare_theme={darkTheme:darkTheme$1,lightTheme:lightTheme$1}},window.aiware={init:init,auth:authHelpers,helpCenter:helpCenter(),dataCenter:dataCenter(),on:aiwareEvents.on,off:aiwareEvents.off,hidePanel:hidePanel,unmountPanel:unmountPanel,store:store$4,registry:registry,registerComponent:registerComponent,AvailableWidgets:AvailableWidgets,mountPanelAction:mountPanel$1,unmountPanelAction:unmountPanel$1,hidePanelAction:hidePanel$1,updatePanelMicroFrontendPropsAction:updatePanelMicroFrontendProps,setData:setData,mountWidget:mountWidget,mountPanel:mountPanel,mountPanelForResponse:mountPanelForResponse,unmountWidget:unmountWidget,version:"sdk_release_version",commit:"8d24ca15a",releaseDate:"2023-07-27T18:00:56.130Z"});export{createReducer as $,AIWareIntlProvider as A,Box$1 as B,FormControl$1 as C,TextField$1 as D,classNames as E,FormattedMessage$1 as F,Grid$1 as G,resetPasswordRequest as H,InputLabel$1 as I,InputAdornment$1 as J,IconButton$1 as K,LoadingButton$1 as L,Select$1 as M,Location as N,OutlinedInput$1 as O,Provider$2 as P,MenuItem$1 as Q,Routes as R,Switch$1 as S,Typography$1 as T,Button$1 as U,Divider$1 as V,createTheme$1 as W,systemStyled as X,useThemeProps$1 as Y,createAction as Z,_extends$2 as _,generateUtilityClasses as a,Popper$1 as a$,createSlice as a0,ENGINE_OWNER_TYPES as a1,ENGINE_FILTER_TYPES as a2,DynamicModuleLoader as a3,preferredLanguageSelector as a4,baseUrlSelector as a5,rootApiSelector as a6,sessionTokenSelector as a7,graphEndpointSelector as a8,controllerNodeRedImageSelector as a9,fetchTemplateGallery as aA,isRevisionsExistOnServerRequest as aB,FormLabel$1 as aC,default_1$b as aD,FormGroup$1 as aE,FormControlLabel$1 as aF,Checkbox$1 as aG,fetchTemplateGalleryFallback as aH,Card$1 as aI,CardContent$1 as aJ,img$m as aK,CardActions$1 as aL,flowStyles as aM,NoResults as aN,CircularProgress$1 as aO,img$c as aP,Dialog$1 as aQ,setApiEndpoint as aR,TableContainer$1 as aS,Table$1 as aT,TableHead$1 as aU,TableRow$1 as aV,TableCell$1 as aW,TableSortLabel$1 as aX,TableBody$1 as aY,img$h as aZ,default_1 as a_,controllerUrlSelector as aa,automateControllerUrlSelector as ab,flowCenterDialogSelector as ac,automateUrlSelector as ad,Portal$1 as ae,flowCenterDialogReducer as af,List$2 as ag,ListItem$1 as ah,ListItemIcon$1 as ai,ListItemText$1 as aj,flowCenterDialogAction as ak,all as al,img$o as am,img$p as an,img$r as ao,img$s as ap,Tooltip$1 as aq,img$i as ar,img$H as as,Skeleton$1 as at,takeLatest$1 as au,fetchAllTags as av,put as aw,select as ax,fetchFlows as ay,call$i as az,styled$1 as b,FormHelperText$2 as b$,ClickAwayListener as b0,Fade$1 as b1,img$t as b2,img$q as b3,img$R as b4,img$D as b5,DialogTitle$1 as b6,DialogContent$1 as b7,DialogActions$1 as b8,Snackbar$1 as b9,React5 as bA,TransitionGroup$1 as bB,connect$1 as bC,Bookmark as bD,EngineFlagIcons as bE,createAsyncThunk as bF,withStyles as bG,getConfigModule as bH,getAuthModule as bI,getSnackbarModule as bJ,AIWareCacheProvider as bK,img$S as bL,img$e as bM,img$d as bN,isEmpty_1 as bO,Backdrop$1 as bP,getDefaultMiddleware as bQ,isNil_1 as bR,UpDown as bS,Icon$1 as bT,get_1 as bU,map_1 as bV,keys_1 as bW,RadioGroup$1 as bX,Avatar$1 as bY,img$x as bZ,baseGraphQLApi as b_,default_1$6 as ba,img$j as bb,img$l as bc,img$V as bd,Tabs$2 as be,Tab$2 as bf,deleteEngine as bg,fetchEngine as bh,img$k as bi,AIWareFormatMessage as bj,FormattedDate as bk,fetchVeritoneGraphQLApi as bl,useTheme as bm,KeyboardArrowRight as bn,KeyboardArrowLeft as bo,useId as bp,InputUnstyled as bq,isHostComponent as br,getDefaultExportFromNamespaceIfNotNamed as bs,commonjsRequire as bt,reactDom as bu,Transition$1 as bv,_defineProperty$1 as bw,__awaiter$d as bx,__generator$2 as by,__spread as bz,Paper$1 as c,isArray_1 as c$,img$g as c0,StyledEngineProvider as c1,ThemeProvider as c2,lightTheme$1 as c3,CssBaseline as c4,Hide as c5,has_1 as c6,showMessage as c7,MessageSeverity as c8,Radio$2 as c9,mountPanel$1 as cA,DialogContentText$1 as cB,userSelector$2 as cC,MoreVert$1 as cD,Menu$1 as cE,Edit as cF,Upload as cG,Delete as cH,CustomTabs as cI,useBackupImg as cJ,img$1A as cK,validate as cL,configSelector as cM,baseGraphQLApiWithError as cN,VerifiedFilled as cO,Add as cP,ExpandLess as cQ,ExpandMore as cR,Collapse$1 as cS,img$17 as cT,Filter$1 as cU,DynamicTable as cV,useTheme$3 as cW,getThemeProps as cX,useEnhancedEffect$1 as cY,React as cZ,_arrayPush as c_,createSvgIcon$2 as ca,_createCompounder as cb,_baseIteratee as cc,isArrayLike_1 as cd,toInteger_1 as ce,_typeof$4 as cf,_assertThisInitialized$1 as cg,_setPrototypeOf$3 as ch,_toPropertyKey as ci,_inheritsLoose$2 as cj,hoistNonReactStatics_cjs as ck,commonjsGlobal$1 as cl,combineReducers as cm,createSelector$1 as cn,fork as co,AIWareThemeProvider$1 as cp,Stack$4 as cq,Close$1 as cr,FullscreenExit as cs,Fullscreen as ct,TabPanel as cu,default_1$8 as cv,unmountPanel$1 as cw,AvailableComponents as cx,delay$1 as cy,hidePanel$1 as cz,capitalize$2 as d,_Symbol as d$,_baseToString as d0,_baseTrim as d1,_castSlice as d2,_stringToArray as d3,toString_1 as d4,ReactIs as d5,upperFirst_1 as d6,isString_1 as d7,_baseGet as d8,_baseSlice as d9,useTheme$2 as dA,useControlled as dB,useEventCallback as dC,ButtonBase$1 as dD,useForkRef as dE,getDefaultExportFromCjs as dF,_root as dG,isObject_1 as dH,MoreHor as dI,takeEvery$1 as dJ,EngineCategoryIcons as dK,selectApiConfigs$2 as dL,Chip$1 as dM,Badge$1 as dN,panelsSelector as dO,tabsClasses$1 as dP,AlarmTwo as dQ,EditList as dR,usePreviousProps$1 as dS,setRef as dT,inputClasses$1 as dU,inputBaseClasses$1 as dV,outlinedInputClasses$1 as dW,filledInputClasses$1 as dX,ClearIcon as dY,ArrowDropDownIcon as dZ,_arrayMap as d_,_castPath as da,_toKey as db,_isIndex as dc,channel$1 as dd,useIntl as de,VideoCamera as df,Image$1 as dg,Sound as dh,Description as di,toNumber_1 as dj,ProgressStepper as dk,size_1 as dl,take as dm,CurlyBraces as dn,UnknownDocument as dp,sdkEventManager as dq,SdkEvents as dr,SdkError as ds,EngineClassIcons as dt,Mode2 as du,EngineModeIcons as dv,DeploymentModelIcons as dw,guid as dx,forceReflow as dy,alpha as dz,_objectWithoutPropertiesLoose$2 as e,index as e$,isArguments_1 as e0,_baseEach as e1,_arrayFilter as e2,_getNative as e3,eq_1 as e4,_Uint8Array as e5,_overArg as e6,_isPrototype as e7,isObjectLike_1 as e8,_baseGetTag as e9,img$L as eA,img$1y as eB,img$K as eC,authSelector as eD,ListItemAvatar$1 as eE,emphasize as eF,useSlotProps as eG,_arraySome as eH,EntityType as eI,injectIntl as eJ,ErrorBoundary$1 as eK,EPermissionAction as eL,Process as eM,Information as eN,Download as eO,NewFolder as eP,SpecialFolder as eQ,User as eR,Source as eS,Search$1 as eT,selectIsOLPEnabled as eU,ListItemSecondaryAction$1 as eV,getLibraryModule as eW,cmsUrlSelector as eX,betaFeaturesSelector as eY,SearchStructuredData as eZ,Grow$1 as e_,_arrayLikeKeys as ea,isBuffer$3 as eb,isFunction_1 as ec,isTypedArray_1 as ed,_Stack as ee,_baseFor as ef,identity_1 as eg,_isIterateeCall as eh,isSymbol_1 as ei,_baseMap as ej,_baseUnary as ek,memoizeOne as el,createBox$1 as em,StepperContext$1 as en,StepContext$1 as eo,SvgIcon$1 as ep,StepConnector$1 as eq,_Set as er,_setToArray as es,_SetCache as et,_cacheHas as eu,img$O as ev,img$N as ew,img$1w as ex,img$1v as ey,img$1u as ez,clsx as f,SecurityGroup as f$,actions as f0,hasPermission as f1,UserAddFilled as f2,Popover$1 as f3,MenuList$1 as f4,MoveFolder as f5,EAuthResourceType as f6,Slide$1 as f7,img$a as f8,selectPanelByPanelName as f9,selectOrgId as fA,navSectionStyles as fB,selectIsUserAdmin as fC,AvatarGroup$1 as fD,ErrorState$2 as fE,NullState$2 as fF,Group as fG,PermissionChangedAction as fH,Lock as fI,useOrganizationPermissions as fJ,EAuthSubResourceType as fK,AddGroup as fL,initialConfigSelector as fM,ConfirmationModal as fN,EnumHelpers as fO,formatBytes as fP,LinearProgress$1 as fQ,NotInterested as fR,mountPanelForResponse$1 as fS,tableStyles as fT,ArrowDown as fU,ArrowUp as fV,useInterval as fW,Iam as fX,contextMenuStyles as fY,safeFormatMessage as fZ,Users as f_,FullScreenContainer as fa,isPermissionLoading as fb,Settings$2 as fc,Hamburger as fd,List as fe,convertEntityToAuthResource as ff,selectUserOrgEdgeVersion as fg,EditAttributes as fh,gqlIntrospection as fi,ProcessingDetail as fj,img$w as fk,img$y as fl,img$4 as fm,FilterRemove as fn,CheckCircle as fo,FolderOpen as fp,Voice as fq,useDoubleClick as fr,FolderFilled as fs,Time as ft,img$z as fu,Undefined as fv,PodcastSource as fw,YoutubeSource as fx,TVSource as fy,RadioSource as fz,generateUtilityClass as g,ArrowBack as g$,getOrganizationPanelModule as g0,Lock2 as g1,EApplicationConfigLevel as g2,NoApps as g3,EApplicationConfigType as g4,green$1 as g5,md5 as g6,selectIsSuperAdmin as g7,organizations_selector as g8,actions$5 as g9,compile as gA,Check as gB,FormattedRelativeTime$1 as gC,BottomQueue as gD,TopQueue as gE,Pause as gF,Cancel as gG,Folder as gH,Hidden as gI,setDuration as gJ,resetDuration as gK,toFinite_1 as gL,_baseForOwn as gM,_arrayReduce as gN,hasIn_1 as gO,useSyncExternalStoreExports as gP,getTabPanelWidthBySize as gQ,Packages as gR,Resources$1 as gS,selectUserCanCreatePackage as gT,Engines as gU,PackagesAvatar as gV,actionChannel as gW,cancelled as gX,flush$3 as gY,cancel as gZ,FlowCenter2 as g_,AddUser as ga,selectors as gb,LibraryDropdown as gc,Remove as gd,Save as ge,Input$3 as gf,getElement as gg,client$1 as gh,Copy as gi,ArrowForward as gj,Modal$1 as gk,_baseIsEqual as gl,Slider$1 as gm,_getSymbols as gn,stubArray_1 as go,_baseGetAllKeys as gp,_getTag as gq,_nodeUtil as gr,_getAllKeys as gs,_castFunction as gt,Article as gu,Task as gv,View as gw,_objectSpread2 as gx,serialize as gy,stringify$2 as gz,composeClasses as h,img$v as h0,FlowTemplate as h1,Schema as h2,registry as h3,registerComponent as h4,AvailableWidgets as h5,updatePanelMicroFrontendProps as h6,setData as h7,root as h8,mountWidget as h9,unmountWidget as ha,mountPanel as hb,unmountPanel as hc,hidePanel as hd,unmountAllPanel as he,init as hf,aiwareEvents as hg,createSvgIcon$1 as i,jsxRuntime as j,interopRequireDefault as k,Route as l,makeStyles as m,useDispatch as n,useSelector as o,authStatusSelector as p,authContextSelector as q,react as r,store$4 as s,AuthContext as t,useThemeProps as u,lodash as v,Alert$1 as w,useNavigate as x,useLocation as y,authErrorMessage as z};
package/js-core.esm.js.gz CHANGED
Binary file
package/js-core.esm56.js CHANGED
@@ -153,4 +153,4 @@ import{i as createSvgIcon,k as interopRequireDefault,j as jsxRuntime,a0 as creat
153
153
  }
154
154
  }
155
155
  }
156
- `;return yield baseGraphQLApiWithError(Object.assign({query:t,variables:{id:s},operationName:e},a))}),updateApplication=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="updateApplication";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation updateApplication ($input: UpdateApplication!) {\n updateApplication (input: $input) {\n id\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),bulkDeleteContextMenuExtensions=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="bulkDeleteContextMenuExtensions";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation bulkDeleteContextMenuExtensions ($input: BulkDeleteContextMenuExtensions!) {\n bulkDeleteContextMenuExtensions (input: $input) {\n mentions {\n id\n label\n url\n type\n }\n tdos {\n id\n label\n url\n type\n }\n watchlists {\n id\n label\n url\n type\n }\n collections {\n id\n label\n url\n type\n }\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),deleteConfigField=(t,a,s)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionDelete";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionDelete($appId: ID! $configKey: String!) {\n applicationConfigDefinitionDelete(\n input: {\n appId: $appId\n configKey: $configKey\n }\n )\n {\n success\n code\n msg\n }\n }\n ",variables:{appId:a,configKey:s},operationName:e},t))}),updateConfigField=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionUpdate";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionUpdate($input: [ApplicationConfigDefinitionUpdateInput]) {\n applicationConfigDefinitionUpdate(input: $input)\n {\n records {\n applicationId\n configKey\n }\n }\n }",variables:{input:a},operationName:e},t))}),getApplicationConfigFields=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinition";return yield baseGraphQLApiWithError(Object.assign({query:"\n query applicationConfigDefinition ($appId: ID!) {\n applicationConfigDefinition(appId: $appId) {\n records {\n applicationId\n configKey\n configType\n configLevel\n description\n defaultValue\n defaultValueJSON\n required\n secured\n }\n }\n\n }\n ",variables:{appId:a},operationName:e},t))}),getOAuthClientSecret=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="getApplicationOatuhClientSecret";return yield baseGraphQLApiWithError(Object.assign({query:"query getApplicationOatuhClientSecret($id: ID!, $password: String!) {\n application(id: $id) {\n id,\n clientSecret(password: $password)\n }\n }",variables:a,operationName:e},t))}),getSchemasByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getSchemasByDataRegistryName";return yield baseGraphQLApiWithError(Object.assign({query:"\n query getSchemasByDataRegistryName($name:String){\n dataRegistries(\n name: $name\n ){\n records {\n id\n name\n modifiedDateTime\n schemas {\n records {\n id\n dataRegistryId\n modifiedDateTime\n majorVersion\n minorVersion\n }\n }\n }\n }\n }\n ",variables:e,operationName:t},a))}),getEvents$1=t=>__awaiter(void 0,void 0,void 0,function*(){var e="systemEvents";return yield baseGraphQLApiWithError(Object.assign({query:'\n query systemEvents {\n events (application: "system", limit: 9999) {\n records {\n id\n eventName\n eventType\n description\n }\n }\n }\n ',operationName:e},t))});function*searchFlows(e){yield delay(200),yield put(actions.flowLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getFlowsByName,t,{name:e.payload});yield put(actions.flowLinkingPanelState.updateFlowLinkingPanelField({field:"searchResults",value:a.engines.records})),yield put(actions.flowLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.flowLinkingPanelState.fetchingDone())}}function*watchSearchFlows(){yield takeLatest$1(actions.flowLinkingPanelState.searchByTerm.type,searchFlows)}const flowsSagas=[fork(watchSearchFlows)];function*searchSchemas(e){yield delay(200),yield put(actions.schemaLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getSchemasByName,t,{name:e.payload});yield put(actions.schemaLinkingPanelState.updateSchemaLinkingPanelField({field:"searchResults",value:lodash.exports.map(a.dataRegistries.records,e=>{var t=lodash.exports.reduce(e.schemas.records,(e,t)=>t.majorVersion>e.majorVersion||t.majorVersion==e.majorVersion&&t.minorVersion>e.minorVersion?t:e);return t?{id:t.id,dataRegistryId:t.dataRegistryId,name:e.name,modifiedDateTime:t.modifiedDateTime,version:`v${t.majorVersion}.`+t.minorVersion}:null}).filter(e=>!(!e||!e.name))})),yield put(actions.schemaLinkingPanelState.fetchingDone())}catch(e){yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.schemaLinkingPanelState.fetchingDone())}}function*watchSearchSchemas(){yield takeLatest$1(actions.schemaLinkingPanelState.searchByTerm.type,searchSchemas)}const schemasSagas=[fork(watchSearchSchemas)];function*searchEngines(e){yield delay(200),yield put(actions.engineLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEnginesByName,t,{name:e.payload}),s=lodash.exports.filter(a.engines.records,e=>"c5458876-43d2-41e8-a340-f734702df04a"!==e.category.id);yield put(actions.engineLinkingPanelState.updateEngineLinkingPanelField({field:"searchResults",value:s})),yield put(actions.engineLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.engineLinkingPanelState.fetchingDone())}}function*watchSearchEngines(){yield takeLatest$1(actions.engineLinkingPanelState.searchByTerm.type,searchEngines)}const enginesSagas=[fork(watchSearchEngines)];function*getEvents(e){yield delay(0),yield put(actions.appEventsPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEvents$1,t);yield put(actions.appEventsPanelState.updateEventsPanelField({field:"searchResults",value:a.events.records})),yield put(actions.appEventsPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.appEventsPanelState.fetchingDone())}}function*watchGetEvents(){yield takeLatest$1(actions.appEventsPanelState.getEvents.type,getEvents)}const appEventsSagas=[fork(watchGetEvents)],supportedAppFields$1=["id","name","isPublic","key","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","contextMenuExtensions","eventEndpoint","entityTags","headerbarEnabled","applicationHeaderbar","packageDistributionType"],formatApp$1=t=>{const a={checkPermissions:t.checkPermissions||!1,name:t.name,key:lodash.exports.snakeCase(t.name)};return supportedAppFields$1.forEach(e=>{if(!lodash.exports.isNil(t[e])){if("applicationHeaderbar"===e)return t.headerbarEnabled&&(a.headerbar=t[e]);a[e]=t[e]}}),lodash.exports.isNil(t.iconPath)||(a.iconUrl=t.iconPath),lodash.exports.isNil(t.oauthUrl)||lodash.exports.isEmpty(t.oauthUrl)||(a.oauth2RedirectUrls=[t.oauthUrl]),a};function*createNewApplication(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"];if(lodash.exports.isNil(e))throw new Error("Empty app not allowed!");var a=yield select(selectApiConfigs);try{var s,i=formatApp$1(e),n=yield call(createApplication,a,i),{flows:o,engines:r,schemas:p}=e;lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)&&lodash.exports.isEmpty(p)||(s={id:n.id},lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)||(s.engines={add:[...lodash.exports.map(o,e=>e.id),...lodash.exports.map(r,e=>e.id)],remove:[]}),lodash.exports.isEmpty(p)||(s.dataRegistries={add:lodash.exports.map(p,e=>e.dataRegistryId),remove:[]}),yield call(updateAppComponents,a,s)),lodash.exports.isEmpty(e.configFields)||(yield call(createAppConfig,a,n.id,e.configFields)),yield put(actions.appFormState.createAppSuccess(n.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appCreateSuccess",defaultMessage:[{type:0,value:"Application successfully created"}]}),severity:MessageSeverity.Success})),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){i=lodash.exports.get(e[0],"data.validationErrors[0].message")||"Application onboarding failed";yield put(actions.appFormState.createAppFailed(e[0].message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appOnboardingFailed",defaultMessage:[{type:1,value:"message"}]},{message:i}),severity:MessageSeverity.Error}))}}function*watchNewApplicationCreateStart(){yield takeLatest$1(actions.appFormState.createAppStart.type,createNewApplication)}const newApplicationSagas=[fork(watchNewApplicationCreateStart)],root="undefined"!=typeof window?window:global,fileUploadChannel=(root.xhrInstances={},channel());function*uploadIcon(t){const a=t.payload.file;t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);try{var e=yield call(getUrlBucket,a.name);const i=Object.assign(Object.assign({},a),{status:IconImportStatus.Uploading,percentComplete:0,expiresInSeconds:e.expiresInSeconds,getUrl:e.getUrl,key:e.key,unsignedUrl:e.unsignedUrl,url:e.url}),n=(yield put(actions.iconUploadState.updateIcon(i)),e=>{fileUploadChannel.put(actions.iconUploadState.updateIcon(Object.assign({id:a.id},e)))});var s=yield uploadFileToS3(e,a,{onProgress:e=>{n({percentComplete:e}),sdkEventManager.dispatch(SdkEvents.fileUploadProgress,null,e)},onAbort:e=>{n({status:IconImportStatus.Aborted}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e,"abort"),i)},onError:e=>{n({status:IconImportStatus.Failed}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e),i)},onUpload:e=>{n({status:IconImportStatus.Uploaded}),sdkEventManager.dispatch(SdkEvents.fileUpload,null,i)}});root.xhrInstances[a.id]=s,yield put(actions.iconUploadState.uploadIconSuccess()),yield put(actions.appFormState.updateAppFormField({field:"iconPath",value:i.getUrl}))}catch(e){yield put(actions.iconUploadState.uploadIconFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.iconUploadFail",defaultMessage:[{type:0,value:"Icon upload failed, please try again."}]}),severity:MessageSeverity.Error}))}}function*getUrlBucket(e){var t=yield select(selectApiConfigs);return yield call(getSignedWritableUrl,t,e)}function*watchUploadIconStart(){yield takeLatest$1(actions.iconUploadState.uploadIconStart.type,uploadIcon)}function*watchProgressChannel(){var e=yield take(fileUploadChannel);yield put(e)}const urlRegex=/^https?:\/\/([a-zA-Z0-9@:%._\+~#=]{2,256}\.)?[a-z0-9-]{2,256}\.[a-z]{2,10}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,semverRegex=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]?\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,supportedAppFields=["id","name","isPublic","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","eventEndpoint","entityTags","headerbarEnabled","applicationHeaderbar","packageDistributionType"],formatApp=a=>{const t={checkPermissions:a.checkPermissions||!1,name:a.name,id:a.id};if(lodash.exports.forEach(supportedAppFields,e=>{if(!lodash.exports.isNil(a[e])){if("applicationHeaderbar"===e)return a.headerbarEnabled&&(t.headerbar=a[e]);t[e]=a[e]}}),lodash.exports.isNil(a.iconPath)||(t.iconUrl=a.iconPath),!lodash.exports.isEmpty(a.contextMenuExtensions)){const s={mentions:[],tdos:[],watchlists:[],collections:[]};lodash.exports.forEach(lodash.exports.keys(a.contextMenuExtensions),t=>{lodash.exports.forEach(a.contextMenuExtensions[t],e=>{s[t].push({id:e.id,label:e.label,url:e.url})})}),t.contextMenuExtensions=s}return"oauth"===a.authMethod?t.oauth2RedirectUrls=[a.oauthUrl]:"none"===a.authMethod&&(t.oauth2RedirectUrls=null),t},decodeApp=(e,t,a)=>{const s=[],i=[];lodash.exports.map(lodash.exports.get(e.components.engines,"records"),e=>{("c5458876-43d2-41e8-a340-f734702df04a"===e.categoryId?s:i).push(e)});var a=lodash.exports.map(lodash.exports.get(a.applicationConfigDefinition,"records"),e=>{return{id:e.applicationId,name:e.configKey,type:e.configType,configLevel:AppConfigLevel[e.configLevel],required:e.required,description:e.description,defaultValue:e.defaultValue,secured:!1}});return{id:e.id,name:e.name,description:e.description,entityTags:lodash.exports.map(e.entityTags,e=>({tagKey:e.tagKey,tagValue:e.tagValue})),configFields:a,url:e.url,oauthUrl:null==(a=e.oauth2RedirectUrls)?void 0:a[0],authMethod:lodash.exports.isEmpty(e.oauth2RedirectUrls)?"none":"oauth",iconPath:e.iconUrl,flows:s,engines:i,headerbarEnabled:e.headerbarEnabled,schemas:lodash.exports.map(lodash.exports.get(e.components.dataRegistries,"records"),e=>{return{dataRegistryId:e.id,name:e.name,modifiedDateTime:e.modifiedDateTime,version:(e=e.publishedSchema)?e.majorVersion+"."+e.minorVersion:""}}),contextMenuExtensions:e.contextMenuExtensions,applicationHeaderbar:e.applicationHeaderbar,packageDistributionType:lodash.exports.last(lodash.exports.sortBy(t.records,e=>semverRegex.exec(e.version))).distributionType}};function*queryAppDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplication,t,e)}function*queryAppConfigFieldDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplicationConfigFields,t,e)}function*editApp(e){var t=yield queryAppDetails(e.payload),e=yield queryAppConfigFieldDetails(e.payload);yield put(actions.appFormState.setEditAppExistingData(decodeApp(t.application,t.packages,e)))}function*updateApp(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"],a=yield select(selectApiConfigs);try{var s,i,n,o,r=formatApp(e),p=yield call(updateApplication,a,r),{flows:l,flowsToDelete:d,engines:c,enginesToDelete:u,schemas:x,schemasToDelete:m,contextMenuExtensionIdsForBulkDelete:g}=e,h=(lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(d)&&lodash.exports.isEmpty(u)&&lodash.exports.isEmpty(m)||(s={id:p.id},i=lodash.exports.differenceBy(d,l,"id"),n=lodash.exports.differenceBy(u,c,"id"),o=lodash.exports.differenceBy(m,x,"dataRegistryId"),lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(i)&&lodash.exports.isEmpty(n)||(s.engines={add:[...lodash.exports.map(l,e=>e.id),...lodash.exports.map(c,e=>e.id)],remove:[...lodash.exports.map(i,e=>e.id),...lodash.exports.map(n,e=>e.id)]}),lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(o)||(s.dataRegistries={add:lodash.exports.map(x,e=>e.dataRegistryId),remove:lodash.exports.map(o,e=>e.dataRegistryId)}),yield call(updateAppComponents,a,s),lodash.exports.isEmpty(g))||(yield call(bulkDeleteContextMenuExtensions,a,g)),yield put(actions.appFormState.createAppSuccess(p.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.app-update-success",defaultMessage:[{type:0,value:"App successfully updated"}]}),severity:MessageSeverity.Success})),{name:"APPLICATION_DETAILS_PANEL",config:{name:"Application Details",applicationId:p.id,disableInstallFeature:!0,headerComponent:jsxRuntime.exports.jsx(PanelHeader,{appId:p.id}),appIsOwned:!0}});yield put(mountPanel({panelId:"APPLICATION_DETAILS_PANEL",microFrontend:h,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,size:"xlarge",zIndex:1001}})),localStorage.removeItem("appOnboardingSession"),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){yield put(actions.appFormState.createAppFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.app-updating-failed",defaultMessage:[{type:0,value:"App updating failed"}]}),severity:MessageSeverity.Error}))}}function*deleteAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configToDelete.id)try{yield call(deleteConfigField,t,e.configToDelete.id,e.configToDelete.name)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-delete-fail",defaultMessage:[{type:0,value:"Config field failed to be deleted"}]}),severity:MessageSeverity.Error}))}}function*updateAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configFields.id){var s={configKey:e.configFields.name,description:e.configFields.description,configLevel:e.configFields.configLevel,configType:AppConfigType[e.configFields.type],defaultValue:e.configFields.defaultValue,required:e.configFields.required,secured:!1},e={input:[{filter:{appId:e.configFields.id,configKey:e.name},update:s}]};try{yield call(updateConfigField,t,e.input)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-update-fail",defaultMessage:[{type:0,value:"Config field failed to be updated"}]}),severity:MessageSeverity.Error}))}}}function*addAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t)try{yield call(createAppConfig,t,e.appId,[e.newConfigField])}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-create-fail",defaultMessage:[{type:0,value:"Config field failed to be created"}]}),severity:MessageSeverity.Error}))}}function*fetchApplications(){var e=yield select(selectApiConfigs),t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);if(e)try{var a=yield call(getApplications,e);yield put(actions.appFormState.fetchApplications(a))}catch(e){yield put(showMessage({content:t({id:"os-app-center-new.get-all-applications-fail",defaultMessage:[{type:0,value:"Fetching applications failed"}]}),severity:MessageSeverity.Error}))}}function*toggleEditApp(e){e=e.payload;if(!e)return yield put(hidePanel("APPLICATION_DETAILS_PANEL"));yield put(mountPanel({panelId:"APP_CENTER_NEW",microFrontend:{name:"APP_CENTER_NEW",config:{name:"Edit app",appId:e}},panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",header:{title:"Edit app",divider:!0},marginTop:55,size:"xlarge",zIndex:1002}})),yield put(hidePanel("APPLICATION_DETAILS_PANEL"))}function*watchEditApp(){yield takeLatest$1(actions.appFormState.editApp.type,editApp)}function*watchUpdateAppStart(){yield takeLatest$1(actions.appFormState.updateAppStart.type,updateApp)}function*watchDeleteConfigField(){yield takeLatest$1(actions.appFormState.removeConfigField.type,deleteAppConfigField)}function*watchUpdateConfigField(){yield takeLatest$1(actions.appFormState.updateConfigField.type,updateAppConfigField)}function*watchCreateConfigField(){yield takeLatest$1(actions.appFormState.createConfigField.type,addAppConfigField)}function*watchGetApplications(){yield takeLatest$1(actions.appFormState.createNewApp.type,fetchApplications)}function*watchToggleEditApp(){yield takeLatest$1(actions.appFormState.toggleEditApp.type,toggleEditApp)}const editAppSagas=[fork(watchEditApp),fork(watchUpdateAppStart),fork(watchDeleteConfigField),fork(watchUpdateConfigField),fork(watchCreateConfigField),fork(watchGetApplications),fork(watchToggleEditApp)];function*updateLocalStorage(){var e=appFormState["selectApp"],t=eventPanelState["selectEventPanel"],e=yield select(e),t=yield select(t);window.localStorage.setItem("appOnboardingSession",JSON.stringify(Object.assign(Object.assign({},e),{eventHandlers:t.handlers})))}function*watchAppForm(){var{appFormState:e,appEventsPanelState:t}=actions,e=[e.updateAppFormField.type,e.updateApplicationHeaderbar.type,e.addConfigField.type,e.createConfigField.type,e.updateConfigField.type,e.removeConfigField.type,e.clearConfigFields.type,e.addContextMenuExtension.type,e.updateContextMenuExtension.type,e.removeContextMenuExtension.type,e.clearContextMenuExtensions.type,t.addHandler.type,t.editHandler.type,t.deleteHandler.type];yield takeLatest$1(e,updateLocalStorage)}const updateAppFormSagas=[fork(watchAppForm)];function*rootSaga(){yield all([watchUploadIconStart(),watchProgressChannel(),...appEventsSagas,...flowsSagas,...enginesSagas,...newApplicationSagas,...schemasSagas,...editAppSagas,...updateAppFormSagas])}function getAppCenterNewModule(){return{id:SLICE_NAME,reducerMap:{[SLICE_NAME]:rootReducer},sagas:[rootSaga],initialActions:[]}}const formattedMessageIdPrefix$2="toggle-switch.",Toggle=e=>{var{checked:t,onChange:a}=e;return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:-1,alignItems:"center"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"off",defaultMessage:"Off",description:"Off lable for aiware headerbar toggle switch"})})),jsxRuntime.exports.jsx(Switch,Object.assign({color:"secondary",id:"toggle-aiware-headerbar",onChange:a},lodash.exports.omit(e,"className"))),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"on",defaultMessage:"On",description:"On lable for aiware headerbar toggle switch"})}))]}))},formattedMessageIdPrefix$1="os-app-center-new.headerbar-step.headerbar-toggle.";var ApplicationHeaderbarToggle=({checked:e=!0,onChange:t,disabled:a})=>jsxRuntime.exports.jsxs(Box,Object.assign({width:"100%","data-test":formattedMessageIdPrefix$1+"container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"title",defaultMessage:"aiWARE Headerbar",description:"Title of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"instructions",defaultMessage:"This allows the aiWARE header to wrap around your app, keeping it self contained.",description:"Instructions of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(FormGroup,{children:jsxRuntime.exports.jsx(Box,{children:jsxRuntime.exports.jsx(Tooltip,Object.assign({title:a&&jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.headerbar.headerbar-toggle-tooltip",defaultMessage:"Headerbar toggle switch is disabled if no application url is provided",description:"Tooltip label for headerbar toggle switch"}),"data-test":"app-center-new.aiware-headerbar-toggle-tooltip"},{children:jsxRuntime.exports.jsx(FormControl,{children:jsxRuntime.exports.jsx(Toggle,{checked:e,onChange:t,"data-test":formattedMessageIdPrefix$1+"toggle",disabled:a})})}))})})]}));const useStyles$8=makeStyles()(e=>({editorImg:{maxWidth:"100%",height:"auto"},container:{"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5,boxSizing:"content-box"}})),formattedMessageIdPrefix="os-app-center-new.headerbar-step.customize-headerbar.";var CustomizeApplicationHeaderbar=({handleOnValidate:e})=>{var t=useStyles$8()["classes"];const s=useDispatch(),a=useSelector(selectApp);var i={name:null==(i=a.applicationHeaderbar)?void 0:i.name,"config.backgroundColor":null==(i=a.applicationHeaderbar)?void 0:i.config.backgroundColor,"config.logoSrc":null==(i=a.applicationHeaderbar)?void 0:i.config.logoSrc,"config.help":null==(i=a.applicationHeaderbar)?void 0:i.config.help,"config.notification":null==(i=a.applicationHeaderbar)?void 0:i.config.notification};const n=useForm({mode:"onChange",defaultValues:i});react.exports.useEffect(()=>{a.headerbarEnabled?null!=e&&e(n.formState.isValid):null!=e&&e(!0)},[n.formState.isValid,a.headerbarEnabled]);var i=e=>{var t=e.target["name"];let a=e.target["value"];"config.zIndex"===t&&(a=Number(a)),s(actions.appFormState.updateApplicationHeaderbar({field:t,value:a}))},o=e=>{var{name:e,checked:t}=e.target;s(actions.appFormState.updateApplicationHeaderbar({field:e,value:t}))};return jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:3,"data-test":formattedMessageIdPrefix+"container"},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{opacity:a.headerbarEnabled?1:.5}},{children:[jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",alignItems:"center",spacing:1},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"title",defaultMessage:"Customize the aiWARE Header",description:"Title of the Customize aiware headerbar section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"optional",defaultMessage:"(Optional)",description:"Optional modifier for titles"})}))]})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"instructions",defaultMessage:"Your inputs will be injected into the header as JSON and can be used to customize the user interface and functionality.",description:"Instructions of the Customize aiware header bar section"})}))]})),a.headerbarEnabled&&jsxRuntime.exports.jsx(Box,{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},n,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,spacing:5,"data-test":formattedMessageIdPrefix+"form-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-name",defaultMessage:"Name",description:"You can set a headerbar name"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-name",inputProps:{maxLength:250,className:t.textInput},rules:{required:!0},onChange:i})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:2},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-backgroundColor",defaultMessage:"Background Color",description:"You can set a headerbar background color"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"color",name:"config.backgroundColor",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.backgroundColor",inputProps:{maxLength:250,className:t.textInput},onChange:i})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-logoSource",defaultMessage:"Logo Source",description:"You can set a headerbar logo source"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"config.logoSrc",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.logoSrc",inputProps:{maxLength:5e3,className:t.textInput},onChange:i})]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"25px 0 0 25px"}},{children:jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:[jsxRuntime.exports.jsx(InputCheckbox,{name:"config.help",checked:null==(i=null==(t=a.applicationHeaderbar)?void 0:t.config)?void 0:i.help,onChange:o,"data-test":"app-center-new.aiware-headerbar-checkbox-help",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-help",defaultMessage:"Help",description:"Help field checkbox"})}),jsxRuntime.exports.jsx(InputCheckbox,{name:"config.notification",checked:null==(i=null==(t=a.applicationHeaderbar)?void 0:t.config)?void 0:i.notification,onChange:o,"data-test":"app-center-new.aiware-headerbar-checkbox-notification",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-notification",defaultMessage:"Notification",description:"Notification field checkbox"})})]}))}))]}))}))})]}))};const useStyles$7=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)}}));var HeaderbarStep=({handleOnValidate:e})=>{const t=useDispatch(),a=useSelector(selectApp);var s=useStyles$7()["classes"];react.exports.useEffect(()=>{t(actions.appFormState.updateAppFormField({field:"headerbarEnabled",value:!lodash.exports.isEmpty(a.url)}))},[]);return jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,flexDirection:"column",rowSpacing:5,columnSpacing:6,className:s.container,"data-test":"app-new-headerbar-step-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(ApplicationHeaderbarToggle,{checked:a.headerbarEnabled,onChange:e=>{t(actions.appFormState.updateAppFormField({field:"headerbarEnabled",value:e.target.checked}))},disabled:lodash.exports.isEmpty(a.url)})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(CustomizeApplicationHeaderbar,{handleOnValidate:e})}))]}))};const useStyles$6=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},grayText:{color:"gray"},textInput:{boxSizing:"content-box"}})),ConfigFields=()=>{const a=useDispatch(),s=useSelector(selectConfigFields),e=e=>lodash.exports.map(e,e=>({name:e.name,configLevel:e.configLevel,type:e.type,default:isEmpty_1(e.defaultValue)?"N/A":e.defaultValue})),[i,n]=react.exports.useState(e(s));react.exports.useEffect(()=>{n(e(s))},[s]);const t=(e=!1,t=-1)=>{e={name:"APP_CENTER_CONFIG_FIELDS_FORM",config:{name:"Custom Fields",isEdit:e,editIndex:t}};a(mountPanel({panelId:"APP_CENTER_CONFIG_FIELDS_FORM",microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-config-fields",heading:"Application Config Fields",description:"Does your application require config fields? If so, specify them here. Leave blank if not..",actionButtonLabel:"Add Config",items:lodash.exports.map(i,e=>({data:e})),columnNames:["Name","Config Level","Type","Default","",""],canEdit:!0,canDelete:!0,onActionClick:()=>t(),onEditClick:e=>{e=i[e],e=findIndex_1(s,{name:e.name,type:e.type});0<=e&&t(!0,e)},onDeleteClick:e=>{var t=i[e],t=findIndex_1(s,{name:t.name,type:t.type});0<=t&&a(actions.appFormState.removeConfigField({removeIndex:t,configToDelete:s[e]}))},onRequestSort:(e,t)=>{n(orderBy_1(i,lowerCase_1(e),t))}})},CME_PANEL_NAME="APP_CENTER_CONTEXT_MENU_EXTENSIONS",ContextMenuExtensions=()=>{const s=useDispatch(),a=useSelector(selectContextMenuExtensions),e=e=>{return lodash.exports.isNil(e)?[]:Object.values(e).flat().map(e=>({id:e.id,type:e.type,label:e.label,url:e.url||""}))},[i,n]=react.exports.useState(e(a)),o=(react.exports.useEffect(()=>{n(e(a))},[JSON.stringify(a)]),(e=!1,t=void 0,a=-1)=>{e={name:CME_PANEL_NAME,config:{name:"Context Menu Extensions",isEdit:e,extensionType:t,editIndex:a}};s(mountPanel({panelId:CME_PANEL_NAME,microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))}),r=e=>{var e=i[e],t=a[e.type+"s"];return{index:lodash.exports.findIndex(t,["id",e.id]),type:e.type}};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-context-menu-extensions",heading:"Context Menu Extensions",description:"Add a menu option to files in aiWare that allow users to send them to your application",actionButtonLabel:"Add Context Menu Extension",items:lodash.exports.map(i,e=>({data:lodash.exports.omit(e,"id")})),columnNames:["Type","Label","URL","",""],canEdit:!0,canDelete:!0,onActionClick:()=>o(),onEditClick:e=>{var{index:e,type:t}=r(e);0<=e?o(!0,t,e):console.log("Extension not found",e,t)},onDeleteClick:e=>{var{index:e,type:t}=r(e);0<=e&&s(actions.appFormState.removeContextMenuExtension({extensionType:t,index:e}))},onRequestSort:(e,t)=>{n(lodash.exports.orderBy(i,lodash.exports.lowerCase(e),t))}})},FunctionalityStep=({handleOnValidate:e})=>{var t=useStyles$6()["classes"];const a=useDispatch();var s=useSelector(selectAppUrl);const i=useForm({mode:"onChange",defaultValues:{url:s}});react.exports.useEffect(()=>{null!=e&&e(i.formState.isValid)},[i.formState.isValid]);return jsxRuntime.exports.jsx(FormProvider,Object.assign({},i,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container,"data-test":"os-app-center-new-functionality-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.application-url-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-url-title-formattedMessage",defaultMessage:"Application URL",description:"Application url title"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption","data-test":"os-app-center-new.application-url-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.integration-description-formattedMessage",defaultMessage:"Provide the url to access your application. Include http or https. If provided, your application will appear in the app switcher.",description:"Application url description"})})),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsx(InputText,{className:t.textInput,type:"url","data-test":"os-app-center-new.url-input",rules:{pattern:{value:urlRegex,message:"Must be a valid URL including protocol."}},onChange:e=>{var{name:e,value:t}=e.target;a(actions.appFormState.updateAppFormField({field:e,value:t}))},placeholder:"URL",name:"url",fullWidth:!0})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ConfigFields,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ContextMenuExtensions,{})}))]}))}))},useStyles$5=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px",marginTop:"9px",marginRight:"15px",background:"#214167"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},checked:{color:"#6098D1"},textInput:{boxSizing:"content-box"}})),useOneClickCopy=a=>{const[t,s]=react.exports.useState(!1);return[e=>{var t;navigator.clipboard.writeText(null!=(t=a.current.dataset.copyToClipboardText)?t:a.current.innerText).catch(e=>{console.error("Error copying to clipboard: ",e)}),s(!0)},e=>jsxRuntime.exports.jsx(Tooltip,Object.assign({open:t,onClose:()=>{s(!1)},title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-copied-to-clipboard",defaultMessage:"Copied to clipboard",description:"Copied to clipboard"})},e,{children:e.children}))]};var OAuthClientSecret=({appId:a,disabled:e})=>{const s=useSelector(selectApiConfigs),[t,i]=react.exports.useState(""),[n,o]=react.exports.useState(!1),[r,p]=react.exports.useState(!1),[l,d]=react.exports.useState(!1);var c=react.exports.useRef();const[u,x]=useOneClickCopy(c);react.exports.useEffect(()=>{!lodash.exports.isEmpty(t)&&l&&(u(null),d(!1))});const m=react.exports.useRef();const[g,h]=react.exports.useState(!1),[f,j]=react.exports.useState(!1);const[y,b]=react.exports.useState(!1);return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"column",spacing:2,"data-test":"oauth-client-secret-retrival-tool"},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-label-formattedMessage",defaultMessage:"Client Secret: OAuth",description:"Lable for the client secret input when selecting OAuth"})}))})),jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2,alignItems:"center",width:"60%"},{children:[jsxRuntime.exports.jsx(x,{children:jsxRuntime.exports.jsx(InputText,{name:"oauthClientSecret",fullWidth:!0,disabled:!0,ref:c,"data-copy-to-clipboard-text":t,id:"clientSecret",color:"secondary",style:{backgroundColor:"#F2F5F9"},type:f?"text":"password",size:"small",value:lodash.exports.isEmpty(t)?Array(54).fill("x").join(""):t,InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"data-test":"oauth-client-secret-reveal","aria-label":"toggle client secret visibility",onClick:()=>{lodash.exports.isEmpty(t)?h(!0):j(!f)},disabled:e},{children:f?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))}})}),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"copy client secret",onClick:e=>{lodash.exports.isEmpty(t)?(d(!0),h(!0)):u(e)},disabled:e,"data-test":"oauth-client-secret-copy"},{children:jsxRuntime.exports.jsx(Copy,{})}))]})),jsxRuntime.exports.jsxs(Collapse,Object.assign({in:g},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-password-input-label-formattedMessage",defaultMessage:"Please enter your account password to reveal client secret",description:"Lable for the client secret password input when selecting OAuth"})}))})),jsxRuntime.exports.jsx("form",Object.assign({onSubmit:e=>{e.preventDefault();var t,e=null==(e=m.current)?void 0:e.value;lodash.exports.isEmpty(e)||(t=e,__awaiter(void 0,void 0,void 0,function*(){console.log("handleFetchClientSecret Start");try{o(!0);var e=yield getOAuthClientSecret(s,{id:a,password:t});console.log("Result:",e),i(e.application.clientSecret),h(!1)}catch(e){m.current.focus(),p(!0)}finally{o(!1)}}).catch(e=>{console.error("Error fetching client secrets: ",e)}))}},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2},{children:[jsxRuntime.exports.jsx(InputText,{autoComplete:"on",autoCorrect:"off",name:"password",InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"toggle password visibility",onClick:()=>{b(!y)},"data-test":"oauth-client-secret-password-reveal"},{children:y?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))},inputRef:m,id:"password",color:r?"error":"secondary",type:y?"text":"password",size:"small"}),n?jsxRuntime.exports.jsx(CircularProgress,{color:"secondary"}):jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"submit password",type:"submit","data-test":"oauth-client-secret-password-submit"},{children:jsxRuntime.exports.jsx(ArrowForward,{})}))]}))}))]}))]}))};const AuthenticationStep=({handleOnValidate:e})=>{var t=useStyles$5()["classes"];const a=useSelector(selectApp),s=useSelector(selectIsEditForm)["isEditForm"],i=useSelector(selectIsResumeSession),n=useDispatch();const o=useForm({mode:"onChange",defaultValues:{oauthUrl:"",authMethod:"none"}});react.exports.useEffect(()=>{null!=e&&e(o.formState.isValid)},[e,o.formState.isValid,a.authMethod]),react.exports.useEffect(()=>{__awaiter(void 0,void 0,void 0,function*(){(i||s)&&(o.reset(a),setTimeout(()=>__awaiter(void 0,void 0,void 0,function*(){yield o.trigger()}),500))})},[a,i,s,o]);var r=e=>{var{name:e,value:t}=e.target;n(actions.appFormState.updateAppFormField({field:e,value:t}))};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-authentication-step-container"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},o,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Heading,{title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-title-formattedMessage",defaultMessage:"Authentication",description:"Authentication title"}),description:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-description-formattedMessage",defaultMessage:"Default authentication is None. OAuth and JWT authentication protocols coming soon",description:"authentication description"}),testName:"os-app-center-new.authentication"}),jsxRuntime.exports.jsx(Typography,{variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.authentication-title"}),jsxRuntime.exports.jsx(Typography,{variant:"caption","data-test":"os-app-center-new.authentication-description"}),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsxs(InputRadioGroup,Object.assign({"data-test":"authentication-radio-group",name:"authMethod",value:a.authMethod,onChange:r,rules:{required:!0},row:!0},{children:[jsxRuntime.exports.jsx(FormControlLabel,{value:"none",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-none"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",color:"textSecondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-None-formattedMessage",defaultMessage:"None",description:"None"})}))}),jsxRuntime.exports.jsx(FormControlLabel,{value:"oauth",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-oauth"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-OAuth-formattedMessage",defaultMessage:"OAuth",description:"OAuth"})}))})]}))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(Collapse,Object.assign({in:lodash.exports.isEqual(a.authMethod,"oauth")},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:5,"data-test":"authentication-oauth-section"},{children:[jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},name:"oauthUrl",value:a.oauthUrl,onChange:r,fullWidth:!0,variant:"outlined",label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2",style:{color:"lightgray"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-url-formattedMessage",defaultMessage:"OAuth URL",description:"Lable for the oauth url input when selecting OAuth"})})),InputLabelProps:{disableAnimation:!1},rules:{required:lodash.exports.isEqual(a.authMethod,"oauth"),pattern:{value:urlRegex,message:"Must be a valid URL including protocol."},maxLength:1e3}}),s?jsxRuntime.exports.jsx(OAuthClientSecret,{appId:a.id}):jsxRuntime.exports.jsxs(Box,{children:[jsxRuntime.exports.jsx(OAuthClientSecret,{appId:"",disabled:!0}),jsxRuntime.exports.jsx(Typography,Object.assign({color:"secondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-not-available-formattedMessage",defaultMessage:"You will be able to retrieve the oauth client secret here after submitting this application.",description:"Instruction durring application onboarding on how to find oauth client secret after application submission."})}))]})]}))}))}))]}))}))}))},useStyles$4=makeStyles()(e=>({container:{width:"100%",padding:"25px 30px"},subheading:{maxWidth:"100%",minWidth:"48.75rem",padding:"30px 0"},titleDesc:{width:"60%",display:"inline-block"},appLogo:{width:"40%",display:"inline-block"},text:{width:"39.5rem",padding:"14px 0",borderBottom:"0.5px solid #D5DFE9",fontWeight:400},textCollapsible:{width:"39.5rem",padding:"8px 0",borderBottom:"0.5px solid #D5DFE9",cursor:"pointer"},collapse:{width:"39.5rem"},collapseContent:{maxHeight:200,overflow:"auto"},pre:{whiteSpace:"pre-line"},asterisk:{color:"#D43060",margin:"0 2px"}})),useStyles$3=makeStyles()(e=>({root:{borderRadius:"50%",border:"1px solid #D5DFE9",display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",width:e.spacing(8),height:e.spacing(8)},logo:{maxWidth:"100%",maxHeight:"100%"},veritoneLogo:{maxWidth:"100%",maxHeight:"100%"}})),AppLogo=({path:e})=>{var t=useStyles$3()["classes"];return jsxRuntime.exports.jsx("div",Object.assign({className:t.root},{children:jsxRuntime.exports.jsx("img",{className:t.logo+" "+(!e&&t.veritoneLogo),src:e||img$1A,alt:"app logo"})}))},Row=({label:e,value:t,style:a,testName:s,icon:i,asterisk:n,handleOpenCollapse:o,textTransformValue:r="capitalize"})=>jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"space-between",alignItems:"center",textTransform:r,"data-test":s+"-container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6","data-test":"label-"+s},{children:e})),jsxRuntime.exports.jsxs(Box,Object.assign({className:a,display:"flex",justifyContent:"space-between",alignItems:"center",onClick:o},{children:[jsxRuntime.exports.jsxs(Typography,Object.assign({variant:"h6",sx:{fontWeight:400}},{children:[t,n]})),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"expand row",size:"small",onClick:o,"data-test":s+"-expand-action-trigger"},{children:i}))]}))]})),ConfirmationStep=()=>{var e=useStyles$4()["classes"],t=useSelector(selectApp);return jsxRuntime.exports.jsxs(Box,Object.assign({className:e.container,"data-test":"os-app-center-new-confirmation-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.subheading},{children:[jsxRuntime.exports.jsxs("div",Object.assign({className:e.titleDesc},{children:[jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",alignItems:"center",textTransform:"capitalize","data-test":"os-app-center-new-confirmation-step.app-name"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2"},{children:lodash.exports.isEmpty(t.name)?"-":t.name}))})),jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-confirmation-step.app-description"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",color:"#2A323C"},{children:lodash.exports.isEmpty(t.description)?"-":t.description}))}))]})),jsxRuntime.exports.jsx("div",Object.assign({"data-test":"os-app-center-new-confirmation-step.app-logo",className:e.appLogo},{children:jsxRuntime.exports.jsx(AppLogo,{path:t.iconPath})}))]})),jsxRuntime.exports.jsxs(Box,Object.assign({sx:{width:"100%"},"data-test":"os-app-center-new-confirmation-step.row-container"},{children:[jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-url-formattedMessage",defaultMessage:"Application URL:",description:"application url"}),textTransformValue:"none",value:lodash.exports.isEmpty(t.url)?"-":t.url,style:e.text,testName:"os-app-center-new-confirmation-step.app-url"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.custom-fields-formattedMessage",defaultMessage:"Custom Fields:",description:"Custom Fields"}),value:lodash.exports.isEmpty(t.configFields)?"-":lodash.exports.join(lodash.exports.map(t.configFields,e=>e.name),", "),style:e.text,testName:"os-app-center-new-confirmation-step.app-custom-fields"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-headerbar-formattedMessage",defaultMessage:"Headerbar:",description:"headerbar"}),value:t.headerbarEnabled?"On (Default)":"Off",style:e.text,testName:"os-app-center-new-confirmation-step.app-headerbar"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-auth-formattedMessage",defaultMessage:"Authentication:",description:"auth"}),value:"oauth"===t.authMethod?`${lodash.exports.startCase(t.authMethod)} (${lodash.exports.truncate(t.oauthUrl,{length:50})})`:"None (Default)",textTransformValue:"none",style:e.text,testName:"os-app-center-new-confirmation-step.app-auth"})]}))]}))},useBasicInfoStyles=makeStyles()(e=>({container:{padding:e.spacing(6),justifyContent:"space-around","& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},textInput:{padding:26},labelRow:{display:"flex",gap:e.spacing(2),alignItems:"flex-end"},optional:{fontSize:10,marginBottom:e.spacing(1)},select:{"& > div":{fontWeight:400,width:"280px"}}})),useIconImporterStyles=makeStyles()(e=>({iconBox:{display:"flex",justifyContent:"center",alignItems:"center",width:200,height:200,padding:e.spacing(3),border:"1px dashed #D5DFE9",borderRadius:5,transition:"all .2s ease","&:hover":{border:"1px solid #dde6ee"}},innerBox:{position:"relative",background:"#F5F5F5",width:"100%",height:"100%",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center",transition:"all .2s ease","&:hover":{background:"#dde6ee"}},fileInput:{display:"none"},addIcon:{color:"#555F7C",height:42,width:42,"&:hover":{color:"#555F7C"}},iconPreview:{objectFit:"cover",borderRadius:5,width:"100%",maxHeight:"100%"},removeIcon:{top:"90%",right:66}})),useDragAndDrop=({acceptedFileTypes:n})=>{const t=react.exports.useRef(),e=react.exports.useRef(),o=useDispatch();var a=useSelector(preferredLanguageSelector);const r=AIWareFormatMessage(a),s=react.exports.useCallback(e=>{var t,a,s,i;e&&(n.includes(e.type)?5e6<=e.size?o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileSize",defaultMessage:[{type:0,value:"File file size must be less than 5 MB"}]}),severity:MessageSeverity.Warning})):({name:t,size:a,type:s}=e,i=URL.createObjectURL(e),i={id:guid(),previewUrl:i,name:t,size:a,type:s},o(actions.iconUploadState.uploadIconStart({file:i}))):o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileType",defaultMessage:[{type:1,value:"type"},{type:0,value:" is not a supported image type."}]},{type:e.type}),severity:MessageSeverity.Warning})))},[n,o]),i=react.exports.useCallback(e=>{e.preventDefault();e=e.dataTransfer.files[0];s(e)},[s]);const p=e=>{e.preventDefault()};return react.exports.useEffect(()=>{const e=t.current;return e.addEventListener("drop",i),()=>{e.removeEventListener("drop",i)}},[i]),react.exports.useEffect(()=>{const e=t.current;return e&&(e.addEventListener("dragover",p),e.addEventListener("dragleave",p)),()=>{e.removeEventListener("dragover",p),e.removeEventListener("dragleave",p)}},[]),{dropZoneRef:t,fileInputRef:e,handleRemoveFile:e=>{e.stopPropagation(),o(actions.iconUploadState.deleteLocalIcon()),o(actions.appFormState.updateAppFormField({field:"iconPath",value:""}))},handleOpenFilePicker:()=>{e.current.click()},handleIconSelect:e=>{e=e.target.files[0];s(e)}}},acceptedFileTypes=["image/jpeg","image/png","image/gif","image/svg+xml"],IconImporter=({iconPath:e})=>{var t=useSelector(selectIcon),a=useIconImporterStyles()["classes"],{dropZoneRef:s,fileInputRef:i,handleRemoveFile:n,handleIconSelect:o,handleOpenFilePicker:r}=useDragAndDrop({acceptedFileTypes:acceptedFileTypes});return jsxRuntime.exports.jsx("div",Object.assign({className:a.iconBox,ref:s,"data-test":"app-description-icon-dropzone"},{children:e||null!=t&&t.previewUrl?jsxRuntime.exports.jsxs("div",Object.assign({className:a.innerBox,style:{backgroundColor:"transparent"}},{children:[jsxRuntime.exports.jsx(IconButton,Object.assign({style:{position:"absolute"},"data-test":"app-description-icon-remove",className:a.removeIcon,size:"small",onClick:n},{children:jsxRuntime.exports.jsx(default_1$2,{})})),jsxRuntime.exports.jsx("img",{src:(null==t?void 0:t.previewUrl)||e,alt:(null==t?void 0:t.name)||"Icon",className:a.iconPreview,"data-test":"app-description-icon-preview"})]})):jsxRuntime.exports.jsxs(Button,Object.assign({className:a.innerBox,onClick:r},{children:[jsxRuntime.exports.jsx("input",{accept:"image/jpeg, image/png",type:"file",ref:i,className:a.fileInput,onChange:o}),jsxRuntime.exports.jsx(default_1$3,{className:a.addIcon})]}))}))},BasicInfo=({onValidate:e})=>{var t=useBasicInfoStyles()["classes"];const a=useIntl(),s=useDispatch(),i=useSelector(selectApp),n=useSelector(selectIsResumeSession),o=useSelector(selectApps);var r=useSelector(selectAppPackageDistributionType),p={name:i.name,description:i.description};const l=useForm({mode:"onChange",defaultValues:p}),d=(react.exports.useEffect(()=>{e(l.formState.isValid)},[l.formState.isValid]),react.exports.useEffect(()=>{__awaiter(void 0,void 0,void 0,function*(){n&&(l.reset(i),setTimeout(()=>__awaiter(void 0,void 0,void 0,function*(){yield l.trigger()}),500))}).catch(e=>{console.error("Error validating information: ",e)})},[n]),(e,t)=>{s(actions.appFormState.updateAppFormField({field:e,value:t}))});p=e=>{var{name:e,value:t}=e.target;d(e,t)};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"basic-info"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},l,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,rowSpacing:4,columnSpacing:10,"data-test":"app-description"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,item:!0,xs:12,sm:8,rowSpacing:2,columnSpacing:6},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12,sm:6},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.name-description-label",defaultMessage:"Name & Description",description:"Name & Description"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-description-caption",defaultMessage:"Provide a name and description to let users know what your application does.",description:"application name and description caption"})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},"data-test":"app-description-input-name",variant:"outlined",sx:{marginBottom:3},placeholder:"Application Name",name:"name",value:i.name,onChange:p,fullWidth:!0,rules:{required:!0,maxLength:100,validate:{isNameSame:t=>{return!o.find(e=>e.name.toLowerCase()===t.toLowerCase())||a.formatMessage({id:"os-app-center-new.app-description-input-name-error",defaultMessage:[{type:0,value:"An application with this name already exists"}]})}}}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{InputProps:{className:t.textInput},"data-test":"app-description-input-description",variant:"outlined",placeholder:"Description",name:"description",fullWidth:!0,multiline:!0,rows:10,value:i.description,onChange:p,rules:{required:!0,maxLength:250}})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({container:!0,item:!0,xs:12,sm:4,rowSpacing:4,columnSpacing:6},{children:jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{py:1}},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.icon-image-label",defaultMessage:"App Icon",description:"App Icon"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.image-recommended-label",defaultMessage:"Recommended image size:{br}300x300 .png or .jpg",description:"Recommended image size:{br} 300x300 .png or .jpg",values:{br:jsxRuntime.exports.jsx("br",{})}})}))]})),jsxRuntime.exports.jsx(IconImporter,{iconPath:i.iconPath})]}))})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(EntityTags,{selectedTags:i.entityTags,setSelectedTags:e=>{s(actions.appFormState.updateAppFormField({field:"entityTags",value:e}))}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(DistributionFlags,{description:"Add Distribution Flag for App",selectedFlag:r,engineFlags:engineFlags,handleEngineFlag:({value:e})=>{d("packageDistributionType",e)},idPrefix:"os-app-center-new",inputName:"appPackageDistribution"})}))]}))}))}))},AppOnboardingFlow=()=>{const a=useDispatch(),t=useSelector(selectApp),s=useSelector(selectIsEditForm)["isEditForm"],[e,i]=react.exports.useState(!1);var n=e=>i(e);var n=[jsxRuntime.exports.jsx(BasicInfo,{onValidate:n}),jsxRuntime.exports.jsx(FunctionalityStep,{handleOnValidate:n}),jsxRuntime.exports.jsx(HeaderbarStep,{handleOnValidate:n}),jsxRuntime.exports.jsx(AuthenticationStep,{handleOnValidate:n}),jsxRuntime.exports.jsx(ConfirmationStep,{})],o=[jsxRuntime.exports.jsx(Button,Object.assign({"data-test":"app-new-submit-app-button",variant:"contained",color:"primary",onClick:()=>{var e;e=!1,s?a(actions.appFormState.updateAppStart({app:t,openBuildPanel:e})):a(actions.appFormState.createAppStart({app:t,openBuildPanel:e}))}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.{idPrefix}-app-button",defaultMessage:"{verb}",description:"{verb} app button text",values:{idPrefix:s?"update":"submit",verb:s?"Update":"Submit"}})}),"submit-app-button")];return jsxRuntime.exports.jsx(ProgressStepper,{panelName:"APP_CENTER_NEW",sessionKey:"appOnboardingSession",entityId:t.id,onResumeSession:e=>{var t=lodash.exports.omit(e,"eventHandlers"),e=lodash.exports.get(e,"eventHandlers");a(actions.appEventsPanelState.resumeSession(e)),a(actions.appFormState.resumeSession(t))},steps:["Basic Info","Functionality","Headerbar","Authentication","Review"],stepContent:n,customFinalStepButtons:o,nextButtonDisabled:!e,idPrefix:"app-center-new-aob"})},appBarHeight$1=55,headerHeight=64,borderBottom$1=5,useStyles$2=makeStyles()(e=>({ecnPanel:{height:`calc(100vh - ${appBarHeight$1}px - ${headerHeight}px - ${borderBottom$1}px)`}})),MainLayout=({appId:e})=>{var t=useStyles$2()["classes"];const a=useDispatch();var s=useSelector(selectIsLoadingExistingAppData)["isLoadingExistingAppData"];return react.exports.useEffect(()=>{e?a(actions.appFormState.editApp(e)):a(actions.appFormState.createNewApp())},[]),jsxRuntime.exports.jsx("div",Object.assign({role:"presentation","data-test":"app-center-new-widget",className:t.ecnPanel},{children:s?jsxRuntime.exports.jsx(Box,Object.assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},{children:jsxRuntime.exports.jsx(CircularProgress,{})})):jsxRuntime.exports.jsx(AppOnboardingFlow,{})}))},AppCenterNew=e=>jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getAppCenterNewModule()]},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(MainLayout,Object.assign({},e))})})}))}),appBarHeight=55,borderBottom=5,mainHeight=`calc(100vh - ${appBarHeight+borderBottom}px)`,useStyles$1=makeStyles()(e=>({root:{display:"flex",flexFlow:"column",height:mainHeight},container:{padding:e.spacing(5),"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{width:"100%"},optional:{fontSize:12,marginBottom:e.spacing(1),marginLeft:e.spacing(1),color:"#9CA8B4"}})),ConfigFieldsForm=({hidePanel:t,isEdit:a=!1,editIndex:s=-1})=>{var e=useStyles$1()["classes"],i=useSelector(preferredLanguageSelector);const n=AIWareFormatMessage(i),o=useDispatch(),r=useSelector(selectApp),p=useSelector(selectConfigFields);var i=()=>a&&0<=s?p[s]:{name:"",configLevel:AppConfigLevel.Organization,type:AppConfigType.String,required:!1,defaultValue:""},l=i();const d=useForm({mode:"onChange",defaultValues:l}),[c,u]=react.exports.useState(i().type),[x,m]=react.exports.useState(i().configLevel);return jsxRuntime.exports.jsx(FormProvider,Object.assign({},d,{children:jsxRuntime.exports.jsxs("form",Object.assign({className:e.root,onSubmit:d.handleSubmit(e=>{a?o(actions.appFormState.updateConfigField({configFields:e,index:s,name:p[s].name})):lodash.exports.isEmpty(r.id)?o(actions.appFormState.addConfigField(e)):o(actions.appFormState.createConfigField({newConfigField:e,appId:r.id})),t()})},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.container,container:!0,spacing:5,"data-test":"app-new-config-fields-form-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-new-config-fields-header-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title",defaultMessage:"{label} Config Fields",description:"Form label for supported file types",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title-close",defaultMessage:"Close",description:"Form label for close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-description-input-icon"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-name"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-name",defaultMessage:"Name",description:"You can set a field name"})})),jsxRuntime.exports.jsx(InputText,{inputProps:{maxLength:50,className:e.textInput},variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-new-config-fields-name-content",rules:{required:!0,maxLength:50,validate:{isNameSame:a=>{return!p.find((e,t)=>t!==s&&e.name===a)||n({id:"os-app-center-new.config-name-error",defaultMessage:[{type:0,value:"Please select a different name"}]})}}}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-description",defaultMessage:"Description",description:"You can set a field description"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",name:"description",fullWidth:!0,multiline:!0,rows:5,"data-test":"app-new-config-fields-description-content",inputProps:{maxLength:250},InputProps:{className:e.textInput},rules:{required:!0,maxLength:250}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-config-level"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.config-level",defaultMessage:"Config Level",description:"You can set a config level"})})),jsxRuntime.exports.jsxs(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"configLevel",value:x,defaultValue:x,onChange:e=>{d.setValue("configLevel",e.target.value),m(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-level-content",rules:{required:!0}},{children:[jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"Organization"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-organization",defaultMessage:"Organization",description:"You can set a config level"})})),jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"User"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-user",defaultMessage:"User",description:"You can set a config level"})}))]}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-type"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-type",defaultMessage:"Type",description:"You can set a field type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"type",value:c,onChange:e=>{d.setValue("type",e.target.value),u(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-fields-type-content",rules:{required:!0}},{children:map_1(keys_1(AppConfigType),(e,t)=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:AppConfigType[e]},{children:AppConfigType[e]}),t))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(SchemaOrText,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"12.5px 0 0 25px"}},{children:jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:jsxRuntime.exports.jsx(InputCheckbox,{name:"required",defaultChecked:l.required,label:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.required-checkbox",defaultMessage:"Make Required",description:"Required field checkbox"})})}))}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!get_1(d,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-new-config-fields-button-submit"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-config-fields.submit-button-label",defaultMessage:"{label}",description:"{label} Config Fields",values:{label:a?"Update":"Add"}})}))}))]}))}))},AppCenterConfigFieldsForm=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ConfigFieldsForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex})})})}),useStyles=makeStyles()(e=>({form:{display:"flex",flexDirection:"column",height:"100%"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{textTransform:"capitalize"}})),ContextMenuExtensionForm=({hidePanel:t,isEdit:a,editIndex:s,extensionType:i})=>{var e=useStyles()["classes"];const n=useDispatch();var o=useSelector(selectIsEditForm)["isEditForm"],r=useSelector(selectPrevContextMenuExtensions);const p=useSelector(selectContextMenuExtensions);r=a&&lodash.exports.findIndex(r[i+"s"],e=>lodash.exports.isMatch(e,p[i+"s"][s]))<0,o=a&&o&&!r,r=useForm({mode:"onChange",defaultValues:a&&0<=s&&!lodash.exports.isNil(i)?p[i+"s"][s]:{label:"",url:"",type:""}});const l=r.watch("type");return jsxRuntime.exports.jsx(Box,Object.assign({sx:{p:6,height:"calc(100vh - 60px)"}},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},r,{children:jsxRuntime.exports.jsxs("form",Object.assign({onSubmit:r.handleSubmit(e=>{a&&0<=s&&!lodash.exports.isNil(i)?n(actions.appFormState.updateContextMenuExtension({extensionType:i,index:s,extension:e})):(e.id=v4(),n(actions.appFormState.addContextMenuExtension({extension:e}))),null!=t&&t()}),className:e.form},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,direction:"column",spacing:8,"data-test":"app-center-new.context-menu-extension.panel-container",flexWrap:"nowrap"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-center-new.context-menu-extension.panel-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title",defaultMessage:"{label} a Context Menu Extension",description:"Panel title for context menu extension form",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title-close",defaultMessage:"Close",description:"Close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-center-new.context-menu-extension.close-button"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.type-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.type-header-text",defaultMessage:"Type",description:"You can set a type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({name:"type",fullWidth:!0,disabled:o,rules:{required:!0},className:e.inputSelect,"data-test":"app-center-new.context-menu-extension.type-input"},{children:Object.values(ContextMenuExtensionType).map(e=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:e,"data-test":"app-center-new.context-menu-extension.type-input."+e},{children:"tdo"===e?"Media (Temporal Data Objects)":e}),e))}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.label-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.label-header",defaultMessage:"Label",description:"You can set a label"})})),jsxRuntime.exports.jsx(InputText,{name:"label",fullWidth:!0,rules:{required:!0,maxLength:50,validate:t=>{var e;return!!lodash.exports.isEmpty(null===p||void 0===p?void 0:p[l+"s"])||!(!(a&&0<=s)||lodash.exports.isNil(i))||(e=null==(e=p[l+"s"])?void 0:e.find(e=>e.label===t),!!lodash.exports.isNil(e))||"Label already exists for this type."}},"data-test":"app-center-new.context-menu-extension.label-input"})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.url-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.url-header",defaultMessage:"Open a URL in a new tab (optional)",description:"You can set a url"})})),jsxRuntime.exports.jsx(InputText,{placeholder:l&&`https://example.com?${l}Id=\${${l}Id}`,name:"url",fullWidth:!0,rules:{maxLength:255,validate:e=>!!lodash.exports.isEmpty(e)||(urlRegex.test(e)?!!lodash.exports.includes(e,"${"+l+"Id}")||"URL must contain ${"+l+"Id}":"Must be a valid URL including protocol.")},"data-test":"app-center-new.context-menu-extension.url-input"})]}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!lodash.exports.get(r,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-center-new.context-menu-extension.submit-button"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.submit-button-text",defaultMessage:"{label}",description:"{label} Context Menu Extension",values:{label:a?"Update":"Add"}})}))}))]}))}))}))},ContextMenuExtensionPanel=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ContextMenuExtensionForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex,extensionType:e.extensionType})})})});export{AppCenterConfigFieldsForm,ContextMenuExtensionPanel as AppCenterContextMenuExtensionPanel,AppCenterNew};
156
+ `;return yield baseGraphQLApiWithError(Object.assign({query:t,variables:{id:s},operationName:e},a))}),updateApplication=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="updateApplication";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation updateApplication ($input: UpdateApplication!) {\n updateApplication (input: $input) {\n id\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),bulkDeleteContextMenuExtensions=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="bulkDeleteContextMenuExtensions";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation bulkDeleteContextMenuExtensions ($input: BulkDeleteContextMenuExtensions!) {\n bulkDeleteContextMenuExtensions (input: $input) {\n mentions {\n id\n label\n url\n type\n }\n tdos {\n id\n label\n url\n type\n }\n watchlists {\n id\n label\n url\n type\n }\n collections {\n id\n label\n url\n type\n }\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),deleteConfigField=(t,a,s)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionDelete";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionDelete($appId: ID! $configKey: String!) {\n applicationConfigDefinitionDelete(\n input: {\n appId: $appId\n configKey: $configKey\n }\n )\n {\n success\n code\n msg\n }\n }\n ",variables:{appId:a,configKey:s},operationName:e},t))}),updateConfigField=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionUpdate";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionUpdate($input: [ApplicationConfigDefinitionUpdateInput]) {\n applicationConfigDefinitionUpdate(input: $input)\n {\n records {\n applicationId\n configKey\n }\n }\n }",variables:{input:a},operationName:e},t))}),getApplicationConfigFields=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinition";return yield baseGraphQLApiWithError(Object.assign({query:"\n query applicationConfigDefinition ($appId: ID!) {\n applicationConfigDefinition(appId: $appId) {\n records {\n applicationId\n configKey\n configType\n configLevel\n description\n defaultValue\n defaultValueJSON\n required\n secured\n }\n }\n\n }\n ",variables:{appId:a},operationName:e},t))}),getOAuthClientSecret=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="getApplicationOatuhClientSecret";return yield baseGraphQLApiWithError(Object.assign({query:"query getApplicationOatuhClientSecret($id: ID!, $password: String!) {\n application(id: $id) {\n id,\n clientSecret(password: $password)\n }\n }",variables:a,operationName:e},t))}),getSchemasByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getSchemasByDataRegistryName";return yield baseGraphQLApiWithError(Object.assign({query:"\n query getSchemasByDataRegistryName($name:String){\n dataRegistries(\n name: $name\n ){\n records {\n id\n name\n modifiedDateTime\n schemas {\n records {\n id\n dataRegistryId\n modifiedDateTime\n majorVersion\n minorVersion\n }\n }\n }\n }\n }\n ",variables:e,operationName:t},a))}),getEvents$1=t=>__awaiter(void 0,void 0,void 0,function*(){var e="systemEvents";return yield baseGraphQLApiWithError(Object.assign({query:'\n query systemEvents {\n events (application: "system", limit: 9999) {\n records {\n id\n eventName\n eventType\n description\n }\n }\n }\n ',operationName:e},t))});function*searchFlows(e){yield delay(200),yield put(actions.flowLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getFlowsByName,t,{name:e.payload});yield put(actions.flowLinkingPanelState.updateFlowLinkingPanelField({field:"searchResults",value:a.engines.records})),yield put(actions.flowLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.flowLinkingPanelState.fetchingDone())}}function*watchSearchFlows(){yield takeLatest$1(actions.flowLinkingPanelState.searchByTerm.type,searchFlows)}const flowsSagas=[fork(watchSearchFlows)];function*searchSchemas(e){yield delay(200),yield put(actions.schemaLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getSchemasByName,t,{name:e.payload});yield put(actions.schemaLinkingPanelState.updateSchemaLinkingPanelField({field:"searchResults",value:lodash.exports.map(a.dataRegistries.records,e=>{var t=lodash.exports.reduce(e.schemas.records,(e,t)=>t.majorVersion>e.majorVersion||t.majorVersion==e.majorVersion&&t.minorVersion>e.minorVersion?t:e);return t?{id:t.id,dataRegistryId:t.dataRegistryId,name:e.name,modifiedDateTime:t.modifiedDateTime,version:`v${t.majorVersion}.`+t.minorVersion}:null}).filter(e=>!(!e||!e.name))})),yield put(actions.schemaLinkingPanelState.fetchingDone())}catch(e){yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.schemaLinkingPanelState.fetchingDone())}}function*watchSearchSchemas(){yield takeLatest$1(actions.schemaLinkingPanelState.searchByTerm.type,searchSchemas)}const schemasSagas=[fork(watchSearchSchemas)];function*searchEngines(e){yield delay(200),yield put(actions.engineLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEnginesByName,t,{name:e.payload}),s=lodash.exports.filter(a.engines.records,e=>"c5458876-43d2-41e8-a340-f734702df04a"!==e.category.id);yield put(actions.engineLinkingPanelState.updateEngineLinkingPanelField({field:"searchResults",value:s})),yield put(actions.engineLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.engineLinkingPanelState.fetchingDone())}}function*watchSearchEngines(){yield takeLatest$1(actions.engineLinkingPanelState.searchByTerm.type,searchEngines)}const enginesSagas=[fork(watchSearchEngines)];function*getEvents(e){yield delay(0),yield put(actions.appEventsPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEvents$1,t);yield put(actions.appEventsPanelState.updateEventsPanelField({field:"searchResults",value:a.events.records})),yield put(actions.appEventsPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.appEventsPanelState.fetchingDone())}}function*watchGetEvents(){yield takeLatest$1(actions.appEventsPanelState.getEvents.type,getEvents)}const appEventsSagas=[fork(watchGetEvents)],supportedAppFields$1=["id","name","isPublic","key","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","contextMenuExtensions","eventEndpoint","entityTags","headerbarEnabled","applicationHeaderbar","packageDistributionType"],formatApp$1=t=>{const a={checkPermissions:t.checkPermissions||!1,name:t.name,key:lodash.exports.snakeCase(t.name)};return supportedAppFields$1.forEach(e=>{if(!lodash.exports.isNil(t[e])){if("applicationHeaderbar"===e)return t.headerbarEnabled&&(a.headerbar=t[e]);a[e]=t[e]}}),lodash.exports.isNil(t.iconPath)||(a.iconUrl=t.iconPath),lodash.exports.isNil(t.oauthUrl)||lodash.exports.isEmpty(t.oauthUrl)||(a.oauth2RedirectUrls=[t.oauthUrl]),a};function*createNewApplication(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"];if(lodash.exports.isNil(e))throw new Error("Empty app not allowed!");var a=yield select(selectApiConfigs);try{var s,i=formatApp$1(e),n=yield call(createApplication,a,i),{flows:o,engines:r,schemas:p}=e;lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)&&lodash.exports.isEmpty(p)||(s={id:n.id},lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)||(s.engines={add:[...lodash.exports.map(o,e=>e.id),...lodash.exports.map(r,e=>e.id)],remove:[]}),lodash.exports.isEmpty(p)||(s.dataRegistries={add:lodash.exports.map(p,e=>e.dataRegistryId),remove:[]}),yield call(updateAppComponents,a,s)),lodash.exports.isEmpty(e.configFields)||(yield call(createAppConfig,a,n.id,e.configFields)),yield put(actions.appFormState.createAppSuccess(n.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appCreateSuccess",defaultMessage:[{type:0,value:"Application successfully created"}]}),severity:MessageSeverity.Success})),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){i=lodash.exports.get(e[0],"data.validationErrors[0].message")||"Application onboarding failed";yield put(actions.appFormState.createAppFailed(e[0].message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appOnboardingFailed",defaultMessage:[{type:1,value:"message"}]},{message:i}),severity:MessageSeverity.Error}))}}function*watchNewApplicationCreateStart(){yield takeLatest$1(actions.appFormState.createAppStart.type,createNewApplication)}const newApplicationSagas=[fork(watchNewApplicationCreateStart)],root="undefined"!=typeof window?window:global,fileUploadChannel=(root.xhrInstances={},channel());function*uploadIcon(t){const a=t.payload.file;t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);try{var e=yield call(getUrlBucket,a.name);const i=Object.assign(Object.assign({},a),{status:IconImportStatus.Uploading,percentComplete:0,expiresInSeconds:e.expiresInSeconds,getUrl:e.getUrl,key:e.key,unsignedUrl:e.unsignedUrl,url:e.url}),n=(yield put(actions.iconUploadState.updateIcon(i)),e=>{fileUploadChannel.put(actions.iconUploadState.updateIcon(Object.assign({id:a.id},e)))});var s=yield uploadFileToS3(e,a,{onProgress:e=>{n({percentComplete:e}),sdkEventManager.dispatch(SdkEvents.fileUploadProgress,null,e)},onAbort:e=>{n({status:IconImportStatus.Aborted}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e,"abort"),i)},onError:e=>{n({status:IconImportStatus.Failed}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e),i)},onUpload:e=>{n({status:IconImportStatus.Uploaded}),sdkEventManager.dispatch(SdkEvents.fileUpload,null,i)}});root.xhrInstances[a.id]=s,yield put(actions.iconUploadState.uploadIconSuccess()),yield put(actions.appFormState.updateAppFormField({field:"iconPath",value:i.getUrl}))}catch(e){yield put(actions.iconUploadState.uploadIconFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.iconUploadFail",defaultMessage:[{type:0,value:"Icon upload failed, please try again."}]}),severity:MessageSeverity.Error}))}}function*getUrlBucket(e){var t=yield select(selectApiConfigs);return yield call(getSignedWritableUrl,t,e)}function*watchUploadIconStart(){yield takeLatest$1(actions.iconUploadState.uploadIconStart.type,uploadIcon)}function*watchProgressChannel(){var e=yield take(fileUploadChannel);yield put(e)}const urlRegex=/^https?:\/\/([a-zA-Z0-9@:%._\+~#=]{2,256}\.)?[a-z0-9-]{2,256}\.[a-z]{2,10}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,semverRegex=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]?\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,supportedAppFields=["id","name","isPublic","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","eventEndpoint","entityTags","headerbarEnabled","applicationHeaderbar","packageDistributionType"],formatApp=a=>{const t={checkPermissions:a.checkPermissions||!1,name:a.name,id:a.id};if(lodash.exports.forEach(supportedAppFields,e=>{if(!lodash.exports.isNil(a[e])){if("applicationHeaderbar"===e)return a.headerbarEnabled&&(t.headerbar=a[e]);t[e]=a[e]}}),lodash.exports.isNil(a.iconPath)||(t.iconUrl=a.iconPath),!lodash.exports.isEmpty(a.contextMenuExtensions)){const s={mentions:[],tdos:[],watchlists:[],collections:[]};lodash.exports.forEach(lodash.exports.keys(a.contextMenuExtensions),t=>{lodash.exports.forEach(a.contextMenuExtensions[t],e=>{s[t].push({id:e.id,label:e.label,url:e.url})})}),t.contextMenuExtensions=s}return"oauth"===a.authMethod?t.oauth2RedirectUrls=[a.oauthUrl]:"none"===a.authMethod&&(t.oauth2RedirectUrls=null),t},decodeApp=(e,t,a)=>{const s=[],i=[];lodash.exports.map(lodash.exports.get(e.components.engines,"records"),e=>{("c5458876-43d2-41e8-a340-f734702df04a"===e.categoryId?s:i).push(e)});var a=lodash.exports.map(lodash.exports.get(a.applicationConfigDefinition,"records"),e=>{return{id:e.applicationId,name:e.configKey,type:e.configType,configLevel:AppConfigLevel[e.configLevel],required:e.required,description:e.description,defaultValue:e.defaultValue,secured:!1}});return{id:e.id,name:e.name,description:e.description,entityTags:lodash.exports.map(e.entityTags,e=>({tagKey:e.tagKey,tagValue:e.tagValue})),configFields:a,url:e.url,oauthUrl:null==(a=e.oauth2RedirectUrls)?void 0:a[0],authMethod:lodash.exports.isEmpty(e.oauth2RedirectUrls)?"none":"oauth",iconPath:e.iconUrl,flows:s,engines:i,headerbarEnabled:e.headerbarEnabled,schemas:lodash.exports.map(lodash.exports.get(e.components.dataRegistries,"records"),e=>{return{dataRegistryId:e.id,name:e.name,modifiedDateTime:e.modifiedDateTime,version:(e=e.publishedSchema)?e.majorVersion+"."+e.minorVersion:""}}),contextMenuExtensions:e.contextMenuExtensions,applicationHeaderbar:null!=(a=e.applicationHeaderbar)?a:{name:"",config:{backgroundColor:"",help:!1,logoSrc:"",notification:!1}},packageDistributionType:lodash.exports.last(lodash.exports.sortBy(t.records,e=>semverRegex.exec(e.version))).distributionType}};function*queryAppDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplication,t,e)}function*queryAppConfigFieldDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplicationConfigFields,t,e)}function*editApp(e){var t=yield queryAppDetails(e.payload),e=yield queryAppConfigFieldDetails(e.payload);yield put(actions.appFormState.setEditAppExistingData(decodeApp(t.application,t.packages,e)))}function*updateApp(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"],a=yield select(selectApiConfigs);try{var s,i,n,o,r=formatApp(e),p=yield call(updateApplication,a,r),{flows:l,flowsToDelete:d,engines:c,enginesToDelete:u,schemas:x,schemasToDelete:m,contextMenuExtensionIdsForBulkDelete:g}=e,h=(lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(d)&&lodash.exports.isEmpty(u)&&lodash.exports.isEmpty(m)||(s={id:p.id},i=lodash.exports.differenceBy(d,l,"id"),n=lodash.exports.differenceBy(u,c,"id"),o=lodash.exports.differenceBy(m,x,"dataRegistryId"),lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(i)&&lodash.exports.isEmpty(n)||(s.engines={add:[...lodash.exports.map(l,e=>e.id),...lodash.exports.map(c,e=>e.id)],remove:[...lodash.exports.map(i,e=>e.id),...lodash.exports.map(n,e=>e.id)]}),lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(o)||(s.dataRegistries={add:lodash.exports.map(x,e=>e.dataRegistryId),remove:lodash.exports.map(o,e=>e.dataRegistryId)}),yield call(updateAppComponents,a,s),lodash.exports.isEmpty(g))||(yield call(bulkDeleteContextMenuExtensions,a,g)),yield put(actions.appFormState.createAppSuccess(p.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.app-update-success",defaultMessage:[{type:0,value:"App successfully updated"}]}),severity:MessageSeverity.Success})),{name:"APPLICATION_DETAILS_PANEL",config:{name:"Application Details",applicationId:p.id,disableInstallFeature:!0,headerComponent:jsxRuntime.exports.jsx(PanelHeader,{appId:p.id}),appIsOwned:!0}});yield put(mountPanel({panelId:"APPLICATION_DETAILS_PANEL",microFrontend:h,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,size:"xlarge",zIndex:1001}})),localStorage.removeItem("appOnboardingSession"),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){yield put(actions.appFormState.createAppFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.app-updating-failed",defaultMessage:[{type:0,value:"App updating failed"}]}),severity:MessageSeverity.Error}))}}function*deleteAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configToDelete.id)try{yield call(deleteConfigField,t,e.configToDelete.id,e.configToDelete.name)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-delete-fail",defaultMessage:[{type:0,value:"Config field failed to be deleted"}]}),severity:MessageSeverity.Error}))}}function*updateAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configFields.id){var s={configKey:e.configFields.name,description:e.configFields.description,configLevel:e.configFields.configLevel,configType:AppConfigType[e.configFields.type],defaultValue:e.configFields.defaultValue,required:e.configFields.required,secured:!1},e={input:[{filter:{appId:e.configFields.id,configKey:e.name},update:s}]};try{yield call(updateConfigField,t,e.input)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-update-fail",defaultMessage:[{type:0,value:"Config field failed to be updated"}]}),severity:MessageSeverity.Error}))}}}function*addAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t)try{yield call(createAppConfig,t,e.appId,[e.newConfigField])}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-create-fail",defaultMessage:[{type:0,value:"Config field failed to be created"}]}),severity:MessageSeverity.Error}))}}function*fetchApplications(){var e=yield select(selectApiConfigs),t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);if(e)try{var a=yield call(getApplications,e);yield put(actions.appFormState.fetchApplications(a))}catch(e){yield put(showMessage({content:t({id:"os-app-center-new.get-all-applications-fail",defaultMessage:[{type:0,value:"Fetching applications failed"}]}),severity:MessageSeverity.Error}))}}function*toggleEditApp(e){e=e.payload;if(!e)return yield put(hidePanel("APPLICATION_DETAILS_PANEL"));yield put(mountPanel({panelId:"APP_CENTER_NEW",microFrontend:{name:"APP_CENTER_NEW",config:{name:"Edit app",appId:e}},panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",header:{title:"Edit app",divider:!0},marginTop:55,size:"xlarge",zIndex:1002}})),yield put(hidePanel("APPLICATION_DETAILS_PANEL"))}function*watchEditApp(){yield takeLatest$1(actions.appFormState.editApp.type,editApp)}function*watchUpdateAppStart(){yield takeLatest$1(actions.appFormState.updateAppStart.type,updateApp)}function*watchDeleteConfigField(){yield takeLatest$1(actions.appFormState.removeConfigField.type,deleteAppConfigField)}function*watchUpdateConfigField(){yield takeLatest$1(actions.appFormState.updateConfigField.type,updateAppConfigField)}function*watchCreateConfigField(){yield takeLatest$1(actions.appFormState.createConfigField.type,addAppConfigField)}function*watchGetApplications(){yield takeLatest$1(actions.appFormState.createNewApp.type,fetchApplications)}function*watchToggleEditApp(){yield takeLatest$1(actions.appFormState.toggleEditApp.type,toggleEditApp)}const editAppSagas=[fork(watchEditApp),fork(watchUpdateAppStart),fork(watchDeleteConfigField),fork(watchUpdateConfigField),fork(watchCreateConfigField),fork(watchGetApplications),fork(watchToggleEditApp)];function*updateLocalStorage(){var e=appFormState["selectApp"],t=eventPanelState["selectEventPanel"],e=yield select(e),t=yield select(t);window.localStorage.setItem("appOnboardingSession",JSON.stringify(Object.assign(Object.assign({},e),{eventHandlers:t.handlers})))}function*watchAppForm(){var{appFormState:e,appEventsPanelState:t}=actions,e=[e.updateAppFormField.type,e.updateApplicationHeaderbar.type,e.addConfigField.type,e.createConfigField.type,e.updateConfigField.type,e.removeConfigField.type,e.clearConfigFields.type,e.addContextMenuExtension.type,e.updateContextMenuExtension.type,e.removeContextMenuExtension.type,e.clearContextMenuExtensions.type,t.addHandler.type,t.editHandler.type,t.deleteHandler.type];yield takeLatest$1(e,updateLocalStorage)}const updateAppFormSagas=[fork(watchAppForm)];function*rootSaga(){yield all([watchUploadIconStart(),watchProgressChannel(),...appEventsSagas,...flowsSagas,...enginesSagas,...newApplicationSagas,...schemasSagas,...editAppSagas,...updateAppFormSagas])}function getAppCenterNewModule(){return{id:SLICE_NAME,reducerMap:{[SLICE_NAME]:rootReducer},sagas:[rootSaga],initialActions:[]}}const formattedMessageIdPrefix$2="toggle-switch.",Toggle=e=>{var{checked:t,onChange:a}=e;return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:-1,alignItems:"center"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"off",defaultMessage:"Off",description:"Off lable for aiware headerbar toggle switch"})})),jsxRuntime.exports.jsx(Switch,Object.assign({color:"secondary",id:"toggle-aiware-headerbar",onChange:a},lodash.exports.omit(e,"className"))),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"on",defaultMessage:"On",description:"On lable for aiware headerbar toggle switch"})}))]}))},formattedMessageIdPrefix$1="os-app-center-new.headerbar-step.headerbar-toggle.";var ApplicationHeaderbarToggle=({checked:e=!0,onChange:t,disabled:a})=>jsxRuntime.exports.jsxs(Box,Object.assign({width:"100%","data-test":formattedMessageIdPrefix$1+"container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"title",defaultMessage:"aiWARE Headerbar",description:"Title of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"instructions",defaultMessage:"This allows the aiWARE header to wrap around your app, keeping it self contained.",description:"Instructions of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(FormGroup,{children:jsxRuntime.exports.jsx(Box,{children:jsxRuntime.exports.jsx(Tooltip,Object.assign({title:a&&jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.headerbar.headerbar-toggle-tooltip",defaultMessage:"Headerbar toggle switch is disabled if no application url is provided",description:"Tooltip label for headerbar toggle switch"}),"data-test":"app-center-new.aiware-headerbar-toggle-tooltip"},{children:jsxRuntime.exports.jsx(FormControl,{children:jsxRuntime.exports.jsx(Toggle,{checked:e,onChange:t,"data-test":formattedMessageIdPrefix$1+"toggle",disabled:a})})}))})})]}));const useStyles$8=makeStyles()(e=>({editorImg:{maxWidth:"100%",height:"auto"},container:{"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},divInputColor:{border:"solid #D5DFE9 0.3px",borderRadius:"2px",position:"relative"},textInput:{padding:14.5,boxSizing:"content-box"}})),formattedMessageIdPrefix="os-app-center-new.headerbar-step.customize-headerbar.";var CustomizeApplicationHeaderbar=({handleOnValidate:e})=>{var t=useStyles$8()["classes"];const s=useDispatch(),a=useSelector(selectApp);var i=react.exports.useRef(null),n={name:null==(n=a.applicationHeaderbar)?void 0:n.name,"config.backgroundColor":null==(n=a.applicationHeaderbar)?void 0:n.config.backgroundColor,"config.logoSrc":null==(n=a.applicationHeaderbar)?void 0:n.config.logoSrc,"config.help":null==(n=a.applicationHeaderbar)?void 0:n.config.help,"config.notification":null==(n=a.applicationHeaderbar)?void 0:n.config.notification};const o=useForm({mode:"onChange",defaultValues:n});react.exports.useEffect(()=>{a.headerbarEnabled?null!=e&&e(o.formState.isValid):null!=e&&e(!0)},[o.formState.isValid,a.headerbarEnabled]);var n=e=>{var t=e.target["name"];let a=e.target["value"];"config.zIndex"===t&&(a=Number(a)),s(actions.appFormState.updateApplicationHeaderbar({field:t,value:a}))},r=e=>{var{name:e,checked:t}=e.target;s(actions.appFormState.updateApplicationHeaderbar({field:e,value:t}))};return jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:3,"data-test":formattedMessageIdPrefix+"container"},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{opacity:a.headerbarEnabled?1:.5}},{children:[jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",alignItems:"center",spacing:1},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"title",defaultMessage:"Customize the aiWARE Header",description:"Title of the Customize aiware headerbar section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"optional",defaultMessage:"(Optional)",description:"Optional modifier for titles"})}))]})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"instructions",defaultMessage:"Your inputs will be injected into the header as JSON and can be used to customize the user interface and functionality.",description:"Instructions of the Customize aiware header bar section"})}))]})),a.headerbarEnabled&&jsxRuntime.exports.jsx(Box,{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},o,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,spacing:5,"data-test":formattedMessageIdPrefix+"form-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-name",defaultMessage:"Name",description:"You can set a headerbar name"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-name",inputProps:{maxLength:250,className:t.textInput},rules:{required:!0},onChange:n})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:2},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-backgroundColor",defaultMessage:"Background Color",description:"You can set a headerbar background color"})})),jsxRuntime.exports.jsx("label",{children:jsxRuntime.exports.jsxs("div",Object.assign({"data-test":"div-input-color",className:t.divInputColor},{children:[jsxRuntime.exports.jsx("div",Object.assign({style:{cursor:"pointer",position:"absolute",top:"30%",left:"35%"}},{children:"None"})),jsxRuntime.exports.jsx(InputText,{ref:i,style:""===(null==(i=a.applicationHeaderbar)?void 0:i.config.backgroundColor)||lodash.exports.isNil(null==(i=a.applicationHeaderbar)?void 0:i.config.backgroundColor)?{visibility:"hidden"}:{},variant:"outlined",type:"color",name:"config.backgroundColor",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.backgroundColor",inputProps:{maxLength:250,className:t.textInput},onChange:n})]}))}),jsxRuntime.exports.jsx(Button,Object.assign({onClick:()=>{s(actions.appFormState.updateApplicationHeaderbar({field:"config.backgroundColor",value:""}))}},{children:"Clear"}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-logoSource",defaultMessage:"Logo Source",description:"You can set a headerbar logo source"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"url",placeholder:"URL",name:"config.logoSrc",fullWidth:!0,rules:{pattern:{value:urlRegex,message:"Must be a valid URL including protocol."}},"data-test":"app-center-new.aiware-headerbar-config.logoSrc",inputProps:{maxLength:5e3,className:t.textInput},onChange:n})]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"25px 0 0 25px"}},{children:jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:[jsxRuntime.exports.jsx(InputCheckbox,{name:"config.help",checked:null==(t=null==(i=a.applicationHeaderbar)?void 0:i.config)?void 0:t.help,onChange:r,"data-test":"app-center-new.aiware-headerbar-checkbox-help",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-help",defaultMessage:"Help",description:"Help field checkbox"})}),jsxRuntime.exports.jsx(InputCheckbox,{name:"config.notification",checked:null==(i=null==(n=a.applicationHeaderbar)?void 0:n.config)?void 0:i.notification,onChange:r,"data-test":"app-center-new.aiware-headerbar-checkbox-notification",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-notification",defaultMessage:"Notification",description:"Notification field checkbox"})})]}))}))]}))}))})]}))};const useStyles$7=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)}}));var HeaderbarStep=({handleOnValidate:e})=>{const t=useDispatch(),a=useSelector(selectApp);var s=useStyles$7()["classes"];react.exports.useEffect(()=>{t(actions.appFormState.updateAppFormField({field:"headerbarEnabled",value:!lodash.exports.isEmpty(a.url)}))},[]);return jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,flexDirection:"column",rowSpacing:5,columnSpacing:6,className:s.container,"data-test":"app-new-headerbar-step-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(ApplicationHeaderbarToggle,{checked:a.headerbarEnabled,onChange:e=>{t(actions.appFormState.updateAppFormField({field:"headerbarEnabled",value:e.target.checked}))},disabled:lodash.exports.isEmpty(a.url)})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(CustomizeApplicationHeaderbar,{handleOnValidate:e})}))]}))};const useStyles$6=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},grayText:{color:"gray"},textInput:{boxSizing:"content-box"}})),ConfigFields=()=>{const a=useDispatch(),s=useSelector(selectConfigFields),e=e=>lodash.exports.map(e,e=>({name:e.name,configLevel:e.configLevel,type:e.type,default:isEmpty_1(e.defaultValue)?"N/A":e.defaultValue})),[i,n]=react.exports.useState(e(s));react.exports.useEffect(()=>{n(e(s))},[s]);const t=(e=!1,t=-1)=>{e={name:"APP_CENTER_CONFIG_FIELDS_FORM",config:{name:"Custom Fields",isEdit:e,editIndex:t}};a(mountPanel({panelId:"APP_CENTER_CONFIG_FIELDS_FORM",microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-config-fields",heading:"Application Config Fields",description:"Does your application require config fields? If so, specify them here. Leave blank if not..",actionButtonLabel:"Add Config",items:lodash.exports.map(i,e=>({data:e})),columnNames:["Name","Config Level","Type","Default","",""],canEdit:!0,canDelete:!0,onActionClick:()=>t(),onEditClick:e=>{e=i[e],e=findIndex_1(s,{name:e.name,type:e.type});0<=e&&t(!0,e)},onDeleteClick:e=>{var t=i[e],t=findIndex_1(s,{name:t.name,type:t.type});0<=t&&a(actions.appFormState.removeConfigField({removeIndex:t,configToDelete:s[e]}))},onRequestSort:(e,t)=>{n(orderBy_1(i,lowerCase_1(e),t))}})},CME_PANEL_NAME="APP_CENTER_CONTEXT_MENU_EXTENSIONS",ContextMenuExtensions=()=>{const s=useDispatch(),a=useSelector(selectContextMenuExtensions),e=e=>{return lodash.exports.isNil(e)?[]:Object.values(e).flat().map(e=>({id:e.id,type:e.type,label:e.label,url:e.url||""}))},[i,n]=react.exports.useState(e(a)),o=(react.exports.useEffect(()=>{n(e(a))},[JSON.stringify(a)]),(e=!1,t=void 0,a=-1)=>{e={name:CME_PANEL_NAME,config:{name:"Context Menu Extensions",isEdit:e,extensionType:t,editIndex:a}};s(mountPanel({panelId:CME_PANEL_NAME,microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))}),r=e=>{var e=i[e],t=a[e.type+"s"];return{index:lodash.exports.findIndex(t,["id",e.id]),type:e.type}};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-context-menu-extensions",heading:"Context Menu Extensions",description:"Add a menu option to files in aiWare that allow users to send them to your application",actionButtonLabel:"Add Context Menu Extension",items:lodash.exports.map(i,e=>({data:lodash.exports.omit(e,"id")})),columnNames:["Type","Label","URL","",""],canEdit:!0,canDelete:!0,onActionClick:()=>o(),onEditClick:e=>{var{index:e,type:t}=r(e);0<=e?o(!0,t,e):console.log("Extension not found",e,t)},onDeleteClick:e=>{var{index:e,type:t}=r(e);0<=e&&s(actions.appFormState.removeContextMenuExtension({extensionType:t,index:e}))},onRequestSort:(e,t)=>{n(lodash.exports.orderBy(i,lodash.exports.lowerCase(e),t))}})},FunctionalityStep=({handleOnValidate:e})=>{var t=useStyles$6()["classes"];const a=useDispatch();var s=useSelector(selectAppUrl);const i=useForm({mode:"onChange",defaultValues:{url:s}});react.exports.useEffect(()=>{null!=e&&e(i.formState.isValid)},[i.formState.isValid]);return jsxRuntime.exports.jsx(FormProvider,Object.assign({},i,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container,"data-test":"os-app-center-new-functionality-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.application-url-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-url-title-formattedMessage",defaultMessage:"Application URL",description:"Application url title"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption","data-test":"os-app-center-new.application-url-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.integration-description-formattedMessage",defaultMessage:"Provide the url to access your application. Include http or https. If provided, your application will appear in the app switcher.",description:"Application url description"})})),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsx(InputText,{className:t.textInput,type:"url","data-test":"os-app-center-new.url-input",rules:{pattern:{value:urlRegex,message:"Must be a valid URL including protocol."}},onChange:e=>{var{name:e,value:t}=e.target;a(actions.appFormState.updateAppFormField({field:e,value:t}))},placeholder:"URL",name:"url",fullWidth:!0})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ConfigFields,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ContextMenuExtensions,{})}))]}))}))},useStyles$5=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px",marginTop:"9px",marginRight:"15px",background:"#214167"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},checked:{color:"#6098D1"},textInput:{boxSizing:"content-box"}})),useOneClickCopy=a=>{const[t,s]=react.exports.useState(!1);return[e=>{var t;navigator.clipboard.writeText(null!=(t=a.current.dataset.copyToClipboardText)?t:a.current.innerText).catch(e=>{console.error("Error copying to clipboard: ",e)}),s(!0)},e=>jsxRuntime.exports.jsx(Tooltip,Object.assign({open:t,onClose:()=>{s(!1)},title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-copied-to-clipboard",defaultMessage:"Copied to clipboard",description:"Copied to clipboard"})},e,{children:e.children}))]};var OAuthClientSecret=({appId:a,disabled:e})=>{const s=useSelector(selectApiConfigs),[t,i]=react.exports.useState(""),[n,o]=react.exports.useState(!1),[r,p]=react.exports.useState(!1),[l,d]=react.exports.useState(!1);var c=react.exports.useRef();const[u,x]=useOneClickCopy(c);react.exports.useEffect(()=>{!lodash.exports.isEmpty(t)&&l&&(u(null),d(!1))});const m=react.exports.useRef();const[g,h]=react.exports.useState(!1),[f,j]=react.exports.useState(!1);const[y,b]=react.exports.useState(!1);return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"column",spacing:2,"data-test":"oauth-client-secret-retrival-tool"},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-label-formattedMessage",defaultMessage:"Client Secret: OAuth",description:"Lable for the client secret input when selecting OAuth"})}))})),jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2,alignItems:"center",width:"60%"},{children:[jsxRuntime.exports.jsx(x,{children:jsxRuntime.exports.jsx(InputText,{name:"oauthClientSecret",fullWidth:!0,disabled:!0,ref:c,"data-copy-to-clipboard-text":t,id:"clientSecret",color:"secondary",style:{backgroundColor:"#F2F5F9"},type:f?"text":"password",size:"small",value:lodash.exports.isEmpty(t)?Array(54).fill("x").join(""):t,InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"data-test":"oauth-client-secret-reveal","aria-label":"toggle client secret visibility",onClick:()=>{lodash.exports.isEmpty(t)?h(!0):j(!f)},disabled:e},{children:f?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))}})}),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"copy client secret",onClick:e=>{lodash.exports.isEmpty(t)?(d(!0),h(!0)):u(e)},disabled:e,"data-test":"oauth-client-secret-copy"},{children:jsxRuntime.exports.jsx(Copy,{})}))]})),jsxRuntime.exports.jsxs(Collapse,Object.assign({in:g},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-password-input-label-formattedMessage",defaultMessage:"Please enter your account password to reveal client secret",description:"Lable for the client secret password input when selecting OAuth"})}))})),jsxRuntime.exports.jsx("form",Object.assign({onSubmit:e=>{e.preventDefault();var t,e=null==(e=m.current)?void 0:e.value;lodash.exports.isEmpty(e)||(t=e,__awaiter(void 0,void 0,void 0,function*(){console.log("handleFetchClientSecret Start");try{o(!0);var e=yield getOAuthClientSecret(s,{id:a,password:t});console.log("Result:",e),i(e.application.clientSecret),h(!1)}catch(e){m.current.focus(),p(!0)}finally{o(!1)}}).catch(e=>{console.error("Error fetching client secrets: ",e)}))}},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2},{children:[jsxRuntime.exports.jsx(InputText,{autoComplete:"on",autoCorrect:"off",name:"password",InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"toggle password visibility",onClick:()=>{b(!y)},"data-test":"oauth-client-secret-password-reveal"},{children:y?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))},inputRef:m,id:"password",color:r?"error":"secondary",type:y?"text":"password",size:"small"}),n?jsxRuntime.exports.jsx(CircularProgress,{color:"secondary"}):jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"submit password",type:"submit","data-test":"oauth-client-secret-password-submit"},{children:jsxRuntime.exports.jsx(ArrowForward,{})}))]}))}))]}))]}))};const AuthenticationStep=({handleOnValidate:e})=>{var t=useStyles$5()["classes"];const a=useSelector(selectApp),s=useSelector(selectIsEditForm)["isEditForm"],i=useSelector(selectIsResumeSession),n=useDispatch();const o=useForm({mode:"onChange",defaultValues:{oauthUrl:"",authMethod:"none"}});react.exports.useEffect(()=>{null!=e&&e(o.formState.isValid)},[e,o.formState.isValid,a.authMethod]),react.exports.useEffect(()=>{__awaiter(void 0,void 0,void 0,function*(){(i||s)&&(o.reset(a),setTimeout(()=>__awaiter(void 0,void 0,void 0,function*(){yield o.trigger()}),500))})},[a,i,s,o]);var r=e=>{var{name:e,value:t}=e.target;n(actions.appFormState.updateAppFormField({field:e,value:t}))};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-authentication-step-container"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},o,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Heading,{title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-title-formattedMessage",defaultMessage:"Authentication",description:"Authentication title"}),description:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-description-formattedMessage",defaultMessage:"Default authentication is None. OAuth and JWT authentication protocols coming soon",description:"authentication description"}),testName:"os-app-center-new.authentication"}),jsxRuntime.exports.jsx(Typography,{variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.authentication-title"}),jsxRuntime.exports.jsx(Typography,{variant:"caption","data-test":"os-app-center-new.authentication-description"}),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsxs(InputRadioGroup,Object.assign({"data-test":"authentication-radio-group",name:"authMethod",value:a.authMethod,onChange:r,rules:{required:!0},row:!0},{children:[jsxRuntime.exports.jsx(FormControlLabel,{value:"none",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-none"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",color:"textSecondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-None-formattedMessage",defaultMessage:"None",description:"None"})}))}),jsxRuntime.exports.jsx(FormControlLabel,{value:"oauth",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-oauth"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-OAuth-formattedMessage",defaultMessage:"OAuth",description:"OAuth"})}))})]}))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(Collapse,Object.assign({in:lodash.exports.isEqual(a.authMethod,"oauth")},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:5,"data-test":"authentication-oauth-section"},{children:[jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},name:"oauthUrl",value:a.oauthUrl,onChange:r,fullWidth:!0,variant:"outlined",label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2",style:{color:"lightgray"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-url-formattedMessage",defaultMessage:"OAuth URL",description:"Lable for the oauth url input when selecting OAuth"})})),InputLabelProps:{disableAnimation:!1},rules:{required:lodash.exports.isEqual(a.authMethod,"oauth"),pattern:{value:urlRegex,message:"Must be a valid URL including protocol."},maxLength:1e3}}),s?jsxRuntime.exports.jsx(OAuthClientSecret,{appId:a.id}):jsxRuntime.exports.jsxs(Box,{children:[jsxRuntime.exports.jsx(OAuthClientSecret,{appId:"",disabled:!0}),jsxRuntime.exports.jsx(Typography,Object.assign({color:"secondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-not-available-formattedMessage",defaultMessage:"You will be able to retrieve the oauth client secret here after submitting this application.",description:"Instruction durring application onboarding on how to find oauth client secret after application submission."})}))]})]}))}))}))]}))}))}))},useStyles$4=makeStyles()(e=>({container:{width:"100%",padding:"25px 30px"},subheading:{maxWidth:"100%",minWidth:"48.75rem",padding:"30px 0"},titleDesc:{width:"60%",display:"inline-block"},appLogo:{width:"40%",display:"inline-block"},text:{width:"39.5rem",padding:"14px 0",borderBottom:"0.5px solid #D5DFE9",fontWeight:400},textCollapsible:{width:"39.5rem",padding:"8px 0",borderBottom:"0.5px solid #D5DFE9",cursor:"pointer"},collapse:{width:"39.5rem"},collapseContent:{maxHeight:200,overflow:"auto"},pre:{whiteSpace:"pre-line"},asterisk:{color:"#D43060",margin:"0 2px"}})),useStyles$3=makeStyles()(e=>({root:{borderRadius:"50%",border:"1px solid #D5DFE9",display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",width:e.spacing(8),height:e.spacing(8)},logo:{maxWidth:"100%",maxHeight:"100%"},veritoneLogo:{maxWidth:"100%",maxHeight:"100%"}})),AppLogo=({path:e})=>{var t=useStyles$3()["classes"];return jsxRuntime.exports.jsx("div",Object.assign({className:t.root},{children:jsxRuntime.exports.jsx("img",{className:t.logo+" "+(!e&&t.veritoneLogo),src:e||img$1A,alt:"app logo"})}))},Row=({label:e,value:t,style:a,testName:s,icon:i,asterisk:n,handleOpenCollapse:o,textTransformValue:r="capitalize"})=>jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"space-between",alignItems:"center",textTransform:r,"data-test":s+"-container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6","data-test":"label-"+s},{children:e})),jsxRuntime.exports.jsxs(Box,Object.assign({className:a,display:"flex",justifyContent:"space-between",alignItems:"center",onClick:o},{children:[jsxRuntime.exports.jsxs(Typography,Object.assign({variant:"h6",sx:{fontWeight:400}},{children:[t,n]})),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"expand row",size:"small",onClick:o,"data-test":s+"-expand-action-trigger"},{children:i}))]}))]})),ConfirmationStep=()=>{var e=useStyles$4()["classes"],t=useSelector(selectApp);return jsxRuntime.exports.jsxs(Box,Object.assign({className:e.container,"data-test":"os-app-center-new-confirmation-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.subheading},{children:[jsxRuntime.exports.jsxs("div",Object.assign({className:e.titleDesc},{children:[jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",alignItems:"center",textTransform:"capitalize","data-test":"os-app-center-new-confirmation-step.app-name"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2"},{children:lodash.exports.isEmpty(t.name)?"-":t.name}))})),jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-confirmation-step.app-description"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",color:"#2A323C"},{children:lodash.exports.isEmpty(t.description)?"-":t.description}))}))]})),jsxRuntime.exports.jsx("div",Object.assign({"data-test":"os-app-center-new-confirmation-step.app-logo",className:e.appLogo},{children:jsxRuntime.exports.jsx(AppLogo,{path:t.iconPath})}))]})),jsxRuntime.exports.jsxs(Box,Object.assign({sx:{width:"100%"},"data-test":"os-app-center-new-confirmation-step.row-container"},{children:[jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-url-formattedMessage",defaultMessage:"Application URL:",description:"application url"}),textTransformValue:"none",value:lodash.exports.isEmpty(t.url)?"-":t.url,style:e.text,testName:"os-app-center-new-confirmation-step.app-url"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.custom-fields-formattedMessage",defaultMessage:"Custom Fields:",description:"Custom Fields"}),value:lodash.exports.isEmpty(t.configFields)?"-":lodash.exports.join(lodash.exports.map(t.configFields,e=>e.name),", "),style:e.text,testName:"os-app-center-new-confirmation-step.app-custom-fields"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-headerbar-formattedMessage",defaultMessage:"Headerbar:",description:"headerbar"}),value:t.headerbarEnabled?"On (Default)":"Off",style:e.text,testName:"os-app-center-new-confirmation-step.app-headerbar"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-auth-formattedMessage",defaultMessage:"Authentication:",description:"auth"}),value:"oauth"===t.authMethod?`${lodash.exports.startCase(t.authMethod)} (${lodash.exports.truncate(t.oauthUrl,{length:50})})`:"None (Default)",textTransformValue:"none",style:e.text,testName:"os-app-center-new-confirmation-step.app-auth"})]}))]}))},useBasicInfoStyles=makeStyles()(e=>({container:{padding:e.spacing(6),justifyContent:"space-around","& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},textInput:{padding:26},labelRow:{display:"flex",gap:e.spacing(2),alignItems:"flex-end"},optional:{fontSize:10,marginBottom:e.spacing(1)},select:{"& > div":{fontWeight:400,width:"280px"}}})),useIconImporterStyles=makeStyles()(e=>({iconBox:{display:"flex",justifyContent:"center",alignItems:"center",width:200,height:200,padding:e.spacing(3),border:"1px dashed #D5DFE9",borderRadius:5,transition:"all .2s ease","&:hover":{border:"1px solid #dde6ee"}},innerBox:{position:"relative",background:"#F5F5F5",width:"100%",height:"100%",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center",transition:"all .2s ease","&:hover":{background:"#dde6ee"}},fileInput:{display:"none"},addIcon:{color:"#555F7C",height:42,width:42,"&:hover":{color:"#555F7C"}},iconPreview:{objectFit:"cover",borderRadius:5,width:"100%",maxHeight:"100%"},removeIcon:{top:"90%",right:66}})),useDragAndDrop=({acceptedFileTypes:n})=>{const t=react.exports.useRef(),e=react.exports.useRef(),o=useDispatch();var a=useSelector(preferredLanguageSelector);const r=AIWareFormatMessage(a),s=react.exports.useCallback(e=>{var t,a,s,i;e&&(n.includes(e.type)?5e6<=e.size?o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileSize",defaultMessage:[{type:0,value:"File file size must be less than 5 MB"}]}),severity:MessageSeverity.Warning})):({name:t,size:a,type:s}=e,i=URL.createObjectURL(e),i={id:guid(),previewUrl:i,name:t,size:a,type:s},o(actions.iconUploadState.uploadIconStart({file:i}))):o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileType",defaultMessage:[{type:1,value:"type"},{type:0,value:" is not a supported image type."}]},{type:e.type}),severity:MessageSeverity.Warning})))},[n,o]),i=react.exports.useCallback(e=>{e.preventDefault();e=e.dataTransfer.files[0];s(e)},[s]);const p=e=>{e.preventDefault()};return react.exports.useEffect(()=>{const e=t.current;return e.addEventListener("drop",i),()=>{e.removeEventListener("drop",i)}},[i]),react.exports.useEffect(()=>{const e=t.current;return e&&(e.addEventListener("dragover",p),e.addEventListener("dragleave",p)),()=>{e.removeEventListener("dragover",p),e.removeEventListener("dragleave",p)}},[]),{dropZoneRef:t,fileInputRef:e,handleRemoveFile:e=>{e.stopPropagation(),o(actions.iconUploadState.deleteLocalIcon()),o(actions.appFormState.updateAppFormField({field:"iconPath",value:""}))},handleOpenFilePicker:()=>{e.current.click()},handleIconSelect:e=>{e=e.target.files[0];s(e)}}},acceptedFileTypes=["image/jpeg","image/png","image/gif","image/svg+xml"],IconImporter=({iconPath:e})=>{var t=useSelector(selectIcon),a=useIconImporterStyles()["classes"],{dropZoneRef:s,fileInputRef:i,handleRemoveFile:n,handleIconSelect:o,handleOpenFilePicker:r}=useDragAndDrop({acceptedFileTypes:acceptedFileTypes});return jsxRuntime.exports.jsx("div",Object.assign({className:a.iconBox,ref:s,"data-test":"app-description-icon-dropzone"},{children:e||null!=t&&t.previewUrl?jsxRuntime.exports.jsxs("div",Object.assign({className:a.innerBox,style:{backgroundColor:"transparent"}},{children:[jsxRuntime.exports.jsx(IconButton,Object.assign({style:{position:"absolute"},"data-test":"app-description-icon-remove",className:a.removeIcon,size:"small",onClick:n},{children:jsxRuntime.exports.jsx(default_1$2,{})})),jsxRuntime.exports.jsx("img",{src:(null==t?void 0:t.previewUrl)||e,alt:(null==t?void 0:t.name)||"Icon",className:a.iconPreview,"data-test":"app-description-icon-preview"})]})):jsxRuntime.exports.jsxs(Button,Object.assign({className:a.innerBox,onClick:r},{children:[jsxRuntime.exports.jsx("input",{accept:"image/jpeg, image/png",type:"file",ref:i,className:a.fileInput,onChange:o}),jsxRuntime.exports.jsx(default_1$3,{className:a.addIcon})]}))}))},BasicInfo=({onValidate:e})=>{var t=useBasicInfoStyles()["classes"];const a=useIntl(),s=useDispatch(),i=useSelector(selectApp),n=useSelector(selectIsResumeSession),o=useSelector(selectApps);var r=useSelector(selectAppPackageDistributionType),p={name:i.name,description:i.description};const l=useForm({mode:"onChange",defaultValues:p}),d=(react.exports.useEffect(()=>{e(l.formState.isValid)},[l.formState.isValid]),react.exports.useEffect(()=>{__awaiter(void 0,void 0,void 0,function*(){n&&(l.reset(i),setTimeout(()=>__awaiter(void 0,void 0,void 0,function*(){yield l.trigger()}),500))}).catch(e=>{console.error("Error validating information: ",e)})},[n]),(e,t)=>{s(actions.appFormState.updateAppFormField({field:e,value:t}))});p=e=>{var{name:e,value:t}=e.target;d(e,t)};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"basic-info"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},l,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,rowSpacing:4,columnSpacing:10,"data-test":"app-description"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,item:!0,xs:12,sm:8,rowSpacing:2,columnSpacing:6},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12,sm:6},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.name-description-label",defaultMessage:"Name & Description",description:"Name & Description"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-description-caption",defaultMessage:"Provide a name and description to let users know what your application does.",description:"application name and description caption"})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},"data-test":"app-description-input-name",variant:"outlined",sx:{marginBottom:3},placeholder:"Application Name",name:"name",value:i.name,onChange:p,fullWidth:!0,rules:{required:!0,maxLength:100,validate:{isNameSame:t=>{return!o.find(e=>e.name.toLowerCase()===t.toLowerCase())||a.formatMessage({id:"os-app-center-new.app-description-input-name-error",defaultMessage:[{type:0,value:"An application with this name already exists"}]})}}}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{InputProps:{className:t.textInput},"data-test":"app-description-input-description",variant:"outlined",placeholder:"Description",name:"description",fullWidth:!0,multiline:!0,rows:10,value:i.description,onChange:p,rules:{required:!0,maxLength:250}})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({container:!0,item:!0,xs:12,sm:4,rowSpacing:4,columnSpacing:6},{children:jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{py:1}},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.icon-image-label",defaultMessage:"App Icon",description:"App Icon"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.image-recommended-label",defaultMessage:"Recommended image size:{br}300x300 .png or .jpg",description:"Recommended image size:{br} 300x300 .png or .jpg",values:{br:jsxRuntime.exports.jsx("br",{})}})}))]})),jsxRuntime.exports.jsx(IconImporter,{iconPath:i.iconPath})]}))})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(EntityTags,{selectedTags:i.entityTags,setSelectedTags:e=>{s(actions.appFormState.updateAppFormField({field:"entityTags",value:e}))}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(DistributionFlags,{description:"Add Distribution Flag for App",selectedFlag:r,engineFlags:engineFlags,handleEngineFlag:({value:e})=>{d("packageDistributionType",e)},idPrefix:"os-app-center-new",inputName:"appPackageDistribution"})}))]}))}))}))},AppOnboardingFlow=()=>{const a=useDispatch(),t=useSelector(selectApp),s=useSelector(selectIsEditForm)["isEditForm"],[e,i]=react.exports.useState(!1);var n=e=>i(e);var n=[jsxRuntime.exports.jsx(BasicInfo,{onValidate:n}),jsxRuntime.exports.jsx(FunctionalityStep,{handleOnValidate:n}),jsxRuntime.exports.jsx(HeaderbarStep,{handleOnValidate:n}),jsxRuntime.exports.jsx(AuthenticationStep,{handleOnValidate:n}),jsxRuntime.exports.jsx(ConfirmationStep,{})],o=[jsxRuntime.exports.jsx(Button,Object.assign({"data-test":"app-new-submit-app-button",variant:"contained",color:"primary",onClick:()=>{var e;e=!1,s?a(actions.appFormState.updateAppStart({app:t,openBuildPanel:e})):a(actions.appFormState.createAppStart({app:t,openBuildPanel:e}))}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.{idPrefix}-app-button",defaultMessage:"{verb}",description:"{verb} app button text",values:{idPrefix:s?"update":"submit",verb:s?"Update":"Submit"}})}),"submit-app-button")];return jsxRuntime.exports.jsx(ProgressStepper,{panelName:"APP_CENTER_NEW",sessionKey:"appOnboardingSession",entityId:t.id,onResumeSession:e=>{var t=lodash.exports.omit(e,"eventHandlers"),e=lodash.exports.get(e,"eventHandlers");a(actions.appEventsPanelState.resumeSession(e)),a(actions.appFormState.resumeSession(t))},steps:["Basic Info","Functionality","Headerbar","Authentication","Review"],stepContent:n,customFinalStepButtons:o,nextButtonDisabled:!e,idPrefix:"app-center-new-aob"})},appBarHeight$1=55,headerHeight=64,borderBottom$1=5,useStyles$2=makeStyles()(e=>({ecnPanel:{height:`calc(100vh - ${appBarHeight$1}px - ${headerHeight}px - ${borderBottom$1}px)`}})),MainLayout=({appId:e})=>{var t=useStyles$2()["classes"];const a=useDispatch();var s=useSelector(selectIsLoadingExistingAppData)["isLoadingExistingAppData"];return react.exports.useEffect(()=>{e?a(actions.appFormState.editApp(e)):a(actions.appFormState.createNewApp())},[]),jsxRuntime.exports.jsx("div",Object.assign({role:"presentation","data-test":"app-center-new-widget",className:t.ecnPanel},{children:s?jsxRuntime.exports.jsx(Box,Object.assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},{children:jsxRuntime.exports.jsx(CircularProgress,{})})):jsxRuntime.exports.jsx(AppOnboardingFlow,{})}))},AppCenterNew=e=>jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getAppCenterNewModule()]},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(MainLayout,Object.assign({},e))})})}))}),appBarHeight=55,borderBottom=5,mainHeight=`calc(100vh - ${appBarHeight+borderBottom}px)`,useStyles$1=makeStyles()(e=>({root:{display:"flex",flexFlow:"column",height:mainHeight},container:{padding:e.spacing(5),"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{width:"100%"},optional:{fontSize:12,marginBottom:e.spacing(1),marginLeft:e.spacing(1),color:"#9CA8B4"}})),ConfigFieldsForm=({hidePanel:t,isEdit:a=!1,editIndex:s=-1})=>{var e=useStyles$1()["classes"],i=useSelector(preferredLanguageSelector);const n=AIWareFormatMessage(i),o=useDispatch(),r=useSelector(selectApp),p=useSelector(selectConfigFields);var i=()=>a&&0<=s?p[s]:{name:"",configLevel:AppConfigLevel.Organization,type:AppConfigType.String,required:!1,defaultValue:""},l=i();const d=useForm({mode:"onChange",defaultValues:l}),[c,u]=react.exports.useState(i().type),[x,m]=react.exports.useState(i().configLevel);return jsxRuntime.exports.jsx(FormProvider,Object.assign({},d,{children:jsxRuntime.exports.jsxs("form",Object.assign({className:e.root,onSubmit:d.handleSubmit(e=>{a?o(actions.appFormState.updateConfigField({configFields:e,index:s,name:p[s].name})):lodash.exports.isEmpty(r.id)?o(actions.appFormState.addConfigField(e)):o(actions.appFormState.createConfigField({newConfigField:e,appId:r.id})),t()})},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.container,container:!0,spacing:5,"data-test":"app-new-config-fields-form-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-new-config-fields-header-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title",defaultMessage:"{label} Config Fields",description:"Form label for supported file types",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title-close",defaultMessage:"Close",description:"Form label for close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-description-input-icon"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-name"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-name",defaultMessage:"Name",description:"You can set a field name"})})),jsxRuntime.exports.jsx(InputText,{inputProps:{maxLength:50,className:e.textInput},variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-new-config-fields-name-content",rules:{required:!0,maxLength:50,validate:{isNameSame:a=>{return!p.find((e,t)=>t!==s&&e.name===a)||n({id:"os-app-center-new.config-name-error",defaultMessage:[{type:0,value:"Please select a different name"}]})}}}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-description",defaultMessage:"Description",description:"You can set a field description"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",name:"description",fullWidth:!0,multiline:!0,rows:5,"data-test":"app-new-config-fields-description-content",inputProps:{maxLength:250},InputProps:{className:e.textInput},rules:{required:!0,maxLength:250}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-config-level"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.config-level",defaultMessage:"Config Level",description:"You can set a config level"})})),jsxRuntime.exports.jsxs(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"configLevel",value:x,defaultValue:x,onChange:e=>{d.setValue("configLevel",e.target.value),m(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-level-content",rules:{required:!0}},{children:[jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"Organization"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-organization",defaultMessage:"Organization",description:"You can set a config level"})})),jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"User"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-user",defaultMessage:"User",description:"You can set a config level"})}))]}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-type"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-type",defaultMessage:"Type",description:"You can set a field type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"type",value:c,onChange:e=>{d.setValue("type",e.target.value),u(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-fields-type-content",rules:{required:!0}},{children:map_1(keys_1(AppConfigType),(e,t)=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:AppConfigType[e]},{children:AppConfigType[e]}),t))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(SchemaOrText,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"12.5px 0 0 25px"}},{children:jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:jsxRuntime.exports.jsx(InputCheckbox,{name:"required",defaultChecked:l.required,label:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.required-checkbox",defaultMessage:"Make Required",description:"Required field checkbox"})})}))}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!get_1(d,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-new-config-fields-button-submit"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-config-fields.submit-button-label",defaultMessage:"{label}",description:"{label} Config Fields",values:{label:a?"Update":"Add"}})}))}))]}))}))},AppCenterConfigFieldsForm=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ConfigFieldsForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex})})})}),useStyles=makeStyles()(e=>({form:{display:"flex",flexDirection:"column",height:"100%"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{textTransform:"capitalize"}})),ContextMenuExtensionForm=({hidePanel:t,isEdit:a,editIndex:s,extensionType:i})=>{var e=useStyles()["classes"];const n=useDispatch();var o=useSelector(selectIsEditForm)["isEditForm"],r=useSelector(selectPrevContextMenuExtensions);const p=useSelector(selectContextMenuExtensions);r=a&&lodash.exports.findIndex(r[i+"s"],e=>lodash.exports.isMatch(e,p[i+"s"][s]))<0,o=a&&o&&!r,r=useForm({mode:"onChange",defaultValues:a&&0<=s&&!lodash.exports.isNil(i)?p[i+"s"][s]:{label:"",url:"",type:""}});const l=r.watch("type");return jsxRuntime.exports.jsx(Box,Object.assign({sx:{p:6,height:"calc(100vh - 60px)"}},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},r,{children:jsxRuntime.exports.jsxs("form",Object.assign({onSubmit:r.handleSubmit(e=>{a&&0<=s&&!lodash.exports.isNil(i)?n(actions.appFormState.updateContextMenuExtension({extensionType:i,index:s,extension:e})):(e.id=v4(),n(actions.appFormState.addContextMenuExtension({extension:e}))),null!=t&&t()}),className:e.form},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,direction:"column",spacing:8,"data-test":"app-center-new.context-menu-extension.panel-container",flexWrap:"nowrap"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-center-new.context-menu-extension.panel-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title",defaultMessage:"{label} a Context Menu Extension",description:"Panel title for context menu extension form",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title-close",defaultMessage:"Close",description:"Close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-center-new.context-menu-extension.close-button"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.type-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.type-header-text",defaultMessage:"Type",description:"You can set a type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({name:"type",fullWidth:!0,disabled:o,rules:{required:!0},className:e.inputSelect,"data-test":"app-center-new.context-menu-extension.type-input"},{children:Object.values(ContextMenuExtensionType).map(e=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:e,"data-test":"app-center-new.context-menu-extension.type-input."+e},{children:"tdo"===e?"Media (Temporal Data Objects)":e}),e))}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.label-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.label-header",defaultMessage:"Label",description:"You can set a label"})})),jsxRuntime.exports.jsx(InputText,{name:"label",fullWidth:!0,rules:{required:!0,maxLength:50,validate:t=>{var e;return!!lodash.exports.isEmpty(null===p||void 0===p?void 0:p[l+"s"])||!(!(a&&0<=s)||lodash.exports.isNil(i))||(e=null==(e=p[l+"s"])?void 0:e.find(e=>e.label===t),!!lodash.exports.isNil(e))||"Label already exists for this type."}},"data-test":"app-center-new.context-menu-extension.label-input"})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.url-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.url-header",defaultMessage:"Open a URL in a new tab (optional)",description:"You can set a url"})})),jsxRuntime.exports.jsx(InputText,{placeholder:l&&`https://example.com?${l}Id=\${${l}Id}`,name:"url",fullWidth:!0,rules:{maxLength:255,validate:e=>!!lodash.exports.isEmpty(e)||(urlRegex.test(e)?!!lodash.exports.includes(e,"${"+l+"Id}")||"URL must contain ${"+l+"Id}":"Must be a valid URL including protocol.")},"data-test":"app-center-new.context-menu-extension.url-input"})]}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!lodash.exports.get(r,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-center-new.context-menu-extension.submit-button"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.submit-button-text",defaultMessage:"{label}",description:"{label} Context Menu Extension",values:{label:a?"Update":"Add"}})}))}))]}))}))}))},ContextMenuExtensionPanel=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ContextMenuExtensionForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex,extensionType:e.extensionType})})})});export{AppCenterConfigFieldsForm,ContextMenuExtensionPanel as AppCenterContextMenuExtensionPanel,AppCenterNew};
Binary file