var U=Object.defineProperty;var v=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var _=(a,t,i)=>t in a?U(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,x=(a,t)=>{for(var i in t||(t={}))R.call(t,i)&&_(a,i,t[i]);if(v)for(var i of v(t))T.call(t,i)&&_(a,i,t[i]);return a};import{j as n,_ as e}from"./main.2.8.10.js";import{u as E,e as F,b as m}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as N}from"./SnackMsg.7BjcJK1j.js";import{S as B}from"./Steps.B84Ui3GU.js";import{I as A,s as D}from"./Integrations.BFhED4ck.js";import O from"./LineAuthorization.KCRy5NYY.js";import{g as r,h as V,v as z,f as H}from"./LineCommonFunc.swLyhc3G.js";import{L as G}from"./LineIntegLayout.CTNSDxol.js";import{B as J}from"./BackIcn.BFDZx8No.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";const K=[{name:"sendPushMessage",label:e("Send a Push Message","bit-integrations"),is_pro:!1},{name:"sendReplyMessage",label:e("Send a Reply Message","bit-integrations"),is_pro:!0},{name:"sendBroadcastMessage",label:e("Send Broadcast Message","bit-integrations"),is_pro:!0}],I=[{label:e("Emojis ID","bit-integrations"),value:"emojis_id",required:!0},{label:e("Product Id","bit-integrations"),value:"product_id",required:!0},{label:e("Emoji Position (0-based index in text)","bit-integrations"),value:"index",required:!0}],j=[{label:e("Sticker ID","bit-integrations"),value:"sticker_id",required:!0},{label:e("Package Id","bit-integrations"),value:"package_id",required:!0}],L=[{label:e("Image's Original Content URL","bit-integrations"),value:"originalContentUrl",required:!0},{label:e("Image's Preview Image URL","bit-integrations"),value:"previewImageUrl",required:!0}],h=[{label:e("Audio's Original Content URL","bit-integrations"),value:"originalContentUrl",required:!0},{label:e("Duration","bit-integrations"),value:"duration",required:!0}],q=[{label:e("Original Content URL","bit-integrations"),value:"originalContentUrl",required:!0},{label:e("Preview Image URL","bit-integrations"),value:"previewImageUrl",required:!0}],k=[{label:e("Title","bit-integrations"),value:"title",required:!0},{label:e("Address","bit-integrations"),value:"address",required:!0},{label:e("Latitude","bit-integrations"),value:"latitude",required:!0},{label:e("longitude","bit-integrations"),value:"longitude",required:!0}],S=[{label:e("Message","bit-integrations"),value:"message",required:!0}];function ce({formFields:a,setFlow:t,flow:i,allIntegURL:C}){const M=E(),{formID:w}=F(),[g,c]=m.useState(!1),[d,b]=m.useState(1),[y,l]=m.useState({show:!1}),[s,u]=m.useState({name:"Line",replyToken:"",recipientId:"",type:"Line",accessToken:"",parse_mode:"HTML",messageTypes:K,emojis_field_map:r(I,"emoji"),message_field_map:r(S),sticker_field_map:r(j,"sticker"),image_field_map:r(L,"image"),audio_field_map:r(h,"audio"),video_field_map:r(q,"video"),location_field_map:r(k,"location"),body:"",actions:{},sendEmojis:!1,messageField:S,sendSticker:!1,sendImage:!1,sendAudio:!1,sendVideo:!1,sendLocation:!1,emojisFields:I,locationFields:k,stickerFields:j,imageFields:L,audioFields:h,videoFields:q}),P=p=>{if(setTimeout(()=>{const o=document.getElementById("btcd-settings-wrp");o&&(o.scrollTop=0)},300),!(s!=null&&s.name)||!f()){const o=H(s);l({show:!0,msg:o&&o.length>0?o.join(", "):e("Please complete required fields to continue.","bit-integrations")});return}b(p)},f=()=>z(s);return n.jsxs("div",{children:[n.jsx(N,{snack:y,setSnackbar:l}),n.jsx("div",{className:"txt-center mt-2",children:n.jsx(B,{step:3,active:d})}),n.jsx(O,{formID:w,lineConf:s,setLineConf:u,step:d,setstep:b,isLoading:g,setIsLoading:c,setSnackbar:l}),n.jsxs("div",{className:"btcd-stp-page",style:x({},d===2&&{width:900,height:"auto",overflow:"visible"}),children:[n.jsx(G,{formFields:a,handleInput:p=>V(p,s,u),lineConf:s,setLineConf:u,isLoading:g,setIsLoading:c,setSnackbar:l}),n.jsxs("button",{onClick:()=>P(3),disabled:!f(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[e("Next","bit-integrations"),n.jsx(J,{className:"ml-1 rev-icn"})]})]}),n.jsx(A,{step:d,saveConfig:()=>D({flow:i,setFlow:t,allIntegURL:C,conf:s,navigate:M,setIsLoading:c,setSnackbar:l}),isLoading:g,dataConf:s,setDataConf:u,formFields:a})]})}export{ce as default};
