import{_ as T}from"./index-sxX6oYqj.js";import{d as v,aQ as m,aR as x,r as g,b as q,w as _,M as w,N as R,X as z,O as r,$ as E,a2 as B,a1 as C,n as F}from"./vue-ChXMuCsz.js";import{i as P,f as A,h as $,j as b,k}from"./index-B9xBZ4Xy.js";import{a as c}from"./index-BPkXZdhA.js";import{f as V}from"./element-plus-xvP3-5Ws.js";const M={class:"intercom-room"},U={class:"text-sm text-gray-600 mb-2"},D={class:"chart-input"},N=v({__name:"IntercomRoom",props:m({zxlPrdId:{},qType:{},defaultText:{},stopUpdateTextFocus:{type:Boolean},autoUpdateTextFocus:{type:Boolean},hiddenTip:{type:Boolean}},{loading:{},loadingModifiers:{}}),emits:m(["confim-successed","confim-failed"],["update:loading"]),setup(d,{expose:f,emit:y}){const t=d,u=y,o=x(d,"loading"),n=g({placeholder:"请输入",val:""}),p=q(),h=()=>p.value?.focus();return _(()=>t.defaultText,s=>{n.val=s||"",t.autoUpdateTextFocus&&F(()=>{h()})},{immediate:!0}),f({confimChartInput:async()=>{const s=t.zxlPrdId;o.value=!0;let e=null;try{if(/^module|function$/.test(t.qType)){const a=t.qType;e=await P(s,a,n.val)}else if(/^role$/.test(t.qType)){const a=t.qType;e=await A(s,a,n.val)}else if(/^businessRule$/.test(t.qType)){const l=await $(s,"bizRule",n.val);if(l){const I=l.data||[];e={total:l.total,data:I.map(i=>({sort:i.sort,function:i.ruleTitle,explanation:i.ruleDesc}))}}}u("confim-successed",e)}catch(a){u("confim-failed",a),c({type:"warning",message:a||"无返回值！"})}return o.value=!1,e},confimChartInputEntityField:async()=>{const s=t.zxlPrdId;o.value=!0;let e=null;try{if(/^entityField$/.test(t.qType)){const a=t.qType;e=await b(s,"entity",n.val)}}catch(a){c({type:"warning",message:a||"无返回值！"})}return o.value=!1,e},confimChartInputEnumItemList:async()=>{const s=t.zxlPrdId;o.value=!0;let e=null;try{if(/^fieldEnum$/.test(t.qType)){const a=t.qType;e=await k(s,"fieldEnum",n.val)}}catch(a){c({type:"warning",message:a||"无返回值！"})}return o.value=!1,e}}),(s,e)=>{const a=V;return R(),w("div",M,[z(r("p",U,E("您将询问AI如下需求："),512),[[B,!t.hiddenTip]]),e[1]||(e[1]=r("div",{class:"chart-history"},null,-1)),r("div",D,[C(a,{ref_key:"chartInputRef",ref:p,type:"textarea",modelValue:n.val,"onUpdate:modelValue":e[0]||(e[0]=l=>n.val=l),autosize:{minRows:5,maxRows:10},autofocus:"",placeholder:n.placeholder,resize:"none"},null,8,["modelValue","placeholder"])])])}}}),J=T(N,[["__scopeId","data-v-596a13be"]]);export{J as I};
