import{r as i,d as o,B as t,h as n}from"./p-846bd001.js";import{r as l,u as e,a as s,g as a}from"./p-297aea3c.js";import{t as d}from"./p-9732f456.js";import{s as r}from"./p-4ff8bb4b.js";import"./p-18355b65.js";import"./p-2d180048.js";import"./p-18891da7.js";import"./p-8cd54418.js";import"./p-5cd01495.js";import"./p-259f1737.js";import"./p-ae2fb9dc.js";import"./p-65879f9e.js";import"./p-dca1478c.js";const u=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.userId=void 0,this.ticket={},this.ticketInput={},this.previewHTML=void 0,this.editor=void 0}async onEditorChange(){var i;(null===(i=this.editorEl)||void 0===i?void 0:i.exportHTML)&&(this.previewHTML=await this.editorEl.exportHTML(),this.editor=await(await this.editorEl.getInstance()).save())}async onChange(i){var o,t;"tags"===(null===(o=null==i?void 0:i.target)||void 0===o?void 0:o.name)&&(this.ticketInput.tags=(null===(t=null==i?void 0:i.target)||void 0===t?void 0:t.value)?i.target.value:[])}onReset(i){var o;if("addSupport"===(null===(o=i.detail)||void 0===o?void 0:o.endpoint)){const i=document.querySelector("ion-modal.modal-support");(null==i?void 0:i.dismiss)&&i.dismiss()}}async onSuccess(i){var o;if("addSupport"===(null===(o=i.detail)||void 0===o?void 0:o.endpoint)){const i=document.querySelector("ion-modal.modal-support");(null==i?void 0:i.dismiss)&&(await i.dismiss(),this.presentToast())}}async presentToast(){(await d.create({message:"Feedback has been sent successfully!",duration:2e3})).present()}getExtension(i){var o=i.split(/[\\/]/).pop(),t=o.lastIndexOf(".");return""===o||t<1?"":o.slice(t+1)}async onPhotoUpload(i){var o;const t=l(this.storage,`${(new Date).toISOString()}.${this.getExtension(null===(o=null==i?void 0:i.file)||void 0===o?void 0:o.name)}`),n=await e(t,i.file);return{success:!0,file:{url:await s(n.ref)}}}componentDidLoad(){(null==t?void 0:t.isBrowser)&&(this.storage=a())}render(){var i,o,t,l,e;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 null===(o=null===(i=this.formEl)||void 0===i?void 0:i.submit)||void 0===o?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:!0,disableLoader:!0,disableEnterButton:!0},n("ion-item",{lines:"inset"},n("fireenjin-avatar",{slot:"start",style:{display:"inline-block",position:"relative",borderRadius:"4px",padding:"0 !important",overflow:"hidden"},initials:`${(null===(i=null==r?void 0:r.profile)||void 0===i?void 0:i.firstName)?null===(o=null==r?void 0:r.profile)||void 0===o?void 0:o.firstName.charAt(0):""}${(null===(t=null==r?void 0:r.profile)||void 0===t?void 0:t.lastName)?null===(l=null==r?void 0:r.profile)||void 0===l?void 0:l.lastName.charAt(0):""}`,src:null===(e=null==r?void 0:r.profile)||void 0===e?void 0:e.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:!0,ref:i=>this.editorEl=i,uploadCallback:i=>this.onPhotoUpload(i)})))))))]}};u.style="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}}";export{u as modal_support}