"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react");exports.default=function(n,r,a){var o=t.useState(!1),s=o[0],l=o[1],i=t.useState(null),u=i[0],c=i[1],d=t.useState(null),f=d[0],p=d[1],v=t.useCallback(function(t,o){return e.__awaiter(void 0,void 0,void 0,function(){var s,i,u,d;return e.__generator(this,function(e){switch(e.label){case 0:if(l(!0),c(null),p(null),0===(s={agent_context:n,agent_description:r,mode:"AgentGenie",llm:o,wta:t.wta.map(function(e){return e.text}),wnta:t.wnta.map(function(e){return e.text})}).wta.length)return console.error("WTA conditions cannot be empty."),l(!1),[2,null];e.label=1;case 1:return e.trys.push([1,4,5,6]),[4,fetch("".concat(a,"/instant_learning/mode-wta-validation"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})];case 2:if(!(i=e.sent()).ok)throw new Error("API Error: ".concat(i.statusText));return[4,i.json()];case 3:return(u=e.sent()).response.is_valid?(console.log("Validation Successful!"),c(null)):(console.warn("Validation failed, conflicts found."),c(u.response)),[2,u.response];case 4:return d=e.sent(),console.error("Failed to validate rules:",d),p(d),[2,null];case 5:return l(!1),[7];case 6:return[2]}})})},[n,r,a]);return{validateAgentRules:v,clearValidation:function(){c(null)},isSaving:s,validationResponse:u,error:f}};
//# sourceMappingURL=useAgentValidation.js.map
