@e-llm-studio/instant-learning 1.3.0-alpha.96 → 1.3.0-alpha.97

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.
Files changed (92) hide show
  1. package/dist/cjs/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js +2 -0
  2. package/dist/cjs/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js.map +1 -0
  3. package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +2 -0
  4. package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +1 -0
  5. package/dist/cjs/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js +2 -0
  6. package/dist/cjs/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js.map +1 -0
  7. package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.js +1 -1
  8. package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.js +1 -1
  9. package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.js +1 -1
  10. package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js +1 -1
  11. package/dist/cjs/features/LSCGuidelinesCart/LearningManagementWrapper.js +1 -1
  12. package/dist/cjs/features/LSCGuidelinesCart/api.js +1 -1
  13. package/dist/cjs/features/LSCGuidelinesCart/endpoints.js +1 -1
  14. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  15. package/dist/cjs/features/LearningManagement/LearningManagementTest.js +1 -1
  16. package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +1 -1
  17. package/dist/cjs/features/LearningManagement/RBAC/AccessManagementPanel.js +1 -1
  18. package/dist/cjs/features/LearningManagement/RBAC/AccessPanel.js +1 -1
  19. package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
  20. package/dist/cjs/features/LearningManagement/Sidebar.js +1 -1
  21. package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
  22. package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
  23. package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js +2 -0
  24. package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js.map +1 -0
  25. package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
  26. package/dist/cjs/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
  27. package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
  28. package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
  29. package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +2 -0
  30. package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +1 -0
  31. package/dist/cjs/index.js +1 -1
  32. package/dist/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js +2 -0
  33. package/dist/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js.map +1 -0
  34. package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +2 -0
  35. package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +1 -0
  36. package/dist/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js +2 -0
  37. package/dist/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js.map +1 -0
  38. package/dist/features/LSCGuidelinesCart/Cart/Cart.js +1 -1
  39. package/dist/features/LSCGuidelinesCart/GuidelineCard.js +1 -1
  40. package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.js +1 -1
  41. package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js +1 -1
  42. package/dist/features/LSCGuidelinesCart/LearningManagementWrapper.js +1 -1
  43. package/dist/features/LSCGuidelinesCart/api.js +1 -1
  44. package/dist/features/LSCGuidelinesCart/endpoints.js +1 -1
  45. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  46. package/dist/features/LearningManagement/LearningManagementTest.js +1 -1
  47. package/dist/features/LearningManagement/LearningTemplateLayout.js +1 -1
  48. package/dist/features/LearningManagement/RBAC/AccessManagementPanel.js +1 -1
  49. package/dist/features/LearningManagement/RBAC/AccessPanel.js +1 -1
  50. package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
  51. package/dist/features/LearningManagement/Sidebar.js +1 -1
  52. package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
  53. package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
  54. package/dist/features/LearningManagement/components/CreateLearningSetModal.js +2 -0
  55. package/dist/features/LearningManagement/components/CreateLearningSetModal.js.map +1 -0
  56. package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
  57. package/dist/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
  58. package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
  59. package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
  60. package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +2 -0
  61. package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +1 -0
  62. package/dist/index.js +1 -1
  63. package/dist/types/src/features/IL-OTJ/_components/index.d.ts +0 -1
  64. package/dist/types/src/features/IL-OTJ/_components/index.d.ts.map +1 -1
  65. package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.d.ts +1 -1
  66. package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.d.ts.map +1 -1
  67. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.d.ts +1 -7
  68. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.d.ts.map +1 -1
  69. package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.d.ts.map +1 -1
  70. package/dist/types/src/features/LSCGuidelinesCart/LearningManagementWrapper.d.ts +1 -6
  71. package/dist/types/src/features/LSCGuidelinesCart/LearningManagementWrapper.d.ts.map +1 -1
  72. package/dist/types/src/features/LSCGuidelinesCart/api.d.ts +0 -1
  73. package/dist/types/src/features/LSCGuidelinesCart/api.d.ts.map +1 -1
  74. package/dist/types/src/features/LSCGuidelinesCart/endpoints.d.ts +0 -1
  75. package/dist/types/src/features/LSCGuidelinesCart/endpoints.d.ts.map +1 -1
  76. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  77. package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts +3 -0
  78. package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts.map +1 -1
  79. package/dist/types/src/features/LearningManagement/RBAC/AccessManagementPanel.d.ts +0 -1
  80. package/dist/types/src/features/LearningManagement/RBAC/AccessManagementPanel.d.ts.map +1 -1
  81. package/dist/types/src/features/LearningManagement/RBAC/AccessPanel.d.ts +0 -2
  82. package/dist/types/src/features/LearningManagement/RBAC/AccessPanel.d.ts.map +1 -1
  83. package/dist/types/src/features/LearningManagement/components/ScopeTree/TreeNode.d.ts.map +1 -1
  84. package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +12 -0
  85. package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +1 -0
  86. package/dist/types/src/features/LearningManagement/store/types.d.ts +0 -25
  87. package/dist/types/src/features/LearningManagement/store/types.d.ts.map +1 -1
  88. package/dist/types/src/features/LearningManagement/types.d.ts +1 -0
  89. package/dist/types/src/features/LearningManagement/types.d.ts.map +1 -1
  90. package/dist/types/src/index.d.ts +0 -1
  91. package/dist/types/src/index.d.ts.map +1 -1
  92. package/package.json +1 -9
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("lucide-react"),t=require("../../styles/ScopeTree.module.css.js"),r=require("./TreeNodeHeader.js"),l=require("./TreeAddAction.js"),d=require("../../store/useLMSConfigStore.js"),a=require("../../constants.js"),s=require("../../store/useLearningTemplateStore.js"),c=require("./TreeSectionItem.js"),u=function(p){var h,v,m,f,_,g=p.node,C=p.depth,T=void 0===C?0:C,D=p.nodePath,b=void 0===D?[]:D,y=p.expandedNodeIds,A=p.activeSelection,x=p.onToggleExpand,L=p.onSectionSelect,S=p.onNodeOptionsClick,E=p.onAddChild,j=p.onRenameChild,N=p.onDeleteChild,R=p.canDeleteScope,w=p.canEditScope,P=p.canCreateScope,I=p.searchQuery,M=p.sectionsConfig,k=void 0===M?[]:M,q=p.nodeTypesConfig,V=void 0===q?[]:q,H=p.forceVisible,W=void 0!==H&&H,O=p.compactView,Y=void 0!==O&&O,Q=e.__spreadArray(e.__spreadArray([],b,!0),[g.id],!1),K=y.has(g.id),U=s.useLearningTemplateStore.getState().backwardCompatibility,X=U||Y,z=d.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scope")),F=!!A&&A.nodePath[A.nodePath.length-1]===g.id,J=!!A&&(A.nodePath.includes(g.id)&&!F),B=d.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.applyToLevels"),""),G=function(){if(U)return[2];if(!B)return null;try{var e=JSON.parse(B);return Array.isArray(e)?e.map(Number):null}catch(e){return null}}(),Z=T+1,$=null===G||G.includes(Z),ee=(U||"true"===d.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.enabled"),"false"))&&$,ne=U?7:parseInt(d.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.count"),"7"),10)||7,ie=g.children||[],oe=ee&&!I&&ie.length>ne,te=i.useRef(null);i.useEffect(function(){F&&te.current&&te.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[F]);var re=function(e,n){if(!n)return!0;var i=n.toLowerCase();return!!e.name.toLowerCase().includes(i)||!!e.children&&e.children.some(function(e){return re(e,n)})};if(!W&&!re(g,I||""))return null;var le=T>=V.length-1?V[V.length-1]:V[T],de=!!(null==le?void 0:le.addChildType),ae=X?k.filter(function(e){return"learnings"!==e.id&&"stations"!==e.id}).filter(function(e){return!e.isVisible||e.isVisible(g,T)}).map(function(e){return{label:e.label,icon:e.icon,onClick:function(){return L(Q,e.id)}}}):[],se=!R||R(g.id),ce=!w||w(g.id),ue=!P||P(g.id),pe=g.children&&g.children.length>0,he=!se||pe,ve=se?pe?"This scope cannot be deleted because other scopes inherit learnings from it.":void 0:"You do not have permission to delete this scope.",me=ue?void 0:"You do not have permission to add a scope here.",fe=!I||g.name.toLowerCase().includes(I.toLowerCase()),_e=function(e){return n.jsx(u,{node:e,depth:T+1,nodePath:Q,expandedNodeIds:y,activeSelection:A,onToggleExpand:x,onSectionSelect:L,onNodeOptionsClick:S,onAddChild:E,onRenameChild:j,onDeleteChild:N,canDeleteScope:R,canEditScope:w,canCreateScope:P,searchQuery:I,forceVisible:fe,sectionsConfig:k,nodeTypesConfig:V,compactView:X},e.id)};return n.jsxs("div",e.__assign({ref:te,className:t.default.nodeWrapper,style:{"--tree-depth":T}},{children:[n.jsx(r.TreeNodeHeader,{nodeType:g.type,name:g.name,isExpanded:K,isSelected:F,isAncestor:J,isExpandable:!!pe,childrenCount:null===(h=g.children)||void 0===h?void 0:h.length,learningsCount:X?null===(v=g.metrics)||void 0===v?void 0:v.learningsCount:void 0,isCompactView:X,onToggleExpand:function(e){e.stopPropagation(),x(g.id)},onClick:function(){L(Q,"learnings")},searchQuery:I,menuOptions:e.__spreadArray(e.__spreadArray(e.__spreadArray([],de&&"station"!==(null===(m=null==g?void 0:g.type)||void 0===m?void 0:m.toLowerCase())?[{label:le.addChildLabel||"Add Child",icon:o.Plus,onClick:function(){return null==E?void 0:E(g.id,le.addChildType,g.name)},disabled:!ue,tooltip:me}]:[],!0),[{label:"".concat(d.dt("".concat(a.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".rename"),"Rename")),icon:o.Pencil,onClick:function(){return null==j?void 0:j(g.id,g.name)},disabled:!ce||"station"===(null===(f=null==g?void 0:g.type)||void 0===f?void 0:f.toLocaleLowerCase()),tooltip:ce?void 0:"You do not have permission to rename this scope."},{label:"station"===(null===(_=null==g?void 0:g.type)||void 0===_?void 0:_.toLowerCase())?"Delete Station":U?"Delete Scope":"".concat(d.dt("".concat(a.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".delete"),"Delete ".concat((null==le?void 0:le.label)||"Node"),{scope:z})),icon:o.Trash2,onClick:function(){var e;return null==N?void 0:N(g.id,g.name,(null===(e=g.metrics)||void 0===e?void 0:e.learningsCount)||0)},disabled:he,tooltip:ve,className:"text-red-500 hover:text-red-600 hover:bg-red-50"}],!1),ae,!0)}),K&&n.jsxs("div",e.__assign({className:t.default.childrenWrapper},{children:[!X&&k.filter(function(e){return!e.isVisible||e.isVisible(g,T)}).map(function(e){var i;return n.jsx(c.TreeSectionItem,{icon:e.icon,label:e.label,badgeCount:e.badgeKey?null===(i=g.metrics)||void 0===i?void 0:i[e.badgeKey]:void 0,isActive:F&&(null==A?void 0:A.sectionId)===e.id,onClick:function(){return L(Q,e.id)}},"".concat(g.id,"-").concat(e.id))}),oe?n.jsxs(n.Fragment,{children:[n.jsx("div",e.__assign({className:t.default.scopeScrollContainer,style:{maxHeight:"calc(var(--scope-row-height, 40px) * ".concat(ne,")"),overflowY:"scroll"}},{children:ie.map(_e)})),n.jsx("button",e.__assign({type:"button",className:t.default.addAction,onClick:function(e){e.stopPropagation(),L(Q,"stations")}},{children:n.jsx("span",e.__assign({style:{paddingLeft:"15px"}},{children:n.jsxs("span",e.__assign({style:{paddingLeft:"15px",display:"flex",alignItems:"center"}},{children:[d.interpolate(d.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.viewMoreText"),U?"View all {count} stations":"Show all {count} scopes"),{count:ie.length}),n.jsx(o.MoveRight,{size:14,style:{marginLeft:"6px",flexShrink:0}})]}))}))}))]}):ie.map(_e),de&&!X&&n.jsx(l.TreeAddAction,{label:le.addChildLabel||"Add Child",onAdd:function(){return null==E?void 0:E(g.id,le.addChildType,g.name)},disabled:!ue,tooltip:me})]}))]}))};exports.TreeNode=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("lucide-react"),t=require("../../styles/ScopeTree.module.css.js"),r=require("./TreeNodeHeader.js"),d=require("./TreeAddAction.js"),a=require("../../store/useLMSConfigStore.js"),l=require("../../constants.js"),s=require("../../store/useLearningTemplateStore.js"),c=require("./TreeSectionItem.js"),u=function(p){var h,v,m,_,f=p.node,g=p.depth,C=void 0===g?0:g,T=p.nodePath,D=void 0===T?[]:T,y=p.expandedNodeIds,b=p.activeSelection,A=p.onToggleExpand,x=p.onSectionSelect,S=p.onNodeOptionsClick,E=p.onAddChild,L=p.onRenameChild,j=p.onDeleteChild,N=p.canDeleteScope,R=p.canEditScope,P=p.canCreateScope,w=p.searchQuery,I=p.sectionsConfig,M=void 0===I?[]:I,k=p.nodeTypesConfig,q=void 0===k?[]:k,H=p.forceVisible,V=void 0!==H&&H,W=p.compactView,O=void 0!==W&&W,Y=e.__spreadArray(e.__spreadArray([],D,!0),[f.id],!1),Q=y.has(f.id),K=s.useLearningTemplateStore.getState().backwardCompatibility,U=K||O,X=a.dt("".concat(l.MIDDLE_DRAWER_DT_PATH,".scope")),z=!!b&&b.nodePath[b.nodePath.length-1]===f.id,F=!!b&&(b.nodePath.includes(f.id)&&!z),J=a.dt("".concat(l.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.applyToLevels"),""),B=function(){if(K)return[2];if(!J)return null;try{var e=JSON.parse(J);return Array.isArray(e)?e.map(Number):null}catch(e){return null}}(),G=C+1,Z=null===B||B.includes(G),$=(K||"true"===a.dt("".concat(l.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.enabled"),"false"))&&Z,ee=K?7:parseInt(a.dt("".concat(l.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.count"),"7"),10)||7,ne=f.children||[],ie=$&&!w&&ne.length>ee,oe=i.useRef(null);i.useEffect(function(){z&&oe.current&&oe.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[z]);var te="station"===(null===(h=null==f?void 0:f.type)||void 0===h?void 0:h.toLowerCase()),re=0===C,de=!!(null===(v=q[Math.min(C,q.length-1)])||void 0===v?void 0:v.addChildType)&&!te&&(!K||re),ae=!(K&&te),le=M.filter(function(e){return(!K||!te||"access"!==e.id)&&(!e.isVisible||e.isVisible(f,C))}),se=function(e,n){if(!n)return!0;var i=n.toLowerCase();return!!e.name.toLowerCase().includes(i)||!!e.children&&e.children.some(function(e){return se(e,n)})};if(!V&&!se(f,w||""))return null;var ce=C>=q.length-1?q[q.length-1]:q[C],ue=U?le.filter(function(e){return"learnings"!==e.id&&"stations"!==e.id}).map(function(e){return{label:e.label,icon:e.icon,onClick:function(){return x(Y,e.id)}}}):[],pe=!N||N(f.id),he=!R||R(f.id),ve=!P||P(f.id),me=f.children&&f.children.length>0,_e=!pe||me,fe=pe?me?"This scope cannot be deleted because other scopes inherit learnings from it.":void 0:"You do not have permission to delete this scope.",ge=ve?void 0:"You do not have permission to add a scope here.",Ce=!w||f.name.toLowerCase().includes(w.toLowerCase()),Te=function(e){return n.jsx(u,{node:e,depth:C+1,nodePath:Y,expandedNodeIds:y,activeSelection:b,onToggleExpand:A,onSectionSelect:x,onNodeOptionsClick:S,onAddChild:E,onRenameChild:L,onDeleteChild:j,canDeleteScope:N,canEditScope:R,canCreateScope:P,searchQuery:w,forceVisible:Ce,sectionsConfig:M,nodeTypesConfig:q,compactView:U},e.id)};return n.jsxs("div",e.__assign({ref:oe,className:t.default.nodeWrapper,style:{"--tree-depth":C}},{children:[n.jsx(r.TreeNodeHeader,{nodeType:f.type,name:f.name,isExpanded:Q,isSelected:z,isAncestor:F,isExpandable:!!me,childrenCount:null===(m=f.children)||void 0===m?void 0:m.length,learningsCount:U?null===(_=f.metrics)||void 0===_?void 0:_.learningsCount:void 0,isCompactView:U,onToggleExpand:function(e){e.stopPropagation(),A(f.id)},onClick:function(){x(Y,"learnings")},searchQuery:w,menuOptions:!1===f.hasAccess?[]:e.__spreadArray(e.__spreadArray(e.__spreadArray(e.__spreadArray([],de?[{label:ce.addChildLabel||"Add Child",icon:o.Plus,onClick:function(){return null==E?void 0:E(f.id,ce.addChildType,f.name)},disabled:!ve,tooltip:ge}]:[],!0),[{label:"".concat(a.dt("".concat(l.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".rename"),"Rename")),icon:o.Pencil,onClick:function(){return null==L?void 0:L(f.id,f.name)},disabled:!he||te,tooltip:he?void 0:"You do not have permission to rename this scope."}],!1),ae?[{label:te?"Delete Station":K?"Delete Scope":"".concat(a.dt("".concat(l.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".delete"),"Delete ".concat((null==ce?void 0:ce.label)||"Node"),{scope:X})),icon:o.Trash2,onClick:function(){var e;return null==j?void 0:j(f.id,f.name,(null===(e=f.metrics)||void 0===e?void 0:e.learningsCount)||0)},disabled:_e,tooltip:fe,className:"text-red-500 hover:text-red-600 hover:bg-red-50"}]:[],!0),ue,!0)}),Q&&n.jsxs("div",e.__assign({className:t.default.childrenWrapper},{children:[!U&&le.map(function(e){var i;return n.jsx(c.TreeSectionItem,{icon:e.icon,label:e.label,badgeCount:e.badgeKey?null===(i=f.metrics)||void 0===i?void 0:i[e.badgeKey]:void 0,isActive:z&&(null==b?void 0:b.sectionId)===e.id,onClick:function(){return x(Y,e.id)}},"".concat(f.id,"-").concat(e.id))}),ie?n.jsxs(n.Fragment,{children:[n.jsx("div",e.__assign({className:t.default.scopeScrollContainer,style:{maxHeight:"calc(var(--scope-row-height, 40px) * ".concat(ee,")"),overflowY:"scroll"}},{children:ne.map(Te)})),n.jsx("button",e.__assign({type:"button",className:t.default.addAction,onClick:function(e){e.stopPropagation(),x(Y,"stations")}},{children:n.jsx("span",e.__assign({style:{paddingLeft:"15px"}},{children:n.jsxs("span",e.__assign({style:{paddingLeft:"15px",display:"flex",alignItems:"center"}},{children:[a.interpolate(a.dt("".concat(l.MIDDLE_DRAWER_DT_PATH,".scopeDisplayLimit.viewMoreText"),K?"View all {count} stations":"Show all {count} scopes"),{count:ne.length}),n.jsx(o.MoveRight,{size:14,style:{marginLeft:"6px",flexShrink:0}})]}))}))}))]}):ne.map(Te),de&&!U&&n.jsx(d.TreeAddAction,{label:ce.addChildLabel||"Add Child",onAdd:function(){return null==E?void 0:E(f.id,ce.addChildType,f.name)},disabled:!ve,tooltip:ge})]}))]}))};exports.TreeNode=u;
2
2
  //# sourceMappingURL=TreeNode.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material"),o=require("lucide-react"),i=require("primereact/toast"),s=require("uuid"),a=require("../../assets/Search-result(add new).svg.js"),l=require("../../store/useAuthStore.js"),u=require("../../config.js"),c=require("../../apis/scopeApis.js"),d=require("./InputField.js"),p=require("./StationAutocomplete.js"),f=require("../CardSkeleton.js"),g=require("./OnboardingLoader.js"),x=require("./TemplateCard.js"),_=[{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"},{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"}],m=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],h=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(v){var S,y=v.isOpen,b=v.onClose,j=v.onBoardStation,w=v.app_integration_id,C=v.token,T=v.stationNameParam,O=t.useState(null),F=O[0],N=O[1],B=t.useState([]),A=B[0],E=B[1],M=t.useState(0),D=M[0],q=M[1],I=t.useState(!0),k=I[0],P=I[1],R=t.useState(!1),z=R[0],L=R[1],W=t.useState([]),G=W[0],U=W[1],Y=t.useState(""),H=Y[0],K=Y[1],X=t.useState(""),J=X[0],Q=X[1],V=t.useState(!1),Z=V[0],$=V[1],ee=t.useState(!1),ne=ee[0],te=ee[1],re=t.useState(null),oe=re[0],ie=re[1],se=t.useState(!1),ae=se[0],le=se[1],ue=t.useState(0),ce=ue[0],de=ue[1],pe=t.useState(""),fe=pe[0],ge=pe[1],xe=l.default().user,_e=t.useRef(null),me=t.useRef(null),he=t.useRef(null),ve=t.useRef(null),Se=t.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),ye=Se[0],be=Se[1],je=function(e,n){return e.find(function(e){return e.value===n})||null},we=t.useMemo(function(){return A.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[A]),Ce=t.useMemo(function(){var e,n,t;if(!ye.genre)return null;var r=A.find(function(e){return e.scope_name===ye.genre});return r?{id:r.id,title:r.scope_name||"Unnamed Template",description:(null===(e=r.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=r.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:r.rules_count||0,tiersCount:r.tier_count||0,isCopy:null!==(t=r.is_copy)&&void 0!==t&&t}:null},[ye.genre,A]);t.useEffect(function(){return function(){he.current&&clearTimeout(he.current)}},[]);var Te=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var t,r,o;return e.__generator(this,function(i){switch(i.label){case 0:if(z)return[2];L(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,c.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(t=i.sent())?void 0:t.status)&&Array.isArray(null==t?void 0:t.data)?(r=t.data,E(function(t){if(0===n)return r;var o=new Set(t.map(function(e){return e.id})),i=r.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],t,!0),i,!0)}),r.length<20?P(!1):P(!0),q(n+20)):P(!1),[3,5];case 3:return o=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),P(!1),[3,5];case 4:return L(!1),[7];case 5:return[2]}})})};t.useEffect(function(){if(y&&(E([]),q(0),P(!0),Te(0),T)){ge(T);e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,c.fetchStationsByKeyword(T,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(t=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===T.toLowerCase()&&!e.ruleset_id}),t&&N(t)),[3,3];case 2:return r=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",r),[3,3];case 3:return[2]}})})}},[y,T]);t.useEffect(function(){be(F?function(n){var t;return e.__assign(e.__assign({},n),{region:null!==(t=F.market)&&void 0!==t?t:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[F]),t.useEffect(function(){var e=setTimeout(function(){Q(H)},500);return function(){return clearTimeout(e)}},[H]),t.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:if(!J.trim())return U([]),[2];$(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,c.searchScopes({search_string:J})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(t=n.data.map(function(e){var n,t,r;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(t=e.inheritance)||void 0===t?void 0:t[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(r=e.is_copy)&&void 0!==r&&r}}),U(t)):U([]),[3,5];case 3:return r=e.sent(),console.error("[StationOnboard] Error searching scopes:",r),U([]),[3,5];case 4:return $(!1),[7];case 5:return[2]}})})},[J]),t.useEffect(function(){!J.trim()&&Ce&&ie(Ce.id)},[J,Ce]);var Oe=function(){setTimeout(function(){ve.current&&ve.current.scrollTo({top:ve.current.scrollHeight,behavior:"smooth"})},100)},Fe=function(){ge(""),N(null),be({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),U([]),K(""),ie(null),b()},Ne=function(n,t){var r;if("primeTime"!==n){var o=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:"";be(function(t){var r;return e.__assign(e.__assign({},t),((r={})[n]=String(o),r))}),"genre"===n&&(te(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(function(){var e=A.find(function(e){return e.scope_name===o});ie(e?e.id:null),te(!1)},800))}else{var i=(null==t?void 0:t.value)?String(t.value):"";be(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Be=Boolean(F&&ye.region&&ye.primeTime.length>0&&ye.genre);return n.jsxs(r.Dialog,e.__assign({open:y,onClose:Fe,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden"}}},{children:[n.jsx(i.Toast,{ref:_e}),n.jsxs(r.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(r.IconButton,e.__assign({onClick:Fe,disabled:ae,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(r.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(g.default,{isLoading:ae,currentStep:ce,onComplete:function(){le(!1);var e=me.current;Fe(),j(e||void 0),me.current=null}}),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[n.jsxs(r.Box,e.__assign({ref:ve,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(r.Box,e.__assign({className:"space-y-1.5"},{children:[n.jsxs("label",e.__assign({className:"text-sm font-medium text-[#19213D]"},{children:[n.jsx("span",e.__assign({className:"mr-0.5 text-xs font-semibold text-[#8F2C23]"},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(p.default,{value:fe,onChange:ge,onStationSelect:function(e){return N(e)}})]})),n.jsx(d.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ye.region||void 0,isSearchable:!1}),n.jsx(d.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:_,value:je(_,(null===(S=ye.primeTime)||void 0===S?void 0:S[0])||""),onOptionChange:function(e){return Ne("primeTime",e)},isSearchable:!1}),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{required:!0,label:"Genre",placeholder:"Select Genre",options:we,value:je(we,ye.genre),onOptionChange:function(e){return Ne("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!z&&k&&Te(D)},isLoadingOptions:z,hasMoreOptions:k})})),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Station Type",placeholder:"None",options:m,value:je(m,ye.type),onOptionChange:function(n){Ne("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&be(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ye.type&&n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:h,value:je(h,ye.lowSelloutConfig),onOptionChange:function(e){return Ne("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),n.jsx(r.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:ye.genre?n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Matching scope for your station"})),n.jsx(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2,mb:4}},{children:ne?n.jsx(f.default,{}):Ce?n.jsx(x.default,e.__assign({},Ce,{isSelected:oe===Ce.id,onSelect:ie}),Ce.id):null})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Other available stations"})),n.jsxs("div",e.__assign({className:"relative mb-4 w-full"},{children:[n.jsx("input",{type:"text",value:H,onChange:function(e){return K(e.target.value)},placeholder:"Search for station...",className:"w-full rounded-lg border border-[#E2E8F0] px-10 py-[7px] text-[12px] outline-none transition-all placeholder:text-[#BAC0CC] focus:border-blue-500 focus:ring-1 focus:ring-blue-500"}),n.jsx(o.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16})]})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Z&&n.jsx(f.default,{}),!Z&&0===G.length&&J.trim()&&n.jsxs(r.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',J,'".']})),!Z&&G.map(function(t){return n.jsx(x.default,e.__assign({},t,{isSelected:oe===t.id,onSelect:ie}),t.id)})]}))]}):n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Fill in the station details to load AI recommended scopes"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:3}},{children:"AI will recommend the most relevant scope for this station."})),n.jsx(r.Box,e.__assign({sx:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.5,py:10}},{children:n.jsx("img",{src:a.default,alt:"Empty Result"})}))]})}))]}))]})),n.jsxs(r.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Fe,disabled:ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t,r,o,i,a,l,d,p,f,g,x,_,m,h,v,S,y;return e.__generator(this,function(b){switch(b.label){case 0:if(!F||!oe)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=Ce?e.__spreadArray([Ce],G,!0):G,t=n.find(function(e){return e.id===oe}),r=null!==(_=null==t?void 0:t.isCopy)&&void 0!==_&&_,le(!0),de(0),o=null,b.label=1;case 1:return b.trys.push([1,3,,4]),i={topic:"customRuleSet",customScopeGroupName:(null===u.IL_CONFIG_CONSTANTS||void 0===u.IL_CONFIG_CONSTANTS?void 0:u.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME)||"Audacy-Traffic-Manager",scopeDescription:F.station_name||"New Station",parentScopeId:null,customScopeName:F.station_name||"New Station",customScopeId:s.v4(),createByName:(null==xe?void 0:xe.firstname)||"System",createdBy:(null==xe?void 0:xe.email)||"system@audacy.com",applicationMappingId:w},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,c.createRuleSet(i,C)];case 2:if(a=b.sent(),!(o=null===(m=null==a?void 0:a.data)||void 0===m?void 0:m.scopeId))throw new Error("Failed to create scope - no scopeId returned");return de(1),[3,4];case 3:return l=b.sent(),console.error("[StationOnboard] Error creating rule set:",l),null===(h=_e.current)||void 0===h||h.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),le(!1),de(0),[2];case 4:return b.trys.push([4,6,,11]),d={market:F.market,region:F.region,primetime_windows:ye.primeTime,genre:ye.genre,station_type:""===ye.type?null:ye.type,low_sellout_configurations:"Low Sellout"===ye.type?ye.lowSelloutConfig:null,ruleset_id:o,station_guid:F.station_guid,station_name:F.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",d),[4,c.updateStation(d)];case 5:return b.sent(),de(2),[3,11];case 6:p=b.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",p),409===p.status?(null===(v=_e.current)||void 0===v||v.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),N(null),ie(null),ge(""),be(function(n){return e.__assign(e.__assign({},n),{region:""})})):null===(S=_e.current)||void 0===S||S.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),b.label=7;case 7:return b.trys.push([7,9,,10]),[4,c.deleteRuleSet(o,C)];case 8:return b.sent(),[3,10];case 9:return f=b.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",f),[3,10];case 10:return le(!1),de(0),[2];case 11:return b.trys.push([11,13,,14]),g={source_scope_id:oe,target_scope_id:o,is_copy_parent_variant_id:r},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",g),[4,c.inheritScope(g)];case 12:return b.sent(),de(3),[3,14];case 13:return x=b.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",x),null===(y=_e.current)||void 0===y||y.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),le(!1),de(0),[2];case 14:return me.current=o,[2]}})})},disabled:!Be||ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Be?"#2563EB":"#BFDBFE",color:"#fff",cursor:Be&&!ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:ae?n.jsxs(n.Fragment,{children:[n.jsx(r.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
2
+ //# sourceMappingURL=BackwardStationOnboardModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackwardStationOnboardModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../../node_modules/style-inject/dist/style-inject.es.js").default("@keyframes CreateLearningSetModal-module_spin__0BrCH{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.CreateLearningSetModal-module_overlay__iwLU2{align-items:center;background-color:#0000004d;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:9999}.CreateLearningSetModal-module_modal__TIP0O{background-color:#fff;border-radius:.75rem;box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;max-width:90%;padding:1.5rem;position:relative;width:600px}.CreateLearningSetModal-module_header__alW8D{align-items:flex-start;display:flex;gap:1rem;justify-content:space-between;margin-bottom:1.5rem}.CreateLearningSetModal-module_headerContent__bxA6y{flex:1}.CreateLearningSetModal-module_title__vlj8Q{color:#19213d;font-size:1.125rem;font-weight:500;margin:0}.CreateLearningSetModal-module_description__TGliO{color:#666f8d;font-size:.875rem;font-weight:400;line-height:1.5;margin-top:.25rem}.CreateLearningSetModal-module_closeBtn__33qJN{align-items:center;background:#0000;border:none;border-radius:.375rem;color:#9ca3af;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:color .2s,background-color .2s}.CreateLearningSetModal-module_closeBtn__33qJN:hover{background-color:#f3f4f6;color:#4b5563}.CreateLearningSetModal-module_closeBtn__33qJN:focus{outline:none}.CreateLearningSetModal-module_form__e8iCL{display:flex;flex-direction:column;gap:1.25rem}.CreateLearningSetModal-module_formGroup__RydF4{display:flex;flex-direction:column;gap:.375rem;position:relative}.CreateLearningSetModal-module_label__q-hkm{align-items:center;color:#19213d;display:flex;font-size:.875rem;font-weight:500}.CreateLearningSetModal-module_asterisk__cXpjU{color:#8f2c23;font-size:1rem;font-weight:600;margin-right:.25rem}.CreateLearningSetModal-module_inputField__nnq0-{background-color:#fff;border:1px solid #f0f2f5;border-radius:.375rem;box-sizing:border-box;color:#19213d;font-size:.875rem;outline:none;padding:.625rem .75rem;transition:border-color .2s,box-shadow .2s;width:100%}.CreateLearningSetModal-module_inputField__nnq0-::placeholder{color:#9ca3af}.CreateLearningSetModal-module_inputField__nnq0-:focus{border-color:#2563eb;box-shadow:0 0 0 2px #2563eb33}.CreateLearningSetModal-module_inputError__Q78Vy{border-color:#8f2c23}.CreateLearningSetModal-module_inputError__Q78Vy:focus{border-color:#8f2c23;box-shadow:0 0 0 2px #8f2c2333}.CreateLearningSetModal-module_errorMessage__z0WBC{color:#8f2c23;font-size:.75rem;font-weight:400;margin-top:.25rem}.CreateLearningSetModal-module_footer__qc-SJ{display:flex;gap:.75rem;justify-content:flex-end;margin-top:1rem}.CreateLearningSetModal-module_cancelBtn__YiIV7{background-color:initial;border:1px solid #e2e8f0;border-radius:.375rem;color:#64748b;cursor:pointer;font-size:.875rem;font-weight:500;padding:.5rem 1rem;transition:background-color .2s}.CreateLearningSetModal-module_cancelBtn__YiIV7:hover:not(:disabled){background-color:#f9fafb}.CreateLearningSetModal-module_cancelBtn__YiIV7:disabled{cursor:not-allowed;opacity:.5}.CreateLearningSetModal-module_confirmBtn__8oMwL{align-items:center;background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;display:inline-flex;font-size:.875rem;font-weight:500;justify-content:center;padding:.5rem 1rem;transition:background-color .2s}.CreateLearningSetModal-module_confirmBtn__8oMwL:hover:not(:disabled){background-color:#1d4ed8}.CreateLearningSetModal-module_confirmBtn__8oMwL:disabled{cursor:not-allowed;opacity:.5}.CreateLearningSetModal-module_spinner__SERKD{animation:CreateLearningSetModal-module_spin__0BrCH 1s linear infinite;color:#fff;height:1rem;margin-right:.5rem;width:1rem}"),exports.default={overlay:"CreateLearningSetModal-module_overlay__iwLU2",modal:"CreateLearningSetModal-module_modal__TIP0O",header:"CreateLearningSetModal-module_header__alW8D",headerContent:"CreateLearningSetModal-module_headerContent__bxA6y",title:"CreateLearningSetModal-module_title__vlj8Q",description:"CreateLearningSetModal-module_description__TGliO",closeBtn:"CreateLearningSetModal-module_closeBtn__33qJN",form:"CreateLearningSetModal-module_form__e8iCL",formGroup:"CreateLearningSetModal-module_formGroup__RydF4",label:"CreateLearningSetModal-module_label__q-hkm",asterisk:"CreateLearningSetModal-module_asterisk__cXpjU",inputField:"CreateLearningSetModal-module_inputField__nnq0-",inputError:"CreateLearningSetModal-module_inputError__Q78Vy",errorMessage:"CreateLearningSetModal-module_errorMessage__z0WBC",footer:"CreateLearningSetModal-module_footer__qc-SJ",cancelBtn:"CreateLearningSetModal-module_cancelBtn__YiIV7",confirmBtn:"CreateLearningSetModal-module_confirmBtn__8oMwL",spinner:"CreateLearningSetModal-module_spinner__SERKD",spin:"CreateLearningSetModal-module_spin__0BrCH"};
2
+ //# sourceMappingURL=CreateLearningSetModal.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateLearningSetModal.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/InstantLearning/InstantLearning.js"),t=require("./features/WtaWnta/WtaWnta.js"),r=require("./features/DocumentLearning/DocumentLearning.js"),n=require("./features/IL-OTJ/ILOTJ.js"),a=require("./features/IL-OTJ/_components/atoms/Button/Button.js"),o=require("./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js"),s=require("./features/IL-OTJ/_components/atoms/Toggle/Toggle.js"),i=require("./features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),p=require("./features/IL-OTJ/_components/molecules/Condition/ConditionList.js"),u=require("./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js"),c=require("./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js"),T=require("./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js"),g=require("./features/IL-OTJ/_components/organisms/TextSection/TextSection.js"),m=require("./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js"),x=require("./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js"),f=require("./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js"),l=require("./features/IL-OTJ/_components/templates/Testing/Testing.js"),d=require("./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js"),L=require("./features/IL-OTJ/helpers/utils.js"),I=require("./features/IL-OTJ/store/CitationsContext.js"),S=require("./features/IL-OTJ/ILOTJTest.js"),j=require("./features/LearningManagement/LearningManagement.js"),O=require("./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js"),q=require("./features/LSCGuidelinesCart/GuidelinesLandingPage.js");require("./features/LearningManagement/LearningManagementTest.js"),exports.InstantLearning=e.default,exports.WtaWnta=t.default,exports.BookLearning=r.default,exports.ILOTJ=n.default,exports.Button=a.Button,exports.Dropdown=o.Dropdown,exports.Toggle=s.Toggle,exports.Textarea=i.Textarea,exports.ConditionList=p.ConditionList,exports.SectionWrapper=u.SectionWrapper,exports.SeparationRow=c.SeparationRow,exports.ConfigSection=T.ConfigSection,exports.TextSection=g.TextSection,exports.ScopeSection=m.ScopeSection,exports.ConditionSection=x.ConditionSection,exports.TrafficManagerTemplate=f.TrafficManagerTemplate,exports.Testing=l.Testing,Object.defineProperty(exports,"TemplateList",{enumerable:!0,get:function(){return d.TemplateList}}),exports.TemplateMap=d.TemplateMap,exports.extractAndParseResponse=L.extractAndParseResponse,exports.extractAndParseWithProperty=L.extractAndParseWithProperty,exports.extractTextFromChildren=L.extractTextFromChildren,exports.extractVariantIds=L.extractVariantIds,exports.parseValidationData=L.parseValidationData,exports.useHeaderObserver=L.useHeaderObserver,exports.CitationProvider=I.CitationProvider,exports.useCitations=I.useCitations,exports.dummyDat=S.dummyDat,exports.getVariantInfo=S.getVariantInfo,exports.LearningManagement=j.default,exports.TeachMePlugin=O.default,exports.TemplateRegistry=O.TemplateRegistry,exports.GuidelineLandingPage=q.GuidelineLandingPage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/InstantLearning/InstantLearning.js"),t=require("./features/WtaWnta/WtaWnta.js"),r=require("./features/DocumentLearning/DocumentLearning.js"),o=require("./features/IL-OTJ/ILOTJ.js"),n=require("./features/IL-OTJ/_components/atoms/Button/Button.js"),a=require("./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js"),s=require("./features/IL-OTJ/_components/atoms/Toggle/Toggle.js"),i=require("./features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),p=require("./features/IL-OTJ/_components/molecules/Condition/ConditionList.js"),u=require("./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js"),c=require("./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js"),T=require("./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js"),m=require("./features/IL-OTJ/_components/organisms/TextSection/TextSection.js"),x=require("./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js"),f=require("./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js"),g=require("./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js"),l=require("./features/IL-OTJ/_components/templates/Testing/Testing.js"),L=require("./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js"),d=require("./features/IL-OTJ/helpers/utils.js"),I=require("./features/IL-OTJ/store/CitationsContext.js"),S=require("./features/IL-OTJ/ILOTJTest.js"),j=require("./features/LearningManagement/LearningManagement.js"),O=require("./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js");require("./features/LearningManagement/LearningManagementTest.js"),exports.InstantLearning=e.default,exports.WtaWnta=t.default,exports.BookLearning=r.default,exports.ILOTJ=o.default,exports.Button=n.Button,exports.Dropdown=a.Dropdown,exports.Toggle=s.Toggle,exports.Textarea=i.Textarea,exports.ConditionList=p.ConditionList,exports.SectionWrapper=u.SectionWrapper,exports.SeparationRow=c.SeparationRow,exports.ConfigSection=T.ConfigSection,exports.TextSection=m.TextSection,exports.ScopeSection=x.ScopeSection,exports.ConditionSection=f.ConditionSection,exports.TrafficManagerTemplate=g.TrafficManagerTemplate,exports.Testing=l.Testing,Object.defineProperty(exports,"TemplateList",{enumerable:!0,get:function(){return L.TemplateList}}),exports.TemplateMap=L.TemplateMap,exports.extractAndParseResponse=d.extractAndParseResponse,exports.extractAndParseWithProperty=d.extractAndParseWithProperty,exports.extractTextFromChildren=d.extractTextFromChildren,exports.extractVariantIds=d.extractVariantIds,exports.parseValidationData=d.parseValidationData,exports.useHeaderObserver=d.useHeaderObserver,exports.CitationProvider=I.CitationProvider,exports.useCitations=I.useCitations,exports.dummyDat=S.dummyDat,exports.getVariantInfo=S.getVariantInfo,exports.LearningManagement=j.default,exports.TeachMePlugin=O.default,exports.TemplateRegistry=O.TemplateRegistry;
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import{__assign as i}from"tslib";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n}from"react";import{TextSection as o}from"../../organisms/TextSection/TextSection.js";import{ScopeSection as d}from"../../organisms/ScopeSection/ScopeSection.js";import{ConditionSection as l}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as s}from"../../organisms/ConfigSection/ConfigSection.js";import{InputDataReasoningCard as a}from"../../InputDataReasoningCard.js";import{ButtonCognitiveIcon as r}from"../../_svg/ButtonCognitiveIcon.js";var c=function(c){var p,h,g,v,u,m,I,f,E,b,y,A,S,C,T,N,w,W,L,O,D,M,x,P,R,j,q,V,H,K,z,B,_,k=c.state,F=c.handlers,G=c.uiState,J=c.customNodes,Q=void 0===J?{}:J,U=n({}),X=U[0],Y=U[1],Z=n(new Set),$=Z[0],ii=Z[1],ei=function(e){Y(function(t){var n;return i(i({},t),((n={})[e]=!t[e],n))})},ti=function(i){var e,t=null===(e=k.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(t)&&t.length>0?t:k.citations||[]},ni={marginTop:"-17px",position:"relative",zIndex:1},oi=function(i){return!!G.isAiStreaming||(!!G.isReadOnly||!(!G.activeEditId||G.activeEditId.startsWith(i)))};return e("div",i({className:"base-template-container",style:{display:"flex",flexDirection:"column",gap:"16px",width:"100%"}},{children:[Q.top&&t("div",i({className:"custom-slot-top"},{children:Q.top})),e("div",i({className:"template-section"},{children:[t(o,{id:"base-title",title:G.titleLabel||"Title",fieldName:G.titleLabel||"Title",rows:1,placeholder:"Enter a descriptive title",required:!0,value:k.title||"",onChange:F.onTitleChange,readOnly:oi("base-title"),isOpen:X.title,onToggle:function(){return ei("title")},isHighlighted:(null===(p=G.highlights)||void 0===p?void 0:p.get("title"))||!1,showCognitiveIcon:!!(null===(h=k.citation)||void 0===h?void 0:h.title),tooltipDescription:"Why this ".concat(G.titleLabel||"Title","?"),errorMessage:null===(g=G.validationErrors)||void 0===g?void 0:g.title,enableInlineEdit:!0,setSendMessageInChat:G.setSendMessageInChat,activeEditId:null!==(v=G.activeEditId)&&void 0!==v?v:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(u=G.pendingEditId)&&void 0!==u?u:null,setPendingEditId:G.setPendingEditId}),(null===(m=k.citation)||void 0===m?void 0:m.title)&&t("div",i({style:ni},{children:t(a,{isVisible:X.title,citation:k.citation.title,citations:ti("title"),fieldName:G.titleLabel||"Title",fieldValue:k.title||""})}))]})),Q.afterTitle&&t("div",i({className:"custom-slot"},{children:Q.afterTitle})),G.showScope&&e("div",i({className:"template-section"},{children:[t(d,{id:"base-scope",title:G.scopeLabel||"",required:!1,scopeData:k.scopeData||{},onScopeChange:F.onScopeChange,openSections:$,setOpenSections:ii,stationOptions:G.stationOptions||[],tierOptions:G.tierOptions||[],tierLabel:G.tierLabel||"Where should this apply?",stationLabel:G.stationLabel||"Which scope should this belong to?",highlights:(null===(I=G.highlights)||void 0===I?void 0:I.get("scope"))||{},isOpen:X.scope,onToggle:function(){return ei("scope")},showCognitiveIcon:!!(null===(f=k.citation)||void 0===f?void 0:f.scope),cognitiveIcon:t(r,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(E=G.validationErrors)||void 0===E?void 0:E.station)||(null===(b=G.validationErrors)||void 0===b?void 0:b.tiers),stationErrorMessage:null===(y=G.validationErrors)||void 0===y?void 0:y.station,tierErrorMessage:null===(A=G.validationErrors)||void 0===A?void 0:A.tiers,readOnly:oi("base-scope")}),(null===(S=k.citation)||void 0===S?void 0:S.scope)&&t("div",i({style:ni},{children:t(a,{isVisible:X.scope,citation:k.citation.scope,citations:ti("scope"),fieldName:"Scope",fieldValue:(null===(T=null===(C=k.scopeData)||void 0===C?void 0:C.tiers)||void 0===T?void 0:T.join(", "))||""})}))]})),Q.afterScope&&t("div",i({className:"custom-slot"},{children:Q.afterScope})),e("div",i({className:"template-section"},{children:[t(o,{id:"base-description",title:G.descriptionLabel||"Description",fieldName:G.descriptionLabel||"Description",rows:3,placeholder:"Explain the behaviour or learning",required:!0,value:k.description||"",onChange:F.onDescriptionChange,readOnly:oi("base-description"),isOpen:X.description,onToggle:function(){return ei("description")},isHighlighted:(null===(N=G.highlights)||void 0===N?void 0:N.get("description"))||!1,showCognitiveIcon:!!(null===(w=k.citation)||void 0===w?void 0:w.description),tooltipDescription:"Why this ".concat(G.descriptionLabel||"Description","?"),errorMessage:null===(W=G.validationErrors)||void 0===W?void 0:W.description,enableInlineEdit:!0,setSendMessageInChat:G.setSendMessageInChat,activeEditId:null!==(L=G.activeEditId)&&void 0!==L?L:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(O=G.pendingEditId)&&void 0!==O?O:null,setPendingEditId:G.setPendingEditId}),(null===(D=k.citation)||void 0===D?void 0:D.description)&&t("div",i({style:ni},{children:t(a,{isVisible:X.description,citation:k.citation.description,citations:ti("description"),fieldName:G.descriptionLabel||"Description",fieldValue:k.description||""})}))]})),Q.afterDescription&&t("div",i({className:"custom-slot"},{children:Q.afterDescription})),t("div",i({className:"template-section"},{children:t(l,{id:"condition-wta-base",idPrefix:"condition-wta",title:G.whenToApplyLabel||"When to apply",required:!0,dividerRequired:!0,readOnly:oi("condition-wta"),conditions:k.whenToApplyConditions||[],onAdd:F.onAddWhenToApply,onRemove:function(i,e,t){return F.onRemoveWhenToApply(t)},onEdit:function(i,e,t,n){return F.onEditWhenToApply(t,n)},isHighlighted:(null===(M=G.highlights)||void 0===M?void 0:M.get("wta"))||!1,highlightedIds:G.highlightedIds,tooltipDescription:"Why this Condition?",citations:ti("whenToApply"),bordered:!0,addLabel:"Add ".concat(G.whenToApplyLabel||"When to apply"),isAiStreaming:G.isAiStreaming,errorMessage:(null===(x=G.validationErrors)||void 0===x?void 0:x.whenToApply)||G.conflictReason,index:0,tierKey:"base",activeEditId:null!==(P=G.activeEditId)&&void 0!==P?P:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(R=G.pendingEditId)&&void 0!==R?R:null,setPendingEditId:G.setPendingEditId,setSendMessageInChat:G.setSendMessageInChat})})),Q.afterWhenToApply&&t("div",i({className:"custom-slot"},{children:Q.afterWhenToApply})),t("div",i({className:"template-section"},{children:t(l,{id:"condition-wnta-base",idPrefix:"condition-wnta",title:G.whenNotToApplyLabel||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:oi("condition-wnta"),conditions:k.whenNotToApplyConditions||[],onAdd:F.onAddWhenNotToApply,onRemove:function(i,e,t){return F.onRemoveWhenToApply(t)},onEdit:function(i,e,t,n){return F.onEditWhenNotToApply(t,n)},isHighlighted:(null===(j=G.highlights)||void 0===j?void 0:j.get("wnta"))||!1,highlightedIds:G.highlightedIds,tooltipDescription:"Why this Condition?",citations:ti("whenNotToApply"),bordered:!0,addLabel:"Add ".concat(G.whenNotToApplyLabel||"When NOT to apply"),isAiStreaming:G.isAiStreaming,errorMessage:null===(q=G.validationErrors)||void 0===q?void 0:q.whenNotToApply,index:0,tierKey:"base",activeEditId:null!==(V=G.activeEditId)&&void 0!==V?V:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(H=G.pendingEditId)&&void 0!==H?H:null,setPendingEditId:G.setPendingEditId,setSendMessageInChat:G.setSendMessageInChat})})),Q.afterWhenNotToApply&&t("div",i({className:"custom-slot"},{children:Q.afterWhenNotToApply})),G.showConfiguration&&e("div",i({className:"template-section"},{children:[t(s,{id:"base-config",title:G.configLabel||"Configuration",required:!1,highlights:(null===(K=G.highlights)||void 0===K?void 0:K.get("config"))||{},bordered:!0,readOnly:oi("base-config"),onConfigChange:function(i,e){var t;return null===(t=F.onConfigChange)||void 0===t?void 0:t.call(F,i,e)},separationItems:G.separationItems||[],toggles:G.toggles||[],index:0,openSections:$,setOpenSections:ii,activeEditId:null!==(z=G.activeEditId)&&void 0!==z?z:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(B=G.pendingEditId)&&void 0!==B?B:null,setPendingEditId:G.setPendingEditId,isAiStreaming:G.isAiStreaming,setSendMessageInChat:G.setSendMessageInChat}),(null===(_=k.citation)||void 0===_?void 0:_.config)&&t("div",i({style:ni},{children:t(a,{isVisible:X.config,citation:k.citation.config,citations:ti("config"),fieldName:G.configLabel||"Configuration",fieldValue:"Proposed Configuration"})}))]})),Q.bottom&&t("div",i({className:"custom-slot-bottom"},{children:Q.bottom}))]}))};export{c as BaseTemplate};
2
+ //# sourceMappingURL=BaseTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseTemplate.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{__assign as e,__spreadArray as t}from"tslib";import{jsx as n,jsxs as i,Fragment as o}from"react/jsx-runtime";import r,{useState as l,useRef as a,useEffect as d,useCallback as c,useMemo as s}from"react";import{Loader2Icon as p,Check as u,X as f,Pencil as h,Trash2 as g,ChevronUp as y,ChevronDown as x,ArrowLeft as m,Sparkles as b,Plus as v}from"lucide-react";var w=0,C=function(){return"cond-".concat(Date.now(),"-").concat(++w)},F="#CBD5E1",k="#9B8AFB",S="#7C3AED",z="#FDA29B",D="#344054",E="#1E293B",A="#334155",B="#64748B",R="#94A3B8",T="#98A2B3",I="#F04438",W="#8F2C23",H="#5925DC",j="#475569",L="#FFFFFF",M="#F8FAFC",N="#F1F5F9",_="#F9F5FF",O="#17B26A",K="#F04438",q="#64748B",U="6px",Y="8px",P="Inter, sans-serif",X={width:38,height:38,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid #D0D5DD",borderRadius:U,cursor:"pointer",background:L,flexShrink:0,transition:"background 0.15s"},V={width:"100%",boxSizing:"border-box",padding:"8px 11.5px",border:"1px solid #D0D5DD",borderRadius:U,fontSize:14,fontWeight:400,lineHeight:"100%",fontFamily:P,outline:"none",color:D,background:L},Z={display:"flex",alignItems:"center",gap:4,marginBottom:8,color:D,fontSize:14,fontWeight:500,lineHeight:"130%",fontFamily:P},G={background:L,border:"1px solid ".concat(F),borderRadius:Y,padding:16},J=n("span",e({style:{color:W,fontSize:12,lineHeight:1,display:"inline-flex",transform:"translateY(0.5px)"}},{children:"*"})),Q={exact_match:{label:"Exact Match",bg:"#F0FDF4",border:"#BBF7D0",text:"#166534",dot:"#22C55E"},conflict:{label:"Conflict",bg:"#FEF2F2",border:"#FECACA",text:"#991B1B",dot:"#EF4444"},partial_overlap:{label:"Partial Match",bg:"#FFF7ED",border:"#FED7AA",text:"#92400E",dot:"#F97316"},new_field:{label:"New",bg:"#F5F3FF",border:"#DDD6FE",text:"#5925DC",dot:"#7C3AED"}},$=function(e){return e?Array.isArray(e)?e.filter(Boolean).join("\n"):e:""},ee=function(e,t){if(!t&&!e)return"exact_match";if(!t)return"new_field";if(!e)return"new_field";var n=function(e){return e.trim().toLowerCase()};if(n(e)===n(t))return"exact_match";var i=new Set(n(e).split(/\s+/)),o=new Set(n(t).split(/\s+/));return Array.from(i).filter(function(e){return o.has(e)}).length/Math.max(i.size,o.size)>=.45?"partial_overlap":"conflict"},te=function(t){var o=t.relation,r=Q[o];return i("div",e({style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 9px",borderRadius:20,background:r.bg,border:"1px solid ".concat(r.border),fontSize:10,fontWeight:600,color:r.text,fontFamily:P,whiteSpace:"nowrap",flexShrink:0}},{children:[n("span",{style:{width:5,height:5,borderRadius:"50%",background:r.dot,flexShrink:0}}),r.label]}))},ne=r.forwardRef(function(t,o){var r=t.label,l=t.value;return i("div",e({ref:o,style:{display:"flex",flexDirection:"column"}},{children:[n("p",e({style:{margin:"0 0 5px 0",fontSize:12,color:B,fontFamily:P}},{children:r})),n("div",e({style:{flex:1,padding:"9px 12px",borderRadius:Y,background:"#FFF3F2",border:"1px solid ".concat("#FECACA"),fontSize:13,lineHeight:"150%",color:l?E:R,fontFamily:P,fontStyle:l?"normal":"italic",wordBreak:"break-word",whiteSpace:"pre-wrap",minHeight:37}},{children:l||"—"}))]}))});ne.displayName="FieldCell";var ie=function(t){var r=t.formData,p=t.existingData,u=t.onClose,f=t.visible,h=r.whenToApply.map(function(e){return e.text}).filter(Boolean).join("\n"),g=r.whenNotToApply.map(function(e){return e.text}).filter(Boolean).join("\n"),y=$(p.whenToApply),x=$(p.whenNotToApply),v=s(function(){return[{label:"Title",proposed:r.name,existing:p.name||"",relation:ee(r.name,p.name||"")},{label:"Description",proposed:r.description,existing:p.description||"",relation:ee(r.description,p.description||"")},{label:"When to apply",proposed:h,existing:y,relation:ee(h,y)},{label:"When NOT to Apply",proposed:g,existing:x,relation:g?ee(g,x):x?"new_field":"exact_match"}]},[r.name,r.description,h,g,p.name,p.description,y,x]),w=v.reduce(function(e,t){return e[t.relation]=(e[t.relation]||0)+1,e},{}),C=a(null),k=a([]),S=a([]),z=l([]),D=z[0],B=z[1];k.current=[],S.current=[];var R=c(function(){if(C.current){var e=C.current.getBoundingClientRect(),t=[];v.forEach(function(n,i){var o=k.current[i],r=S.current[i];if(o&&r){o.style.height="auto",r.style.height="auto";var l=o.getBoundingClientRect(),a=r.getBoundingClientRect(),d=Math.max(l.height,a.height);o.style.height="".concat(d,"px"),r.style.height="".concat(d,"px");var c=o.getBoundingClientRect(),s=r.getBoundingClientRect(),p=c.top+c.height/2-e.top;t.push({x1:c.right-e.left,y1:p,x2:s.left-e.left,y2:p,relation:n.relation})}}),B(t)}},[v]);return d(function(){var e=setTimeout(R,150);window.addEventListener("resize",R);var t=null;return C.current&&(t=new ResizeObserver(function(){window.requestAnimationFrame(function(){return R()})})).observe(C.current),function(){clearTimeout(e),window.removeEventListener("resize",R),t&&t.disconnect()}},[R,f]),i(o,{children:[n("div",{onClick:u,style:{position:"absolute",inset:0,background:"rgba(15,23,42,0.18)",zIndex:10,opacity:f?1:0,transition:"opacity 0.25s ease",pointerEvents:f?"auto":"none"}}),i("div",e({style:{position:"absolute",inset:0,background:L,zIndex:11,display:"flex",flexDirection:"column",transform:f?"translateX(0)":"translateX(100%)",transition:"transform 0.28s cubic-bezier(0.4,0,0.2,1)",borderRadius:Y,overflow:"hidden"}},{children:[i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid ".concat(F),flexShrink:0,background:L}},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[n("button",e({type:"button",onClick:u,style:e(e({},X),{width:32,height:32,border:"1px solid ".concat(F),borderRadius:U})},{children:n(m,{size:15,color:A})})),n("span",e({style:{fontSize:15,fontWeight:600,color:E,fontFamily:P,letterSpacing:"-0.01em"}},{children:"Category Comparison"}))]})),n("div",e({style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"}},{children:Object.entries(w).map(function(t){var o=t[0],r=t[1];return i("div",e({style:{display:"flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:20,background:Q[o].bg,border:"1px solid ".concat(Q[o].border),fontSize:11,fontWeight:600,color:Q[o].text,fontFamily:P}},{children:[n("span",{style:{width:5,height:5,borderRadius:"50%",background:Q[o].dot}}),r," ",Q[o].label]}),o)})}))]})),n("div",e({style:{flex:1,overflowY:"auto",padding:16}},{children:i("div",e({ref:C,style:{display:"grid",gridTemplateColumns:"1fr 140px 1fr",alignItems:"start",gap:"0",position:"relative"}},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:D.map(function(t,o){var r=(t.x1+t.x2)/2,l=t.y1,a=Q[t.relation];return i("g",{children:[n("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:a.border,strokeWidth:"1.5"}),n("foreignObject",e({x:r-70,y:l-14,width:"140",height:"28"},{children:n("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(te,{relation:t.relation})}))}))]},o)})})),i("div",e({style:{border:"1.5px dashed #CBD5E1",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:14}},{children:[n("p",e({style:{margin:"0 0 2px 0",fontSize:13,fontWeight:600,color:E,fontFamily:P}},{children:"Category You're Creating"})),v.map(function(e,t){return n(ne,{ref:function(e){k.current[t]=e},label:e.label,value:e.proposed},t)})]})),n("div",{}),i("div",e({style:{border:"1.5px dashed #CBD5E1",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:14}},{children:[i("p",e({style:{margin:"0 0 2px 0",fontSize:13,fontWeight:600,color:H,fontFamily:P,display:"flex",alignItems:"center",gap:5}},{children:[n(b,{size:13,color:H}),"Existing Category"]})),v.map(function(e,t){return n(ne,{ref:function(e){S.current[t]=e},label:e.label,value:e.existing},t)})]}))]}))}))]}))]})},oe=function(t){var r=t.condition,l=t.index,a=t.isEditing,d=t.editText,c=t.onEditStart,s=t.onEditChange,p=t.onEditSave,y=t.onEditCancel,x=t.onRemove,m=t.readOnly,b=t.onBlurContainer,v={width:40,height:38,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:M,borderRight:"1px solid #D0D5DD",color:j,fontSize:14,fontFamily:P};return i("div",a?e({style:{display:"flex",alignItems:"center",gap:12},onBlur:b},{children:[i("div",e({style:{display:"flex",flex:1,alignItems:"center",background:L,border:"1px solid ".concat(k),borderRadius:Y,overflow:"hidden"}},{children:[n("div",e({style:v},{children:l+1})),n("input",{type:"text",value:d,onChange:function(e){return s(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Enter"===e.key&&d.trim()?p():"Escape"===e.key&&y()},style:{flex:1,padding:"8px 11.5px",fontSize:14,fontFamily:P,color:D,border:"none",outline:"none",background:"transparent"}})]})),n("button",e({type:"button",disabled:!d.trim(),onClick:p,style:e(e({},X),{borderRadius:Y,opacity:d.trim()?1:.5,cursor:d.trim()?"pointer":"not-allowed",background:d.trim()?L:M})},{children:n(u,{size:18,color:O})})),n("button",e({type:"button",onClick:y,style:e(e({},X),{borderRadius:Y})},{children:n(f,{size:18,color:K})}))]}):e({style:{display:"flex",alignItems:"center",gap:12}},{children:[i("div",e({style:{display:"flex",flex:1,alignItems:"center",background:L,border:"1px solid #D0D5DD",borderRadius:Y,overflow:"hidden",height:38}},{children:[n("div",e({style:e(e({},v),{height:"100%"})},{children:l+1})),n("div",e({style:{flex:1,padding:"0 11.5px",fontSize:14,fontFamily:P,display:"flex",alignItems:"center",height:"100%"}},{children:r.text?n("span",e({style:{color:D}},{children:r.text})):n("span",e({style:{color:R}},{children:"Enter condition"}))}))]})),!m&&i(o,{children:[n("button",e({type:"button",onClick:c,style:e(e({},X),{border:"1px solid ".concat(F),borderRadius:Y})},{children:n(h,{size:16,color:q})})),n("button",e({type:"button",onClick:x,style:e(e({},X),{border:"1px solid ".concat(z),borderRadius:Y})},{children:n(g,{size:16,color:K})}))]})]}))},re=function(t){var r=t.title,l=t.required,a=t.isExpanded,d=t.setIsExpanded,c=t.conditions,s=t.prefix,p=t.editingCondKey,u=t.editingCondText,f=t.setEditingCondKey,h=t.setEditingCondText,g=t.onAdd,x=t.onUpdate,m=t.onRemove,b=t.addLabel,w=t.readOnly,C=t.errorMessage,k=t.style,S=c.length>0;return i("div",e({style:e({border:"1px solid ".concat(F),borderRadius:Y,padding:16},k)},{children:[i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8,cursor:S?"pointer":"default",userSelect:"none"},onClick:function(){S&&d(function(e){return!e})}},{children:[i("label",e({style:e(e({},Z),{marginBottom:0,cursor:S?"pointer":"default"})},{children:[l&&J,n("span",{children:r})]})),n("button",e({type:"button",style:{background:"none",border:"none",cursor:"pointer",padding:0,display:"flex",alignItems:"center",transform:a?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s"}},{children:n(y,{size:20,color:S?D:R})}))]})),a&&i(o,{children:[0===c.length&&n("p",e({style:{color:B,fontSize:14,fontStyle:"italic",fontWeight:300,fontFamily:P,margin:"0 0 12px 0"}},{children:"No conditions applied"})),n("div",e({style:{display:"flex",flexDirection:"column",gap:12,marginBottom:12}},{children:c.map(function(e,t){var i="".concat(s,"_").concat(e.id);return n(oe,{condition:e,index:t,isEditing:p===i,editText:u,onEditStart:function(){f(i),h(e.text)},onEditChange:h,onEditSave:function(){u.trim()&&(x(e.id,u),f(null))},onEditCancel:function(){e.text?f(null):m(e.id)},onRemove:function(){return m(e.id)},readOnly:w,onBlurContainer:function(t){return function(e,t,n){if(!e.currentTarget.contains(e.relatedTarget)){var i="".concat(s,"_").concat(t);u.trim()||n?u.trim()&&x(t,u):m(t),p===i&&f(null)}}(t,e.id,e.text)}},e.id)})})),!w&&i("button",e({type:"button",onClick:g,style:{display:"flex",alignItems:"center",gap:7,color:H,fontSize:14,fontWeight:500,fontFamily:P,background:"none",border:"none",cursor:"pointer",padding:0}},{children:[n(v,{size:16}),b]})),C&&n("p",e({style:{marginTop:8,color:I,fontSize:12,fontFamily:P,margin:"8px 0 0 0"}},{children:C}))]})]}))},le=function(r){var s=r.state,m=r.handlers,b=r.uiState,w=s.formData,k=s.nameLabel,W=void 0===k?"Category Name":k,M=s.namePlaceholder,Q=void 0===M?"Enter category name":M,$=m.setFormData,ee=b.readOnly,te=void 0!==ee&&ee,ne=b.isAiStreaming,oe=void 0!==ne&&ne;b.setActiveEditId,b.setSendMessageInChat;var le=b.validationErrors,ae=void 0===le?{}:le,de=b.addExampleBtnRef,ce=b.comparisonData,se=void 0===ce?null:ce,pe=b.onComparisonClose,ue=l(null),fe=ue[0],he=ue[1],ge=l(""),ye=ge[0],xe=ge[1],me=l(null),be=me[0],ve=me[1],we=l(""),Ce=we[0],Fe=we[1],ke=l(!0),Se=ke[0],ze=ke[1],De=l(!0),Ee=De[0],Ae=De[1],Be=l(null),Re=Be[0],Te=Be[1],Ie=l(""),We=Ie[0],He=Ie[1],je=l(""),Le=je[0],Me=je[1],Ne=l([]),_e=Ne[0],Oe=Ne[1],Ke=l(!1),qe=Ke[0],Ue=Ke[1],Ye=a(null),Pe=l(!1),Xe=Pe[0],Ve=Pe[1],Ze=a(oe);d(function(){se?requestAnimationFrame(function(){return Ue(!0)}):Ue(!1)},[se]),d(function(){Ze.current&&!oe&&Xe&&Ve(!1),Ze.current=oe},[oe,Xe]);var Ge=te,Je=c(function(t,n){return $(function(i){var o;return e(e({},i),((o={})[t]=n,o))})},[$]),Qe=function(n){var i=C();$(function(o){var r;return e(e({},o),((r={})[n]=t(t([],o[n],!0),[{id:i,text:""}],!1),r))}),ve("".concat("whenToApply"===n?"wta":"wnta","_").concat(i)),Fe(""),"whenToApply"!==n||Se||ze(!0),"whenNotToApply"!==n||Ee||Ae(!0)},$e=function(t,n,i){return $(function(o){var r;return e(e({},o),((r={})[t]=o[t].map(function(t){return t.id===n?e(e({},t),{text:i}):t}),r))})},et=function(t,n){return $(function(i){var o;return e(e({},i),((o={})[t]=i[t].filter(function(e){return e.id!==n}),o))})},tt=function(e){return Oe(function(n){return n.includes(e)?n.filter(function(t){return t!==e}):t(t([],n,!0),[e],!1)})},nt=c(function(){var n=C();$(function(i){return e(e({},i),{occurrences:t(t([],i.occurrences||[],!0),[{id:n,title:"",description:""}],!1)})}),Te(n),He(""),Me(""),Oe(function(e){return t(t([],e,!0),[n],!1)})},[$]),it=c(function(){Ue(!1),setTimeout(function(){null==pe||pe()},280)},[pe]),ot=function(t){return i("button",e({ref:t?void 0:de,type:"button",disabled:t,onClick:nt,style:{display:"flex",alignItems:"center",gap:7,padding:"7px 10.5px",background:"none",border:"none",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,transition:"opacity 0.15s"}},{children:[n(v,{size:14,color:H}),n("span",e({style:{color:H,fontSize:14,fontWeight:500,fontFamily:P}},{children:"Add example"}))]}))};return i("div",e({style:{flex:1,overflowY:"auto",position:"relative"}},{children:[se&&n(ie,{formData:w,existingData:se,onClose:it,visible:qe}),Xe&&oe&&i("div",e({style:{display:"flex",alignItems:"center",color:"#141414",fontSize:13,fontWeight:500,fontStyle:"italic",marginBottom:12,paddingLeft:4,fontFamily:P}},{children:[n(p,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}}),"Updating category details..."]})),i("div",e({style:e(e({},G),{marginBottom:12})},{children:[i("div",e({style:{marginBottom:12}},{children:[i("label",e({style:Z},{children:[J,n("span",{children:W})]})),Ge&&"name"!==fe?n("div",e({style:{display:"flex",alignItems:"center",gap:12}},{children:n("div",e({style:{flex:1,padding:"10px 14px",border:"1px solid #D0D5DD",borderRadius:U,fontSize:14,background:L,minHeight:42,display:"flex",alignItems:"center"}},{children:w.name?n("span",e({style:{color:D}},{children:w.name})):n("span",e({style:{color:T}},{children:Q}))}))})):Ge&&"name"===fe?i("div",e({style:{display:"flex",alignItems:"center",gap:12}},{children:[n("input",{type:"text",value:ye,onChange:function(e){return xe(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Enter"===e.key?(Je("name",ye),he(null)):"Escape"===e.key&&he(null)},placeholder:Q,style:e(e({},V),{flex:1,width:"auto",border:"1px solid ".concat(S)})}),n("button",e({type:"button",onClick:function(){Je("name",ye),he(null)},style:X},{children:n(u,{size:18,color:O})})),n("button",e({type:"button",onClick:function(){return he(null)},style:X},{children:n(f,{size:18,color:K})}))]})):n("input",{type:"text",value:w.name,onChange:function(e){return Je("name",e.target.value)},placeholder:Q,disabled:oe,style:e(e({},V),{opacity:oe?.6:1,cursor:oe?"not-allowed":"text"})}),(null==ae?void 0:ae.name)&&n("p",e({style:{marginTop:4,color:I,fontSize:12,fontFamily:P,margin:"4px 0 0 0"}},{children:ae.name}))]})),i("div",e({style:{marginBottom:12}},{children:[i("label",e({style:Z},{children:[J,n("span",{children:"Category Description"})]})),Ge&&"description"!==fe?n("div",e({style:{display:"flex",alignItems:"flex-start",gap:12}},{children:n("div",e({style:{flex:1,padding:"12px 14px",border:"1px solid #D0D5DD",borderRadius:U,fontSize:14,background:L,minHeight:80}},{children:w.description?n("span",e({style:{color:D,whiteSpace:"pre-wrap"}},{children:w.description})):n("span",e({style:{color:T}},{children:"Describe when this category should be applied"}))}))})):Ge&&"description"===fe?i("div",e({style:{display:"flex",alignItems:"flex-start",gap:12}},{children:[n("textarea",{value:ye,onChange:function(e){return xe(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Escape"===e.key&&he(null)},placeholder:"Enter Description",rows:4,style:e(e({},V),{flex:1,width:"auto",border:"1px solid ".concat(S),resize:"none",lineHeight:"140%"})}),i("div",e({style:{display:"flex",flexDirection:"column",gap:8}},{children:[n("button",e({type:"button",onClick:function(){Je("description",ye),he(null)},style:X},{children:n(u,{size:18,color:O})})),n("button",e({type:"button",onClick:function(){return he(null)},style:X},{children:n(f,{size:18,color:K})}))]}))]})):n("textarea",{value:w.description,onChange:function(e){return Je("description",e.target.value)},placeholder:"Describe when this category should be applied.",disabled:oe,style:e(e({},V),{height:60,paddingTop:7,paddingBottom:10.5,border:"1px solid ".concat(F),lineHeight:"140%",resize:"none",boxShadow:"0 1px 2px 0 rgba(18,18,23,0.05)",opacity:oe?.6:1,cursor:oe?"not-allowed":"text"})}),(null==ae?void 0:ae.description)&&n("p",e({style:{marginTop:4,color:I,fontSize:12,fontFamily:P,margin:"4px 0 0 0"}},{children:ae.description}))]})),n(re,{title:"When to Apply",required:!0,isExpanded:Se,setIsExpanded:ze,conditions:w.whenToApply,prefix:"wta",editingCondKey:be,editingCondText:Ce,setEditingCondKey:ve,setEditingCondText:Fe,onAdd:function(){return Qe("whenToApply")},onUpdate:function(e,t){return $e("whenToApply",e,t)},onRemove:function(e){return et("whenToApply",e)},addLabel:"Add When to Apply",readOnly:oe||te,errorMessage:null==ae?void 0:ae.whenToApply,style:{marginBottom:12}}),n(re,{title:"When NOT to Apply",required:!1,isExpanded:Ee,setIsExpanded:Ae,conditions:w.whenNotToApply,prefix:"wnta",editingCondKey:be,editingCondText:Ce,setEditingCondKey:ve,setEditingCondText:Fe,onAdd:function(){return Qe("whenNotToApply")},onUpdate:function(e,t){return $e("whenNotToApply",e,t)},onRemove:function(e){return et("whenNotToApply",e)},addLabel:"Add When NOT to Apply",readOnly:oe||te,errorMessage:null==ae?void 0:ae.whenNotToApply})]})),i("div",e({style:e(e({},G),{marginTop:12})},{children:[i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12}},{children:[i("div",{children:[i("h4",e({style:{color:E,fontSize:14,fontWeight:500,lineHeight:"120%",letterSpacing:"0.02em",fontFamily:P,margin:"0 0 4px 0"}},{children:["Example (",(w.occurrences||[]).length,")"]})),n("p",e({style:{color:B,fontSize:12,fontWeight:300,lineHeight:"120%",letterSpacing:"0.02em",fontFamily:P,margin:0}},{children:"Add real examples to help the system understand this category"}))]}),(w.occurrences||[]).length>0&&!te&&ot(null!==Re||oe)]})),0===(w.occurrences||[]).length?i("div",e({style:{border:"1px solid ".concat(F),borderRadius:Y,background:L,padding:"24px 12px 12px",minHeight:181,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}},{children:[n("div",e({style:{marginBottom:16}},{children:i("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 56 56",fill:"none"},{children:[n("rect",{x:"4",y:"4",width:"48",height:"48",rx:"24",fill:"#F1F5F9"}),n("rect",{x:"4",y:"4",width:"48",height:"48",rx:"24",stroke:"#F8FAFC",strokeWidth:"8"}),n("rect",{width:"24",height:"24",transform:"translate(16 16)",fill:"#F1F5F9"}),n("path",{d:"M25 19.5V18M21.0607 21.0607L20 20M21.0607 29L20 30.0607M29 21.0607L30.0607 20M19.5 25H18M31.8645 32.1896L29.3727 36.817C29.0881 37.3457 28.9457 37.61 28.7745 37.6769C28.6259 37.7349 28.4585 37.7185 28.324 37.6328C28.1689 37.534 28.0806 37.2471 27.9038 36.6733L24.4452 25.4453C24.3008 24.9765 24.2286 24.7421 24.2867 24.5838C24.3373 24.446 24.446 24.3373 24.5838 24.2867C24.7421 24.2286 24.9765 24.3008 25.4452 24.4452L36.6732 27.9038C37.247 28.0806 37.5339 28.169 37.6327 28.324C37.7185 28.4586 37.7348 28.6259 37.6768 28.7745C37.61 28.9458 37.3456 29.0881 36.817 29.3728L32.1896 31.8645C32.111 31.9068 32.0717 31.9279 32.0374 31.9551C32.0068 31.9792 31.9792 32.0068 31.9551 32.0374C31.9279 32.0717 31.9068 32.111 31.8645 32.1896Z",stroke:"#475569",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))})),n("p",e({style:{color:A,fontSize:12,fontWeight:500,lineHeight:"120%",fontFamily:P,margin:"0 0 8px 0"}},{children:"No example added yet"})),n("p",e({style:{color:B,fontSize:14,fontWeight:300,lineHeight:"140%",fontFamily:P,margin:"0 0 8px 0",maxWidth:530}},{children:"Add an example to show how this category is used, or generate one using chat."})),!te&&ot(null!==Re||oe)]})):n("div",e({style:{display:"flex",flexDirection:"column",gap:12}},{children:(w.occurrences||[]).map(function(t,r){var l=_e.includes(t.id);return Re===t.id?i("div",e({style:{display:"flex",flexDirection:"column",gap:12,border:"1px solid ".concat(F),borderRadius:Y,background:L,padding:16,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[i("div",{children:[n("label",e({style:e(e({},Z),{marginBottom:8})},{children:n("span",e({style:{color:A}},{children:"Title/Subject"}))})),n("input",{type:"text",value:We,onChange:function(e){return He(e.target.value)},placeholder:"e.g., Follow-up on client feedback from last meeting",style:e(e({},V),{border:"1px solid ".concat(F),lineHeight:"140%"})})]}),i("div",{children:[i("label",e({style:{display:"flex",alignItems:"center",gap:4,marginBottom:8}},{children:[n("span",e({style:{color:A,fontSize:14,fontWeight:500,fontFamily:P}},{children:"Message body"})),J]})),n("textarea",{ref:function(e){e&&Re===t.id&&!Ye.current&&(Ye.current=e),e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},value:Le,onChange:function(e){Me(e.target.value),e.target.style.height="auto",e.target.style.height="".concat(e.target.scrollHeight,"px")},placeholder:"e.g., Hi, here's the latest update on the project. Let us know if you have any questions.",rows:1,style:e(e({},V),{border:"1px solid ".concat(F),overflow:"hidden",minHeight:60,lineHeight:"140%",resize:"none"})})]}),i("div",e({style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:4}},{children:[n("button",e({type:"button",onClick:function(){t.title||t.description||$(function(n){return e(e({},n),{occurrences:(n.occurrences||[]).filter(function(e){return e.id!==t.id})})}),Te(null),Ye.current=null},style:{padding:"6px 12px",color:j,fontSize:14,fontWeight:500,lineHeight:"140%",fontFamily:P,background:"none",border:"none",cursor:"pointer",borderRadius:U}},{children:"Cancel"})),n("button",e({type:"button",disabled:!Le.trim(),onClick:function(){var n;Le.trim()&&(n=t.id,$(function(t){return e(e({},t),{occurrences:t.occurrences.map(function(t){return t.id===n?e(e({},t),{title:We,description:Le}):t})})}),Te(null),Ye.current=null,Oe(function(e){return e.filter(function(e){return e!==t.id})}))},style:{padding:"6px 12px",borderRadius:U,fontSize:14,fontWeight:500,lineHeight:"140%",fontFamily:P,cursor:Le.trim()?"pointer":"not-allowed",background:Le.trim()?_:L,border:"1px solid ".concat(Le.trim()?_:"#E2E8F0"),color:Le.trim()?H:R,transition:"background 0.15s"}},{children:"Save"}))]}))]}),t.id):i("div",e({style:{display:"flex",flexDirection:"column",border:"1px solid #E2E8F0",borderRadius:Y,background:L,overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:12,padding:12}},{children:[n("div",e({style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:N,borderRadius:U,color:j,fontSize:10,fontWeight:500,fontFamily:P}},{children:r+1})),n("div",e({style:{flex:1,fontSize:15,fontWeight:500,lineHeight:"140%",fontFamily:P,color:A,wordBreak:"break-word"}},{children:t.title||n("span",e({style:{color:R,fontWeight:400,fontSize:14}},{children:"Untitled example"}))})),i("div",e({style:{display:"flex",alignItems:"center",gap:8,flexShrink:0}},{children:[!te&&i(o,{children:[n("button",e({type:"button",disabled:null!==Re||oe,onClick:function(){Te(t.id),He(t.title),Me(t.description),l||tt(t.id)},style:e(e({},X),{width:36,height:36,border:"1px solid #E2E8F0",borderRadius:U,opacity:null!==Re||oe?.5:1,cursor:null!==Re||oe?"not-allowed":"pointer"})},{children:n(h,{size:16,color:q})})),n("button",e({type:"button",disabled:null!==Re||oe,onClick:function(){return $(function(n){return e(e({},n),{occurrences:(n.occurrences||[]).filter(function(e){return e.id!==t.id})})})},style:e(e({},X),{width:36,height:36,border:"1px solid ".concat(z),borderRadius:U,opacity:null!==Re||oe?.5:1,cursor:null!==Re||oe?"not-allowed":"pointer"})},{children:n(g,{size:16,color:K})}))]}),n("button",e({type:"button",onClick:function(){return tt(t.id)},style:e(e({},X),{width:36,height:36,border:"none",background:"transparent"})},{children:n(l?y:x,{size:20,color:q})}))]}))]})),l&&i("div",e({style:{display:"flex",flexDirection:"column",padding:"4px 12px 16px"}},{children:[i("div",e({style:{marginBottom:12}},{children:[n("p",e({style:{color:B,fontSize:13,lineHeight:"140%",fontFamily:P,margin:"0 0 4px 0"}},{children:"Title/Subject:"})),n("p",e({style:{color:E,fontSize:14,fontWeight:300,lineHeight:"150%",fontFamily:P,whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},{children:t.title||n("span",e({style:{color:R,fontStyle:"italic"}},{children:"—"}))}))]})),i("div",{children:[n("p",e({style:{color:B,fontSize:13,lineHeight:"140%",fontFamily:P,margin:"0 0 4px 0"}},{children:"Message body:"})),n("p",e({style:{color:E,fontSize:14,fontWeight:300,lineHeight:"150%",fontFamily:P,whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},{children:t.description}))]})]}))]}),t.id)})}))]}))]}))};export{le as CreateCategory,le as default};
2
+ //# sourceMappingURL=CreateCategory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateCategory.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{__assign as i}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useState as t}from"react";import{ConditionSection as o}from"../../organisms/ConditionSection/ConditionSection.js";import{TextSection as l}from"../../organisms/TextSection/TextSection.js";var r=function(r){var d,s,u,a=r.state,p=r.handlers,h=r.uiState,g=(null==h?void 0:h.highlights)||{},c=t({}),v=c[0],y=c[1],m=function(e){y(function(n){var t;return i(i({},n),((t={})[e]=!n[e],t))})},A=function(i){var e,n=null===(e=a.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(n)&&n.length>0?n:a.citations};return e("div",i({className:"simple-guideline-template"},{children:n("div",i({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[e(l,i({id:"guideline-title",title:"Guideline Title",rows:1,placeholder:"Enter a short, descriptive title for the guideline",required:!0,value:a.guidelineTitle,onChange:p.setGuidelineTitle,readOnly:null==h?void 0:h.isAiStreaming,isOpen:v.guidelineTitle,onToggle:function(){return m("guidelineTitle")},isHighlighted:g.guidelineTitle||!1,tooltipDescription:"Why this Title?",errorMessage:null===(d=null==h?void 0:h.validationErrors)||void 0===d?void 0:d.guidelineTitle},h)),e(l,i({id:"guideline-description",title:"Guideline Description",rows:4,placeholder:"Describe what this guideline enforces or ensures",required:!0,value:a.guidelineDescription,onChange:p.setGuidelineDescription,readOnly:null==h?void 0:h.isAiStreaming,isOpen:v.guidelineDescription,onToggle:function(){return m("guidelineDescription")},isHighlighted:g.guidelineDescription||!1,tooltipDescription:"Why this Description?",errorMessage:null===(s=null==h?void 0:h.validationErrors)||void 0===s?void 0:s.guidelineDescription},h)),e(o,i({id:"when-to-apply",title:"When to apply",required:!0,dividerRequired:!0,readOnly:null==h?void 0:h.isAiStreaming,conditions:a.whenToApplyConditions||[],onAdd:function(){return p.addWhenToApply()},onRemove:function(i,e,n){return p.removeWhenToApply(n)},onEdit:function(i,e,n,t){return p.editWhenToApply(n,t)},index:0,tierKey:"default",isHighlighted:g.wta||!1,highlightedIds:null==h?void 0:h.highlightedIds,tooltipDescription:"Why this Condition?",citations:A("whenToApply"),bordered:!0,addLabel:"Add When to apply",isAiStreaming:null==h?void 0:h.isAiStreaming,errorMessage:null===(u=null==h?void 0:h.validationErrors)||void 0===u?void 0:u.whenToApply},h)),e(o,i({id:"when-not-to-apply",title:"When NOT to apply",required:!1,dividerRequired:!0,readOnly:null==h?void 0:h.isAiStreaming,conditions:a.whenNotToApplyConditions||[],onAdd:function(){return p.addWhenNotToApply()},onRemove:function(i,e,n){return p.removeWhenNotToApply(n)},onEdit:function(i,e,n,t){return p.editWhenNotToApply(n,t)},index:0,tierKey:"default",isHighlighted:g.wnta||!1,highlightedIds:null==h?void 0:h.highlightedIds,tooltipDescription:"Why this Condition?",citations:A("whenNotToApply"),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:null==h?void 0:h.isAiStreaming},h))]}))}))};export{r as WorkflowComposer};
2
+ //# sourceMappingURL=WorkflowComposer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowComposer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__spreadArray as t,__assign as e}from"tslib";import{jsxs as n,jsx as i}from"react/jsx-runtime";import{useState as r,useEffect as c}from"react";import{Check as a,Eye as l,X as o}from"lucide-react";import d from"./Cart.styles.js";function s(t){try{var e=new Date(t),n=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),i=e.toLocaleDateString("en-GB").replace(/\//g,"/");return"Added on - ".concat(n," | ").concat(i)}catch(e){return t}}function h(h){var u=h.items,m=h.onRemove,p=h.onProceed,f=r(new Set),g=f[0],y=f[1];c(function(){1!==u.length?y(function(e){var n=new Set(u.map(function(t){return t.instant_learning_id})),i=new Set(t([],e,!0).filter(function(t){return n.has(t)}));return i.size===e.size?e:i}):y(new Set([u[0].instant_learning_id]))},[u]);var v=u.filter(function(t){return g.has(t.instant_learning_id)});return n("section",e({style:d.cartSection},{children:[n("div",e({style:d.cartHeaderRow},{children:[i("p",e({style:d.cartTitle},{children:"Guideline Cart"})),n("span",e({style:d.cartBadge},{children:[u.length," Added"]}))]})),i("p",e({style:d.cartDescription},{children:u.length>1?"Click items to select them for this session":"Selected for this session"})),i("div",e({style:d.cartBody},{children:i("div",e({style:d.cartList},{children:0===u.length?i("div",e({style:d.emptyState},{children:"No guidelines added yet"})):u.map(function(t){var r=g.has(t.instant_learning_id);return n("div",e({style:r?d.cartItemSelected:d.cartItem,onClick:function(){return e=t.instant_learning_id,void y(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}},{children:[n("div",e({style:d.cartItemTop},{children:[n("div",e({style:d.cartItemTopLeft},{children:[i("span",e({style:r?d.cartCheckbox:d.cartCheckboxEmpty},{children:r&&i(a,{size:12,strokeWidth:3})})),i("p",e({style:d.cartItemName},{children:t.instant_learning_title}))]})),n("div",e({style:d.cartItemIcons},{children:[i(l,{size:16,strokeWidth:2}),i("button",e({type:"button",style:d.removeBtn,onClick:function(e){return function(t,e){t.stopPropagation(),y(function(t){if(!t.has(e))return t;var n=new Set(t);return n.delete(e),n}),m(e)}(e,t.instant_learning_id)}},{children:i(o,{size:16,strokeWidth:2})}))]}))]})),i("p",e({style:d.cartItemDescription},{children:t.instant_learning_description})),i("p",e({style:d.cartItemDate},{children:s(t.created_at)}))]}),t.instant_learning_id)})}))})),i("button",e({type:"button",style:v.length>0?d.proceedButton:d.proceedButtonDisabled,disabled:0===v.length,onClick:function(){return v.length>0&&p(v)}},{children:n("span",{children:["Proceed with Selected",v.length>1?" (".concat(v.length,")"):""]})}))]}))}export{h as Cart,h as default};
1
+ import{__assign as t}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import{useState as i}from"react";import{Check as r,Eye as c,X as l}from"lucide-react";import o from"./Cart.styles.js";function a(t){try{var e=new Date(t),n=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),i=e.toLocaleDateString("en-GB").replace(/\//g,"/");return"Added on - ".concat(n," | ").concat(i)}catch(e){return t}}function d(d){var s,u=d.items,h=d.onRemove,m=d.onProceed,p=i(null),y=p[0],f=p[1];var g=null!==(s=u.find(function(t){return t.instant_learning_id===y}))&&void 0!==s?s:null;return e("section",t({style:o.cartSection},{children:[e("div",t({style:o.cartHeaderRow},{children:[n("p",t({style:o.cartTitle},{children:"Guideline Cart"})),e("span",t({style:o.cartBadge},{children:[u.length," Added"]}))]})),n("p",t({style:o.cartDescription},{children:"Click an item to select it for this session"})),n("div",t({style:o.cartBody},{children:n("div",t({style:o.cartList},{children:0===u.length?n("div",t({style:o.emptyState},{children:"No guidelines added yet"})):u.map(function(i){var d=i.instant_learning_id===y;return e("div",t({style:d?o.cartItemSelected:o.cartItem,onClick:function(){return t=i.instant_learning_id,void f(function(e){return e===t?null:t});var t}},{children:[e("div",t({style:o.cartItemTop},{children:[e("div",t({style:o.cartItemTopLeft},{children:[n("span",t({style:d?o.cartCheckbox:o.cartCheckboxEmpty},{children:d&&n(r,{size:12,strokeWidth:3})})),n("p",t({style:o.cartItemName},{children:i.instant_learning_title}))]})),e("div",t({style:o.cartItemIcons},{children:[n(c,{size:16,strokeWidth:2}),n("button",t({type:"button",style:o.removeBtn,onClick:function(t){return function(t,e){t.stopPropagation(),y===e&&f(null),h(e)}(t,i.instant_learning_id)}},{children:n(l,{size:16,strokeWidth:2})}))]}))]})),n("p",t({style:o.cartItemDescription},{children:i.instant_learning_description})),n("p",t({style:o.cartItemDate},{children:a(i.created_at)}))]}),i.instant_learning_id)})}))})),n("button",t({type:"button",style:g?o.proceedButton:o.proceedButtonDisabled,disabled:!g,onClick:function(){return g&&m(g)}},{children:n("span",{children:"Proceed with Selected"})}))]}))}export{d as Cart,d as default};
2
2
  //# sourceMappingURL=Cart.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as t}from"tslib";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{BookOpen as i,Eye as n,MoreVertical as o,UserCheck as d,Compass as c,Check as l,Plus as s}from"lucide-react";import a from"./GuidelineCard.styles.js";function u(t){try{var e=new Date(t),r=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),i=e.toLocaleDateString("en-GB").replace(/\//g,"/");return"Added on - ".concat(r," | ").concat(i)}catch(e){return t}}function h(h){var p=h.guideline,y=h.inCart,f=h.onToggleCart,m=h.onExplore;return e("div",t({style:a.card},{children:[e("div",t({style:a.cardTop},{children:[e("div",t({style:a.cardTopLeft},{children:[r(i,{size:18,strokeWidth:2,color:"#6D5BFF"}),r("p",t({style:a.cardTitle},{children:p.instant_learning_title}))]})),e("div",t({style:a.cardTopIcons},{children:[r(n,{size:16,strokeWidth:2}),r(o,{size:16,strokeWidth:2}),r(d,{size:16,strokeWidth:2})]}))]})),r("p",t({style:a.cardDescription},{children:p.instant_learning_description})),r("p",t({style:a.cardDate},{children:u(p.created_at)})),e("div",t({style:a.cardActionsRow},{children:[e("button",t({type:"button",style:a.exploreButton,onClick:function(){return null==m?void 0:m(p)}},{children:[r(c,{size:15,strokeWidth:2.4}),r("span",{children:"Explore"})]})),e("button",y?t({type:"button",style:a.cardAddedButton,onClick:function(){return f(p)}},{children:[r(l,{size:16,strokeWidth:2.4}),r("span",{children:"Selected"})]}):t({type:"button",style:a.cardAddButton,onClick:function(){return f(p)}},{children:[r(s,{size:16,strokeWidth:2.4}),r("span",{children:"Select"})]}))]}))]}))}export{h as GuidelineCard,h as default};
1
+ import{__assign as t}from"tslib";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{BookOpen as i,Eye as n,MoreVertical as d,UserCheck as o,Compass as c,Check as l,Plus as s}from"lucide-react";import a from"./GuidelineCard.styles.js";function u(t){try{var e=new Date(t),r=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),i=e.toLocaleDateString("en-GB").replace(/\//g,"/");return"Added on - ".concat(r," | ").concat(i)}catch(e){return t}}function h(h){var p=h.guideline,y=h.inCart,f=h.onToggleCart,m=h.onExplore;return e("div",t({style:a.card},{children:[e("div",t({style:a.cardTop},{children:[e("div",t({style:a.cardTopLeft},{children:[r(i,{size:18,strokeWidth:2,color:"#6D5BFF"}),r("p",t({style:a.cardTitle},{children:p.instant_learning_title}))]})),e("div",t({style:a.cardTopIcons},{children:[r(n,{size:16,strokeWidth:2}),r(d,{size:16,strokeWidth:2}),r(o,{size:16,strokeWidth:2})]}))]})),r("p",t({style:a.cardDescription},{children:p.instant_learning_description})),r("p",t({style:a.cardDate},{children:u(p.created_at)})),e("div",t({style:a.cardActionsRow},{children:[e("button",t({type:"button",style:a.exploreButton,onClick:function(){return null==m?void 0:m(p)}},{children:[r(c,{size:15,strokeWidth:2.4}),r("span",{children:"Explore"})]})),e("button",y?t({type:"button",style:a.cardAddedButton,onClick:function(){return f(p)}},{children:[r(l,{size:16,strokeWidth:2.4}),r("span",{children:"Added to Cart"})]}):t({type:"button",style:a.cardAddButton,onClick:function(){return f(p)}},{children:[r(s,{size:16,strokeWidth:2.4}),r("span",{children:"Add to Cart"})]}))]}))]}))}export{h as GuidelineCard,h as default};
2
2
  //# sourceMappingURL=GuidelineCard.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as n,jsxs as t,Fragment as i}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import{CircleHelp as l,Plus as d,UserCheck as a,Clock3 as s,ShoppingBag as u,Search as c,Check as p,ChevronDown as h,ChevronUp as f}from"lucide-react";import{fetchGuidelineInstances as g}from"./api.js";import{GuidelineCard as m}from"./GuidelineCard.js";import{Cart as b}from"./Cart/Cart.js";import{LearningManagementWrapper as y}from"./LearningManagementWrapper.js";import _ from"./GuidelinesLandingPage.styles.js";import{OutlinedInput as v,InputAdornment as k}from"@mui/material";function C(e,n){var t,i,r,o;return n?null!==(o=null===(r=e.mode_mappings.find(function(e){return e.mode_id===n}))||void 0===r?void 0:r.application_integration_id)&&void 0!==o?o:"":null!==(i=null===(t=e.mode_mappings[0])||void 0===t?void 0:t.application_integration_id)&&void 0!==i?i:""}function z(z){var A=z.baseUrl,S=z.baseWebsocketUrl,W=z.token,w=z.userDetails,x=z.modeId,B=z.assistantName,F=z.appsecRbacUrl,I=z.appsecBaseUrl,U=z.onProceedSelected,L=r([]),j=L[0],G=L[1],M=r(6),T=M[0],D=M[1],E=r([]),R=E[0],N=E[1],O=r(!1),P=O[0],H=O[1],K=r(null),q=K[0],J=K[1],Q=r(null),V=Q[0],X=Q[1],Y=r(""),Z=Y[0],$=Y[1],ee=r(""),ne=ee[0],te=ee[1];o(function(){var e=setTimeout(function(){te(Z.trim())},750);return function(){return clearTimeout(e)}},[Z]),o(function(){D(6)},[ne]),o(function(){H(!0),J(null),g(A,W).then(function(e){G(e.data)}).catch(function(e){return J(e.message)}).finally(function(){return H(!1)})},[A,W]);var ie=new Set(R.map(function(e){return e.instant_learning_id}));function re(e){N(function(n){return n.some(function(n){return n.instant_learning_id===e.instant_learning_id})?n.filter(function(n){return n.instant_learning_id!==e.instant_learning_id}):[e]})}var oe=ne.length>=2?j.filter(function(e){var n,t,i=ne.toLowerCase();return(null===(n=e.instant_learning_title)||void 0===n?void 0:n.toLowerCase().includes(i))||(null===(t=e.instant_learning_description)||void 0===t?void 0:t.toLowerCase().includes(i))}):j,le=oe.slice(0,T),de=oe.length-T,ae=T>6;return n("div",e({style:_.page},{children:t("main",e({style:_.main},{children:[t("section",e({style:_.headerSection},{children:[t("div",e({style:_.intro},{children:[n("h1",e({style:_.title},{children:"Add Guidelines"})),n("p",e({style:_.description},{children:"Add guidelines that shape how your agent behaves, responds, and interprets."})),t("button",e({type:"button",style:_.debugLink},{children:[n("span",{children:"Know more about debug mode"}),n(l,{size:18,strokeWidth:2})]}))]})),t("button",e({type:"button",style:_.addButton},{children:[n(d,{size:20,strokeWidth:2.4}),n("span",{children:"Add Guideline"})]}))]})),t("section",e({style:_.bodySection},{children:[t("section",e({style:_.librarySection},{children:[t("div",e({style:_.libraryTabs},{children:[t("button",e({type:"button",style:e(e({},_.tab),_.tabActive)},{children:[n(a,{size:18,strokeWidth:2}),n("span",{children:"Saved"})]})),t("button",e({type:"button",style:_.tab},{children:[n(s,{size:18,strokeWidth:2}),n("span",{children:"Recently used"})]})),t("button",e({type:"button",style:_.tab},{children:[n(u,{size:18,strokeWidth:2}),n("span",{children:"Marketplace"})]}))]})),!V&&n("div",e({style:{position:"sticky",top:0,zIndex:10,backgroundColor:"#FFFFFF",paddingTop:12,backdropFilter:"blur(8px)"}},{children:n(v,{placeholder:"Search Guideline",value:Z,onChange:function(e){return $(e.target.value)},size:"small",startAdornment:n(k,e({position:"start"},{children:n(c,{size:16,color:"#9CA3AF"})})),sx:{width:"280px",borderRadius:"8px",fontSize:"14px","& .MuiOutlinedInput-notchedOutline":{borderColor:"#E5E7EB"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#D1D5DB"},bgcolor:"#fff"}})})),V?n(y,{userDetails:w,baseUrl:A,baseWebsocketUrl:S,assistantName:B,appsecRbacUrl:F,appsecBaseUrl:I,appIntegrationId:C(V,x),modeId:x,guidelineTitle:V.instant_learning_title,onBack:function(){return X(null)},headerActions:ie.has(V.instant_learning_id)?t("button",e({type:"button",style:_.cardAddedButton,onClick:function(){return re(V)}},{children:[n(p,{size:16,strokeWidth:2.4}),n("span",{children:"Added to Cart"})]})):t("button",e({type:"button",style:_.cardAddButton,onClick:function(){return re(V)}},{children:[n(d,{size:16,strokeWidth:2.4}),n("span",{children:"Add to Cart"})]}))}):t(i,{children:[P&&n("p",e({style:_.loadingState},{children:"Loading guidelines..."})),q&&t("p",e({style:_.errorState},{children:["Error: ",q]})),!P&&!q&&n(i,{children:0===oe.length?n("p",e({style:_.loadingState},{children:ne.length>=2?"No guidelines match your search.":"No guidelines found."})):t(i,{children:[n("div",e({style:_.libraryGrid},{children:le.map(function(e){return n(m,{guideline:e,inCart:ie.has(e.instant_learning_id),onToggleCart:re,onExplore:X},e.instant_learning_id)})})),t("div",e({style:{display:"flex",alignItems:"center",gap:16}},{children:[de>0&&t("button",e({type:"button",style:_.showMore,onClick:function(){return D(function(e){return e+6})}},{children:[t("span",{children:["Show more guidelines (",de,")"]}),n(h,{size:16,strokeWidth:2.4})]})),ae&&t("button",e({type:"button",style:_.showMore,onClick:function(){return D(6)}},{children:[n("span",{children:"Hide"}),n(f,{size:16,strokeWidth:2.4})]}))]}))]})})]})]})),n(b,{items:R,onRemove:function(e){N(function(n){return n.filter(function(n){return n.instant_learning_id!==e})})},onProceed:function(e){console.log("Proceeding with selected guidelines from lib:",e),U(e)}})]}))]}))}))}export{z as GuidelineLandingPage,z as default};
1
+ import{__assign as n,__spreadArray as e}from"tslib";import{jsx as t,jsxs as i,Fragment as r}from"react/jsx-runtime";import{useState as o,useEffect as l}from"react";import{CircleHelp as d,Plus as a,UserCheck as s,Clock3 as u,ShoppingBag as c,ChevronDown as p,ChevronUp as h}from"lucide-react";import{fetchGuidelineInstances as m}from"./api.js";import{GuidelineCard as f}from"./GuidelineCard.js";import{Cart as y}from"./Cart/Cart.js";import{LearningManagementWrapper as g}from"./LearningManagementWrapper.js";import b from"./GuidelinesLandingPage.styles.js";function _(n,e){var t,i,r,o;return e?null!==(o=null===(r=n.mode_mappings.find(function(n){return n.mode_id===e}))||void 0===r?void 0:r.application_integration_id)&&void 0!==o?o:"":null!==(i=null===(t=n.mode_mappings[0])||void 0===t?void 0:t.application_integration_id)&&void 0!==i?i:""}function v(v){var k=v.baseUrl,S=v.token,W=v.userDetails,z=v.modeId,C=o([]),j=C[0],w=C[1],G=o(6),I=G[0],x=G[1],A=o([]),L=A[0],M=A[1],T=o(!0),B=T[0],D=T[1],E=o(null),P=E[0],R=E[1],H=o(null),K=H[0],U=H[1];l(function(){D(!0),R(null),m(k,S).then(function(n){w(n.data)}).catch(function(n){return R(n.message)}).finally(function(){return D(!1)})},[k,S]);var q=new Set(L.map(function(n){return n.instant_learning_id}));function F(n){M(function(t){return t.some(function(e){return e.instant_learning_id===n.instant_learning_id})?t.filter(function(e){return e.instant_learning_id!==n.instant_learning_id}):e(e([],t,!0),[n],!1)})}var J=j.slice(0,I),N=j.length-I,O=I>6;return t("div",n({style:b.page},{children:i("main",n({style:b.main},{children:[i("section",n({style:b.headerSection},{children:[i("div",n({style:b.intro},{children:[t("h1",n({style:b.title},{children:"Add Guidelines"})),t("p",n({style:b.description},{children:"Add guidelines that shape how your agent behaves, responds, and interprets."})),i("button",n({type:"button",style:b.debugLink},{children:[t("span",{children:"Know more about debug mode"}),t(d,{size:18,strokeWidth:2})]}))]})),i("button",n({type:"button",style:b.addButton},{children:[t(a,{size:20,strokeWidth:2.4}),t("span",{children:"Add Guideline"})]}))]})),i("section",n({style:b.bodySection},{children:[i("section",n({style:b.librarySection},{children:[i("div",n({style:b.libraryTabs},{children:[i("button",n({type:"button",style:n(n({},b.tab),b.tabActive)},{children:[t(s,{size:18,strokeWidth:2}),t("span",{children:"Saved"})]})),i("button",n({type:"button",style:b.tab},{children:[t(u,{size:18,strokeWidth:2}),t("span",{children:"Recently used"})]})),i("button",n({type:"button",style:b.tab},{children:[t(c,{size:18,strokeWidth:2}),t("span",{children:"Marketplace"})]}))]})),K?t(g,{userDetails:W,appIntegrationId:_(K,z),modeId:z,guidelineTitle:K.instant_learning_title,onBack:function(){return U(null)}}):i(r,{children:[B&&t("p",n({style:b.loadingState},{children:"Loading guidelines..."})),P&&i("p",n({style:b.errorState},{children:["Error: ",P]})),!B&&!P&&i(r,{children:[t("div",n({style:b.libraryGrid},{children:J.map(function(n){return t(f,{guideline:n,inCart:q.has(n.instant_learning_id),onToggleCart:F,onExplore:U},n.instant_learning_id)})})),i("div",n({style:{display:"flex",alignItems:"center",gap:16}},{children:[N>0&&i("button",n({type:"button",style:b.showMore,onClick:function(){return x(function(n){return n+6})}},{children:[i("span",{children:["Show more guidelines (",N,")"]}),t(p,{size:16,strokeWidth:2.4})]})),O&&i("button",n({type:"button",style:b.showMore,onClick:function(){return x(6)}},{children:[t("span",{children:"Hide"}),t(h,{size:16,strokeWidth:2.4})]}))]}))]})]})]})),t(y,{items:L,onRemove:function(n){M(function(e){return e.filter(function(e){return e.instant_learning_id!==n})})},onProceed:function(){}})]}))]}))}))}export{v as GuidelineLandingPage,v as default};
2
2
  //# sourceMappingURL=GuidelinesLandingPage.js.map
@@ -1,2 +1,2 @@
1
- var e={page:{height:"100%",width:"100%",background:"#ffffff",fontFamily:"Inter, sans-serif"},main:{height:"100%",overflow:"auto",padding:40},headerSection:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:24,justifyContent:"space-between",alignItems:"flex-start"},intro:{minWidth:280,flex:"1 1 0%"},title:{fontSize:30,fontWeight:700,lineHeight:"38px",color:"#6D35F2",margin:0},description:{marginTop:8,fontSize:19,lineHeight:"28px",color:"#1F2937"},debugLink:{marginTop:12,display:"inline-flex",alignItems:"center",gap:8,fontSize:14,fontWeight:500,color:"#53657D",background:"none",border:"none",padding:0,cursor:"pointer"},addButton:{display:"inline-flex",height:44,minWidth:210,flexShrink:0,alignItems:"center",justifyContent:"center",gap:12,borderRadius:6,background:"#4438F5",padding:"0 20px",fontSize:15,fontWeight:600,color:"#ffffff",border:"none",boxShadow:"0 1px 2px rgba(16,24,40,0.08)",cursor:"pointer",marginLeft:"auto"},bodySection:{marginTop:48,display:"grid",width:"100%",gridTemplateColumns:"minmax(0,1fr) minmax(300px,360px)",alignItems:"start",gap:24},librarySection:{minWidth:0},libraryTabs:{display:"flex",borderBottom:"1px solid #EAECF0"},tab:{position:"relative",display:"inline-flex",height:40,alignItems:"center",gap:8,padding:"0 16px",fontSize:14,fontWeight:500,background:"none",border:"none",cursor:"pointer",color:"#B5BDC8"},tabActive:{color:"#1F2937",boxShadow:"inset 0 -3px 0 0 #6D5BFF"},libraryGrid:{marginTop:24,display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:20},cardAddButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,border:"1px solid #4438F5",background:"#ffffff",fontSize:13,fontWeight:600,color:"#4438F5",cursor:"pointer"},cardAddedButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,border:"1px solid #EAE7FF",background:"#EDE9FE",fontSize:13,fontWeight:600,color:"#4438F5",cursor:"pointer"},showMore:{marginTop:28,display:"inline-flex",alignItems:"center",gap:8,fontSize:14,fontWeight:600,color:"#5B2CF4",background:"none",border:"none",cursor:"pointer"},loadingState:{marginTop:24,fontSize:14,color:"#667085"},errorState:{marginTop:24,fontSize:14,color:"#F04438"}};export{e as default};
1
+ var e={page:{height:"100%",width:"100%",background:"#ffffff",fontFamily:"Inter, sans-serif"},main:{height:"100%",overflow:"auto",padding:40},headerSection:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:24,justifyContent:"space-between",alignItems:"flex-start"},intro:{minWidth:280,flex:"1 1 0%"},title:{fontSize:30,fontWeight:700,lineHeight:"38px",color:"#6D35F2",margin:0},description:{marginTop:8,fontSize:19,lineHeight:"28px",color:"#1F2937"},debugLink:{marginTop:12,display:"inline-flex",alignItems:"center",gap:8,fontSize:14,fontWeight:500,color:"#53657D",background:"none",border:"none",padding:0,cursor:"pointer"},addButton:{display:"inline-flex",height:44,minWidth:210,flexShrink:0,alignItems:"center",justifyContent:"center",gap:12,borderRadius:6,background:"#4438F5",padding:"0 20px",fontSize:15,fontWeight:600,color:"#ffffff",border:"none",boxShadow:"0 1px 2px rgba(16,24,40,0.08)",cursor:"pointer",marginLeft:"auto"},bodySection:{marginTop:48,display:"grid",width:"100%",gridTemplateColumns:"minmax(0,1fr) minmax(300px,360px)",alignItems:"start",gap:24},librarySection:{minWidth:0},libraryTabs:{display:"flex",borderBottom:"1px solid #EAECF0"},tab:{position:"relative",display:"inline-flex",height:40,alignItems:"center",gap:8,padding:"0 16px",fontSize:14,fontWeight:500,background:"none",border:"none",cursor:"pointer",color:"#B5BDC8"},tabActive:{color:"#1F2937",boxShadow:"inset 0 -3px 0 0 #6D5BFF"},libraryGrid:{marginTop:24,display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:20},showMore:{marginTop:28,display:"inline-flex",alignItems:"center",gap:8,fontSize:14,fontWeight:600,color:"#5B2CF4",background:"none",border:"none",cursor:"pointer"},loadingState:{marginTop:24,fontSize:14,color:"#667085"},errorState:{marginTop:24,fontSize:14,color:"#F04438"}};export{e as default};
2
2
  //# sourceMappingURL=GuidelinesLandingPage.styles.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as a,jsxs as i}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{ArrowLeft as o}from"lucide-react";import{QueryClient as l,QueryClientProvider as r}from"@tanstack/react-query";import c from"../LearningManagement/LearningManagement.js";import{fetchRBACConfig as d}from"./api.js";var p={config:{CUSTOM_SCOPE_GROUP_NAME:"Preview",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"preview-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:"preview",ORGANIZATION_NAME:"techolution",BASE_URL:"https://devllmstudio.creativeworkspace.ai",BASE_WEBSOCKET_URL:"wss://devllmstudio.creativeworkspace.ai/graphql",CHAT_TITLE:"Preview",CHAT_TITLE_EDIT:"Preview Edit",FORM_TITLE:"Learning Details",INITIAL_CHAT_MESSAGE:"Hi",CATEGORY:"Global-Template",SOCKET_TIMEOUT:24e4},llmStudioUrl:"https://devllmstudio.creativeworkspace.ai",audacyBackendUrl:"https://dev-audacy-traffic-manager.techo.camp",ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"}},s={applicationName:"IL Mode - ILOTJ",applicationId:"6a22c19581f05dc3afc8ad57",moduleId:"6a22c19581f05dc3afc8ad8e",applicationModuleId:"6a22c19581f05dc3afc8ad88",applicationResourceId:"6a22c19681f05dc3afc8ad94",appsecRbacUrl:"https://dev-cw-appsec.techo.camp/granularApi",appsecBaseUrl:"https://dev-cw-appsec.techo.camp"},f={configId:"6a1825e9fb722c37637b9490"},u=new l,g={wrapper:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},header:{display:"flex",alignItems:"center",gap:12,padding:"10px 0",borderBottom:"1px solid #EAECF0",flexShrink:0},backButton:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",fontSize:14,fontWeight:500,color:"#344054",padding:"4px 8px",borderRadius:6},headerTitle:{fontSize:14,fontWeight:600,color:"#1F2937",margin:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},headerActions:{display:"flex",alignItems:"center",gap:8,marginLeft:"auto"},lmsContainer:{flex:1,minHeight:0,overflow:"hidden"},loadingState:{padding:24,fontSize:14,color:"#667085"}};function m(l){var m=l.userDetails,h=l.baseUrl,T=l.baseWebsocketUrl,I=l.assistantName,v=l.appsecRbacUrl,_=l.appsecBaseUrl,E=l.appIntegrationId,A=l.modeId,S=l.guidelineTitle,L=l.onBack,b=l.headerActions,C=t(null),w=C[0],U=C[1];return n(function(){if(E){var a=e(e({},p),{config:e(e({},p.config),{ASSISTANT_NAME:I,BASE_URL:h,BASE_WEBSOCKET_URL:T}),llmStudioUrl:h}),i=e(e({},s),{appsecRbacUrl:v,appsecBaseUrl:_}),t=!1;return U(null),d(h,m.accessToken,E).then(function(n){var o,l,r,c;if(!t){var d=n?{applicationName:n.application_name,applicationId:n.application_id,moduleId:null===(o=n.module_data)||void 0===o?void 0:o.Scopes,applicationModuleId:null===(l=n.module_data)||void 0===l?void 0:l.General,applicationResourceId:null===(r=n.resource_data)||void 0===r?void 0:r["Learning Management"],appsecRbacUrl:v,appsecBaseUrl:_}:i;U(e(e({},a),{auditLogConfig:{configId:null!==(c=null==n?void 0:n.change_log_config_id)&&void 0!==c?c:f.configId},rbacConfig:d}))}}).catch(function(){t||(console.warn("RBAC config fetch failed, using fallback."),U(e(e({},a),{auditLogConfig:f,rbacConfig:i})))}),function(){t=!0}}},[E,h,T,I,v,_]),a(r,e({client:u},{children:i("div",e({style:g.wrapper},{children:[i("div",e({style:g.header},{children:[i("button",e({type:"button",style:g.backButton,onClick:L},{children:[a(o,{size:16,strokeWidth:2}),"Back"]})),S&&a("p",e({style:g.headerTitle},{children:S})),b&&a("div",e({style:g.headerActions},{children:b}))]})),a("div",e({style:g.lmsContainer},{children:w?a(c,e({},w,{userDetails:m,app_integration_id:E,modeId:A}),"lms-explore"):a("p",e({style:g.loadingState},{children:"Loading..."}))}))]}))}))}export{m as LearningManagementWrapper,m as default};
1
+ import{__assign as e}from"tslib";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{ArrowLeft as t}from"lucide-react";import{QueryClient as r,QueryClientProvider as n}from"@tanstack/react-query";import o from"../LearningManagement/LearningManagement.js";var l={config:{CUSTOM_SCOPE_GROUP_NAME:"Preview",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"preview-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:"preview",ORGANIZATION_NAME:"techolution",BASE_URL:"https://devllmstudio.creativeworkspace.ai",BASE_WEBSOCKET_URL:"wss://devllmstudio.creativeworkspace.ai/graphql",CHAT_TITLE:"Preview",CHAT_TITLE_EDIT:"Preview Edit",FORM_TITLE:"Learning Details",INITIAL_CHAT_MESSAGE:"Hi",CATEGORY:"Global-Template",SOCKET_TIMEOUT:24e4},llmStudioUrl:"https://devllmstudio.creativeworkspace.ai",audacyBackendUrl:"https://dev-audacy-traffic-manager.techo.camp",auditLogConfig:{configId:"6a1825e9fb722c37637b9490"},ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"},rbacConfig:{applicationName:"IL Mode - ILOTJ",applicationId:"6a22c19581f05dc3afc8ad57",moduleId:"6a22c19581f05dc3afc8ad8e",applicationModuleId:"6a22c19581f05dc3afc8ad88",applicationResourceId:"6a22c19681f05dc3afc8ad94",appsecRbacUrl:"https://dev-cw-appsec.techo.camp/granularApi",appsecBaseUrl:"https://dev-cw-appsec.techo.camp"}},c=new r,d={wrapper:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},header:{display:"flex",alignItems:"center",gap:12,padding:"10px 0",borderBottom:"1px solid #EAECF0",flexShrink:0},backButton:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",fontSize:14,fontWeight:500,color:"#344054",padding:"4px 8px",borderRadius:6},headerTitle:{fontSize:14,fontWeight:600,color:"#1F2937",margin:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},headerActions:{display:"flex",alignItems:"center",gap:8,marginLeft:"auto"},lmsContainer:{flex:1,minHeight:0,overflow:"hidden"}};function p(r){var p=r.userDetails,s=r.appIntegrationId,f=r.modeId,m=r.guidelineTitle,g=r.onBack,u=r.headerActions;return i(n,e({client:c},{children:a("div",e({style:d.wrapper},{children:[a("div",e({style:d.header},{children:[a("button",e({type:"button",style:d.backButton,onClick:g},{children:[i(t,{size:16,strokeWidth:2}),"Back"]})),m&&i("p",e({style:d.headerTitle},{children:m})),u&&i("div",e({style:d.headerActions},{children:u}))]})),i("div",e({style:d.lmsContainer},{children:i(o,e({},l,{userDetails:p,app_integration_id:s,modeId:f}),"lms-explore")}))]}))}))}export{p as LearningManagementWrapper,p as default};
2
2
  //# sourceMappingURL=LearningManagementWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as t,__generator as n}from"tslib";import{endpoints as e}from"./endpoints.js";function r(r,o){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e.listInstances(r),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(o)}})];case 1:if(!(t=n.sent()).ok)throw new Error("Failed to fetch guidelines: ".concat(t.status));return[2,t.json()]}})})}function o(r,o,i){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e.getRbacConfig(r,i),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(o)}})];case 1:if(!(t=n.sent()).ok)throw new Error("Failed to fetch RBAC config: ".concat(t.status));return[4,t.json()];case 2:return[2,n.sent().data]}})})}export{r as fetchGuidelineInstances,o as fetchRBACConfig};
1
+ import{__awaiter as t,__generator as n}from"tslib";import{endpoints as e}from"./endpoints.js";function i(i,o){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e.listInstances(i),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(o)}})];case 1:if(!(t=n.sent()).ok)throw new Error("Failed to fetch guidelines: ".concat(t.status));return[2,t.json()]}})})}export{i as fetchGuidelineInstances};
2
2
  //# sourceMappingURL=api.js.map
@@ -1,2 +1,2 @@
1
- var n={listInstances:function(n){return"".concat(n,"/instant_learning/ilotj/listInstances?createdAt=desc")},getRbacConfig:function(n,t){return"".concat(n,"/instant_learning/ilotj/application/getRBACAuditConfig/").concat(t)}};export{n as endpoints};
1
+ var t={listInstances:function(t){return"".concat(t,"/instant_learning/ilotj/listInstances?createdAt=desc")}};export{t as endpoints};
2
2
  //# sourceMappingURL=endpoints.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as t,__awaiter as n,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as l}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import S from"./store/useAuthStore.js";import{fetchTiers as y,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as A,createRuleSet as L,renameScope as E,deleteRuleSet as I,requestAccess as R}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as w,setQueryParams as O}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import N from"./components/LearningTemplateManagementSkeleton.js";import{findNodeById as _,findNodePathById as D}from"./utils/treeUtils.js";import k from"./store/useEnvStore.js";import{useConfigStore as M}from"./store/useConfigStore.js";import{TooltipProvider as B}from"./components/ToolTip.js";import P from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as U}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as q}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as G}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as F}from"./queries/useLMSConfigQuery.js";import x from"./RuleContent/AddScopeModal.js";import H from"./components/RuleContentSkeleton.js";import Q from"./components/ErrorStateDisplay.js";import{useLocation as z}from"react-router-dom";import K from"./shared/SuccessToastContent.js";import V from"./shared/ErrorToastContent.js";import W from"./RuleContent/RenameScopeModal.js";import{dt as Y}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as J,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as X,EMPTY_STATE_DT_PATH as Z}from"./constants.js";function $($){var ee,te,ne,re=this,oe=$.userDetails,se=$.llmStudioUrl,ie=$.audacyBackendUrl,ae=$.ilLabels,ce=$.config,le=$.rbacConfig,ue=$.auditLogConfig,de=$.app_integration_id,pe=$.backwardCompatibility,me=void 0!==pe&&pe,fe=$.cognitiveCompareCompatibility,ve=void 0!==fe&&fe,ge=$.modeId,he=$.modeDetails;m(function(e){return e.selectedRuleSetId});var Se=m(function(e){return e.setSelectedRuleSetId}),ye=m(function(e){return e.error}),be=m(function(e){return e.setError}),Ce=m(function(e){return e.setStations}),Te=m(function(e){return e.scopeTreeData}),Ae=m(function(e){return e.setScopeTreeData}),Le=a({isOpen:!1,type:"GLOBAL"}),Ee=Le[0],Ie=Le[1],Re=a(!1),we=Re[0],Oe=Re[1],je=a(!1),Ne=je[0],_e=je[1],De=a("learnings"),ke=De[0],Me=De[1],Be=a(null),Pe=Be[0],Ue=Be[1],qe=a(null),Ge=qe[0];qe[1];var Fe=a(!1),xe=Fe[0],He=Fe[1],Qe=a(!1),ze=Qe[0],Ke=Qe[1];c(null);var Ve=c(null),We=c(!1),Ye=c(null),Je=S();Je.user;var Xe=Je.setUser,Ze=M(),$e=Ze.setConfig,et=Ze.setIlLabels,tt=function(){try{return z()}catch(e){return{search:""}}}();l(function(){if(!We.current){var e=new URLSearchParams(window.location.search),t=e.get(w.RULESET_ID),n=e.get(w.SECTION),r=n&&At.has(n)?n:"learnings";(null==t?void 0:t.length)&&Se&&Me&&(Se(t),Me(r),We.current=!0)}},[null==tt?void 0:tt.search,Me,Se]);var nt=U(function(e){return e.fetchPermissions}),rt=U(function(e){return e.hasPermission}),ot=q(function(e){return e.setRoles}),st=k(function(e){return e.appsecRbacUrl})===le.appsecRbacUrl,it=G(le.applicationId,st).data,at=F(null!=de?de:"",me),ct=at.isLoading,lt=at.isError,ut=at.refetch;at.isSuccess;var dt=a(0),pt=dt[0],mt=dt[1];l(function(){if(!me&&de&&se){n(re,void 0,void 0,function(){var e,t,n,o,s,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,b(de)];case 1:return e=r.sent(),"number"==typeof(t=null===(i=null===(s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&t>0&&mt(t-1),[3,3];case 2:return n=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",n),[3,3];case 3:return[2]}})})}},[de,se]),l(function(){it&&ot(it.map(function(e){return{_id:e._id,name:e.name}}))},[it,ot]),l(function(){var e;console.log("userDetails",oe),Xe(oe),console.log("llmStudioUrl",se),console.log("audacyBackendUrl",ie),k.getState().setLlmStudioUrl(se),k.getState().setAudacyBackendUrl(ie),k.getState().setRbacConfig(le),k.getState().setAuditLogConfig(ue),k.getState().setBaseModeName((null==he?void 0:he.modeNameFromURL)||null),$e(ce),et(ae),m.getState().setAppIntegrationId(null!=de?de:null),m.getState().setBackwardCompatibility(me),m.getState().setCognitiveCompareCompatibility(null!=ve&&ve),m.getState().setToken(null!==(e=null==oe?void 0:oe.accessToken)&&void 0!==e?e:null)},[oe,Xe,se,ie,le,ue,ce,$e,ae,et,de,me,ve,he]),l(function(){(null==oe?void 0:oe.accessToken)&&se&&y()},[de,null==oe?void 0:oe.accessToken,se]);var ft=function(t){return void 0===t&&(t=!0),n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:t&&Oe(!0),be(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,nt(le.applicationId)];case 2:return r.sent(),n=function(t){if(!U.getState().hasPermission("ilotj.scope.view",t.id))return null;var r=t.children?t.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return e(e({},t),{children:r})},[4,C(de,oe.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=n(s))?(Ue(null),Ae({data:i}),Ve.current?(Se(Ve.current),Me("learnings"),Ve.current=null):(a=m.getState().selectedRuleSetId,c=a?_(i,a):null,a&&c||Se(i.id))):(Ue(null!==(u=s.id)&&void 0!==u?u:null),Ae(null)):(Ue(null),Ae(null))),[3,6];case 4:return l=r.sent(),console.error("Failed to fetch rule sets or permissions",l),be("Failed to load data. Please try again later."),[3,6];case 5:return Oe(!1),[7];case 6:return[2]}})})};l(function(){var e;(null===(e=null==oe?void 0:oe.accessToken)||void 0===e?void 0:e.length)&&st?ft(!0):console.warn("Error: Trying to fetch rules without access token",oe)},[null==oe?void 0:oe.accessToken,be,Ce,le.applicationId,st]);var vt=function(t,o,s){return n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:_e(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(t,oe.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===t&&(n=m.getState().scopeTreeData,(o=D((null==n?void 0:n.data)||null,t))&&o.length>1&&(s=o[o.length-2],Se(s),Me("learnings"))),[4,ft(!0)];case 3:return r.sent(),Ie(function(t){return e(e({},t),{isOpen:!1})}),null===(a=Ye.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(c=Ye.current)||void 0===c||c.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(l=null==i?void 0:i.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return _e(!1),[7];case 6:return[2]}})})},gt=function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),O(((n={})[w.SECTION]="learnings"===t?null:t,n[w.RULESET_ID]=e,n)),Me(t),Se(e)},ht=Te,St=Ge?{data:{id:Ge.stationId,name:Ge.stationName,type:"STATION",metrics:{learningsCount:Ge.learningsCount,stationsCount:0},children:[]}}:ht,yt=!!(null==St?void 0:St.data);null===(ee=null==St?void 0:St.data)||void 0===ee||ee.type;var bt=U(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",le.applicationResourceId||"");if(ct)return o("div",e({className:v.learningManagementContainer},{children:o(H,{})}));if(lt)return o("div",e({className:v.learningManagementContainer},{children:o(Q,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return ut()},title:"Error Loading Configuration"})}));var Ct=t(t([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(Y("".concat(J,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:pt},function(){return e({type:"SCOPE",label:Y("".concat(J,".scope"),"Scope")},!me&&{addChildLabel:Y("".concat(X,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),me?[]:[{type:"SUBSCOPE",label:Y("".concat(J,".subScope"),"Subscope")}],!0),Tt=[{id:"learnings",label:Y("".concat(J,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:Y("".concat(J,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:Y("".concat(J,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],At=new Set(Tt.map(function(e){return e.id})),Lt=Ge?Tt.filter(function(e){return"stations"!==e.id}):Tt;return o(B,{children:s("div",e({className:v.learningManagementContainer},{children:[o("div",e({className:v.mainWrapper},{children:we?o(N,{}):ye?s("div",e({className:v.errorContainer},{children:[o("div",e({className:v.errorTitle},{children:"Error Loading Data"})),o("p",e({className:v.errorDesc},{children:ye})),o("button",e({onClick:function(){return ft(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):yt?o(g,{onOpenCreateModal:function(){return Ie({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return Ie({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return Ie({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,t,o){return n(re,void 0,void 0,function(){var n,s,i;return r(this,function(r){switch(r.label){case 0:return n=m.getState().scopeTreeData,s=D((null==n?void 0:n.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,vt(e)];case 1:return r.sent(),[3,3];case 2:Ie({isOpen:!0,type:"DELETE",scopeId:e,initialName:t,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return rt("ilotj.scope.delete",e)},canEditScope:function(e){return rt("ilotj.scope.edit",e)},canCreateScope:function(e){return rt("ilotj.scope.create",e)},onSectionSelect:gt,activeSectionId:ke,scopeTreeData:St,sectionsConfig:Lt,onViewStation:function(e){gt(e.stationId,"learnings")},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(Ve.current=t),ft(e)},nodeTypesConfig:Ct,app_integration_id:de,token:oe.accessToken,modeId:ge}):o(h,{onCreate:function(){return Ie({isOpen:!0,type:"GLOBAL"})},title:Y("".concat(Z,".title"),"No Global Scope has been added!"),desc:Y("".concat(Z,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:Y("".concat(Z,".createGlobalScope"),"Create Global Scope"),canCreateRule:bt,noAccessTitle:Y("".concat(Z,".noAccessTitle"),"Access Restricted"),noAccessDesc:Y("".concat(Z,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:Y("".concat(Z,".requestAccessButton"),"Request Access"),requestSentButton:Y("".concat(Z,".requestSentButton"),"Request Sent"),onRequestAccess:function(){return n(re,void 0,void 0,function(){var e,t,n,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(n=m.getState().scopeTreeData)||void 0===n?void 0:n.data)||void 0===s?void 0:s.id)||Pe))return null===(i=Ye.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:"Unable to identify the global scope for this access request."})}),[2];He(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,R(e)];case 2:return r.sent(),Ke(!0),null===(a=Ye.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(K,{message:"Access request submitted successfully!"})}),[3,5];case 3:return t=r.sent(),null===(c=Ye.current)||void 0===c||c.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(u=null===(l=null==t?void 0:t.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,5];case 4:return He(!1),[7];case 5:return[2]}})})},isRequestingAccess:xe,isAccessRequested:ze})})),o(f,{ref:Ye,pt:{root:{style:{zIndex:9999}}}}),me&&Ee.isOpen&&"DELETE"!==Ee.type&&"RENAME"!==Ee.type?o(P,{isOpen:!0,onClose:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onSubmit:function(t){return n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u,d,p,f,v,g,h,S,y,b,C,E,I;return r(this,function(r){switch(r.label){case 0:_e(!0),n=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,n&&"object"==typeof t?o=t:(s=t,i="SCOPE"===Ee.type&&Ee.parentId,a=i?"genreRuleSet":Ee.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Ee.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:de}),[4,L(o,oe.accessToken)];case 2:if(c=r.sent(),!(l=null===(h=null==c?void 0:c.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Ve.current=l,u=n&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!n&&"GLOBAL"!==Ee.type&&Ee.parentId,!u&&!d)return[3,10];if(!(p=n?null===(b=null===(y=m.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===b?void 0:b.id:Ee.parentId))return[3,10];if(!me)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,A({source_scope_id:p,target_scope_id:l})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,T({source_scope_id:p,target_scope_id:l,application_mapping_id:de||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return v=r.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,ft(!0)];case 11:return r.sent(),Ie(function(t){return e(e({},t),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(C=Ye.current)||void 0===C||C.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(E=null==g?void 0:g.response)||void 0===E?void 0:E.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return _e(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:yt,canCreateGlobal:bt,globalScopeId:null!==(ne=null===(te=null==Te?void 0:Te.data)||void 0===te?void 0:te.id)&&void 0!==ne?ne:null}):s(i,{children:[o(x,{isOpen:Ee.isOpen&&"DELETE"!==Ee.type&&"RENAME"!==Ee.type,onClose:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onCreate:function(e){e&&(Ve.current=e),ft(!0)},hasGlobalRuleSet:yt,parentId:Ee.parentId}),o(W,{isOpen:Ee.isOpen&&"RENAME"===Ee.type,onClose:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onSave:function(t){return n(re,void 0,void 0,function(){var n,s,i,a,c,l;return r(this,function(r){switch(r.label){case 0:_e(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Ee.scopeId?(n=m.getState().backwardCompatibility,s=n?{scope_id:Ee.scopeId,scope_name:t}:{scope_id:Ee.scopeId,scope_type:"Custom",scope_name:t,application_mapping_id:de},[4,E(s,oe.accessToken)]):[2];case 2:return r.sent(),[4,ft(!0)];case 3:return r.sent(),Ie(function(t){return e(e({},t),{isOpen:!1})}),[3,6];case 4:throw i=r.sent(),console.error("An error occurred during scope rename.",i),null===(a=Ye.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(l=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return _e(!1),[7];case 6:return[2]}})})},initialName:Ee.initialName})]}),o(j,{isOpen:Ee.isOpen&&"DELETE"===Ee.type,onCancel:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onConfirm:function(){return vt(Ee.scopeId,Ee.initialName,Ee.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:v.highlight},{children:Ee.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Ne})]}))})}export{$ as default};
1
+ import{__assign as e,__spreadArray as t,__awaiter as n,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as l}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import S from"./store/useAuthStore.js";import{fetchTiers as y,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as A,createRuleSet as L,renameScope as E,deleteRuleSet as I,requestAccess as R}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as w,setQueryParams as O}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import N from"./components/LearningTemplateManagementSkeleton.js";import{findNodeById as _,findNodePathById as D}from"./utils/treeUtils.js";import k from"./store/useEnvStore.js";import{useConfigStore as M}from"./store/useConfigStore.js";import{TooltipProvider as B}from"./components/ToolTip.js";import P from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as q}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as U}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as G}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as F}from"./queries/useLMSConfigQuery.js";import x from"./RuleContent/AddScopeModal.js";import H from"./components/RuleContentSkeleton.js";import Q from"./components/ErrorStateDisplay.js";import{useLocation as z}from"react-router-dom";import K from"./shared/SuccessToastContent.js";import V from"./shared/ErrorToastContent.js";import W from"./RuleContent/RenameScopeModal.js";import{dt as Y}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as J,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as X,EMPTY_STATE_DT_PATH as Z}from"./constants.js";function $($){var ee,te,ne,re=this,oe=$.userDetails,se=$.llmStudioUrl,ie=$.audacyBackendUrl,ae=$.ilLabels,ce=$.config,le=$.rbacConfig,ue=$.auditLogConfig,de=$.app_integration_id,pe=$.backwardCompatibility,me=void 0!==pe&&pe,fe=$.cognitiveCompareCompatibility,ve=void 0!==fe&&fe,ge=$.modeId,he=$.modeDetails;m(function(e){return e.selectedRuleSetId});var Se=m(function(e){return e.setSelectedRuleSetId}),ye=m(function(e){return e.error}),be=m(function(e){return e.setError}),Ce=m(function(e){return e.setStations}),Te=m(function(e){return e.scopeTreeData}),Ae=m(function(e){return e.setScopeTreeData}),Le=a({isOpen:!1,type:"GLOBAL"}),Ee=Le[0],Ie=Le[1],Re=a(!1),we=Re[0],Oe=Re[1],je=a(!1),Ne=je[0],_e=je[1],De=a("learnings"),ke=De[0],Me=De[1],Be=a(null),Pe=Be[0],qe=Be[1],Ue=a(null),Ge=Ue[0];Ue[1];var Fe=a(!1),xe=Fe[0],He=Fe[1],Qe=a(!1),ze=Qe[0],Ke=Qe[1];c(null);var Ve=c(null),We=c(!1),Ye=c(null),Je=S();Je.user;var Xe=Je.setUser,Ze=M(),$e=Ze.setConfig,et=Ze.setIlLabels,tt=function(){try{return z()}catch(e){return{search:""}}}();l(function(){if(!We.current){var e=new URLSearchParams(window.location.search),t=e.get(w.RULESET_ID),n=e.get(w.SECTION),r=n&&Lt.has(n)?n:"learnings";(null==t?void 0:t.length)&&Se&&Me&&(Se(t),Me(r),We.current=!0)}},[null==tt?void 0:tt.search,Me,Se]);var nt=q(function(e){return e.fetchPermissions}),rt=q(function(e){return e.hasPermission}),ot=U(function(e){return e.setRoles}),st=k(function(e){return e.appsecRbacUrl})===le.appsecRbacUrl,it=G(le.applicationId,st).data,at=F(null!=de?de:"",me),ct=at.isLoading,lt=at.isError,ut=at.refetch;at.isSuccess;var dt=a(0),pt=dt[0],mt=dt[1];l(function(){if(!me&&de&&se){n(re,void 0,void 0,function(){var e,t,n,o,s,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,b(de)];case 1:return e=r.sent(),"number"==typeof(t=null===(i=null===(s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&t>0&&mt(t-1),[3,3];case 2:return n=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",n),[3,3];case 3:return[2]}})})}},[de,se]),l(function(){it&&ot(it.map(function(e){return{_id:e._id,name:e.name}}))},[it,ot]),l(function(){var e;console.log("userDetails",oe),Xe(oe),console.log("llmStudioUrl",se),console.log("audacyBackendUrl",ie),k.getState().setLlmStudioUrl(se),k.getState().setAudacyBackendUrl(ie),k.getState().setRbacConfig(le),k.getState().setAuditLogConfig(ue),k.getState().setBaseModeName((null==he?void 0:he.modeNameFromURL)||null),$e(ce),et(ae),m.getState().setAppIntegrationId(null!=de?de:null),m.getState().setBackwardCompatibility(me),m.getState().setCognitiveCompareCompatibility(null!=ve&&ve),m.getState().setToken(null!==(e=null==oe?void 0:oe.accessToken)&&void 0!==e?e:null)},[oe,Xe,se,ie,le,ue,ce,$e,ae,et,de,me,ve,he]),l(function(){(null==oe?void 0:oe.accessToken)&&se&&y()},[de,null==oe?void 0:oe.accessToken,se]);var ft=function(t){return void 0===t&&(t=!0),n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u,d,p;return r(this,function(r){switch(r.label){case 0:t&&Oe(!0),be(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,nt(le.applicationId)];case 2:return r.sent(),n=function(t){var r=q.getState().hasPermission("ilotj.scope.view",t.id),o=t.children?t.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return r||0!==o.length?e(e({},t),{hasAccess:r,children:o}):null},[4,C(de,oe.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=n(s))?(qe(null),Ae({data:i}),Ve.current?(Se(Ve.current),Me("learnings"),Ve.current=null):(a=m.getState().selectedRuleSetId,c=a?_(i,a):null,a&&c||(l=function(e){if(e.hasAccess)return e;for(var t=0,n=e.children||[];t<n.length;t++){var r=n[t],o=l(r);if(o)return o}return null},u=l(i),Se(u?u.id:i.id)))):(qe(null!==(p=s.id)&&void 0!==p?p:null),Ae(null)):(qe(null),Ae(null))),[3,6];case 4:return d=r.sent(),console.error("Failed to fetch rule sets or permissions",d),be("Failed to load data. Please try again later."),[3,6];case 5:return Oe(!1),[7];case 6:return[2]}})})};l(function(){var e;(null===(e=null==oe?void 0:oe.accessToken)||void 0===e?void 0:e.length)&&st?ft(!0):console.warn("Error: Trying to fetch rules without access token",oe)},[null==oe?void 0:oe.accessToken,be,Ce,le.applicationId,st]);var vt=function(t,o,s){return n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:_e(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(t,oe.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===t&&(n=m.getState().scopeTreeData,(o=D((null==n?void 0:n.data)||null,t))&&o.length>1&&(s=o[o.length-2],Se(s),Me("learnings"))),[4,ft(!0)];case 3:return r.sent(),Ie(function(t){return e(e({},t),{isOpen:!1})}),null===(a=Ye.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(c=Ye.current)||void 0===c||c.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(l=null==i?void 0:i.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return _e(!1),[7];case 6:return[2]}})})},gt=function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),O(((n={})[w.SECTION]="learnings"===t?null:t,n[w.RULESET_ID]=e,n)),Me(t),Se(e),Ke(!1)},ht=Te,St=Ge?{data:{id:Ge.stationId,name:Ge.stationName,type:"STATION",metrics:{learningsCount:Ge.learningsCount,stationsCount:0},children:[]}}:ht,yt=!!(null==St?void 0:St.data);null===(ee=null==St?void 0:St.data)||void 0===ee||ee.type;var bt=q(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",le.applicationResourceId||""),Ct=function(e){return n(re,void 0,void 0,function(){var t,n,s,i,a,c,l,u,d;return r(this,function(r){switch(r.label){case 0:if(!(t="string"==typeof e?e:(null===(i=null===(s=m.getState().scopeTreeData)||void 0===s?void 0:s.data)||void 0===i?void 0:i.id)||Pe))return null===(a=Ye.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:"Unable to identify the global scope for this access request."})}),[2];He(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,R(t)];case 2:return r.sent(),Ke(!0),null===(c=Ye.current)||void 0===c||c.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(K,{message:"Access request submitted successfully!"})}),[3,5];case 3:return n=r.sent(),null===(l=Ye.current)||void 0===l||l.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(d=null===(u=null==n?void 0:n.response)||void 0===u?void 0:u.data)||void 0===d?void 0:d.detail)||"Failed to request access. Please try again."})}),[3,5];case 4:return He(!1),[7];case 5:return[2]}})})};if(ct)return o("div",e({className:v.learningManagementContainer},{children:o(H,{})}));if(lt)return o("div",e({className:v.learningManagementContainer},{children:o(Q,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return ut()},title:"Error Loading Configuration"})}));var Tt=t(t([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(Y("".concat(J,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:pt},function(){return e({type:"SCOPE",label:Y("".concat(J,".scope"),"Scope")},!me&&{addChildLabel:Y("".concat(X,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),me?[]:[{type:"SUBSCOPE",label:Y("".concat(J,".subScope"),"Subscope")}],!0),At=[{id:"learnings",label:Y("".concat(J,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:Y("".concat(J,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:Y("".concat(J,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],Lt=new Set(At.map(function(e){return e.id})),Et=Ge?At.filter(function(e){return"stations"!==e.id}):At;return o(B,{children:s("div",e({className:v.learningManagementContainer},{children:[o("div",e({className:v.mainWrapper},{children:we?o(N,{}):ye?s("div",e({className:v.errorContainer},{children:[o("div",e({className:v.errorTitle},{children:"Error Loading Data"})),o("p",e({className:v.errorDesc},{children:ye})),o("button",e({onClick:function(){return ft(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):yt?o(g,{onOpenCreateModal:function(){return Ie({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return Ie({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return Ie({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,t,o){return n(re,void 0,void 0,function(){var n,s,i;return r(this,function(r){switch(r.label){case 0:return n=m.getState().scopeTreeData,s=D((null==n?void 0:n.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,vt(e)];case 1:return r.sent(),[3,3];case 2:Ie({isOpen:!0,type:"DELETE",scopeId:e,initialName:t,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return rt("ilotj.scope.delete",e)},canEditScope:function(e){return rt("ilotj.scope.edit",e)},canCreateScope:function(e){return rt("ilotj.scope.create",e)},onSectionSelect:gt,activeSectionId:ke,scopeTreeData:St,sectionsConfig:Et,onViewStation:function(e){gt(e.stationId,"learnings")},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(Ve.current=t),ft(e)},nodeTypesConfig:Tt,app_integration_id:de,token:oe.accessToken,modeId:ge,onRequestAccess:Ct,isRequestingAccess:xe,isAccessRequested:ze}):o(h,{onCreate:function(){return Ie({isOpen:!0,type:"GLOBAL"})},title:Y("".concat(Z,".title"),"No Global Scope has been added!"),desc:Y("".concat(Z,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:Y("".concat(Z,".createGlobalScope"),"Create Global Scope"),canCreateRule:bt,noAccessTitle:Y("".concat(Z,".noAccessTitle"),"Access Restricted"),noAccessDesc:Y("".concat(Z,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:Y("".concat(Z,".requestAccessButton"),"Request Access"),requestSentButton:Y("".concat(Z,".requestSentButton"),"Request Sent"),onRequestAccess:Ct,isRequestingAccess:xe,isAccessRequested:ze})})),o(f,{ref:Ye,pt:{root:{style:{zIndex:9999}}}}),me&&Ee.isOpen&&"DELETE"!==Ee.type&&"RENAME"!==Ee.type?o(P,{isOpen:!0,onClose:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onSubmit:function(t){return n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u,d,p,f,v,g,h,S,y,b,C,E,I;return r(this,function(r){switch(r.label){case 0:_e(!0),n=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,n&&"object"==typeof t?o=t:(s=t,i="SCOPE"===Ee.type&&Ee.parentId,a=i?"genreRuleSet":Ee.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Ee.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:de}),[4,L(o,oe.accessToken)];case 2:if(c=r.sent(),!(l=null===(h=null==c?void 0:c.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Ve.current=l,u=n&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!n&&"GLOBAL"!==Ee.type&&Ee.parentId,!u&&!d)return[3,10];if(!(p=n?null===(b=null===(y=m.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===b?void 0:b.id:Ee.parentId))return[3,10];if(!me)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,A({source_scope_id:p,target_scope_id:l})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,T({source_scope_id:p,target_scope_id:l,application_mapping_id:de||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return v=r.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,ft(!0)];case 11:return r.sent(),Ie(function(t){return e(e({},t),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(C=Ye.current)||void 0===C||C.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(E=null==g?void 0:g.response)||void 0===E?void 0:E.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return _e(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:yt,canCreateGlobal:bt,globalScopeId:null!==(ne=null===(te=null==Te?void 0:Te.data)||void 0===te?void 0:te.id)&&void 0!==ne?ne:null}):s(i,{children:[o(x,{isOpen:Ee.isOpen&&"DELETE"!==Ee.type&&"RENAME"!==Ee.type,onClose:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onCreate:function(e){e&&(Ve.current=e),ft(!0)},hasGlobalRuleSet:yt,parentId:Ee.parentId}),o(W,{isOpen:Ee.isOpen&&"RENAME"===Ee.type,onClose:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onSave:function(t){return n(re,void 0,void 0,function(){var n,s,i,a,c,l;return r(this,function(r){switch(r.label){case 0:_e(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Ee.scopeId?(n=m.getState().backwardCompatibility,s=n?{scope_id:Ee.scopeId,scope_name:t}:{scope_id:Ee.scopeId,scope_type:"Custom",scope_name:t,application_mapping_id:de},[4,E(s,oe.accessToken)]):[2];case 2:return r.sent(),[4,ft(!0)];case 3:return r.sent(),Ie(function(t){return e(e({},t),{isOpen:!1})}),[3,6];case 4:throw i=r.sent(),console.error("An error occurred during scope rename.",i),null===(a=Ye.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(l=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return _e(!1),[7];case 6:return[2]}})})},initialName:Ee.initialName})]}),o(j,{isOpen:Ee.isOpen&&"DELETE"===Ee.type,onCancel:function(){return Ie(e(e({},Ee),{isOpen:!1}))},onConfirm:function(){return vt(Ee.scopeId,Ee.initialName,Ee.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:v.highlight},{children:Ee.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Ne})]}))})}export{$ as default};
2
2
  //# sourceMappingURL=LearningManagement.js.map
@@ -1,2 +1,2 @@
1
- import"tslib";import"react/jsx-runtime";import"react";import"lucide-react";import"./store/useLearningTemplateStore.js";import"primereact/toast";import"./apis/scopeApis.js";import"./store/usePermissionsStore.js";import"./store/useLMSConfigStore.js";import"./components/ToolTip.js";import"./store/useAuthStore.js";import"@mui/material";import"@mui/icons-material/Check";import"@mui/icons-material/CloseRounded";import{QueryClient as t}from"@tanstack/react-query";import"./store/useEnvStore.js";import"date-fns/format";import"date-fns/isValid";import"date-fns/parseISO";import"framer-motion";import"../IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../IL-OTJ/_components/InputDataReasoningCard.js";import"../IL-OTJ/_components/TooltipComponent.js";import"../IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import"../IL-OTJ/store/CitationsContext.js";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"../LSCGuidelinesCart/LearningManagementWrapper.js";import"./store/useConfigStore.js";import"appsec-ui";import"@radix-ui/react-tooltip";import"./components/StationOnboarding/InputField.js";import"./config.js";import"./store/useAppSecRolesStore.js";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"./AuditLog/ChangeLogDiff.js";import"react-router-dom";new t;
1
+ import"tslib";import"react/jsx-runtime";import"react";import"lucide-react";import"./store/useLearningTemplateStore.js";import"primereact/toast";import"./apis/scopeApis.js";import"./store/usePermissionsStore.js";import"./store/useLMSConfigStore.js";import"./components/ToolTip.js";import"./store/useAuthStore.js";import"@mui/material";import"@mui/icons-material/Check";import"@mui/icons-material/CloseRounded";import{QueryClient as t}from"@tanstack/react-query";import"./store/useEnvStore.js";import"date-fns/format";import"date-fns/isValid";import"date-fns/parseISO";import"framer-motion";import"../IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../IL-OTJ/_components/InputDataReasoningCard.js";import"../IL-OTJ/_components/TooltipComponent.js";import"../IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import"../IL-OTJ/store/CitationsContext.js";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"./store/useConfigStore.js";import"appsec-ui";import"@radix-ui/react-tooltip";import"./components/StationOnboarding/InputField.js";import"./config.js";import"./store/useAppSecRolesStore.js";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"./AuditLog/ChangeLogDiff.js";import"react-router-dom";new t;
2
2
  //# sourceMappingURL=LearningManagementTest.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as o,jsx as n}from"react/jsx-runtime";import{useEffect as t}from"react";import i from"./RuleContent/RuleContent.js";import r from"./StationsContent/StationsContent.js";import a from"./RBAC/AccessManagementPanel.js";import"appsec-ui";import"./store/useAuthStore.js";import"./store/usePermissionsStore.js";import s from"./store/useEnvStore.js";import d from"./styles/LearningTemplateLayout.module.css.js";import{findNodeById as l,mapScopeChildrenToStations as c}from"./utils/treeUtils.js";import u from"./SidebarWrapper.js";import{useLearningTemplateStore as p}from"./store/useLearningTemplateStore.js";import m from"./components/StationOnboarding/StationOnboardModal.js";import f from"./AuditLog/AuditLog.js";var S=function(S){var g,v,C=S.onOpenCreateModal,h=S.onRefreshRuleSets,R=S.scopeTreeData,j=S.onAddChild,I=S.onRenameChild,A=S.onDeleteChild,D=S.canDeleteScope,M=S.canEditScope,O=S.canCreateScope,T=S.onSectionSelect,w=S.onViewStation,b=S.activeSectionId,k=void 0===b?"learnings":b,y=S.sectionsConfig,L=S.nodeTypesConfig,_=S.app_integration_id,N=S.token,U=S.modeId,x=p(function(e){return e.isStationModalOpen}),B=p(function(e){return e.setStationModalOpen}),E=p(function(e){return e.isStationOnboardModalTriggered}),P=p(function(e){return e.setIsStationOnboardModalTriggered}),V=p(function(e){return e.selectedRuleSetId}),F=p(function(e){return e.rawAuditRuleData}),W=s(function(e){return e.auditLogConfig});p(function(e){return e.ruleData});var q=V?l((null==R?void 0:R.data)||null,V):null;return Boolean((null===(g=null==R?void 0:R.data)||void 0===g?void 0:g.id)&&V===R.data.id),t(function(){E&&B(!0)},[E,B,P]),o("div",e({className:d.container},{children:[n(u,{onOpenCreateModal:C,onRefreshRuleSets:h,scopeTreeData:R,onAddChild:j,onRenameChild:I,onDeleteChild:A,canDeleteScope:D,canEditScope:M,canCreateScope:O,onSectionSelect:T,activeSectionId:k,sectionsConfig:y,nodeTypesConfig:L}),n("div",e({id:"rule-template-layout-content",className:"".concat(d.content," relative flex-1 overflow-hidden")},{children:"stations"===k?n(r,{scopeId:V||"",scopeName:(null==q?void 0:q.name)||"Unknown Scope",stationsCount:null===(v=null==q?void 0:q.metrics)||void 0===v?void 0:v.stationsCount,stations:c(q),onViewStation:w}):"access"===k?n(a,{selectedRuleSetId:V,scopeName:(null==q?void 0:q.name)||"Unknown Scope",useApplicationModuleForScopeAccess:!1}):"history"===k?(null==W?void 0:W.configId)?n(f,{configId:W.configId,scopeId:V||void 0,scopeName:(null==q?void 0:q.name)||"Unknown Scope",ruleData:F}):null:n(i,{onRefreshRuleSets:h,app_integration_id:_,token:N,modeId:U})})),n(m,{isOpen:x,onClose:function(){B(!1),P(!1)},onBoardStation:function(e){h(!0,e)},app_integration_id:_,token:N})]}))};export{S as default};
1
+ import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useEffect as n}from"react";import s from"./RuleContent/RuleContent.js";import i from"./StationsContent/StationsContent.js";import c from"./RBAC/AccessManagementPanel.js";import"appsec-ui";import"./store/useAuthStore.js";import"./store/usePermissionsStore.js";import{useLearningTemplateStore as a}from"./store/useLearningTemplateStore.js";import r from"./store/useEnvStore.js";import l from"./styles/LearningTemplateLayout.module.css.js";import{findNodeById as u,mapScopeChildrenToStations as d}from"./utils/treeUtils.js";import m from"./SidebarWrapper.js";import p from"./components/StationOnboarding/StationOnboardModal.js";import f from"./AuditLog/AuditLog.js";import S from"./components/EmptyLearningState.js";import{dt as v}from"./store/useLMSConfigStore.js";import{EMPTY_STATE_DT_PATH as g}from"./constants.js";var A=function(A){var C,R,h=A.onOpenCreateModal,j=A.onRefreshRuleSets,q=A.scopeTreeData,D=A.onAddChild,I=A.onRenameChild,T=A.onDeleteChild,w=A.canDeleteScope,M=A.canEditScope,O=A.canCreateScope,L=A.onSectionSelect,b=A.onViewStation,y=A.activeSectionId,B=void 0===y?"learnings":y,k=A.sectionsConfig,_=A.nodeTypesConfig,N=A.app_integration_id,E=A.token,U=A.modeId,x=A.onRequestAccess,P=A.isRequestingAccess,V=A.isAccessRequested,Y=a(function(e){return e.isStationModalOpen}),W=a(function(e){return e.setStationModalOpen}),z=a(function(e){return e.isStationOnboardModalTriggered}),F=a(function(e){return e.setIsStationOnboardModalTriggered}),G=a(function(e){return e.selectedRuleSetId}),H=a(function(e){return e.rawAuditRuleData}),J=r(function(e){return e.auditLogConfig});a(function(e){return e.ruleData});var K=G?u((null==q?void 0:q.data)||null,G):null;return Boolean((null===(C=null==q?void 0:q.data)||void 0===C?void 0:C.id)&&G===q.data.id),n(function(){z&&W(!0)},[z,W,F]),t("div",e({className:l.container},{children:[o(m,{onOpenCreateModal:h,onRefreshRuleSets:j,scopeTreeData:q,onAddChild:D,onRenameChild:I,onDeleteChild:T,canDeleteScope:w,canEditScope:M,canCreateScope:O,onSectionSelect:L,activeSectionId:B,sectionsConfig:k,nodeTypesConfig:_}),o("div",e({id:"rule-template-layout-content",className:"".concat(l.content," relative flex-1 overflow-hidden")},{children:"stations"===B?o(i,{scopeId:G||"",scopeName:(null==K?void 0:K.name)||"Unknown Scope",stationsCount:null===(R=null==K?void 0:K.metrics)||void 0===R?void 0:R.stationsCount,stations:d(K),onViewStation:b}):"access"===B?o(c,{selectedRuleSetId:G,scopeName:(null==K?void 0:K.name)||"Unknown Scope"}):"history"===B?(null==J?void 0:J.configId)?o(f,{configId:J.configId,scopeId:G||void 0,scopeName:(null==K?void 0:K.name)||"Unknown Scope",ruleData:H}):null:K&&!1===K.hasAccess?o(S,{onCreate:function(){},title:v("".concat(g,".noAccessTitle"),"Access Restricted"),desc:v("".concat(g,".noAccessDesc"),"You do not have access to view this ".concat(null==K?void 0:K.name," learnings.")),button:"",canCreateRule:!1,noAccessTitle:v("".concat(g,".noAccessTitle"),"Access Restricted"),noAccessDesc:v("".concat(g,".noAccessDesc"),"You do not have access to view this ".concat(null==K?void 0:K.name," learnings.")),requestAccessButton:v("".concat(g,".requestAccessButton"),"Request Access"),requestSentButton:v("".concat(g,".requestSentButton"),"Request Sent"),onRequestAccess:function(){return null==x?void 0:x(G)},isRequestingAccess:P,isAccessRequested:V}):o(s,{onRefreshRuleSets:j,app_integration_id:N,token:E,modeId:U})})),o(p,{isOpen:Y,onClose:function(){W(!1),F(!1)},onBoardStation:function(e){j(!0,e)},app_integration_id:N,token:E})]}))};export{A as default};
2
2
  //# sourceMappingURL=LearningTemplateLayout.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as c,jsx as s}from"react/jsx-runtime";import{useState as o}from"react";import a from"./AccessPanel.js";import t from"../store/useEnvStore.js";import{usePermissionsStore as i}from"../store/usePermissionsStore.js";import l from"./AccessPanel.module.css.js";import{dt as n}from"../store/useLMSConfigStore.js";var r=function(r){var p=r.selectedRuleSetId,d=r.useApplicationModuleForScopeAccess,m=void 0!==d&&d,u=r.scopeName,v=(null==u?void 0:u.trim())||"Selected",f=o("scope"),b=f[0],h=f[1],g=t(function(e){return e.rbacConfig}),A=i(function(e){return e.hasPermission}),S=null==g?void 0:g.applicationResourceId,x=(null==g?void 0:g.applicationModuleId)||(null==g?void 0:g.moduleId),I=m?x:null==g?void 0:g.moduleId,j=Boolean(S&&A("ilotj.scope.access.application.view",S));return c("div",e({className:l.accessManagement},{children:[s("div",e({style:{padding:"24px 24px 0",fontFamily:"Arial, sans-serif"}},{children:c("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[s("h1",e({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:n("access.title","".concat(v," - Access Management"),{scope_name:v})})),s("p",e({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:n("access.subtitle","Manage users and groups within the ".concat(v," scope."),{scope_name:v})}))]}))})),c("div",e({className:l.accessTabs,role:"tablist","aria-label":"Access level"},{children:[s("button",e({type:"button",role:"tab","aria-selected":"scope"===b,className:"".concat(l.accessTab," ").concat("scope"===b?l.accessTabActive:""),onClick:function(){return h("scope")}},{children:n("access.scopeLevelAccess","Scope Level Access")})),s("button",e({type:"button",role:"tab","aria-selected":"application"===b,className:"".concat(l.accessTab," ").concat("application"===b?l.accessTabActive:""),onClick:function(){return h("application")},disabled:!j,title:j?"":"You don't have permission to view application access"},{children:n("access.appLevelAccess","Application Level Access")}))]})),s("div",e({className:l.accessTabPanel,role:"tabpanel"},{children:s(a,"application"===b?{resourceId:S,moduleId:x,accessLevel:"application"}:{ruleSetId:p,moduleId:I,accessLevel:"scope"})}))]}))};export{r as default};
1
+ import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import n from"./AccessPanel.js";import i from"../store/useEnvStore.js";import s from"./AccessPanel.module.css.js";import{dt as l}from"../store/useLMSConfigStore.js";var r=function(r){var a=r.selectedRuleSetId,c=r.scopeName,d=(null==c?void 0:c.trim())||"Selected",m=i(function(e){return e.rbacConfig});(null==m?void 0:m.applicationModuleId)||null==m||m.moduleId;var p=null==m?void 0:m.moduleId;return t("div",e({className:s.accessManagement},{children:[o("div",e({style:{padding:"24px 24px 0",fontFamily:"Arial, sans-serif"}},{children:t("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[o("h1",e({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:l("access.title","".concat(d," - Access Management"),{scope_name:d})})),o("p",e({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:l("access.subtitle","Manage users and groups within the ".concat(d," scope."),{scope_name:d})}))]}))})),o("div",e({className:s.accessTabPanel,role:"tabpanel"},{children:o(n,{ruleSetId:a,moduleId:p,mode:"both"})}))]}))};export{r as default};
2
2
  //# sourceMappingURL=AccessManagementPanel.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as o}from"react/jsx-runtime";import{RbacQueryProvider as r,AppsecProvider as c,AccessListPanel as a}from"appsec-ui";import s from"../store/useAuthStore.js";import{usePermissionsStore as n}from"../store/usePermissionsStore.js";import t from"./AccessPanel.module.css.js";import i from"../store/useEnvStore.js";var u=function(u){var d=u.ruleSetId,p=u.resourceId,l=u.moduleId,m=u.accessLevel,f=void 0===m?"scope":m,v=u.mode,g=void 0===v?"both":v;u.canManageAppAccess;var h=s(function(e){return e.user}),I=i(function(e){return e.rbacConfig}),j=i(function(e){return e.appsecRbacUrl}),A=i(function(e){return e.appsecBaseUrl}),U=null==h?void 0:h.accessToken,b=n(function(e){return e.hasPermission}),P=p||d||void 0,S=Boolean(P),N="application"===f,E=N?"ilotj.scope.access.application":"ilotj.scope.access",G=S&&b("".concat(E,".user.add"),P),k=S&&b("".concat(E,".user.edit"),P),x=S&&b("".concat(E,".user.remove"),P),B=S&&b("".concat(E,".group.add"),P),D=S&&b("".concat(E,".group.edit"),P),M=S&&b("".concat(E,".group.remove"),P);if(!(P&&I&&j&&A))return o("div",e({className:t.accessPanel},{children:o("p",e({className:t.emptyState},{children:"Waiting for access configuration..."}))}));var T=N?I.applicationModuleId||l||I.moduleId:l||I.moduleId;return o("div",e({className:t.accessPanel},{children:o(r,{children:o(c,e({appId:I.applicationName,baseUrl:j,appsecUrl:A,mode:"manage",getAuthToken:function(){return null!=U?U:""}},{children:o(a,{resourceId:P,moduleId:T,mode:g,canAddUser:G,canEditUser:k,canDeleteUser:x,canAddGroup:B,canEditGroup:D,canDeleteGroup:M})}))})}))};export{u as default};
1
+ import{__assign as e}from"tslib";import{jsx as r}from"react/jsx-runtime";import{RbacQueryProvider as o,AppsecProvider as t,AccessListPanel as n}from"appsec-ui";import c from"../store/useAuthStore.js";import{usePermissionsStore as s}from"../store/usePermissionsStore.js";import{useLearningTemplateStore as a}from"../store/useLearningTemplateStore.js";import i from"./AccessPanel.module.css.js";import u from"../store/useEnvStore.js";var d=function(d){var m=d.ruleSetId,l=d.resourceId,p=d.moduleId,f=d.mode,v=void 0===f?"both":f,g=c(function(e){return e.user}),h=u(function(e){return e.rbacConfig}),b=u(function(e){return e.appsecRbacUrl}),j=u(function(e){return e.appsecBaseUrl}),I=null==g?void 0:g.accessToken,U=s(function(e){return e.hasPermission}),S=a(function(e){return e.backwardCompatibility}),A=l||m||void 0,P=Boolean(A),N="ilotj.scope.access",k=P&&U("".concat(N,".user.add"),A),E=P&&U("".concat(N,".user.edit"),A),G=P&&U("".concat(N,".user.remove"),A),T=P&&U("".concat(N,".group.add"),A),x=P&&U("".concat(N,".group.edit"),A),y=P&&U("".concat(N,".group.remove"),A);if(!(A&&h&&b&&j))return r("div",e({className:i.accessPanel},{children:r("p",e({className:i.emptyState},{children:"Waiting for access configuration..."}))}));var B=p||h.moduleId,C=S?"users":v;return r("div",e({className:i.accessPanel},{children:r(o,{children:r(t,e({appId:h.applicationName,baseUrl:b,appsecUrl:j,mode:"manage",getAuthToken:function(){return null!=I?I:""}},{children:r(n,{resourceId:A,moduleId:B,mode:C,canAddUser:k,canEditUser:E,canDeleteUser:G,canAddGroup:T,canEditGroup:x,canDeleteGroup:y})}))})}))};export{d as default};
2
2
  //# sourceMappingURL=AccessPanel.js.map