@e-llm-studio/instant-learning 0.0.179 → 0.0.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/IL-OTJ/_components/AccordianSection.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
- package/dist/features/IL-OTJ/_components/AccordianSection.js +1 -1
- package/dist/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +1 -1
- package/dist/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.js +1 -1
- package/dist/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJTest.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.d.ts +2 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as e,__rest as n,__assign as t}from"../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as a,jsxs as r,Fragment as i}from"react/jsx-runtime";import{ReactMarkdown as o}from"../../../../node_modules/react-markdown/lib/react-markdown.js";import c from"../../../../node_modules/rehype-raw/lib/index.js";import s from"../../../../node_modules/remark-gfm/index.js";import{useState as l,useRef as d,useEffect as u,useCallback as p,useMemo as m}from"react";import{RuleDisplay as g,ActionableButton as v,ActionableCheckbox as f}from"./ClickableChatComponents.js";import{MarkdownLinkRenderer as h,MarkdownDivRenderer as S,MarkdownSpanRenderer as b}from"../MarkdownComponents/MarkdownElements.js";import{extractTextFromChildren as y}from"../../helpers/utils.js";import{RuleVariantCard as k}from"./RuleVariantCard.js";import{MarkdownSelect as x}from"../MarkdownComponents/MarkdownSelect.js";var w=function(w){var C=w.index,_=w.content,E=w.role;w.messages;var T=w.handleStream,N=w.scrollToBottom,L=w.isLastMessage,M=w.onSave,I=w.citations,B=w.setChatSize,j=w.chatSize,z=w.isStreamEnd,R=w.messageIsEnd,A=w.onViewComparison,W=w.onTypeResponseClick,D=l(_),V=D[0],P=D[1],q=l([]),J=q[0],$=q[1],F=l(!1),G=F[0],H=F[1],O=l(!1),K=O[0],U=O[1],X=l(!1),Y=X[0],Q=X[1],Z=l(null),ee=Z[0],ne=Z[1],te=l(null),ae=te[0],re=te[1],ie=l([]),oe=ie[0],ce=ie[1],se=l(!1),le=se[0],de=se[1],ue=l(!1),pe=ue[0],me=ue[1],ge=l(new Set),ve=ge[0],fe=ge[1],he=l(new Set),Se=he[0],be=he[1],ye=d({handleStream:T,onSave:M,selectedTiers:J,tiersSubmitted:K,citations:I,openCardIds:ve,openCitationIds:Se,chatSize:j,isLastMessage:L,scrollToBottom:N,isStreamEnd:z,selectedVariant:ae,messageIsEnd:R,isCommitted:Y,clickedAction:ee,gapSelections:oe,gapsSubmitted:pe,onTypeResponseClick:W});ye.current={handleStream:T,onSave:M,selectedTiers:J,tiersSubmitted:K,citations:I,openCardIds:ve,openCitationIds:Se,chatSize:j,isLastMessage:L,scrollToBottom:N,isStreamEnd:z,selectedVariant:ae,messageIsEnd:R,isCommitted:Y,clickedAction:ee,gapSelections:oe,gapsSubmitted:pe,onTypeResponseClick:W},u(function(){re(null),Q(!1),ne(null),de(!1),me(!1),ce([])},[C]),u(function(){if(R&&!Y&&!ae){var e=V.match(/<variant-card[^>]*isselected=["']true["'][^>]*>/i);if(e){var n=e[0].match(/id=["']([^"']+)["']/),t=e[0].match(/variantname=["']([^"']+)["']/),a=e[0].match(/decisionstrength=["']([^"']+)["']/);n&&t&&re({id:n[1],variantName:t[1],decisionStrength:parseInt((null==a?void 0:a[1])||"0")})}}},[V,R,Y,ae]);var ke=p(function(e,n,t){var a=function(t){var a=new Set(t);return n?a.add(e):a.delete(e),a};"card"===t?fe(function(e){return a(e)}):be(function(e){return a(e)})},[]),xe=p(function(e,n,t){void 0===n&&(n=!1);var a=ye.current,r=a.handleStream;a.onSave;var i=e.trim();r&&(r(new KeyboardEvent("keydown",{key:"Enter"}),!1,i),n&&t&&(Q(!0),ne(t))),n||P(function(e){return e.replace(/<button([^>]*)class=["']clickable-button["']([^>]*)>([\s\S]*?)<\/button>/gi,function(e,n,t,a){var r=a.trim(),o='data-selected="'.concat(r===i,'"');return"<button".concat(n,'class="clickable-button" ').concat(o).concat(t,">").concat(a,"</button>")})})},[]),we=p(function(e,n){de(e),ce(n)},[]),Ce=p(function(){var e=ye.current,n=e.handleStream,t=e.gapSelections.map(function(e){var n=Array.isArray(e.userSelection)?e.userSelection.join(", "):e.userSelection;return"".concat(e.name,": ").concat(n||"Skipped")}),a="Here are my choices for the critical gaps:\n".concat(t.join(","));n(new KeyboardEvent("keydown",{key:"Enter"}),!1,a),me(!0)},[]),_e=p(function(e,n){var t=ye.current.citations;return t&&t.find(function(t){return t.customMetaData.citation_number&&"Cognitive Decisioning"!==t.customMetaData.citation_title&&t.customMetaData.source===n&&String(t.customMetaData.citation_number)===String(e)})||null},[]),Ee=p(function(n,t){var a=ye.current.scrollToBottom,r=Array.isArray(n)?n[0].trim():n.trim();H(!0),$(function(n){var a=e([],n,!0);if(["both tiers","all tiers"].includes(r.toLowerCase()))a=t?["Both Tiers","Tier 1","Tier 2"]:[];else{t?a.includes(r)||a.push(r):a=a.filter(function(e){return e!==r});var i=a.includes("Tier 1"),o=a.includes("Tier 2");i&&o?a.includes("Both Tiers")||a.push("Both Tiers"):a=a.filter(function(e){return!["Both Tiers","All tiers"].includes(e)})}return a.filter(function(e,n){return a.indexOf(e)===n})}),null==a||a()},[]),Te=p(function(e,n,t,a){ye.current.isCommitted||n&&re({id:e,variantName:t,decisionStrength:a})},[]),Ne=function(){if(!ye.current.isCommitted){var e="Edit ".concat((null==ae?void 0:ae.variantName)||"Selected Behavior");xe(e,!0,"edit")}},Le=p(function(){var e=ye.current,n=e.handleStream,t=e.selectedTiers,a=t.join(" and ");t.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})&&(a="Both Tiers"),n(new KeyboardEvent("keydown",{key:"Enter"}),!1,"".concat(a)),U(!0),H(!1),P(function(e){return e.replace(/<checkbox\s+class=["']clickable-box["'][^>]*>([\s\S]*?)<\/checkbox>/gi,function(e,n){var a=n.trim();return t.includes(a)?e:""})})},[]),Me=m(function(){return{p:function(e){e.node;var r=n(e,["node"]);return a("span",t({},r,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",fontSize:"1rem",lineHeight:"1.625rem",marginBottom:"user"===E?"0":"1rem"}},{children:null==r?void 0:r.children}))},code:function(e){e.node;var r=n(e,["node"]);return a("span",t({},r,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"inline-flex",fontSize:"1rem",lineHeight:"1.625rem"}},{children:null==r?void 0:r.children}))},ol:function(e){e.node;var r=n(e,["node"]);return a("ol",t({},r,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==r?void 0:r.children}))},ul:function(e){e.node;var r=n(e,["node"]);return a("ul",t({},r,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==r?void 0:r.children}))},rule:function(e){e.node;var t=n(e,["node"]);return a(g,{content:y(t.children)})},button:function(e){var r=e.node,i=e.className,o=n(e,["node","className"]),c=ye.current,s=c.isLastMessage,l=c.handleStream,d=c.isStreamEnd;return a(v,t({node:r,className:i||o.class,handleStream:l,onAction:xe,disabled:!s,isStreamEnd:d,isLastMessage:s,onTypeResponseClick:W},o))},checkbox:function(e){var r=e.node,i=e.className,o=n(e,["node","className"]),c=ye.current,s=c.selectedTiers,l=c.tiersSubmitted,d=c.isLastMessage;return a(f,t({node:r,className:i||o.class,selectedItems:s,onToggle:Ee,isSubmitted:l,disabled:!d},o))},a:function(e){var n=ye.current,r=n.chatSize,i=n.openCitationIds;return a(h,t({},e,{chatSize:r,openCitationIds:i,getCitationByNumber:_e,handleToggleState:ke,isStreamEnd:ye.current.isStreamEnd}))},div:function(e){var n=ye.current,r=n.openCardIds,i=n.citations,o=n.isLastMessage,c=n.isStreamEnd,s=n.gapsSubmitted,l=n.onTypeResponseClick;return"rule-validation-card-trigger"===e.className?a(S,t({},e,{onViewComparison:A,isLastMessage:o})):a(S,t({},e,{openCardIds:r,citations:i,handleToggleState:ke,isStreamEnd:c,isLastMessage:o,handleStream:T,onGapValidation:we,isGapsSubmitted:s,onViewComparison:A,onTypeResponseClick:l}))},span:function(e){var n,r;if((null===(n=e.className)||void 0===n?void 0:n.includes("cognitive-card-trigger"))||(null===(r=e.className)||void 0===r?void 0:r.includes("view-form-update-trigger"))){var i=ye.current,o=i.openCardIds,c=i.citations,s=i.isLastMessage,l=i.isStreamEnd;return a(b,t({},e,{openCardIds:o,citations:c,handleToggleState:ke,isStreamEnd:!s||l}))}return a("span",t({},e))},"variant-card":function(e){e.node;var r=n(e,["node"]),i=r.variantname,o=r.decisionstrength,c=r.id,s=ye.current,l=s.isCommitted,d=s.isLastMessage,u=s.selectedVariant;if(!R)return null;var p=(null==u?void 0:u.id)===c,m=parseInt(o||"0");return a(k,t({variantName:i,decisionStrength:m,isEditable:!l&&d,isSelected:p,onToggle:function(e){return Te(c,e,i,m)},onEdit:function(){return Ne()}},{children:r.children}))},br:function(e){return a("p",t({style:{marginBottom:"0.75rem"}},e))}}},[xe,Ee,_e,ke,E,ae,Y,R,we,Te]);u(function(){K||(P(_),setTimeout(function(){null==N||N()},50))},[_,K,N]);var Ie=d(0);u(function(){var e=ve.size+Se.size;e>0&&0===Ie.current?null==B||B(50):0===e&&Ie.current>0&&(null==B||B(40)),Ie.current=e},[ve,Se,B]);var Be=m(function(){return[c]},[]),je=m(function(){return[s]},[]),ze=(null==ae?void 0:ae.variantName)||"Selected Behavior",Re=oe.some(function(e){return"string"==typeof e.userSelection&&"type your response"===e.userSelection.trim().toLowerCase()}),Ae=le&&R&&(L||pe)&&!Re;return r(i,{children:[r("div",t({style:{lineHeight:"1.625rem",fontSize:"1rem",marginTop:"0.5rem",marginBottom:"".concat("assistant"===E?"1rem":"0rem"),fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[a(o,t({components:Me,rehypePlugins:Be,remarkPlugins:je},{children:function(e){if(!e)return"";var n=e.replace(/\\"/g,'"').replace(/\\'/g,"'");n=(n=(n=n.replace(/```(?:\w+)?\n?([\s\S]*?)```/gi,"$1")).replace(/<br\s*\/?>/gi,"\n\n")).replace(/<critical_gaps\s+([\s\S]*?)>([\s\S]*?)<\/critical_gaps>/gi,function(e,n,t){try{for(var a={},r=/([a-z0-9_]+)\s*=\s*(["'])([\s\S]*?)\2/gi,i=void 0;null!==(i=r.exec(n));)a[i[1]]=i[3];for(var o=[],c=/<gap_card\s+([\s\S]*?)>([\s\S]*?)<\/gap_card>/gi,s=void 0,l=function(){for(var e=s[1],n=s[2],t={};null!==(i=r.exec(e));)t[i[1]]=i[3];var a=n.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),c=null;if(a){var l=a[1],d=function(e){var n;return(null===(n=l.match(new RegExp("<".concat(e,">([\\s\\S]*?)<\\/").concat(e,">"),"i")))||void 0===n?void 0:n[1])||""};c={id:d("id"),reason:d("reason"),gap:d("gap"),score:d("relevance_score")}}var u=function(e){var n=e.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),t=e.match(/<explaination\s+value=(["'])([\s\S]*?)\1\s*><\/explaination>/i),a=null,r=null,i=e;if(n){var o=n[1],c=function(e){var n=o.match(new RegExp("<".concat(e,">([\\s\\S]*?)<\\/").concat(e,">"),"i"));return n?n[1].replace(/\\n/g,"\n").trim():""};a={id:c("id"),reason:c("reason"),gap:c("gap"),score:c("relevance_score")},i=e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/i,"").trim()}if(t){try{var s=t[2];r=JSON.parse(s.replace(/"/g,'"')),console.log("Parsed Explanation successfully:",r)}catch(e){console.error("Explanation parse error:",e,"Raw value:",t[2])}i=i.replace(/<explaination[\s\S]*?><\/explaination>/i,"")}return{text:i,aiReasoning:a,explanation:r}},p=[],m="text",g=/<(selectoption|radioselect)>/i.test(n),v=/<checkbox>/i.test(n),f=/<textfield>/i.test(n);if(g){m="radio";for(var h=void 0,S=/<selectoption[^>]*>\s*([\s\S]*?)\s*<\/selectoption>/gi;null!==(h=S.exec(n));)p.push(u(h[1]))}else if(v){m="checkbox";for(var b=void 0,y=/<checkbox>\s*([\s\S]*?)\s*<\/checkbox>/gi;null!==(b=y.exec(n));)p.push(u(b[1]))}else f&&(m="text");"radio"!==m||0!==p.length||f||(m="text"),o.push({id:"gap-".concat(o.length),name:t.gap_name||"Gap",decisionStrength:t.gap_decision_strength,impact:t.impact,value:t.gap_value,aiReasoning:c,inputType:m,options:p,userSelection:"checkbox"===m?[]:""})};null!==(s=c.exec(t));)l();var d={count:a.count,decisionStrength:a.critical_gaps_decision_strength,value:a.value,gaps:o},u=JSON.stringify(d).replace(/"/g,""");return'\n\n<div class="critical-gaps-trigger" data-payload="'.concat(u,'"></div>\n\n')}catch(n){return console.error("Error parsing critical gaps XML",n),e}}),n=(n=(n=(n=(n=n.replace(/<variant-card\s+([\s\S]*?)>([\s\S]*?)<\/variant-card>/gi,function(e,n,t){for(var a,r={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(a=i.exec(n));)r[a[1]]=a[3];return'\n\n<variant-card id="'.concat(r.id||"",'" variantname="').concat(r.variantname||"",'" decisionstrength="').concat(r.decisionstrength||"0",'" iseditable="').concat(r.iseditable||"false",'" isselected="').concat(r.isselected||"false",'">').concat(t,"</variant-card>\n\n")})).replace(/<rule-validation-card\s+([\s\S]*?)>([\s\S]*?)<\/rule-validation-card>/gi,function(e,n,t){for(var a,r={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(a=i.exec(n));)r[a[1]]=a[3];var o=function(e){return(r[e]||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};return'\n\n<div class="rule-validation-card-trigger" \n data-type="'.concat(o("validationType"),'"\n data-decision-strength="').concat(o("decisionStrength"),'"\n data-title="').concat(o("ruleTitle"),'"\n data-tier="').concat(o("tier"),'"\n data-description="').concat(o("ruleDescription"),'">').concat(t,"</div>\n\n")})).replace(/<(singleselect|multiselect|instantselect)>([\s\S]*?)<\/\1>/gi,function(e,n,t){var a="multi";return"singleselect"===n?a="single":"instantselect"===n&&(a="instant"),'\n\n<div class="markdown-select-trigger" data-type="'.concat(a,'">').concat(t,"</div>\n\n")})).replace(/<selectoption\s+([\s\S]*?)>([\s\S]*?)<\/selectoption>/gi,function(e,n,t){for(var a,r={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2/gi;null!==(a=i.exec(n));)r[a[1]]=a[3];return'<div class="select-option-item" data-id="'.concat(r.id||"",'" data-cd="').concat(r.cd||"false",'">').concat(t,"</div>")})).replace(/<view_form_update_card\s+title=["'](.*?)["']>([\s\S]*?)<\/view_form_update_card>/gi,function(e,n,t){for(var a,r=[],i=/<form_value\s+value=["']([\s\S]*?)["']>([\s\S]*?)<\/form_value>/gi,o=function(){var e=a[1],n=a[2],t=function(e){var t;return(null===(t=n.match(new RegExp("<".concat(e,">([\\s\\S]*?)<\\/").concat(e,">"),"i")))||void 0===t?void 0:t[1])||""};r.push({label:e,reasoning:{id:t("id"),reason:t("reason"),gap:t("gap"),score:t("relevance_score")}})};null!==(a=i.exec(t));)o();var c={title:n||"Updated Fields",fields:r},s=JSON.stringify(c).replace(/"/g,""");return'<span class="view-form-update-trigger" data-payload="'.concat(s,'"></span>')}),n=n.replace(/<!--<ai_reasoning>(?![\s\S]*?<\/ai_reasoning>-->)[\s\S]*$/gi,"");["ai_reasoning"].forEach(function(e){var t=new RegExp("\x3c!--\\s*(<".concat(e,">[\\s\\S]*?<\\/").concat(e,">)\\s*--\x3e"),"gi");n=n.replace(t,"$1")});var t=0;n=n.replace(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/gi,function(e,n){var a=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,n,t){return'<a href="'.concat(t,'" data-shielded="true">').concat(n,"</a>")});return a=a.replace(/</g,"<").replace(/>/g,">"),t++,'<span class="cognitive-card-trigger" data-card-id="card-'.concat(t,'">').concat(a,"</span>")});var a=0;return n.replace(/(\[[^\]]+\]\()([^)]+)(\))/g,function(e,n,t,r){var i=t.replace(/\s/g,"%20");if(i.includes("citationNumber=")){a++;var o=i.includes("?")?"&":"?";return"".concat(n).concat(i).concat(o,"uiUniqueId=").concat(a).concat(r)}return"".concat(n).concat(i).concat(r)})}(V)}),C),R&&V.includes("<variant-card")&&r("div",t({style:{gap:"8px"}},{children:[r(v,t({className:"clickable-button",handleStream:T,disabled:!L||!ae&&!Y||Y&&"add"!==ee,isStreamEnd:z,onAction:function(){return xe("Add ".concat(ze),!0,"add")},"data-selected":"add"===ee?"true":Y?"false":void 0},{children:["Add ",ze]})),r(v,t({className:"clickable-button",handleStream:T,disabled:!L||!ae&&!Y||Y&&"edit"!==ee,isStreamEnd:z,onAction:function(){return xe("Edit ".concat(ze),!0,"edit")},"data-selected":"edit"===ee?"true":Y?"false":void 0},{children:["Edit ",ze]})),a(v,t({className:"clickable-button",handleStream:T,disabled:!L||Y&&"skip"!==ee,isStreamEnd:z,onAction:function(){return xe("Skip for now",!0,"skip")},"data-selected":"skip"===ee?"true":Y?"false":void 0},{children:"Skip for now"}))]})),Ae&&a("div",t({style:{marginTop:"12px",display:"flex",justifyContent:"flex-start"}},{children:a(x,{type:"instant",options:[{id:"proceed-gaps",label:"Proceed to Fix Gaps"}],selectedIds:pe?["proceed-gaps"]:[],disabled:pe,citations:[],onProceed:Ce})}))]})),a("div",t({style:{display:"flex",maxWidth:"100%"}},{children:a("div",t({style:{width:"100%"}},{children:(null==J?void 0:J.length)>0&&G&&!K?r("div",t({style:{marginTop:"10px"}},{children:[r("span",{children:["It looks like you've chosen ",J&&0!==J.length?J.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})?"Both Tiers":J.join(", "):"",". Would you like me to proceed?"]}),a("p",{children:a("button",t({style:{padding:"0.5rem 1rem",margin:"0.5rem 0",backgroundColor:"#2661eb",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif"},onClick:Le},{children:"Yes"}))})]})):null}))}))]})};export{w as default};
|
|
1
|
+
import{__spreadArray as e,__rest as n,__assign as t}from"../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as a,jsxs as r,Fragment as i}from"react/jsx-runtime";import{ReactMarkdown as o}from"../../../../node_modules/react-markdown/lib/react-markdown.js";import c from"../../../../node_modules/rehype-raw/lib/index.js";import s from"../../../../node_modules/remark-gfm/index.js";import{useState as l,useRef as d,useEffect as u,useCallback as p,useMemo as m}from"react";import{RuleDisplay as g,ActionableButton as v,ActionableCheckbox as f}from"./ClickableChatComponents.js";import{MarkdownLinkRenderer as h,MarkdownDivRenderer as S,MarkdownSpanRenderer as b}from"../MarkdownComponents/MarkdownElements.js";import{extractTextFromChildren as y}from"../../helpers/utils.js";import{RuleVariantCard as k}from"./RuleVariantCard.js";import{MarkdownSelect as x}from"../MarkdownComponents/MarkdownSelect.js";var w=function(w){var C=w.index,_=w.content,E=w.role;w.messages;var T=w.handleStream,N=w.scrollToBottom,I=w.isLastMessage,L=w.onSave,M=w.citations,B=w.setChatSize,j=w.chatSize,z=w.isStreamEnd,R=w.messageIsEnd,A=w.onViewComparison,W=w.onTypeResponseClick,D=l(_),V=D[0],P=D[1],q=l([]),J=q[0],$=q[1],F=l(!1),G=F[0],H=F[1],O=l(!1),K=O[0],U=O[1],X=l(!1),Y=X[0],Q=X[1],Z=l(null),ee=Z[0],ne=Z[1],te=l(null),ae=te[0],re=te[1],ie=l([]),oe=ie[0],ce=ie[1],se=l(!1),le=se[0],de=se[1],ue=l(!1),pe=ue[0],me=ue[1],ge=l(new Set),ve=ge[0],fe=ge[1],he=l(new Set),Se=he[0],be=he[1],ye=d({handleStream:T,onSave:L,selectedTiers:J,tiersSubmitted:K,citations:M,openCardIds:ve,openCitationIds:Se,chatSize:j,isLastMessage:I,scrollToBottom:N,isStreamEnd:z,selectedVariant:ae,messageIsEnd:R,isCommitted:Y,clickedAction:ee,gapSelections:oe,gapsSubmitted:pe,onTypeResponseClick:W});ye.current={handleStream:T,onSave:L,selectedTiers:J,tiersSubmitted:K,citations:M,openCardIds:ve,openCitationIds:Se,chatSize:j,isLastMessage:I,scrollToBottom:N,isStreamEnd:z,selectedVariant:ae,messageIsEnd:R,isCommitted:Y,clickedAction:ee,gapSelections:oe,gapsSubmitted:pe,onTypeResponseClick:W},u(function(){re(null),Q(!1),ne(null),de(!1),me(!1),ce([])},[C]),u(function(){if(R&&!Y&&!ae){var e=V.match(/<variant-card[^>]*isselected=["']true["'][^>]*>/i);if(e){var n=e[0].match(/id=["']([^"']+)["']/),t=e[0].match(/variantname=["']([^"']+)["']/),a=e[0].match(/decisionstrength=["']([^"']+)["']/);n&&t&&re({id:n[1],variantName:t[1],decisionStrength:parseInt((null==a?void 0:a[1])||"0")})}}},[V,R,Y,ae]);var ke=p(function(e,n,t){var a=function(t){var a=new Set(t);return n?a.add(e):a.delete(e),a};"card"===t?fe(function(e){return a(e)}):be(function(e){return a(e)})},[]),xe=p(function(e,n,t){void 0===n&&(n=!1);var a=ye.current,r=a.handleStream;a.onSave;var i=e.trim();r&&(r(new KeyboardEvent("keydown",{key:"Enter"}),!1,i),n&&t&&(Q(!0),ne(t))),n||P(function(e){return e.replace(/<button([^>]*)class=["']clickable-button["']([^>]*)>([\s\S]*?)<\/button>/gi,function(e,n,t,a){var r=a.trim(),o='data-selected="'.concat(r===i,'"');return"<button".concat(n,'class="clickable-button" ').concat(o).concat(t,">").concat(a,"</button>")})})},[]),we=p(function(e,n){de(e),ce(n)},[]),Ce=p(function(){var e=ye.current,n=e.handleStream,t=e.gapSelections.map(function(e){var n=Array.isArray(e.userSelection)?e.userSelection.join(", "):e.userSelection;return"".concat(e.name,": ").concat(n||"Skipped")}),a="Here are my choices for the critical gaps:\n".concat(t.join(","));n(new KeyboardEvent("keydown",{key:"Enter"}),!1,a),me(!0)},[]),_e=p(function(e,n){var t=ye.current.citations;return t&&t.find(function(t){return t.customMetaData.citation_number&&"Cognitive Decisioning"!==t.customMetaData.citation_title&&t.customMetaData.source===n&&String(t.customMetaData.citation_number)===String(e)})||null},[]),Ee=p(function(n,t){var a=ye.current.scrollToBottom,r=Array.isArray(n)?n[0].trim():n.trim();H(!0),$(function(n){var a=e([],n,!0);if(["both tiers","all tiers"].includes(r.toLowerCase()))a=t?["Both Tiers","Tier 1","Tier 2"]:[];else{t?a.includes(r)||a.push(r):a=a.filter(function(e){return e!==r});var i=a.includes("Tier 1"),o=a.includes("Tier 2");i&&o?a.includes("Both Tiers")||a.push("Both Tiers"):a=a.filter(function(e){return!["Both Tiers","All tiers"].includes(e)})}return a.filter(function(e,n){return a.indexOf(e)===n})}),null==a||a()},[]),Te=p(function(e,n,t,a){ye.current.isCommitted||n&&re({id:e,variantName:t,decisionStrength:a})},[]),Ne=function(){if(!ye.current.isCommitted){var e="Edit ".concat((null==ae?void 0:ae.variantName)||"Selected Behavior");xe(e,!0,"edit")}},Ie=p(function(){var e=ye.current,n=e.handleStream,t=e.selectedTiers,a=t.join(" and ");t.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})&&(a="Both Tiers"),n(new KeyboardEvent("keydown",{key:"Enter"}),!1,"".concat(a)),U(!0),H(!1),P(function(e){return e.replace(/<checkbox\s+class=["']clickable-box["'][^>]*>([\s\S]*?)<\/checkbox>/gi,function(e,n){var a=n.trim();return t.includes(a)?e:""})})},[]),Le=m(function(){return{p:function(e){e.node;var r=n(e,["node"]);return a("span",t({},r,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",fontSize:"1rem",lineHeight:"1.625rem",marginBottom:"user"===E?"0":"1rem"}},{children:null==r?void 0:r.children}))},code:function(e){e.node;var r=n(e,["node"]);return a("span",t({},r,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"inline-flex",fontSize:"1rem",lineHeight:"1.625rem"}},{children:null==r?void 0:r.children}))},ol:function(e){e.node;var r=n(e,["node"]);return a("ol",t({},r,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==r?void 0:r.children}))},ul:function(e){e.node;var r=n(e,["node"]);return a("ul",t({},r,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==r?void 0:r.children}))},rule:function(e){e.node;var t=n(e,["node"]);return a(g,{content:y(t.children)})},button:function(e){var r=e.node,i=e.className,o=n(e,["node","className"]),c=ye.current,s=c.isLastMessage,l=c.handleStream,d=c.isStreamEnd;return a(v,t({node:r,className:i||o.class,handleStream:l,onAction:xe,disabled:!s,isStreamEnd:d,isLastMessage:s,onTypeResponseClick:W},o))},checkbox:function(e){var r=e.node,i=e.className,o=n(e,["node","className"]),c=ye.current,s=c.selectedTiers,l=c.tiersSubmitted,d=c.isLastMessage;return a(f,t({node:r,className:i||o.class,selectedItems:s,onToggle:Ee,isSubmitted:l,disabled:!d},o))},a:function(e){var n=ye.current,r=n.chatSize,i=n.openCitationIds;return a(h,t({},e,{chatSize:r,openCitationIds:i,getCitationByNumber:_e,handleToggleState:ke,isStreamEnd:ye.current.isStreamEnd}))},div:function(e){var n=ye.current,r=n.openCardIds,i=n.citations,o=n.isLastMessage,c=n.isStreamEnd,s=n.gapsSubmitted,l=n.onTypeResponseClick;return"rule-validation-card-trigger"===e.className?a(S,t({},e,{onViewComparison:A,isLastMessage:o})):a(S,t({},e,{openCardIds:r,citations:i,handleToggleState:ke,isStreamEnd:c,isLastMessage:o,handleStream:T,onGapValidation:we,isGapsSubmitted:s,onViewComparison:A,onTypeResponseClick:l}))},span:function(e){var n,r;if((null===(n=e.className)||void 0===n?void 0:n.includes("cognitive-card-trigger"))||(null===(r=e.className)||void 0===r?void 0:r.includes("view-form-update-trigger"))){var i=ye.current,o=i.openCardIds,c=i.citations,s=i.isLastMessage,l=i.isStreamEnd;return a(b,t({},e,{openCardIds:o,citations:c,handleToggleState:ke,isStreamEnd:!s||l}))}return a("span",t({},e))},"variant-card":function(e){e.node;var r=n(e,["node"]),i=r.variantname,o=r.decisionstrength,c=r.id,s=ye.current,l=s.isCommitted,d=s.isLastMessage,u=s.selectedVariant;if(!R)return null;var p=(null==u?void 0:u.id)===c,m=parseInt(o||"0");return a(k,t({variantName:i,decisionStrength:m,isEditable:!l&&d,isSelected:p,onToggle:function(e){return Te(c,e,i,m)},onEdit:function(){return Ne()}},{children:r.children}))},br:function(e){return a("p",t({style:{marginBottom:"0.75rem"}},e))}}},[xe,Ee,_e,ke,E,ae,Y,R,we,Te]);u(function(){K||(P(_),setTimeout(function(){null==N||N()},50))},[_,K,N]);var Me=d(0);u(function(){var e=ve.size+Se.size;e>0&&0===Me.current?null==B||B(50):0===e&&Me.current>0&&(null==B||B(40)),Me.current=e},[ve,Se,B]);var Be=m(function(){return[c]},[]),je=m(function(){return[s]},[]),ze=(null==ae?void 0:ae.variantName)||"Selected Behavior",Re=oe.some(function(e){return"string"==typeof e.userSelection&&"type your response"===e.userSelection.trim().toLowerCase()}),Ae=le&&R&&(I||pe)&&!Re;return r(i,{children:[r("div",t({style:{lineHeight:"1.625rem",fontSize:"1rem",marginTop:"0.5rem",marginBottom:"".concat("assistant"===E?"1rem":"0rem"),fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[a(o,t({components:Le,rehypePlugins:Be,remarkPlugins:je},{children:function(e){if(!e)return"";var n=e.replace(/\\"/g,'"').replace(/\\'/g,"'");n=(n=(n=n.replace(/```(?:\w+)?\n?([\s\S]*?)```/gi,"$1")).replace(/<br\s*\/?>/gi,"\n\n")).replace(/<critical_gaps\s+([\s\S]*?)>([\s\S]*?)<\/critical_gaps>/gi,function(e,n,t){try{for(var a={},r=/([a-z0-9_]+)\s*=\s*(["'])([\s\S]*?)\2/gi,i=void 0;null!==(i=r.exec(n));)a[i[1]]=i[3];for(var o=[],c=/<gap_card\s+([\s\S]*?)>([\s\S]*?)<\/gap_card>/gi,s=void 0,l=function(){for(var e=s[1],n=s[2],t={};null!==(i=r.exec(e));)t[i[1]]=i[3];var a=n.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),c=null;if(a){var l=a[1],d=function(e){var n;return(null===(n=l.match(new RegExp("<".concat(e,">([\\s\\S]*?)<\\/").concat(e,">"),"i")))||void 0===n?void 0:n[1])||""};c={id:d("id"),reason:d("reason"),gap:d("gap"),score:d("relevance_score")}}var u=function(e){var n=e.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),t=e.match(/<explaination\s+value=(["'])([\s\S]*?)\1\s*><\/explaination>/i),a=null,r=null,i=e;if(n){var o=n[1],c=function(e){var n=o.match(new RegExp("<".concat(e,">([\\s\\S]*?)<\\/").concat(e,">"),"i"));return n?n[1].replace(/\\n/g,"\n").trim():""};a={id:c("id"),reason:c("reason"),gap:c("gap"),score:c("relevance_score")},i=e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/i,"").trim()}if(t){try{var s=t[2];r=JSON.parse(s.replace(/"/g,'"')),console.log("Parsed Explanation successfully:",r)}catch(e){console.error("Explanation parse error:",e,"Raw value:",t[2])}i=i.replace(/<explaination[\s\S]*?><\/explaination>/i,"")}return{text:i,aiReasoning:a,explanation:r}},p=[],m="text",g=/<(selectoption|radioselect)>/i.test(n),v=/<checkbox>/i.test(n),f=/<textfield>/i.test(n);if(g){m="radio";for(var h=void 0,S=/<selectoption[^>]*>\s*([\s\S]*?)\s*<\/selectoption>/gi;null!==(h=S.exec(n));)p.push(u(h[1]))}else if(v){m="checkbox";for(var b=void 0,y=/<checkbox>\s*([\s\S]*?)\s*<\/checkbox>/gi;null!==(b=y.exec(n));)p.push(u(b[1]))}else f&&(m="text");"radio"!==m||0!==p.length||f||(m="text"),o.push({id:"gap-".concat(o.length),name:t.gap_name||"Gap",decisionStrength:t.gap_decision_strength,impact:t.impact,value:t.gap_value,aiReasoning:c,inputType:m,options:p,userSelection:"checkbox"===m?[]:""})};null!==(s=c.exec(t));)l();var d={count:a.count,decisionStrength:a.critical_gaps_decision_strength,value:a.value,gaps:o},u=JSON.stringify(d).replace(/"/g,""");return'\n\n<div class="critical-gaps-trigger" data-payload="'.concat(u,'"></div>\n\n')}catch(n){return console.error("Error parsing critical gaps XML",n),e}}),n=(n=(n=(n=(n=n.replace(/<variant-card\s+([\s\S]*?)>([\s\S]*?)<\/variant-card>/gi,function(e,n,t){for(var a,r={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(a=i.exec(n));)r[a[1]]=a[3];return'\n\n<variant-card id="'.concat(r.id||"",'" variantname="').concat(r.variantname||"",'" decisionstrength="').concat(r.decisionstrength||"0",'" iseditable="').concat(r.iseditable||"false",'" isselected="').concat(r.isselected||"false",'">').concat(t,"</variant-card>\n\n")})).replace(/<rule-validation-card\s+([\s\S]*?)>([\s\S]*?)<\/rule-validation-card>/gi,function(e,n,t){for(var a,r={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(a=i.exec(n));)r[a[1]]=a[3];var o=function(e){return(r[e]||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};return'\n\n<div class="rule-validation-card-trigger" \n data-type="'.concat(o("validationType"),'"\n data-decision-strength="').concat(o("decisionStrength"),'"\n data-title="').concat(o("ruleTitle"),'"\n data-tier="').concat(o("tier"),'"\n data-rule-id="').concat(o("ruleId"),'" \n data-description="').concat(o("ruleDescription"),'">').concat(t,"</div>\n\n")})).replace(/<(singleselect|multiselect|instantselect)>([\s\S]*?)<\/\1>/gi,function(e,n,t){var a="multi";return"singleselect"===n?a="single":"instantselect"===n&&(a="instant"),'\n\n<div class="markdown-select-trigger" data-type="'.concat(a,'">').concat(t,"</div>\n\n")})).replace(/<selectoption\s+([\s\S]*?)>([\s\S]*?)<\/selectoption>/gi,function(e,n,t){for(var a,r={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2/gi;null!==(a=i.exec(n));)r[a[1]]=a[3];return'<div class="select-option-item" data-id="'.concat(r.id||"",'" data-cd="').concat(r.cd||"false",'">').concat(t,"</div>")})).replace(/<view_form_update_card\s+title=["'](.*?)["']>([\s\S]*?)<\/view_form_update_card>/gi,function(e,n,t){for(var a,r=[],i=/<form_value\s+value=["']([\s\S]*?)["']>([\s\S]*?)<\/form_value>/gi,o=function(){var e=a[1],n=a[2],t=function(e){var t;return(null===(t=n.match(new RegExp("<".concat(e,">([\\s\\S]*?)<\\/").concat(e,">"),"i")))||void 0===t?void 0:t[1])||""};r.push({label:e,reasoning:{id:t("id"),reason:t("reason"),gap:t("gap"),score:t("relevance_score")}})};null!==(a=i.exec(t));)o();var c={title:n||"Updated Fields",fields:r},s=JSON.stringify(c).replace(/"/g,""");return'<span class="view-form-update-trigger" data-payload="'.concat(s,'"></span>')}),n=n.replace(/<!--<ai_reasoning>(?![\s\S]*?<\/ai_reasoning>-->)[\s\S]*$/gi,"");["ai_reasoning"].forEach(function(e){var t=new RegExp("\x3c!--\\s*(<".concat(e,">[\\s\\S]*?<\\/").concat(e,">)\\s*--\x3e"),"gi");n=n.replace(t,"$1")});var t=0;n=n.replace(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/gi,function(e,n){var a=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,n,t){return'<a href="'.concat(t,'" data-shielded="true">').concat(n,"</a>")});return a=a.replace(/</g,"<").replace(/>/g,">"),t++,'<span class="cognitive-card-trigger" data-card-id="card-'.concat(t,'">').concat(a,"</span>")});var a=0;return n.replace(/(\[[^\]]+\]\()([^)]+)(\))/g,function(e,n,t,r){var i=t.replace(/\s/g,"%20");if(i.includes("citationNumber=")){a++;var o=i.includes("?")?"&":"?";return"".concat(n).concat(i).concat(o,"uiUniqueId=").concat(a).concat(r)}return"".concat(n).concat(i).concat(r)})}(V)}),C),R&&V.includes("<variant-card")&&r("div",t({style:{gap:"8px"}},{children:[r(v,t({className:"clickable-button",handleStream:T,disabled:!I||!ae&&!Y||Y&&"add"!==ee,isStreamEnd:z,onAction:function(){return xe("Add ".concat(ze),!0,"add")},"data-selected":"add"===ee?"true":Y?"false":void 0},{children:["Add ",ze]})),r(v,t({className:"clickable-button",handleStream:T,disabled:!I||!ae&&!Y||Y&&"edit"!==ee,isStreamEnd:z,onAction:function(){return xe("Edit ".concat(ze),!0,"edit")},"data-selected":"edit"===ee?"true":Y?"false":void 0},{children:["Edit ",ze]})),a(v,t({className:"clickable-button",handleStream:T,disabled:!I||Y&&"skip"!==ee,isStreamEnd:z,onAction:function(){return xe("Skip for now",!0,"skip")},"data-selected":"skip"===ee?"true":Y?"false":void 0},{children:"Skip for now"}))]})),Ae&&a("div",t({style:{marginTop:"12px",display:"flex",justifyContent:"flex-start"}},{children:a(x,{type:"instant",options:[{id:"proceed-gaps",label:"Proceed to Fix Gaps"}],selectedIds:pe?["proceed-gaps"]:[],disabled:pe,citations:[],onProceed:Ce})}))]})),a("div",t({style:{display:"flex",maxWidth:"100%"}},{children:a("div",t({style:{width:"100%"}},{children:(null==J?void 0:J.length)>0&&G&&!K?r("div",t({style:{marginTop:"10px"}},{children:[r("span",{children:["It looks like you've chosen ",J&&0!==J.length?J.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})?"Both Tiers":J.join(", "):"",". Would you like me to proceed?"]}),a("p",{children:a("button",t({style:{padding:"0.5rem 1rem",margin:"0.5rem 0",backgroundColor:"#2661eb",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif"},onClick:Ie},{children:"Yes"}))})]})):null}))}))]})};export{w as default};
|
|
2
2
|
//# sourceMappingURL=MessageRendering.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as n}from"react";import o from"../_svg/InfoIcon.js";var l=function(l){var r=l.validationType,d=l.decisionStrength,s=l.
|
|
1
|
+
import{__assign as e}from"../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useState as n}from"react";import o from"../_svg/InfoIcon.js";var l=function(l){var r=l.validationType,d=l.decisionStrength,s=l.ruleId,a=l.title,p=l.tier,c=l.descriptionText,x=l.reasoningNode,g=l.customStyles,f=l.onViewComparison,u=l.disabled,h=n(!1),m=h[0],y=h[1],F="100%"===d?"Exact Rule Found":"duplicate"===r?"Existing Rule Found":"Similar Rule Found",b=e({display:"flex",flexDirection:"column",border:"1px solid #E3E6EA",borderRadius:"8px",padding:"14px 16px",gap:"8px",backgroundColor:"#fff"},null==g?void 0:g.container),v=e({display:"flex",alignItems:"center",gap:"4px",backgroundColor:"#E0F2FE80",color:"#0369A1",padding:"0.5px 9px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},null==g?void 0:g.headerTag),D=e({display:"flex",alignItems:"center",gap:"4px",backgroundColor:"#FEE2E2",color:"#B91C1C",padding:"0.5px 7px",borderRadius:"6px",fontSize:"12px",fontWeight:500},null==g?void 0:g.strengthBadgeStyle),E=e({display:"flex",flexDirection:"row",alignItems:"center",padding:"8px",gap:"8px",width:"100%",maxWidth:"140px",height:"44px",backgroundColor:u?"#F2F4F7":m?"#EFF4FF":"transparent",border:u?"1px solid #D0D5DD":m?"1px solid #B2CCFF":"1px solid transparent",borderRadius:"8px",cursor:u?"not-allowed":"pointer",opacity:u?.6:1,boxSizing:"border-box",transition:"all 0.2s ease"},null==g?void 0:g.button);return i("div",e({style:b},{children:[i("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[i("div",e({style:v},{children:[t(o,{})," ",F]})),d&&t("div",e({style:D},{children:i("span",{children:[d," Similarity"]})}))]})),i("div",e({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:[i("h3",e({style:e({fontSize:"14px",fontWeight:500,color:"#19213D",margin:0},null==g?void 0:g.title)},{children:[a," ",p?"— ".concat(p):""]})),i("div",e({style:e({fontSize:"14px",fontWeight:400,color:"#666F8D",lineHeight:"1.5"},null==g?void 0:g.description)},{children:[t("span",{children:c}),x]}))]})),i("button",e({style:E,onClick:function(){y(!0),f(s,d)},disabled:u},{children:[i("svg",e({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t("rect",{x:"0.5",y:"0.5",width:"27",height:"27",rx:"13.5",fill:m?"#D1E0FF":"transparent",stroke:m?"#D1E0FF":"#D0D5DD",style:{transition:"all 0.2s ease"}}),t("path",{d:"M9.33399 13.9974L18.6673 13.9974M18.6673 13.9974L14.0007 18.6641M18.6673 13.9974L14.0007 9.33073",stroke:m?"#004EEB":"#667085",strokeWidth:"1.52381",strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke 0.2s ease"}})]})),t("span",e({style:{fontSize:"14px",fontWeight:500,fontFamily:"'Inter', sans-serif",color:"#1D2939",lineHeight:"20px",display:"flex",alignItems:"center"}},{children:"Compare"}))]}))]}))]}))};export{l as default};
|
|
2
2
|
//# sourceMappingURL=RuleValidationCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i}from"../../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as e,jsx as n}from"react/jsx-runtime";import o,{useState as t}from"react";import{InputDataReasoningCard as l}from"../../InputDataReasoningCard.js";import{ConditionSection as r}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as a}from"../../organisms/ConfigSection/ConfigSection.js";import{ScopeSection as d}from"../../organisms/ScopeSection/ScopeSection.js";import{TextSection as c}from"../../organisms/TextSection/TextSection.js";import s from"../../AccordianSection.js";import{ButtonCognitiveIcon as u}from"../../_svg/ButtonCognitiveIcon.js";var v=function(t){var l=t.children,r=t.onAddVariant,a=t.isDisabled,d=o.Children.toArray(l);return e("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[d.map(function(i,t){return e(o.Fragment,{children:[i,n("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},t)}),n("div",i({onClick:a?void 0:r,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:a?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:a?"not-allowed":"pointer",backgroundColor:a?"#f8fafc":"#FFFFFF",opacity:a?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))},p=function(p){var g,h,f,y,m,T,D,A,C,x,O,S=p.state,b=p.handlers,V=p.uiState,w=(null==V?void 0:V.highlights)||new Map,R=w.get("global_0")||{},I=t({}),E=I[0],W=I[1],_=t(null),N=_[0],F=_[1],j=o.useRef(null==V?void 0:V.defaultVariantOpen),L=o.useRef(S.variantsByTier);o.useEffect(function(){var i,e,n,o,t=null,l=!1;j.current!==(null==V?void 0:V.defaultVariantOpen)&&(l=!0,j.current=null==V?void 0:V.defaultVariantOpen),S.variantsByTier,L.current,l&&(null===(e=null===(i=null==V?void 0:V.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=S.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=S.variantsByTier)||void 0===e?void 0:e[n])||[]).forEach(function(i,e){(null==V?void 0:V.defaultVariantOpen)===e&&(t="".concat(n,"-variant-").concat(e)),(null==V?void 0:V.autoScrollVariantIndex)===e&&(t="".concat(n,"-variant-").concat(e))})}),t&&F(t)),null===N&&(null==V?void 0:V.defaultVariantOpen)>=0&&(null===(o=null===(n=null==V?void 0:V.tierOptions)||void 0===n?void 0:n.filter(function(i){var e,n;return null===(n=null===(e=S.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===o||o.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=S.variantsByTier)||void 0===e?void 0:e[n])||[])[V.defaultVariantOpen]&&F("".concat(n,"-variant-").concat(V.defaultVariantOpen))})),L.current=S.variantsByTier},[S.variantsByTier,null==V?void 0:V.defaultVariantOpen,null===(g=S.scopeData)||void 0===g?void 0:g.tiers,null==V?void 0:V.tierOptions,null==V?void 0:V.autoScrollVariantIndex]);var B=function(e){W(function(n){var o;return i(i({},n),((o={})[e]=!n[e],o))})},q=function(i){var e,n=null===(e=S.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(n)&&n.length>0?n:S.citations},M={marginTop:"-17px",position:"relative",zIndex:1},k=function(i){i&&i.scrollIntoView({behavior:"smooth",block:"center"})};return console.log("CreateRule state:",S),console.log("CreateRule uiState:",V),e("div",i({className:"traffic-manager-template"},{children:[n(s,i({title:{type:"other",label:(null==V?void 0:V.setupLabel)||"Rule Setup"},footerData:{ruleTitle:S.ruleTitle,stations:[S.scopeData.station],tiers:null===(h=S.scopeData)||void 0===h?void 0:h.tiers},defaultOpen:"Create"===(null==V?void 0:V.usedFor),readOnly:"Create"!==(null==V?void 0:V.usedFor)},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[n(c,i({id:"rule-title",title:V.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the rule",required:!0,value:S.ruleTitle,onChange:b.setRuleTitle,readOnly:"Create"!==(null==V?void 0:V.usedFor)||(null==V?void 0:V.isAiStreaming),isOpen:E.ruleTitle,onToggle:function(){return B("ruleTitle")},isHighlighted:R.ruleTitle||!1,showCognitiveIcon:S.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(f=V.validationErrors)||void 0===f?void 0:f.ruleTitle},V)),S.citation.ruleTitle&&n("div",i({style:M},{children:n(l,{isVisible:E.ruleTitle,citation:S.citation.ruleTitle,citations:q("ruleTitle"),fieldName:"Rule Title",fieldValue:S.ruleTitle})})),n(d,i({id:"scope",title:V.scopeTitle||"Scope",required:!0,scopeData:S.scopeData,onScopeChange:b.onScopeChange,tierLabel:"Which tiers should this rule apply to?",stationLabel:"Which rule set should this rule belong to?",highlights:R,isOpen:E.scopeData,onToggle:function(){return B("scopeData")},showCognitiveIcon:S.citation.scopeData,cognitiveIcon:n(u,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(y=V.validationErrors)||void 0===y?void 0:y.station)||(null===(m=V.validationErrors)||void 0===m?void 0:m.tiers),stationErrorMessage:null===(T=V.validationErrors)||void 0===T?void 0:T.station,tierErrorMessage:null===(D=V.validationErrors)||void 0===D?void 0:D.tiers,readOnly:"Create"!==(null==V?void 0:V.usedFor)||(null==V?void 0:V.isAiStreaming)},V)),S.citation.scopeData&&n("div",i({style:M},{children:n(l,{isVisible:E.scopeData,citation:S.citation.scopeData,citations:q("scopeData"),fieldName:"Scope",fieldValue:null===(C=null===(A=S.scopeData)||void 0===A?void 0:A.tiers)||void 0===C?void 0:C.join(", ")})}))]}))})),null===(O=null===(x=null==V?void 0:V.tierOptions)||void 0===x?void 0:x.filter(function(i){var e,n;return null===(n=null===(e=S.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===O?void 0:O.map(function(o,t,d){var u,p,g,h,f=o.toLowerCase().replace(/ /g,"_"),y=(null===(u=S.variantsByTier)||void 0===u?void 0:u[f])||[],m=y.length,T=!1;if(1===m){var D=y[0],A=!(null===(p=null==D?void 0:D.ruleDescription)||void 0===p?void 0:p.trim()),C=(null===(g=null==D?void 0:D.whenToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,x=(null===(h=null==D?void 0:D.whenNotToApplyConditions)||void 0===h?void 0:h.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;A&&!C&&!x&&(T=!0)}var O=T?void 0:"".concat(m," ").concat(1===m?"variant":"variants"," configured for this tier"),R=!((null==V?void 0:V.defaultTierOpen)>=0)||t===V.defaultTierOpen;return console.log("Rendering tier : ",o),n(s,i({variant:"tier-header",title:{type:"other",label:o},subtitle:O,defaultOpen:R,footerData:{description:"Variants for ".concat(o)}},{children:n(v,i({onAddVariant:function(){var i;return null===(i=b.addNewVariant)||void 0===i?void 0:i.call(b,f)},isDisabled:null==V?void 0:V.isAiStreaming},{children:y.map(function(o,t){var d,u,v,p,g,h,m,T,D,A=o.variantType||"default",C="".concat(f,"-variant-").concat(t),x=!0===o.is_variant;(null==V?void 0:V.defaultVariantOpen)>=0&&V.defaultVariantOpen;var O="".concat(f,"_").concat(t),S=w.get(O)||{},R=(null===(u=null===(d=V.separationItemsByTier)||void 0===d?void 0:d[f])||void 0===u?void 0:u.get(t))||[],I=(null===(p=null===(v=V.togglesByTier)||void 0===v?void 0:v[f])||void 0===p?void 0:p.get(t))||[],W=(null==V?void 0:V.autoScrollVariantIndex)===t||!0===o.is_variant;return console.log("Rendering ".concat(f," variant ").concat(t,":"),o),console.log("Rendering Variant : ",o),console.log("Open Accordion ID:",N,"Current Variant ID:",C),console.log("Active variant accordion index in UI state:",null==V?void 0:V.activeVariantAccordionIndex),console.log("Default open for this variant:",null==V?void 0:V.defaultVariantOpen),console.log("UI State:",V),n("div",i({ref:W?k:null,style:{width:"100%"}},{children:n(s,i({title:{type:A,label:o.isReadOnly&&y.length>1?"".concat(t?"Variant "+t:"Default"):(null==V?void 0:V.behaviourLabel)?null==V?void 0:V.behaviourLabel:0==t?"Default":"Variant "+t,isNewVariant:x},defaultOpen:!0,expanded:N===C,onToggle:function(){var i,e=N===C;console.log("is closing:",e),F(e?null:C),null===(i=null==V?void 0:V.setActiveVariantAccordionIndex)||void 0===i||i.call(V,e?null:t)},variant:"rule-behavior",footerData:{ruleTitle:A,description:o.ruleDescription||""}},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[n(c,i({id:"rule-description-".concat(f,"-").concat(t),title:V.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the rule behaviour",required:!0,readOnly:o.isReadOnly||(null==V?void 0:V.isAiStreaming),value:o.ruleDescription||"",onChange:function(i){return b.setRuleDescription(f,t,i)},isOpen:E["ruleDescription-".concat(f,"-").concat(t)],onToggle:function(){return B("ruleDescription-".concat(f,"-").concat(t))},isHighlighted:S.ruleDescription||!1,showCognitiveIcon:null===(g=o.reasoning)||void 0===g?void 0:g.ruleDescription,tooltipDescription:"Why this Description?",errorMessage:null===(h=V.validationErrors)||void 0===h?void 0:h["ruleDescription-".concat(f,"-").concat(t)]},V)),(null===(m=o.reasoning)||void 0===m?void 0:m.ruleDescription)&&n("div",i({style:M},{children:n(l,{isVisible:E["ruleDescription-".concat(f,"-").concat(t)],citation:o.reasoning.ruleDescription,citations:q("ruleDescription_".concat(f,"_").concat(t)),fieldName:"Rule Description",fieldValue:o.ruleDescription})})),n(r,i({id:"when-to-apply-".concat(f,"-").concat(t),title:V.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:o.isReadOnly||(null==V?void 0:V.isAiStreaming),conditions:o.whenToApplyConditions||[],onAdd:function(){return b.addWhenToApply(f,t)},onRemove:function(i,e,n){return b.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,o){return b.editWhenToApply(i,e,n,o)},index:t,tierKey:f,isHighlighted:S.wta||!1,highlightedIds:null==V?void 0:V.highlightedIds,tooltipDescription:"Why this Condition?",citations:q("whenToApply_".concat(f,"_").concat(t)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:V.isAiStreaming,errorMessage:null===(T=V.validationErrors)||void 0===T?void 0:T["whenToApply-".concat(f,"-").concat(t)]},V)),n(r,i({id:"when-not-to-apply-".concat(f,"-").concat(t),title:V.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:o.isReadOnly||(null==V?void 0:V.isAiStreaming),conditions:o.whenNotToApplyConditions||[],onAdd:function(){return b.addWhenNotToApply(f,t)},onRemove:function(i,e,n){return b.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,o){return b.editWhenNotToApply(i,e,n,o)},index:t,tierKey:f,isHighlighted:S.wnta||!1,highlightedIds:null==V?void 0:V.highlightedIds,tooltipDescription:"Why this Condition?",citations:q("whenNotToApply_".concat(f,"_").concat(t)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:V.isAiStreaming},V)),n(a,i({id:"config-".concat(f,"-").concat(t),title:V.configTitle||"Configuration",required:!1,highlights:S,bordered:!0,readOnly:o.isReadOnly||(null==V?void 0:V.isAiStreaming),onConfigChange:function(i,e){return b.onConfigChange(f,t,i,e)},separationItems:R,toggles:I,index:t},V)),(null===(D=o.reasoning)||void 0===D?void 0:D.configData)&&n("div",i({style:M},{children:n(l,{citation:o.reasoning.configData,citations:q("configData_".concat(f,"_").concat(t)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),C)}),"".concat(f,"-variant-").concat(t))})}))}),"tier-".concat(t))})]}))};export{p as CreateRule};
|
|
1
|
+
import{__assign as i}from"../../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as e,jsx as n}from"react/jsx-runtime";import o,{useState as t}from"react";import{InputDataReasoningCard as l}from"../../InputDataReasoningCard.js";import{ConditionSection as r}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as a}from"../../organisms/ConfigSection/ConfigSection.js";import{ScopeSection as d}from"../../organisms/ScopeSection/ScopeSection.js";import{TextSection as c}from"../../organisms/TextSection/TextSection.js";import s from"../../AccordianSection.js";import{ButtonCognitiveIcon as u}from"../../_svg/ButtonCognitiveIcon.js";var v=function(t){var l=t.children,r=t.onAddVariant,a=t.isDisabled,d=o.Children.toArray(l);return e("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[d.map(function(i,t){return e(o.Fragment,{children:[i,n("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},t)}),n("div",i({onClick:a?void 0:r,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:a?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:a?"not-allowed":"pointer",backgroundColor:a?"#f8fafc":"#FFFFFF",opacity:a?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))},p=function(p){var g,f,h,y,m,T,D,A,C,x,O,S=p.state,V=p.handlers,b=p.uiState,w=(null==b?void 0:b.highlights)||new Map,I=w.get("global_0")||{},R=t({}),E=R[0],_=R[1],W=t(null),N=W[0],F=W[1],j=o.useRef(null==b?void 0:b.defaultVariantOpen),B=o.useRef(S.variantsByTier);o.useEffect(function(){var i,e,n,o,t=null,l=!1;j.current!==(null==b?void 0:b.defaultVariantOpen)&&(l=!0,j.current=null==b?void 0:b.defaultVariantOpen),S.variantsByTier,B.current,l&&(null===(e=null===(i=null==b?void 0:b.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=S.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=S.variantsByTier)||void 0===e?void 0:e[n])||[]).forEach(function(i,e){(null==b?void 0:b.defaultVariantOpen)===e&&(t="".concat(n,"-variant-").concat(e)),(null==b?void 0:b.autoScrollVariantIndex)===e&&(t="".concat(n,"-variant-").concat(e))})}),t&&F(t)),null===N&&(null==b?void 0:b.defaultVariantOpen)>=0&&(null===(o=null===(n=null==b?void 0:b.tierOptions)||void 0===n?void 0:n.filter(function(i){var e,n;return null===(n=null===(e=S.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===o||o.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=S.variantsByTier)||void 0===e?void 0:e[n])||[])[b.defaultVariantOpen]&&F("".concat(n,"-variant-").concat(b.defaultVariantOpen))})),B.current=S.variantsByTier},[S.variantsByTier,null==b?void 0:b.defaultVariantOpen,null===(g=S.scopeData)||void 0===g?void 0:g.tiers,null==b?void 0:b.tierOptions,null==b?void 0:b.autoScrollVariantIndex]);var L=function(e){_(function(n){var o;return i(i({},n),((o={})[e]=!n[e],o))})},q=function(i){var e,n=null===(e=S.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(n)&&n.length>0?n:S.citations},M={marginTop:"-17px",position:"relative",zIndex:1},k=function(i){i&&i.scrollIntoView({behavior:"smooth",block:"center"})};console.log("CreateRule state:",S),console.log("CreateRule uiState:",b);var H=function(i){return i?"default_variant"===i?"Default":i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Default Variant"};return e("div",i({className:"traffic-manager-template"},{children:[n(s,i({title:{type:"other",label:(null==b?void 0:b.setupLabel)||"Rule Setup"},footerData:{ruleTitle:S.ruleTitle,stations:[S.scopeData.station],tiers:null===(f=S.scopeData)||void 0===f?void 0:f.tiers},defaultOpen:"Create"===(null==b?void 0:b.usedFor),readOnly:"Create"!==(null==b?void 0:b.usedFor)},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[n(c,i({id:"rule-title",title:b.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the rule",required:!0,value:S.ruleTitle,onChange:V.setRuleTitle,readOnly:"Create"!==(null==b?void 0:b.usedFor)||(null==b?void 0:b.isAiStreaming),isOpen:E.ruleTitle,onToggle:function(){return L("ruleTitle")},isHighlighted:I.ruleTitle||!1,showCognitiveIcon:S.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(h=b.validationErrors)||void 0===h?void 0:h.ruleTitle},b)),S.citation.ruleTitle&&n("div",i({style:M},{children:n(l,{isVisible:E.ruleTitle,citation:S.citation.ruleTitle,citations:q("ruleTitle"),fieldName:"Rule Title",fieldValue:S.ruleTitle})})),n(d,i({id:"scope",title:b.scopeTitle||"Scope",required:!0,scopeData:S.scopeData,onScopeChange:V.onScopeChange,tierLabel:"Which tiers should this rule apply to?",stationLabel:"Which rule set should this rule belong to?",highlights:I,isOpen:E.scopeData,onToggle:function(){return L("scopeData")},showCognitiveIcon:S.citation.scopeData,cognitiveIcon:n(u,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(y=b.validationErrors)||void 0===y?void 0:y.station)||(null===(m=b.validationErrors)||void 0===m?void 0:m.tiers),stationErrorMessage:null===(T=b.validationErrors)||void 0===T?void 0:T.station,tierErrorMessage:null===(D=b.validationErrors)||void 0===D?void 0:D.tiers,readOnly:"Create"!==(null==b?void 0:b.usedFor)||(null==b?void 0:b.isAiStreaming)},b)),S.citation.scopeData&&n("div",i({style:M},{children:n(l,{isVisible:E.scopeData,citation:S.citation.scopeData,citations:q("scopeData"),fieldName:"Scope",fieldValue:null===(C=null===(A=S.scopeData)||void 0===A?void 0:A.tiers)||void 0===C?void 0:C.join(", ")})}))]}))})),null===(O=null===(x=null==b?void 0:b.tierOptions)||void 0===x?void 0:x.filter(function(i){var e,n;return null===(n=null===(e=S.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===O?void 0:O.map(function(o,t,d){var u,p,g,f,h=o.toLowerCase().replace(/ /g,"_"),y=(null===(u=S.variantsByTier)||void 0===u?void 0:u[h])||[],m=y.length,T=!1;if(1===m){var D=y[0],A=!(null===(p=null==D?void 0:D.ruleDescription)||void 0===p?void 0:p.trim()),C=(null===(g=null==D?void 0:D.whenToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,x=(null===(f=null==D?void 0:D.whenNotToApplyConditions)||void 0===f?void 0:f.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;A&&!C&&!x&&(T=!0)}var O=T?void 0:"".concat(m," ").concat(1===m?"variant":"variants"," configured for this tier"),I=!((null==b?void 0:b.defaultTierOpen)>=0)||t===b.defaultTierOpen;return console.log("Rendering tier : ",o),n(s,i({variant:"tier-header",title:{type:"other",label:o},subtitle:O,defaultOpen:I,footerData:{description:"Variants for ".concat(o)}},{children:n(v,i({onAddVariant:function(){var i;return null===(i=V.addNewVariant)||void 0===i?void 0:i.call(V,h)},isDisabled:null==b?void 0:b.isAiStreaming},{children:y.map(function(o,t){var d,u,v,p,g,f,y,m,T,D=o.variantType||"default",A="".concat(h,"-variant-").concat(t),C=!0===o.is_variant;(null==b?void 0:b.defaultVariantOpen)>=0&&b.defaultVariantOpen;var x="".concat(h,"_").concat(t),O=w.get(x)||{},S=(null===(u=null===(d=b.separationItemsByTier)||void 0===d?void 0:d[h])||void 0===u?void 0:u.get(t))||[],I=(null===(p=null===(v=b.togglesByTier)||void 0===v?void 0:v[h])||void 0===p?void 0:p.get(t))||[],R=(null==b?void 0:b.autoScrollVariantIndex)===t||!0===o.is_variant;return console.log("Rendering ".concat(h," variant ").concat(t,":"),o),console.log("Rendering Variant : ",o),console.log("Open Accordion ID:",N,"Current Variant ID:",A),console.log("Active variant accordion index in UI state:",null==b?void 0:b.activeVariantAccordionIndex),console.log("Default open for this variant:",null==b?void 0:b.defaultVariantOpen),console.log("UI State:",b),console.log("variantType checking :",D),n("div",i({ref:R?k:null,style:{width:"100%"}},{children:n(s,i({title:{type:D,label:H(D),isNewVariant:C},defaultOpen:!0,expanded:N===A,onToggle:function(){var i,e=N===A;console.log("is closing:",e),F(e?null:A),null===(i=null==b?void 0:b.setActiveVariantAccordionIndex)||void 0===i||i.call(b,e?null:t)},variant:"rule-behavior",footerData:{ruleTitle:D,description:o.ruleDescription||""}},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[n(c,i({id:"rule-description-".concat(h,"-").concat(t),title:b.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the rule behaviour",required:!0,readOnly:o.isReadOnly||(null==b?void 0:b.isAiStreaming),value:o.ruleDescription||"",onChange:function(i){return V.setRuleDescription(h,t,i)},isOpen:E["ruleDescription-".concat(h,"-").concat(t)],onToggle:function(){return L("ruleDescription-".concat(h,"-").concat(t))},isHighlighted:O.ruleDescription||!1,showCognitiveIcon:null===(g=o.reasoning)||void 0===g?void 0:g.ruleDescription,tooltipDescription:"Why this Description?",errorMessage:null===(f=b.validationErrors)||void 0===f?void 0:f["ruleDescription-".concat(h,"-").concat(t)]},b)),(null===(y=o.reasoning)||void 0===y?void 0:y.ruleDescription)&&n("div",i({style:M},{children:n(l,{isVisible:E["ruleDescription-".concat(h,"-").concat(t)],citation:o.reasoning.ruleDescription,citations:q("ruleDescription_".concat(h,"_").concat(t)),fieldName:"Rule Description",fieldValue:o.ruleDescription})})),n(r,i({id:"when-to-apply-".concat(h,"-").concat(t),title:b.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:o.isReadOnly||(null==b?void 0:b.isAiStreaming),conditions:o.whenToApplyConditions||[],onAdd:function(){return V.addWhenToApply(h,t)},onRemove:function(i,e,n){return V.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,o){return V.editWhenToApply(i,e,n,o)},index:t,tierKey:h,isHighlighted:O.wta||!1,highlightedIds:null==b?void 0:b.highlightedIds,tooltipDescription:"Why this Condition?",citations:q("whenToApply_".concat(h,"_").concat(t)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:b.isAiStreaming,errorMessage:null===(m=b.validationErrors)||void 0===m?void 0:m["whenToApply-".concat(h,"-").concat(t)]},b)),n(r,i({id:"when-not-to-apply-".concat(h,"-").concat(t),title:b.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:o.isReadOnly||(null==b?void 0:b.isAiStreaming),conditions:o.whenNotToApplyConditions||[],onAdd:function(){return V.addWhenNotToApply(h,t)},onRemove:function(i,e,n){return V.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,o){return V.editWhenNotToApply(i,e,n,o)},index:t,tierKey:h,isHighlighted:O.wnta||!1,highlightedIds:null==b?void 0:b.highlightedIds,tooltipDescription:"Why this Condition?",citations:q("whenNotToApply_".concat(h,"_").concat(t)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:b.isAiStreaming},b)),n(a,i({id:"config-".concat(h,"-").concat(t),title:b.configTitle||"Configuration",required:!1,highlights:O,bordered:!0,readOnly:o.isReadOnly||(null==b?void 0:b.isAiStreaming),onConfigChange:function(i,e){return V.onConfigChange(h,t,i,e)},separationItems:S,toggles:I,index:t},b)),(null===(T=o.reasoning)||void 0===T?void 0:T.configData)&&n("div",i({style:M},{children:n(l,{citation:o.reasoning.configData,citations:q("configData_".concat(h,"_").concat(t)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),A)}),"".concat(h,"-variant-").concat(t))})}))}),"tier-".concat(t))})]}))};export{p as CreateRule};
|
|
2
2
|
//# sourceMappingURL=CreateRule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILOTJTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/IL-OTJ/ILOTJTest.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAKzE,OAAO,EAA8C,oBAAoB,EAAuB,MAAM,iBAAiB,CAAC;AASxH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEzE,UAAU,UAAU;CACnB;AAKD,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAKD,eAAO,MAAM,cAAc,YAAmB,qBAAqB,iBASlE,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"ILOTJTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/IL-OTJ/ILOTJTest.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAKzE,OAAO,EAA8C,oBAAoB,EAAuB,MAAM,iBAAiB,CAAC;AASxH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEzE,UAAU,UAAU;CACnB;AAKD,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAKD,eAAO,MAAM,cAAc,YAAmB,qBAAqB,iBASlE,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAk6DnC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageRendering.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/MessageRendering/MessageRendering.tsx"],"names":[],"mappings":"AAWA,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,GAAG,CAAC;IAClB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,QAAA,MAAM,gBAAgB,iMAgBnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"MessageRendering.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/MessageRendering/MessageRendering.tsx"],"names":[],"mappings":"AAWA,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,GAAG,CAAC;IAClB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,QAAA,MAAM,gBAAgB,iMAgBnB,qBAAqB,4CAy4BvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -2,12 +2,13 @@ import React, { CSSProperties } from 'react';
|
|
|
2
2
|
interface RuleCardProps {
|
|
3
3
|
validationType: "duplicate" | "similar" | "conflicting";
|
|
4
4
|
decisionStrength?: string;
|
|
5
|
+
ruleId?: string;
|
|
5
6
|
title: string;
|
|
6
7
|
tier?: string;
|
|
7
8
|
descriptionText: string;
|
|
8
9
|
reasoningNode: React.ReactNode;
|
|
9
10
|
customStyles?: RuleCardStyles;
|
|
10
|
-
onViewComparison: () => void;
|
|
11
|
+
onViewComparison: (ruleId?: string, strength?: string) => void;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
}
|
|
13
14
|
interface RuleCardStyles {
|
package/dist/types/src/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuleValidationCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAIvD,UAAU,aAAa;IACrB,cAAc,EAAE,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,gBAAgB,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"RuleValidationCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAIvD,UAAU,aAAa;IACrB,cAAc,EAAE,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAyJ/C,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRule.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.tsx"],"names":[],"mappings":"AAmDA,eAAO,MAAM,UAAU,iCAAkC,GAAG,
|
|
1
|
+
{"version":3,"file":"CreateRule.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.tsx"],"names":[],"mappings":"AAmDA,eAAO,MAAM,UAAU,iCAAkC,GAAG,4CA2Z3D,CAAC"}
|