import{r as i,d as o,B as t,h as n}from"./p-03169580.js";import{r as e,u as l,a as s,g as d}from"./p-91ec29c3.js";import{t as a}from"./p-c5cf028c.js";import{s as r}from"./p-46225039.js";import"./p-a1c2b210.js";import"./p-2d180048.js";import"./p-4cb16df5.js";import"./p-7cbdb4ea.js";import"./p-59c95c5f.js";import"./p-c9699503.js";const u="modal-support fireenjin-editor{width:calc(100% - 75px);margin:0 0 0 60px}modal-support fireenjin-editor .codex-editor__redactor{padding-bottom:0 !important}@media only screen and (max-width: 800px){.modal-support{--width:100%;--max-width:auto}}";let p=class{constructor(t){i(this,t);this.floodteamCloseModal=o(this,"floodteamCloseModal",7);this.fireenjinFetch=o(this,"fireenjinFetch",7);this.fireenjinUpload=o(this,"fireenjinUpload",7);this.heading="Get Help";this.ticket={};this.ticketInput={}}async onEditorChange(){var i;if(!((i=this.editorEl)===null||i===void 0?void 0:i.exportHTML))return;this.previewHTML=await this.editorEl.exportHTML();this.editor=await(await this.editorEl.getInstance()).save()}async onChange(i){var o,t;if(((o=i===null||i===void 0?void 0:i.target)===null||o===void 0?void 0:o.name)==="tags"){this.ticketInput.tags=((t=i===null||i===void 0?void 0:i.target)===null||t===void 0?void 0:t.value)?i.target.value:[]}}onReset(i){var o;if(((o=i.detail)===null||o===void 0?void 0:o.endpoint)==="addSupport"){const i=document.querySelector("ion-modal.modal-support");if(i===null||i===void 0?void 0:i.dismiss){i.dismiss()}}}async onSuccess(i){var o;if(((o=i.detail)===null||o===void 0?void 0:o.endpoint)==="addSupport"){const i=document.querySelector("ion-modal.modal-support");if(i===null||i===void 0?void 0:i.dismiss){await i.dismiss();this.presentToast()}}}async presentToast(){const i=await a.create({message:`Feedback has been sent successfully!`,duration:2e3});i.present()}getExtension(i){var o=i.split(/[\\/]/).pop(),t=o.lastIndexOf(".");if(o===""||t<1)return"";return o.slice(t+1)}async onPhotoUpload(i){var o;const t=e(this.storage,`${(new Date).toISOString()}.${this.getExtension((o=i===null||i===void 0?void 0:i.file)===null||o===void 0?void 0:o.name)}`);const n=await l(t,i.file);const d=await s(n.ref);return{success:true,file:{url:d}}}componentDidLoad(){if(!(t===null||t===void 0?void 0:t.isBrowser))return;this.storage=d()}render(){var i,o,t,e,l;return[n("ion-header",null,n("ion-toolbar",null,n("ion-title",null,this.heading),n("ion-buttons",{slot:"end"},n("ion-button",{onClick:()=>{var i,o;return(o=(i=this.formEl)===null||i===void 0?void 0:i.submit)===null||o===void 0?void 0:o.call(i)},color:"primary",fill:"solid"},"Send"),n("ion-button",{onClick:()=>this.floodteamCloseModal.emit()},n("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),n("ion-content",null,n("ion-grid",null,n("ion-row",null,n("ion-col",{class:"ion-padding"},n("ion-text",{color:"medium"},"Select the type of support you require and then give us a brief summary of your issue and someone will follow up with you."))),n("ion-row",null,n("ion-col",{class:"ion-padding"},n("ion-card",{style:{overflow:"visible"}},n("fireenjin-form",{name:"support",endpoint:"addSupport",beforeSubmit:i=>({...this.ticketInput,...i,userId:this.userId,html:this.previewHTML,editor:this.editor}),ref:i=>this.formEl=i,submitButton:"Submit",resetButton:"Cancel",resetButtonColor:"medium",hideControls:true,disableLoader:true,disableEnterButton:true},n("ion-item",{lines:"inset"},n("fireenjin-avatar",{slot:"start",style:{display:"inline-block",position:"relative",borderRadius:"4px",padding:"0 !important",overflow:"hidden"},initials:`${((i=r===null||r===void 0?void 0:r.profile)===null||i===void 0?void 0:i.firstName)?(o=r===null||r===void 0?void 0:r.profile)===null||o===void 0?void 0:o.firstName.charAt(0):""}${((t=r===null||r===void 0?void 0:r.profile)===null||t===void 0?void 0:t.lastName)?(e=r===null||r===void 0?void 0:r.profile)===null||e===void 0?void 0:e.lastName.charAt(0):""}`,src:(l=r===null||r===void 0?void 0:r.profile)===null||l===void 0?void 0:l.photo}),n("fireenjin-select",{name:"type",label:"Type",labelPosition:"stacked",options:[{label:"Bug",value:"Bug 🐞"},{label:"Feedback",value:"Task ✅"}],value:"Task ✅"})),n("fireenjin-editor",{style:{minHeight:"50px"},autofocus:true,ref:i=>this.editorEl=i,uploadCallback:i=>this.onPhotoUpload(i)})))))))]}};p.style=u;export{p as modal_support};
//# sourceMappingURL=p-56972a8c.entry.js.map