import{A as e,C as t,E as n,M as r,St as i,V as a,X as o,bt as s,cn as c,ft as l,lt as u,ot as d,p as f,t as p,z as m}from"./_plugin-vue_export-helper-9JxOV_6y.js";import{J as h}from"./GxPagination-CS4FI5Lo.js";import{a as g}from"./validate-xgwjLZZ4.js";import{d as _,f as v,l as y,p as b,u as x}from"./api-D8OSG9JK.js";var S={class:`intercom-room`},C={class:`text-sm text-gray-600 mb-2`},w={class:`chart-input`},T=p(r({__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(r,{expose:p,emit:m}){let T=r,E=m,D=d(r,`loading`),O=s({placeholder:`请输入`,val:``}),k=i(),A=()=>k.value?.focus();return u(()=>T.defaultText,e=>{O.val=e||``,T.autoUpdateTextFocus&&a(()=>{A()})},{immediate:!0}),p({confimChartInput:async()=>{let e=T.zxlPrdId;D.value=!0;let t=null;try{if(/^module|function$/.test(T.qType)){let n=T.qType;t=await y(e,n,O.val)}else if(/^role$/.test(T.qType)){let n=T.qType;t=await b(e,n,O.val)}else if(/^businessRule$/.test(T.qType)){let n=await x(e,`bizRule`,O.val);if(n){let e=n.data||[];t={total:n.total,data:e.map(e=>({sort:e.sort,function:e.ruleTitle,explanation:e.ruleDesc}))}}}E(`confim-successed`,t)}catch(e){E(`confim-failed`,e),g({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t},confimChartInputEntityField:async()=>{let e=T.zxlPrdId;D.value=!0;let t=null;try{/^entityField$/.test(T.qType)&&(T.qType,t=await _(e,`entity`,O.val))}catch(e){g({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t},confimChartInputEnumItemList:async()=>{let e=T.zxlPrdId;D.value=!0;let t=null;try{/^fieldEnum$/.test(T.qType)&&(T.qType,t=await v(e,`fieldEnum`,O.val))}catch(e){g({type:`warning`,message:e||`无返回值！`})}return D.value=!1,t}}),(r,i)=>{let a=h;return o(),n(`div`,S,[l(t(`p`,C,c(`您将询问AI如下需求：`),512),[[f,!T.hiddenTip]]),i[1]||=t(`div`,{class:`chart-history`},null,-1),t(`div`,w,[e(a,{ref_key:`chartInputRef`,ref:k,type:`textarea`,modelValue:O.val,"onUpdate:modelValue":i[0]||=e=>O.val=e,autosize:{minRows:5,maxRows:10},autofocus:``,placeholder:O.placeholder,resize:`none`},null,8,[`modelValue`,`placeholder`])])])}}}),[[`__scopeId`,`data-v-596a13be`]]);export{T as t};