"use strict";(globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[]).push([[9314],{99314:(t,a,e)=>{e.r(a),e.d(a,{useAipptStore:()=>o});var r=e(84522),s=e(10435),n=e(74003),i=e(79664);var c=e(17319);const o=(0,s.Q_)(r.BU.aippt,{syncStorage:{watch:["planList","featureTexts","feedbackData"]},state:()=>({modalShow:!1,iframeConfig:null,modalPanel:"home",restInfo:{restCount:0,list:[]},planList:[],featureTexts:[],selectPlan:null,planShow:!1,orderLoading:!1,payOrderIds:new Set,paymentOrderData:null,localCurrentTime:0,historyOrders:[],historyShow:!1,introShow:!1,modalFullScreen:!1,feedbackData:void 0,outlineTitle:"",outlineContent:"",pptRecordId:"",orderError:!1}),getters:{},actions:{setModal(t){this.modalShow=t},setModalPanel(t){this.modalPanel=t},setPlanShow(t){this.planShow=t},setHistoryShow(t){this.historyShow=t},setIntroShow(t){this.introShow=t},setSelectPlan(t){this.selectPlan=t},setModalFullScreen(t){this.modalFullScreen=t},setOutlineTitle(t){this.outlineTitle=t},setOutlineContent(t){this.outlineContent=t},setPPTRecordId(t){this.pptRecordId=t},clearPayOrderIds(){this.payOrderIds.clear()},setOrderError(t){this.orderError=t},async getAipptAuth(){const[t,a]=await(async()=>{try{const t=await i.hj.get(`${n.H}aippt/code`,{},{_auth:!0,_single:!0});return 0===t.code&&t.data?[null,t.data]:(t.code,[t.message])}catch(t){return["catch error"]}})();if(!t&&a)return this.iframeConfig=a,a;c.R.fail({message:t||"获取授权失败, 请重试"})},async getAipptPlanRestInfo(){const[t,a]=await(async()=>{try{const t=await i.hj.get(`${n.H}aippt/rest-info`,{},{_auth:!0});if(0===t.code&&t.data)return[null,t.data];throw t}catch(t){return["catch error"]}})();!t&&a&&(this.restInfo=a)},async getAipptPlan(){this.orderLoading=!0;const[t,a]=await(async()=>{try{const t=await i.hj.get(`${n.H}aippt/plan`,{},{_auth:!0,_single:!0});if(0===t.code&&t.data)return[null,t.data];throw t}catch(t){return["catch error"]}})();!t&&a&&(this.planList=a.list,this.featureTexts=a.features,this.selectPlan=a.list[a.select],this.getAipptOrderPaycode())},async getAipptOrderPaycode(){if(!this.selectPlan)return;this.orderLoading=!0;const[t,a]=await(async t=>{try{const a=await i.hj.post(`${n.H}aippt/create-order`,{planId:t},{_auth:!0,_single:!0});return 0===a.code&&a.data?[null,a.data]:[a.message]}catch(t){return["catch error"]}})(this.selectPlan.id);this.orderLoading=!1,!t&&a?(this.localCurrentTime=Date.now(),this.paymentOrderData=a,this.payOrderIds.add(a.orderId),this.orderError=!1):this.orderError=!0},async checkAipptAllOrders(){this.orderLoading=!0;const[t,a]=await(async()=>{try{const t=await i.hj.post(`${n.H}aippt/check-all-order`,{},{_auth:!0});return 0===t.code&&t.data?[null,t.data]:[t.message]}catch(t){return["catch error"]}})()},async checkAipptOrders(t){const[a,e]=await(async t=>{try{const a=await i.hj.post(`${n.H}aippt/check-multi-order`,{ids:t},{_auth:!0});return 0===a.code&&a.data?[null,a.data]:[a.message]}catch(t){return["catch error"]}})(t);return a||!e?"":e.paidId},async getHistoryOrders(){const[t,a]=await(async()=>{try{const t=await i.hj.get(`${n.H}aippt/hitory`,{},{_auth:!0});return 0===t.code&&t.data?[null,t.data]:[t.message]}catch(t){return["catch error"]}})();!t&&a&&(this.historyOrders=a)},async recordCreatePPT(){const[t,a]=await(async t=>{try{const a=await i.hj.post(`${n.H}aippt/record-ppt`,t,{_auth:!0});return 0===a.code&&a.data?[null,a.data]:[a.message]}catch(t){return["catch error"]}})({title:this.outlineTitle,outline:this.outlineContent});return t||!a?(c.R.fail({message:t||"获取授权失败, 请重试"}),!1):a.recordId},async getAipptSceneAuth(t){if(1025===t){const t=await this.recordCreatePPT();if(!t)return!1;this.pptRecordId=t}const[a,e]=await(async t=>{try{const a=await i.hj.post(`${n.H}aippt/scene-auth`,{scene:t},{_auth:!0});if(0===a.code&&a.data)return[null,a.data];throw a}catch(t){return["catch error"]}})(t);return!(a||!e)||(c.R.fail({message:a||"获取授权失败, 请重试"}),!1)},async creatPPTSuccess(t){const a={recordId:this.pptRecordId,title:t.title,aipptId:t.id},[e,r]=await(async t=>{try{const a=await i.hj.post(`${n.H}aippt/create-ppt-done`,t,{_auth:!0});if(0===a.code&&a.data)return[null,a.data];throw a}catch(t){return["catch error"]}})(a);if(!e&&r)return this.clearTempData(),r},clearTempData(){this.outlineTitle="",this.outlineContent="",this.pptRecordId=""},async getFeedback(){const[t,a]=await(async()=>{try{const t=await i.hj.get(`${n.H}aippt/feedback`,{},{_auth:!0});if(0===t.code&&t.data)return[null,t.data];throw t}catch(t){return["catch error"]}})();!t&&a&&(this.feedbackData=a)},async updateAipptRecord(){if(!this.pptRecordId)return;const[t,a]=await(async t=>{try{const a=await i.hj.post(`${n.H}aippt/update-record-ppt`,t,{_auth:!0});if(0===a.code&&a.data)return[null,a.data];throw a}catch(t){return["catch error"]}})({recordId:this.pptRecordId});return!t&&a?a:void 0},onAiPPTTokenExpired(){c.R.fail({message:"token过期, 请重新进入"}),this.clearTempData(),this.setModalPanel("home")}}})}}]);