1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6458],{45840:function(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=function(){return[]},t.resolve=t,t.id=45840,e.exports=t},5432:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/my-outward-bound/safety-and-medical/medical-form-upload",function(){return a(85261)}])},38082:function(e,t,a){"use strict";var n=a(67294);let i=e=>new Promise(t=>{setTimeout(()=>t(),e)});t.Z=function(e,t){let{delay:a,skip:r}=t||{},[s,l]=(0,n.useState)(void 0),[o,c]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{let t;if(e&&!r){a&&await i(a);try{t=await fetch(e)}catch(t){console.error("Failed to fetch: ".concat(e),t),c(!0);return}if(!t.ok){c(!0);return}c(!1),l(await t.json())}})()},[e,a,r]);let d=[s,o];return d.data=s,d.error=o,d}},98607:function(e,t,a){"use strict";var n=a(85893);a(67294);var i=a(52448);t.Z=e=>{let{className:t,type:a,buttonText:r,isLoading:s,disabled:l,onClick:o}=e;return(0,n.jsxs)("button",{type:a,className:t,disabled:l||s,onClick:o,children:[s&&(0,n.jsx)(i.Z,{className:"me-2",as:"span",animation:"border",size:"sm",role:"status","aria-hidden":"true"}),r]})}},51501:function(e,t,a){"use strict";a.d(t,{Z:function(){return w}});var n=a(85893),i=a(19490),r=a(42221),s=a.n(r),l=a(23855);let o=["image/heic","image/heif","image/heic-sequence","image/heif-sequence"],c=[".heic",".heif"],d=e=>{let t=e.type.toLowerCase();if(o.some(e=>e===t))return!0;let a=e.name.toLowerCase();return c.some(e=>a.endsWith(e))},u=async e=>{if(!d(e))return e;let t=new Uint8Array(await e.arrayBuffer()),a=await s()({buffer:t,format:"JPEG",quality:1}),n=c.find(t=>e.name.toLowerCase().endsWith(t)),i=n?e.name.slice(0,-n.length):e.name;return new File([new Uint8Array(a)],"".concat(i,".jpg"),{type:"image/jpeg"})},m=async e=>{let{results:t,errors:a}=await (0,l.vE)(e,e=>u(e).catch(t=>{throw new l.Gs('Failed to convert file "'.concat(e.name,'" to JPEG'),{cause:t,customData:{filename:e.name,type:e.type,size:e.size}})}));if(a.length)throw new l.GN("Failed to convert files to JPEG",a);return t};var f=a(96678),p=a(98270),h=a(94184),y=a.n(h),g=a(67294);let b="file-upload";var w=e=>{let{className:t,accept:a,selectedFiles:r,setSelectedFiles:s,multiple:o}=e,{showNotification:c}=(0,i.lm)(),[d,u]=(0,g.useState)(!1),h=async e=>{if(!e)return;let t=Array.from(e);u(!0);try{let e=await m(t);s(e)}catch(e){(0,l.ZP)({error:e,customData:{filenames:t.map(e=>e.name)}}),c({type:"Danger",title:"Error",body:"Failed to process the selected file(s). Please try a different file."})}finally{u(!1)}},w=e=>{s(r.filter((t,a)=>a!==e))};return(0,n.jsxs)("div",{className:y()("file-selector",t),children:[(0,n.jsx)("input",{className:"d-none",id:b,type:"file",accept:a,multiple:o,onChange:e=>{let{target:t}=e;h(t.files),t.value=""}}),0===r.length&&(0,n.jsxs)("button",{type:"button",className:"no-file",disabled:d,onClick:()=>{var e;return null===(e=document.getElementById(b))||void 0===e?void 0:e.click()},children:[(0,n.jsx)("span",{className:"text-uppercase",children:d?"Processing file(s)â¦"
1:"Upload file(s) here"}),(0,n.jsx)(p.Z,{className:"ms-2",asset:"/assets/ic-upload.svg",width:16,height:16})]}),r.length>0&&r.map((e,t)=>{let a=e.name,i=e.type.startsWith("image/")?e.type.split("/")[1]:"pdf";return(0,n.jsx)(f.P,{className:y()({"mt-2":t>0}),extension:i,title:a,footer:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"btn btn-link d-flex gap-1 p-0",onClick:()=>{var e;return null===(e=document.getElementById(b))||void 0===e?void 0:e.click()},children:["Replace file(s)",(0,n.jsx)(p.Z,{asset:"/assets/ic-upload.svg",width:16,height:16})]}),(0,n.jsxs)("button",{type:"button",className:"btn btn-link d-flex gap-1 p-0",onClick:()=>w(t),children:[(0,n.jsx)("span",{className:"d-none d-sm-inline-block",children:"Remove"}),(0,n.jsx)(p.Z,{asset:"/assets/ic-close.svg",width:16,height:16})]})]})},a)})]})}},85261:function(e,t,a){"use strict";a.r(t);var n=a(85893),i=a(73606),r=a(83959),s=a(38082),l=a(19490),o=a(23855),c=a(74771),d=a(96678),u=a(98270),m=a(91924),f=a(98607),p=a(51501),h=a(40221),y=a(35823),g=a.n(y),b=a(11163),w=a(67294);let x=["image/jpeg","image/png","image/webp"],j=e=>{let t=[],a=[],n=0;return e.forEach(e=>{n+e.size>r.fT&&(t.push(a),a=[],n=0),a.push(e),n+=e.size}),a.length>0&&t.push(a),t};t.default=(0,c.t)(e=>{let{user:t}=e,a=(0,b.useRouter)(),{child:c}=a.query,{showNotification:y,hideNotification:v}=(0,l.lm)(),{checkSession:N}=(0,i.aF)(),{childProfile:F,isAdapted:k}=t,E=void 0!==c&&!!(null==F?void 0:F.id),{id:P,medicalDeclarationStatus:C}=E?F:t,[D,M]=(0,w.useState)([]),[S,Z]=(0,w.useState)(!1),[_,O]=(0,w.useState)(),[T,z]=(0,w.useState)(Date.now()),[U]=(0,s.Z)("".concat((0,r.Dr)(P),"?t=").concat(T),{skip:!P});if("Medical Form Required"!==C&&"Medical Form Received"!==C&&!k)return a.push(r.cn),(0,n.jsx)(n.Fragment,{});let B=async()=>{if(!D.length)return;v(),Z(!0);let e=D.map(async e=>e.type&&x.includes(e.type)?new File([await (0,h.Z)(e,{maxSizeMB:r.fM})],e.name,{type:e.type}):e),t=await Promise.all(e),a=t.filter(e=>e.size>r.fT).map(e=>e.name);if(a.length){y({type:"Danger",title:"Error",body:"Selected file(s) (".concat(a,") exceeds maximum allowed size (").concat(r.fM,"MB). Please reduce your file size and try again.")}),Z(!1);return}let n=(0,r.Dr)(P);for(let e of j(t)){let t=new FormData;if(e.forEach(e=>{t.append("files",e)}),!(await fetch(n,{method:"POST",body:t})).ok){y({type:"Danger",title:"Error",body:"Failed to upload medical form. Please check your file and try again."}),Z(!1);return}}await N(),z(Date.now()),Z(!1)};return(0,n.jsxs)(n.Fragment,{children:[("Medical Form Required"===C||k&&!C)&&(0,n.jsxs)(m.Z,{title:"Upload Medical Form",backUrl:r.JO.medicalForm(E),children:[(0,n.jsx)("p",{className:"heading",children:"Upload your accomplished medical form here."}),(0,n.jsx)("p",{children:"Please upload your medical form, duly accomplished by a medical doctor or nurse practitioner here. An Outward Bound Medical Screener/Nurse will screen this and we'll get back to you regarding the final acceptance and confirmation of your enrolment."}),(0,n.jsx)(p.Z,{className:"mt-5",selectedFiles:D,setSelectedFiles:M,accept:"application/pdf,image/*",multiple:!0}),(0,n.jsx)(f.Z,{type:"button",className:"btn btn-primary theme--accent mt-5 w-100 justify-content-center text-uppercase",disabled:!D.length,isLoading:S,buttonText:"Submit Form",onClick:async()=>{y({type:"Warning",title:"Confirm Submission",body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:"Please confirm your file for submission. To replace the Medical Form file after you've submitted will require you to contact us directly."}),(0,n.jsxs)("div",{className:"d-flex gap-3",children:[(0,n.jsx)("button",{className:"mt-3 btn btn-sm btn-primary text-uppercase col",type:"button",onClick:B,children:"Confirm"}),(0,n.jsx)("button",{type:"button",className:"mt-3 btn btn-sm btn-outline-primary text-uppercase col",onClick:()=>v(),children:"Cancel"})]})]})})}})]}),"Medical Form Received"===C&&(0,n.jsxs)(m.Z,{title:"Medical Form Submitted",backUrl:r.cn,children:[(0,n.jsx)("p",{className:"heading",children:"Your Medical Form was successfully submitted."}
1),(0,n.jsx)("p",{children:"Thank you for submitting your Medical Form. Our Outward Bound Medical Screener is currently reviewing your information to finalise your acceptance. We will be in touch shortly with an update regarding your enrolment status. We appreciate your patience during this process."}),null==U?void 0:U.map(e=>{let{File_Name:t,id:a}=e,i=t.lastIndexOf("."),s=i>=0,l=s?t.slice(0,i):t,c=s?t.slice(i+1):void 0;return(0,n.jsx)(d.P,{className:"mt-5",extension:c,title:l,footer:(0,n.jsxs)("button",{type:"button",className:"btn btn-link d-flex gap-1 p-0",onClick:async()=>{O(a);let e="".concat((0,r.Dr)(P),"/").concat(a);await fetch(e).then(e=>e.arrayBuffer()).then(e=>{g()(e,t)}).catch(e=>{y({type:"Danger",title:"Error",body:"Failed to download attachment. Please try again."}),(0,o.ZP)({error:e,customData:{contactId:P,fullFilename:t,attachmentId:a}})}).finally(()=>{O(void 0)})},children:["Download",(0,n.jsx)(u.Z,{asset:"/assets/ic-download.svg",width:16,height:16})]}),downloading:_===a},a)})]})]})})}},function(e){e.O(0,[7479,2311,4380,8521,5756,9607,221,408,6196,3879,2888,9774,179],function(){return e(e.s=5432)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.