(()=>{"use strict";var e,t={579:(e,t,r)=>{const a=Vue;function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var l={class:"bg-white dark:bg-gray-800 rounded-lg shadow"},n={class:"flex flex-col md:flex-row md:items-center border-b border-gray-100 dark:border-gray-700"},s=(0,a.createElementVNode)("div",{class:"px-6 md:px-8 mt-1 md:mt-1 w-full md:w-1/5"},[(0,a.createElementVNode)("label",{class:"inline-block leading-tight space-x-1",for:"content_type"},[(0,a.createElementVNode)("span",null,"Data Type"),(0,a.createElementVNode)("span",{class:"text-red-500 text-sm"},"*")])],-1),d={class:"mt-1 md:mt-0 pb-5 px-6 md:px-8 md:w-3/5 w-full md:py-5"},c={class:"space-y-1"},i=[(0,a.createElementVNode)("option",{value:""},"Select Data Type",-1),(0,a.createElementVNode)("option",{value:"real"},"Real Data",-1),(0,a.createElementVNode)("option",{value:"fake"},"Fake Data",-1)],m={class:"flex flex-col md:flex-row md:items-center border-b border-gray-100 dark:border-gray-700"},u=(0,a.createElementVNode)("div",{class:"px-6 md:px-8 mt-1 md:mt-1 w-full md:w-1/5"},[(0,a.createElementVNode)("label",{class:"inline-block leading-tight space-x-1",for:"database_table"},[(0,a.createElementVNode)("span",null,"Database Table"),(0,a.createElementVNode)("span",{class:"text-red-500 text-sm"},"*")])],-1),p={class:"mt-1 md:mt-0 pb-5 px-6 md:px-8 md:w-3/5 w-full md:py-5"},g={class:"space-y-1"},y=(0,a.createElementVNode)("option",{value:""},"Select Table",-1),b=["value"],f={class:"flex flex-col md:flex-row md:items-center border-b border-gray-100 dark:border-gray-700"},h=(0,a.createElementVNode)("div",{class:"px-6 md:px-8 mt-1 md:mt-1 w-full md:w-1/5"},[(0,a.createElementVNode)("label",{class:"inline-block leading-tight space-x-1",for:"number_of_records"},[(0,a.createElementVNode)("span",null,"Number of Records"),(0,a.createElementVNode)("span",{class:"text-red-500 text-sm"},"*")])],-1),x={class:"mt-1 md:mt-0 pb-5 px-6 md:px-8 md:w-3/5 w-full md:py-5"},k={class:"space-y-1"},v={class:"flex flex-col md:flex-row md:items-center border-b border-gray-100 dark:border-gray-700"},E=(0,a.createElementVNode)("div",{class:"px-6 md:px-8 mt-1 md:mt-1 w-full md:w-1/5"},[(0,a.createElementVNode)("label",{class:"inline-block leading-tight space-x-1",for:"data_required"},[(0,a.createElementVNode)("span",null,"Data Description"),(0,a.createElementVNode)("span",{class:"text-red-500 text-sm"},"*")])],-1),N={class:"mt-1 md:mt-0 pb-5 px-6 md:px-8 md:w-3/5 w-full md:py-5"},V={class:"space-y-1"},_={class:"flex flex-col md:flex-row md:items-center border-b border-gray-100 dark:border-gray-700",id:"available_columns",ref:"columns"},w=(0,a.createElementVNode)("div",{class:"px-6 md:px-8 mt-1 md:mt-1 w-full md:w-1/5 py-6"},[(0,a.createElementVNode)("label",{class:"inline-block leading-tight space-x-1",for:"collumns"},[(0,a.createElementVNode)("span",null,"Available Columns:"),(0,a.createElementVNode)("span",{class:"text-red-500 text-sm"},"*")])],-1),B={class:"mt-2 pb-5 px-2 md:px-2 md:w-3/5 w-full md:py-5 flex justify-center"},C={key:0,class:"space-y-1"},D={class:"container mx-auto"},S={class:"table-auto md:w-1/3"},L=(0,a.createElementVNode)("thead",null,[(0,a.createElementVNode)("tr",{class:"text-xs"},[(0,a.createElementVNode)("th",{class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-3"}," Select "),(0,a.createElementVNode)("th",{class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-3"}," Name "),(0,a.createElementVNode)("th",{class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-3"}," Type "),(0,a.createElementVNode)("th",{class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-3"}," Length "),(0,a.createElementVNode)("th",{class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-3"}," Nullable "),(0,a.createElementVNode)("th",{class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-3"}," Default ")])],-1),j={class:"text-center"},M={class:"border border-gray-100 dark:border-gray-700 px-4 py-1"},F=["value"],O=["checked"],T={class:"border border-gray-100 dark:border-gray-700 px-4 py-1"},q={class:"border border-gray-100 dark:border-gray-700 px-4 py-1"},R={class:"border border-gray-100 dark:border-gray-700 px-4 py-1"},G={class:"border border-gray-100 dark:border-gray-700 px-4 py-1"},P={class:"border border-gray-100 dark:border-gray-700 px-4 py-1"},U={key:1,class:"text-red-500 font-bold mt-4 flex justify-center text-center"},z={key:0,class:"mt-4 flex justify-center"},H=[(0,a.createElementVNode)("img",{src:"/vendor/chatgpt-seeder/images/loading-spinner.gif",alt:"Loading",width:"46",class:"flex justify-center bg-opacity-80 z-50"},null,-1)],Z={key:1,class:"text-green-500 font-bold mt-4 flex justify-center capitalize"},A={key:2,class:"text-red-500 font-bold mt-4 flex justify-center text-center"},I={class:"flex flex-col md:flex-row md:items-center justify-center md:justify space-y-2 md:space-y-0 space-x-3"},J=(0,a.createElementVNode)("button",{type:"submit",class:"shadow relative bg-primary-500 hover:bg-primary-900 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900"},[(0,a.createElementVNode)("span",{class:""},"Generate Data")],-1),K=(0,a.createElementVNode)("div",{class:"fixed inset-0 bg-black opacity-50"},null,-1),Q={class:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-600"},W=(0,a.createElementVNode)("h2",{class:"text-md font-bold"},"Preview Data",-1),X=[(0,a.createElementVNode)("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,a.createElementVNode)("path",{d:"M6 18L18 6M6 6l12 12"})],-1)],Y={class:"px-6 py-4"},$={class:"flex justify-center overflow-x max-h-[calc(100vh-5em)]"},ee={class:"table-auto overflow-scroll min-w-[20rem]"},te={class:"flex justify-center mb-4 mt-2"},re={class:"flex justify-center mt-8"};const ae={data:function(){return{tables:[],columns:[],form:{data_type:"",database_table:"",number_of_records:"",selected_columns:[],seed_data:[]},usage:null,keys:[],sample_data:[],generate_retry:3,retry_count:0,showModal:!1,isLoading:!1,message:"",error:""}},mounted:function(){this.getTables(),this.getGenerateRetry()},methods:{getGenerateRetry:function(){var e=this;try{Nova.request().get("/nova-vendor/chatgpt-seeder/chatgpt-seeder/get-generate-retry",{}).then((function(t){var r=t.data;e.generate_retry=r.generate_retry}))}catch(e){this.error=e.message}},getTables:function(){var e=this;try{Nova.request().get("/nova-vendor/chatgpt-seeder/chatgpt-seeder/tables",{}).then((function(t){var r=t.data;e.tables=r.tables}))}catch(e){this.error=e.message}},getColumns:function(e){var t=this;try{this.clearError(),this.columns=[],this.form.selected_columns=[],this.database_table=e.target.value,Nova.request().get("/nova-vendor/chatgpt-seeder/chatgpt-seeder/columns/"+e.target.value,{}).then((function(e){var r=e.data;r.exception?(t.isLoading=!1,t.error=r.exception_message):t.columns=r.columns}))}catch(e){this.error=e.message}},submitForm:function(){this.clearError(),this.resetRetry(),this.generate()},generate:function(){var e=this;try{this.clearError(),this.message="",this.isLoading=!0,this.retry_count<=this.generate_retry?(this.form.columns=this.columns,Nova.request().post("/nova-vendor/chatgpt-seeder/chatgpt-seeder/generate",this.form).then((function(t){var r=t.data;r.api_response_error?(e.isLoading=!1,e.error=r.api_response_error):r.exception?(e.isLoading=!1,e.error=r.exception_message):(e.usage=r.usage,r.data?(e.content=r.data,(r=r.data.slice(0,8)).length>1?(e.sample_data=r,e.keys=Object.keys(r[0]),e.isLoading=!1,e.openModal()):(e.retry_count++,e.generate())):(e.retry_count++,e.generate()))}))):(this.isLoading=!1,this.error="Retry limit exceeded! Please refine your data description for more accurate results!")}catch(e){this.error=e.message}},proceed:function(){var e=this;try{this.clearError(),this.form.seed_data=this.content,Nova.request().post("/nova-vendor/chatgpt-seeder/chatgpt-seeder/proceed",this.form).then((function(t){var r=t.data;r.exception?(e.isLoading=!1,e.error=r.exception_message):r.succeed?(e.isLoading=!1,e.message=e.form.database_table+" table seeded successfully!"):(e.isLoading=!1,e.message="Data return is invalid!")}))}catch(e){this.error=e.message}},reGenerate:function(){this.resetRetry(),this.submitForm()},resetRetry:function(){this.retry_count=0},clearForm:function(){this.columns=[],this.selected_columns=[],this.form.data_type=null,this.form.database_table=null,this.form.number_of_records=null,this.form.data_required=null,this.form.seed_data=[],this.keys=[],this.sample_data=[],this.resetRetry(),this.clearError(),this.message="",this.isLoading=!1},clearError:function(){this.error=""},openModal:function(){this.showModal=!0},closeModal:function(){this.showModal=!1,this.message=""},handleOutsideClick:function(){this.closeModal()}}};const oe=(0,r(744).Z)(ae,[["render",function(e,t,r,ae,oe,le){var ne=this,se=(0,a.resolveComponent)("Head"),de=(0,a.resolveComponent)("Heading"),ce=(0,a.resolveComponent)("diver");return(0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,null,[(0,a.createElementVNode)("div",null,[(0,a.createVNode)(se,{title:"ChatGPT Seeder"}),(0,a.createVNode)(de,{class:"mb-4"},{default:(0,a.withCtx)((function(){return[(0,a.createTextVNode)("ChatGPT Seeder")]})),_:1}),(0,a.createElementVNode)("form",{onSubmit:t[7]||(t[7]=(0,a.withModifiers)((function(){return le.submitForm&&le.submitForm.apply(le,arguments)}),["prevent"])),ref:"form",method:"post",class:"space-y-8"},[(0,a.createElementVNode)("div",l,[(0,a.createElementVNode)("div",n,[s,(0,a.createElementVNode)("div",d,[(0,a.createElementVNode)("div",c,[(0,a.withDirectives)((0,a.createElementVNode)("select",{class:"w-full form-control form-input form-input-bordered","onUpdate:modelValue":t[0]||(t[0]=function(e){return oe.form.data_type=e}),required:""},i,512),[[a.vModelSelect,oe.form.data_type]])])])]),(0,a.createElementVNode)("div",m,[u,(0,a.createElementVNode)("div",p,[(0,a.createElementVNode)("div",g,[(0,a.withDirectives)((0,a.createElementVNode)("select",{"onUpdate:modelValue":t[1]||(t[1]=function(e){return oe.form.database_table=e}),class:"w-full form-control form-input form-input-bordered",id:"database_table",onChange:t[2]||(t[2]=function(e){return le.getColumns(e)}),required:""},[y,((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(this.tables,(function(e){return(0,a.openBlock)(),(0,a.createElementBlock)("option",{value:e,key:e},(0,a.toDisplayString)(e),9,b)})),128))],544),[[a.vModelSelect,oe.form.database_table]])])])]),(0,a.createElementVNode)("div",f,[h,(0,a.createElementVNode)("div",x,[(0,a.createElementVNode)("div",k,[(0,a.withDirectives)((0,a.createElementVNode)("input",{type:"text",class:"w-full form-control form-input form-input-bordered","onUpdate:modelValue":t[3]||(t[3]=function(e){return oe.form.number_of_records=e}),required:""},null,512),[[a.vModelText,oe.form.number_of_records]])])])]),(0,a.createElementVNode)("div",v,[E,(0,a.createElementVNode)("div",N,[(0,a.createElementVNode)("div",V,[(0,a.withDirectives)((0,a.createElementVNode)("input",{type:"text",class:"w-full form-control form-input form-input-bordered",placeholder:"Describe the data you are looking for..","onUpdate:modelValue":t[4]||(t[4]=function(e){return oe.form.data_required=e}),required:""},null,512),[[a.vModelText,oe.form.data_required]])])])]),(0,a.createElementVNode)("div",_,[w,(0,a.createElementVNode)("div",B,[this.columns.length>0?((0,a.openBlock)(),(0,a.createElementBlock)("div",C,[(0,a.createElementVNode)("div",D,[(0,a.createElementVNode)("table",S,[L,(0,a.createElementVNode)("tbody",j,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(this.columns,(function(e,r){return(0,a.openBlock)(),(0,a.createElementBlock)("tr",{key:r,class:"hover:bg-gray-100 dark:hover:bg-gray-600"},[(0,a.createElementVNode)("td",M,[e.column_not_nullable?(0,a.createCommentVNode)("",!0):(0,a.withDirectives)(((0,a.openBlock)(),(0,a.createElementBlock)("input",{key:0,type:"checkbox",class:"w-4 form-control form-input-bordered",value:e.column_name,"onUpdate:modelValue":t[5]||(t[5]=function(e){return oe.form.selected_columns=e})},null,8,F)),[[a.vModelCheckbox,oe.form.selected_columns]]),e.column_not_nullable?((0,a.openBlock)(),(0,a.createElementBlock)("input",{key:1,type:"checkbox",class:"w-4 form-control form-input-bordered",checked:e.column_not_nullable,disabled:!0},null,8,O)):(0,a.createCommentVNode)("",!0)]),(0,a.createElementVNode)("td",T,(0,a.toDisplayString)(e.column_name),1),(0,a.createElementVNode)("td",q,(0,a.toDisplayString)(e.column_type),1),(0,a.createElementVNode)("td",R,(0,a.toDisplayString)(e.column_length),1),(0,a.createElementVNode)("td",G,(0,a.toDisplayString)(!e.column_not_nullable),1),(0,a.createElementVNode)("td",P,(0,a.toDisplayString)(e.column_default),1)])})),128))])])])])):(0,a.createCommentVNode)("",!0),""!==this.form.database_table&&0===this.columns.length?((0,a.openBlock)(),(0,a.createElementBlock)("div",U," This table has no columns. ")):(0,a.createCommentVNode)("",!0)])],512)]),oe.isLoading?((0,a.openBlock)(),(0,a.createElementBlock)("div",z,H)):(0,a.createCommentVNode)("",!0),this.message?((0,a.openBlock)(),(0,a.createElementBlock)("div",Z,(0,a.toDisplayString)(this.message),1)):(0,a.createCommentVNode)("",!0),this.error?((0,a.openBlock)(),(0,a.createElementBlock)("div",A,(0,a.toDisplayString)(this.error),1)):(0,a.createCommentVNode)("",!0),(0,a.createElementVNode)("div",I,[(0,a.createElementVNode)("button",{type:"button",class:"bg-gray-700 text-white font-bold py-2 px-4 rounded",onClick:t[6]||(t[6]=function(){return le.clearForm&&le.clearForm.apply(le,arguments)})}," Clear "),J])],544)]),oe.showModal?((0,a.openBlock)(),(0,a.createElementBlock)("div",{key:0,class:"modal fixed inset-0 flex items-center justify-center z-40",onClick:t[12]||(t[12]=function(){return le.handleOutsideClick&&le.handleOutsideClick.apply(le,arguments)})},[K,(0,a.createVNode)(ce,{class:"relative bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-2xl w-full mx-4 overflow-y-auto border border-gray-200 dark:border-gray-600"},{default:(0,a.withCtx)((function(){return[(0,a.createElementVNode)("div",Q,[W,(0,a.createElementVNode)("button",{onClick:t[8]||(t[8]=function(){return le.closeModal&&le.closeModal.apply(le,arguments)}),class:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none"},X)]),(0,a.createElementVNode)("div",Y,[(0,a.createElementVNode)("div",$,[(0,a.createElementVNode)("table",ee,[(0,a.createElementVNode)("thead",null,[(0,a.createElementVNode)("tr",null,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(ne.keys,(function(e){return(0,a.openBlock)(),(0,a.createElementBlock)("th",{key:e,class:"border border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-700 px-4 py-2 capitalize"},(0,a.toDisplayString)(e),1)})),128))])]),(0,a.createElementVNode)("tbody",null,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(ne.sample_data,(function(e){return(0,a.openBlock)(),(0,a.createElementBlock)("tr",{key:e,class:"hover:bg-gray-400 dark:hover:bg-gray-700"},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(ne.keys,(function(t){return(0,a.openBlock)(),(0,a.createElementBlock)("td",{key:t,class:"border border-gray-200 dark:border-gray-600 px-4 py-1 text-center"},["object"===o(e[t])?((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,{key:0},(0,a.renderList)(e[t],(function(e,t){return(0,a.openBlock)(),(0,a.createElementBlock)("span",{key:t},(0,a.toDisplayString)(t)+": "+(0,a.toDisplayString)(e),1)})),128)):((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:1},[(0,a.createTextVNode)((0,a.toDisplayString)(e[t]),1)],64))])})),128))])})),128))])])]),(0,a.createElementVNode)("div",te," Total Tokens Used: "+(0,a.toDisplayString)(ne.usage.total_tokens),1),(0,a.createElementVNode)("div",re,[(0,a.createElementVNode)("button",{class:"px-4 py-2 bg-green-500 text-white rounded-md mr-2 rounded",onClick:t[9]||(t[9]=function(){return le.proceed&&le.proceed.apply(le,arguments)})},"Proceed "),(0,a.createElementVNode)("button",{class:"bg-primary-500 text-white font-bold py-2 px-4 border-b-4 border-primary-500 hover:border-blue-500 rounded mr-2",onClick:t[10]||(t[10]=function(){return le.reGenerate&&le.reGenerate.apply(le,arguments)})}," Regenerate "),(0,a.createElementVNode)("button",{class:"px-4 py-2 bg-red-500 text-white rounded-md rounded",onClick:t[11]||(t[11]=function(){return le.closeModal&&le.closeModal.apply(le,arguments)})},"Close ")])])]})),_:1})])):(0,a.createCommentVNode)("",!0)],64)}]]);Nova.booting((function(e,t){Nova.inertia("ChatgptSeeder",oe)}))},762:()=>{},744:(e,t)=>{t.Z=(e,t)=>{const r=e.__vccOpts||e;for(const[e,a]of t)r[e]=a;return r}}},r={};function a(e){var o=r[e];if(void 0!==o)return o.exports;var l=r[e]={exports:{}};return t[e](l,l.exports,a),l.exports}a.m=t,e=[],a.O=(t,r,o,l)=>{if(!r){var n=1/0;for(i=0;i<e.length;i++){for(var[r,o,l]=e[i],s=!0,d=0;d<r.length;d++)(!1&l||n>=l)&&Object.keys(a.O).every((e=>a.O[e](r[d])))?r.splice(d--,1):(s=!1,l<n&&(n=l));if(s){e.splice(i--,1);var c=o();void 0!==c&&(t=c)}}return t}l=l||0;for(var i=e.length;i>0&&e[i-1][2]>l;i--)e[i]=e[i-1];e[i]=[r,o,l]},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={103:0,990:0};a.O.j=t=>0===e[t];var t=(t,r)=>{var o,l,[n,s,d]=r,c=0;if(n.some((t=>0!==e[t]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(d)var i=d(a)}for(t&&t(r);c<n.length;c++)l=n[c],a.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return a.O(i)},r=self.webpackChunknaif_chatgpt_seeder=self.webpackChunknaif_chatgpt_seeder||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),a.O(void 0,[990],(()=>a(579)));var o=a.O(void 0,[990],(()=>a(762)));o=a.O(o)})();
|