1/*! For license information please see 3242.505e353a.chunk.js.LICENSE.txt */ 2(globalThis.webpackChunkvuexy_react_admin_dashboard||=[]).push([[3242],{31388(e,i,t){"use strict";var o=t(65043),n=t(30064),l=t.n(n),a=t(41981);const d=t.n(a)()(l()),s=e=>{let{open:i,toggle:t,acceptClick:n,dismissClick:l,confirmButtonText:a="Save",cancelButtonText:s="Leave",showCancelButton:r=!0}=e;return(0,o.useEffect)(()=>{i&&(async()=>{const e=await d.fire({title:"Warning!",html:'<div style="margin-top: 1px; font-size: 18px; line-height: 1.5;padding: 0 30px;">\n Data has not been saved. Are you sure you want to leave this page?\n </div>',icon:"warning",showCancelButton:r,confirmButtonText:a,cancelButtonText:s,customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-danger ms-1"},buttonsStyling:!1,allowOutsideClick:!1,allowEscapeKey:!1});e.isConfirmed?await n():r&&e.isDismissed&&l(),t()})()},[i]),null};t.d(i,["A",0,s])},6296(e,i,t){"use strict";t.r(i),t.d(i,{default:()=>R});var o=t(65043),n=t(72643),l=t(9370),a=t(73686),d=t(2177),s=t(39546),r=t(1275),u=t(86178),c=t.n(u),v=t(18456),p=t(90338),m=t(34533),f=t(22411),h=t(40375),A=t(36799),g=t(31289),E=t(43103),D=t(2143),y=t(12171),S=t(25384),_=(t(45817),t(24293)),I=t(91735),b=t(70579);const T=e=>{var i,t,l,a,d,s,r,u;let{stepper:c,totalAmount:v,fees:p,handlePaymentProceed:m,formDetail:f,invoiceLoading:h,paymentLoading:A,applicationFormData:g,applicationData:E,getPaymentLink:D,setApplicationFormData:y,step:T,submitLoading:C}=e;const[L,N]=(0,o.useState)(0),[P,w]=(0,o.useState)({method:"online",creditCard:"visa",chequeNo:"001234"}),[R,O]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e;const i=()=>{const e=(null===E||void 0===E?void 0:E.ApplicationNo)||(null===E||void 0===E?void 0:E.InvoicePkey)||(null===E||void 0===E?void 0:E._id);if(!e)return;const i=`PAY_LOCK_${e}`,t=localStorage.getItem(i);if(t){Date.now()-parseInt(t,10)<6e5?O(!0):(O(!1),localStorage.removeItem(i))}else O(!1)};return i(),e=setInterval(i,5e3),()=>clearInterval(e)},[E]);const M=()=>{const e=(null===E||void 0===E?void 0:E.ApplicationNo)||(null===E||void 0===E?void 0:E.InvoicePkey)||(null===E||void 0===E?void 0:E._id);e&&(localStorage.setItem(`PAY_LOCK_${e}`,Date.now().toString()),O(!0))};return(0,o.useEffect)(()=>{y(e=>({...e,payment:P}))},[P,y]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsxs)("div",{className:"payment-card",children:[(0,b.jsxs)("div",{className:"payment-left",children:[(0,b.jsx)("p",{children:"Total"}),(0,b.jsx)("h1",{children:(0,b.jsxs)("b",{children:["HK$",v,".00"]})}),(0,b.jsx)("hr",{}),p.map((e,i)=>{var t;return(0,b.jsxs)("div",{className:"d-flex justify-content-between",children:[(0,b.jsxs)("p",{children:["(",i+1,") ",(null===(t=e.detail)||void 0===t?void 0:t.Fee_Name)||("AF"===e.type?"Application Fee":"Renewal Fee")]}),(0,b.jsxs)("b",{children:["HK$",e.amount,".00"]})]},i)})]}),(0,b.jsx)("div",{className:"payment-right",children:(0,b.jsxs)("div",{className:"mb-1",children:[(0,b.jsx)("div",{className:"d-flex justify-content-between align-items-center cursor-pointer",children:(0,b.jsx)(S.A,{label:"Online Payment",color:"primary",name:"paymentMethod",value:"online",onClick:()=>{return N("online"===(e="online")?0:1),void w(i=>({...i,method:e}));var e},checked:"online"===P.method})}),(0,b.jsx)(n.SD,{isOpen:0===L,children:(0,b.jsx)("p",{children:"Application fee is non-refundable."})})]})})]})}),R&&!((null===E||void 0===E||null===(i=E.OfficeUse)||void 0===i||null===(t=i.GeneralWorkflow)||void 0===t?void 0:t.ApplicationStatus)===(null===I.f8||void 0===I.f8?void 0:I.f8.SUBMITTED_PAID)||null!==E&&void 0!==E&&E.PaymentCompleted)&&(0,b.jsxs)("div",{className:"alert alert-warning mt-2 mb-0 p-1",children:[(0,b.jsx)("h5",{style:{color:"#000",fontWeight:600},children:"Remarks:"}),(0,b.jsx)("p",{style:{color:"#999999",fontWeight:500},children:"Payment is processing. The payment button is disabled for 10 minutes to prevent duplicate transactions and will re-enable automatically if the payment does not complete."}),(0,b.jsx)("p",{style:{color:"#999999",fontWeight:500},children:"Please allow up to 10 minutes for the application status to update. "})]}),(0,b.jsx)(_.A,{formDetail:f,stepper:c,handleSubmit:async()=>{},step:T,showProceedBtn:!(null!==E&&void 0!==E&&E.InvoicePkey)&&![I.f8.WITHDRAW,I.f8.REJECT,I.f8.NOT_PROCEED_ASSESSMENT,I.f8.COMPLETED].includes(null===E||void 0===E||null===(l=E.OfficeUse)||void 0===l||null===(a=l.GeneralWorkflow)||void 0===a?void 0:a.ApplicationStatus),getPaymentLink:()=>{R||("cheque"!==P.method&&M(),D(null===E||void 0===E?void 0:E.InvoicePkey))},showPayButton:!(null===E||void 0===E||!E.InvoicePkey)&&![I.f8.WITHDRAW,I.f8.REJECT,I.f8.NOT_PROCEED_ASSESSMENT,I.f8.COMPLETED].includes(null===E||void 0===E||null===(d=E.OfficeUse)||void 0===d||null===(s=d.GeneralWorkflow)||void 0===s?void 0:s.ApplicationStatus),handlePaymentProceed:()=>{R||("cheque"!==P.method&&M(),m())},submitLoading:h,paymentLoading:A,disableButton:[I.f8.SUBMITTED_PAID,I.f8.COMPLETED].includes(null===E||void 0===E||null===(r=E.OfficeUse)||void 0===r||null===(u=r.GeneralWorkflow)||void 0===u?void 0:u.ApplicationStatus)||(null===E||void 0===E?void 0:E.PaymentCompleted),disableSubmit:R})]})},C=o.memo(T);
2var L=t(88667),N=t(6468),P=t(24401),w=t(31388);const R=(0,a.Ng)(e=>{var i;return{code:null===e||void 0===e||null===(i=e.application)||void 0===i?void 0:i.code}},null)(e=>{var i,t,u,S;const _=(0,o.useRef)(null),{code:T}=l.parse(window.location.search),R=(0,a.wA)(),O=(0,v.W6)(),M=(0,v.zy)(),B=null===M||void 0===M||null===(i=M.state)||void 0===i?void 0:i.preview,x=null===M||void 0===M||null===(t=M.state)||void 0===t?void 0:t.step,[F,k]=(0,o.useState)(B||!1),[j]=(0,o.useState)(!T),[$,G]=(0,o.useState)([]),[U,V]=(0,o.useState)({}),[H,K]=(0,o.useState)({}),[Q,W]=(0,o.useState)({}),[q,Y]=(0,o.useState)([]),[z,J]=(0,o.useState)(!1),[X,Z]=(0,o.useState)([]),[ee,ie]=(0,o.useState)([]),[te,oe]=(0,o.useState)([]),[ne,le]=(0,o.useState)([]),[ae,de]=(0,o.useState)([]),[se,re]=(0,o.useState)([]),[ue,ce]=(0,o.useState)({}),[ve,pe]=(0,o.useState)(!1),[me,fe]=(0,o.useState)(!1),[he,Ae]=(0,o.useState)(!1),[ge,Ee]=(0,o.useState)(null),[De,ye]=(0,o.useState)(!1),[Se,_e]=(0,o.useState)(!1),[Ie,be]=(0,o.useState)(!1),[Te,Ce]=(0,o.useState)(0),[Le,Ne]=(0,o.useState)(!0),[Pe,we]=(0,o.useState)(0),[Re,Oe]=(0,o.useState)([]),[Me,Be]=(0,o.useState)(!1),[xe,Fe]=(0,o.useState)([]),[ke,je]=(0,o.useState)([]),$e=(0,o.useRef)(!1),Ge=((0,o.useRef)(null),(0,o.useRef)(!1)),Ue=(0,o.useRef)(!1),Ve=(0,o.useRef)(!1),He=(0,o.useRef)(!0),Ke=(0,o.useRef)(null),Qe=(0,o.useRef)(""),We=[8,9,10],qe=(0,a.d4)(e=>e.application.gradeOfMembership),Ye=(0,a.d4)(e=>{var i;return null===(i=e.application)||void 0===i?void 0:i.ERBMemberData}),ze=(0,o.useCallback)(()=>{Ne(!1)},[]),Je=async e=>{const i=(0,s.gL)();be(!0);const t=(null===i||void 0===i?void 0:i.company_code)||"siia";fetch(`https://invoice-api.hkie.org.hk/api/application/invoice/detail/${t}/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(async e=>{const i=await e.json();var t,o,n,l,a;200===i.MsgCode?(window.open(null===i||void 0===i||null===(t=i.Data)||void 0===t?void 0:t.OnlinePaymentLink),_e(!1),be(!1)):(0,s.jU)(null===i||void 0===i||null===(o=i.Data)||void 0===o||null===(n=o.error)||void 0===n||null===(l=n.details)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)}).catch(e=>console.log("error",e))},Xe=async i=>{var t,o,n,l,a,r,u,v,p,m,f,h,A,g,E;_e(!0);const D=(0,s.gL)(),y="cheque"!==(null===U||void 0===U||null===(t=U.payment)||void 0===t?void 0:t.method)?"LE0028":"LE0029",S=(null===i||void 0===i||null===(o=i.ApplicationGroupID)||void 0===o?void 0:o.toString())||(null===i||void 0===i||null===(n=i.ApplicationNo)||void 0===n?void 0:n.toString()),_=(null===i||void 0===i||null===(l=i.ApplicationDetails)||void 0===l||null===(a=l.PersonalDetails)||void 0===a?void 0:a.Title)||"",I=(null===i||void 0===i||null===(r=i.ApplicationDetails)||void 0===r||null===(u=r.PersonalDetails)||void 0===u?void 0:u.Surname)||"",b=(null===i||void 0===i||null===(v=i.ApplicationDetails)||void 0===v||null===(p=v.PersonalDetails)||void 0===p?void 0:p.FamilyName)||"",C=`${_?`${_} `:""}${null===I||void 0===I?void 0:I.toUpperCase()} ${b}`.trim();let N=Re.map(e=>{var t,o,n,l,a;return{BranchNo:"erb",RefOrderType:"ERB",RefOrderNo:S,RefType:"",RefNo:"",RefParentNo:"",RelateRefNo:"",BusinessDescription:"",ProductNo:(null===(t=e.detail)||void 0===t?void 0:t.Fee_Code)||"application-fee",ProductName:(null===(o=e.detail)||void 0===o?void 0:o.Fee_Name)||"Application Fee",ProductDescription:`${(null===(n=e.detail)||void 0===n?void 0:n.Fee_Name)||"Application Fee"} ${null===i||void 0===i||null===(l=i.ApplicationNo)||void 0===l?void 0:l.toString()}`,ServiceName:"",GroupType:(null===(a=e.detail)||void 0===a?void 0:a.Fee_Type)||"Application Fee",CostType:"",ReimbursementFg:!1,Unit:"",Qty:1,UnitPrice:e.amount||0,Discount:0,Amount:e.amount||0,TaxItem:[]}});const P={InvoiceType:"ERB",BusinessSystemCode:"HKIE-ERB",BusinessDescription:[null===i||void 0===i||null===(m=i.ApplicationDetails)||void 0===m||null===(f=m.PersonalDetails)||void 0===f?void 0:f.HKIDCardNo,(null===i||void 0===i||null===(h=i.ApplicationDetails)||void 0===h||null===(A=h.PersonalDetails)||void 0===A?void 0:A.MemberShipNo)||(null===i||void 0===i?void 0:i.MemberShipNo)].filter(
2Boolean).join(", "),RefOrderType:"ERB",RefOrderNo:S,CITFg:!1,IssueDate:c()().format("YYYY-MM-DD"),IssueBy:"",BranchNo:"erb",BranchName:"ERB",BillBy:y,BillByName:"Online Payment (0028)",CustomerNo:S,CustomerName:`${C} (${S})`,CustomerInformation:"",ContactPerson:"",CountryNo:"",StateProvinceNo:"",CityNo:"",CustomerVatNo:"",Address:"",Email:(null===i||void 0===i||null===(g=i.ApplicationDetails)||void 0===g||null===(E=g.PersonalDetails)||void 0===E?void 0:E.EMAIL)||(null===D||void 0===D?void 0:D.userEmail)||"",OfficeTel:"",PostalCode:"",BankNo:"",AdditionalCompanyNo:"",AdditionalCompanyName:"",AdditionalCompanyCountryNo:"",AdditionalCompanyStateProvinceNo:"",AdditionalCompanyCityNo:"",AdditionalCompanyAddress:"",AdditionalCompanyEmail:"",AdditionalCompanyOfficeTel:"",AdditionalCompanyVatNo:"",AdditionalCompanyPostalCode:"",BillingCurrency:"HKD",DisplayCurrencyFg:!1,DisplayCurrency:"",PaymentTerm:"COD",DueDate:"",AssignedInvoiceNo:"",AssignedInvoiceDate:"",GovernmentInvoiceNo:"",ActualSupplierInvoiceNo:"",PaymentMethod:"Global Payment/ Aliy pay / FPS",Cash:0,ChequeNo:"",ReceivedBy:"",ReceivedDate:"",PaidDate:"",BankInDate:"",OurReference:"",PayInstruction:"",PartnerCompanyReference:"",CommissionEarner:"",CommissionCurrency:"",CommissionRate:0,Particulars:"",VendorReference:"",Note:"",CompanyTerms:"",InternalComments:"",product:N,dynamicform:[]},w=(null===D||void 0===D?void 0:D.company_code)||"siia";fetch(`https://invoice-api.hkie.org.hk/api/application/invoice/create/${w}`,{method:"POST",body:JSON.stringify(P),headers:{"Content-Type":"application/json"}}).then(async i=>{const t=await i.json();var o,n;200===t.MsgCode?(await(i=>{let t=(null===e||void 0===e?void 0:e.code)||T,o=`${null===L.A||void 0===L.A?void 0:L.A.EDIT_APPLICATION_DETAILS("ERB",t)}`;d.A.put(o,{InvoicePkey:i}).then(async e=>{var t;if(200===(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.MsgCode))Y({...q,InvoicePkey:i});else{var o,n,l,a;const i=(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.LongMsg)||(null===e||void 0===e||null===(n=e.data)||void 0===n?void 0:n.InternalMsg)||(null===e||void 0===e||null===(l=e.data)||void 0===l||null===(a=l.Data)||void 0===a?void 0:a.ShortMsg);(0,s.jU)("",null===i||void 0===i?void 0:i.toString().split(",").join("<br />"))}}).catch(e=>console.log(e,"err")).finally(()=>pe(!1))})(null===t||void 0===t||null===(o=t.Data)||void 0===o?void 0:o.InvoicePkey),await Je(null===t||void 0===t||null===(n=t.Data)||void 0===n?void 0:n.InvoicePkey)):(_e(!1),(0,s.jU)((null===t||void 0===t?void 0:t.ShortMsg)||(null===t||void 0===t?void 0:t.LongMsg)||(null===t||void 0===t?void 0:t.InternalMsg)))}).catch(e=>console.log("error",e))},Ze=async function(i){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(F&&!n)return void console.log("[SUBMIT] Skipped \u2014 In Preview Mode");if(ye(!0),Ve.current=!0,$e.current)return void console.log("[SUBMIT] API call already in progress, skipping...");let l={...i},a=(null===e||void 0===e?void 0:e.code)||T,r=a?t?`${null===L.A||void 0===L.A?void 0:L.A.SUBMIT_APPLICATION("ERB",a)}`:`${null===L.A||void 0===L.A?void 0:L.A.EDIT_APPLICATION_DETAILS("ERB",a)}`:`${null===L.A||void 0===L.A?void 0:L.A.ADD_APPLICATION_DETAILS("ERB")}`,u=a?t?"post":"put":"post",c=null!==q&&void 0!==q&&q.ApplicationNo?null===q||void 0===q?void 0:q.ApplicationNo:Math.floor((new Date).getTime()/1e3);const v=(0,s.gL)();let p={...q,FormType:"ERB",ApplicationType:"AF",MemberShipNo:(null===v||void 0===v?void 0:v.memberShipNo)||"",Description:null===ue||void 0===ue?void 0:ue.description,ApplicationNo:null===c||void 0===c?void 0:c.toString(),UserId:(null===v||void 0===v?void 0:v._id)||"",is_deleted:!1,ApplicationDetails:{...U,PersonalDetails:{...null===U||void 0===U?void 0:U.PersonalDetails,...Ke.current||{},...null===l||void 0===l?void 0:l.PersonalDetails},...l}};var m,f,h,A,g,E,D;t&&(p={...p,OfficeUse:{...p.OfficeUse,Roles:{...null===(m=p)||void 0===m||null===(f=m.OfficeUse)||void 0===f?void 0:f.Roles,SeniorManager:(null===(h=p)||void 0===h||null===(A=h.OfficeUse)||void 0===A||null===(g=A.Roles)||void 0===g?void 0:g.SeniorManager)||(null===ue||void 0===ue?void 0:ue.defaultSeniorManager)||""},GeneralWorkflow:{...null===(E=p)||void 0===E||null===(D=E.OfficeUse)||void 0===D?void 0:D.GeneralWorkflow,ApplicationStatus:null===I.f8||void 0===I.f8?void 0:I.f8.SUBMITTED_WAIT_FOR_PAYMENT}}});a?p.updateBy=null===v||void 0===v?void 0:v.userName:(p.createBy=(null===v||void 0===v?void 0:v.userName)||"",p.updateDate="",p.updateBy=""),Y({...q,...p}),pe(!0),$e.current=!0,d.A[u](r,p).then(async e=>{var i;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,l,d,r,u,c;
2if(re(null===(t=p)||void 0===t||null===(l=t.ApplicationDetails)||void 0===l||null===(d=l.Discipline)||void 0===d?void 0:d.map((e,i)=>{var t;return{value:e,label:`${null===(t=p)||void 0===t?void 0:t.ApplicationNo}-${i+1}`}})),!a&&null!==e&&void 0!==e&&null!==(r=e.data)&&void 0!==r&&null!==(u=r.Data)&&void 0!==u&&null!==(c=u[0])&&void 0!==c&&c._id){var v;const i=null===(v=e.data.Data[0])||void 0===v?void 0:v._id;R({type:"APPLICATION_CODE",data:i}),Ge.current=!0,Ue.current=!0,O.replace(`?code=${i}`),setTimeout(()=>{Ge.current=!1},100)}n?(Ge.current=!0,k(!0),Be(!0),O.push({pathname:M.pathname,search:M.search,state:{...M.state,preview:!0,step:Te+1}})):o&&(null===$||void 0===$||$.next())}else{var m,f,h;const i=(null===e||void 0===e||null===(m=e.data)||void 0===m?void 0:m.LongMsg)||(null===e||void 0===e||null===(f=e.data)||void 0===f?void 0:f.InternalMsg)||(null===e||void 0===e||null===(h=e.data)||void 0===h?void 0:h.ShortMsg);(0,s.jU)(i)}}).catch(e=>console.log(e,"err")).finally(()=>{pe(!1),$e.current=!1})},ei=(0,o.useCallback)(async()=>{if(We.includes(Te))return void console.log("[AUTOSAVE] Skipped \u2014 Preview/Payment step");if(F||(0,P.Im)(U))return;if($e.current||me)return void console.log("[AUTOSAVE] Save already in progress, skipping...");fe(!0),$e.current=!0;const i=(0,s.gL)();let t=l.parse(window.location.search).code||(null===e||void 0===e?void 0:e.code)||null,o=t?`${null===L.A||void 0===L.A?void 0:L.A.EDIT_APPLICATION_DETAILS("ERB",t)}`:`${null===L.A||void 0===L.A?void 0:L.A.ADD_APPLICATION_DETAILS("ERB")}`,n=t?"put":"post",a=null!==q&&void 0!==q&&q.ApplicationNo?null===q||void 0===q?void 0:q.ApplicationNo:Math.floor((new Date).getTime()/1e3),r={...q,FormType:"ERB",ApplicationType:"AF",MemberShipNo:(null===i||void 0===i?void 0:i.memberShipNo)||"",Description:null===ue||void 0===ue?void 0:ue.description,ApplicationNo:null===a||void 0===a?void 0:a.toString(),UserId:(null===i||void 0===i?void 0:i._id)||"",is_deleted:!1,ApplicationDetails:{...U,PersonalDetails:{...null===U||void 0===U?void 0:U.PersonalDetails,...Ke.current||{}}}};t?r.updateBy=null===i||void 0===i?void 0:i.userName:(r.createBy=(null===i||void 0===i?void 0:i.userName)||"",r.updateDate="",r.updateBy="");try{var u;const e=await d.A[n](o,r);if(200===(null===e||void 0===e||null===(u=e.data)||void 0===u?void 0:u.MsgCode)){var c,v,p,m,f;if(re(null===r||void 0===r||null===(c=r.ApplicationDetails)||void 0===c||null===(v=c.Discipline)||void 0===v?void 0:v.map((e,i)=>({value:e,label:`${null===r||void 0===r?void 0:r.ApplicationNo}-${i+1}`}))),!t&&null!==e&&void 0!==e&&null!==(p=e.data)&&void 0!==p&&null!==(m=p.Data)&&void 0!==m&&null!==(f=m[0])&&void 0!==f&&f._id){var h;const i=e.data.Data[0]._id;Y(null===(h=e.data)||void 0===h?void 0:h.Data[0]),R({type:"APPLICATION_CODE",data:i}),Ge.current=!0,Ue.current=!0,O.replace(`?code=${i}`),setTimeout(()=>{Ge.current=!1},100)}ye(!1),Ve.current=!1}else{var A,g,E,D;const i=(null===e||void 0===e||null===(A=e.data)||void 0===A?void 0:A.LongMsg)||(null===e||void 0===e||null===(g=e.data)||void 0===g?void 0:g.InternalMsg)||(null===e||void 0===e||null===(E=e.data)||void 0===E||null===(D=E.Data)||void 0===D?void 0:D.ShortMsg);console.error("[AUTOSAVE] Error:",i)}}catch(y){console.error("[AUTOSAVE] Error:",y)}finally{fe(!1),$e.current=!1}},[U,q,T,e,F,R,Te]),ii=(0,o.useRef)(!1);(0,o.useEffect)(()=>{var e,i,t;if(ii.current)return;const o=(null===q||void 0===q?void 0:q.MemberShipNo)||(null===Ye||void 0===Ye?void 0:Ye.MemberShipNo);o&&((null===q||void 0===q||null===(e=q.ApplicationDetails)||void 0===e||null===(i=e.ExistingQualification)||void 0===i||null===(t=i.Documents)||void 0===t?void 0:t.length)>0?ii.current=!0:(ii.current=!0,d.A.get(`${L.A.GET_ERB_MEMBER_DETAIL(o)}`).then(e=>{var i;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,o,n;const i=((null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o||null===(n=o[0])||void 0===n?void 0:n.ProfessionalQualification)||[]).map((e,i)=>({id:Date.now()+i,MembershipNo:(null===e||void 0===e?void 0:e.MembershipNo)||"",NameOfInstitution:(null===e||void 0===e?void 0:e.NameOfInstitution)||"",Grade:(null===e||void 0===e?void 0:e.Grade)||"",QualifiedDate:(null===e||void 0===e?void 0:e.QualifiedDate)||null}));V(t=>{var o,n,l;return{...t,ExistingQualification:{Documents:i},ExistingProfessionalQualificationMemberList:(null===e||void 0===e||null===(o=e.data)||void 0===o||null===(n=o.Data)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.ExistingProfessionalQualification)||[]}})}})))},[null===q||void 0===q?void 0:q.MemberShipNo,null===Ye||void 0===Ye?void 0:Ye.MemberShipNo]);const ti=[{id:"information",title:"Personal Details",step:0,content:(0,b.jsx)(p.A,{stepper:$,formDetail:ue,code:T,applicationData:q,personalDetailFormData:H,applicationFormData:U,handleFormSubmit:Ze,setApplicationFormData:V,submitLoading:ve,personalDataRef:Ke,onFormReady:ze,step:0})},{id:"discipline_apply_for",title:"Discipline Apply for",step:1,content:(0,b.jsx)(m.A,{stepper:$,formDetail:ue,applicationData:q,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,disciplineOptions:te,submitLoading:ve,step:1})},{id:"academic_qualification",title:"Academic Qualifications",step:2,content:(0,b.jsx)(f.A,{stepper:$,formDetail:ue,applicationData:q,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,academicOptions:X,fullTitleDegreeOptions:ne,getInstitutionDegreeList:async e=>{const i=await(0,N.Dq)(e);le(i)},modeOfStudyOptions:ae,submitLoading:ve,step:2})},{id:"HKIE_qualifications",title:"HKIE Qualification",step:3,content:(0,b.jsx)(E.A,{stepper:$,formDetail:ue,applicationData:q,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,disciplineOptions:te,gradeOfMembershipOptions:ke,submitLoading:ve,step:3})}
2,{id:"professional_qualification",title:"Professional Qualifications",step:4,content:(0,b.jsx)(h.A,{stepper:$,formDetail:ue,applicationData:q,erbMemberGradeOption:xe,nameOfAcademicOptions:ee,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,submitLoading:ve,academicOptions:X,step:4})},{id:"employment_details",title:"Employment Details",step:5,content:(0,b.jsx)(A.A,{stepper:$,formDetail:ue,applicationData:q,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,submitLoading:ve,step:5})},{id:"absence_from_hongkong",title:"Absence from Hong Kong",step:6,content:(0,b.jsx)(D.A,{stepper:$,formDetail:ue,applicationData:q,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,submitLoading:ve,step:6})},{id:"declaration_undertaking_consent",title:"Declaration, Undertaking and Consent",step:7,content:(0,b.jsx)(g.A,{stepper:$,formDetail:ue,applicationData:q,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,submitLoading:ve,step:7})}],oi=[...ti].sort((e,i)=>e.step-i.step),ni=[{id:"preview_and_submit",title:"Preview and Submit",hide:!1,step:10,content:(0,b.jsx)(y.A,{stepWizard:oi,formDetail:ue,applicationData:q,stepper:$,handleFormSubmit:Ze,personalDataRef:Ke,applicationFormData:U,setApplicationFormData:V,applicationNoList:se,submitLoading:ve,step:10})},{id:"payment",title:"Payment",hide:!1,step:11,content:(0,b.jsx)(C,{stepper:$,totalAmount:Pe,fees:Re,invoiceLoading:Se,formDetail:ue,handlePaymentProceed:async()=>{await Xe(q)},applicationData:q,getPaymentLink:Je,applicationFormData:U,setApplicationFormData:V,handleFormSubmit:Ze,submitLoading:Se,paymentLoading:Ie,step:11})}],li=(0,o.useCallback)(()=>{d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.GET_DICT_DATA_LIST("erb-grade-type")}`).then(e=>{var i,t;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)&&null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.Data){var o,n;const i=null===e||void 0===e||null===(o=e.data)||void 0===o||null===(n=o.Data)||void 0===n?void 0:n.map(e=>({value:null===e||void 0===e?void 0:e.dictValue,label:null===e||void 0===e?void 0:e.dictLabel}));Fe(i)}}).catch(e=>{console.log(e,"err")})},[]),ai=()=>{var e;const i=qe||(null===U||void 0===U||null===(e=U.HKIEQualification)||void 0===e?void 0:e.GradeOfMembership);console.log("[ERB] Fetching fees (AF & RF) for grade:",i);const t=e=>d.A.post(`${null===L.A||void 0===L.A?void 0:L.A.GET_ERB_PAYMENT_AMOUNT(e)}`,{GradeOfMember:i||""});Promise.all([t("AF"),t("RF")]).then(e=>{const i=[];let t=0;e.forEach((e,o)=>{var n,l,a;const d=0===o?"AF":"RF";if(200===(null===e||void 0===e||null===(n=e.data)||void 0===n?void 0:n.MsgCode)&&null!==e&&void 0!==e&&null!==(l=e.data)&&void 0!==l&&null!==(a=l.Data)&&void 0!==a&&a[0]){var s,r;const o=e.data.Data[0],n=(null===o||void 0===o||null===(s=o.PriceLevel)||void 0===s||null===(r=s[0])||void 0===r?void 0:r.Unit_Price)||0;n>0&&(i.push({type:d,amount:n,detail:o}),t+=n)}}),console.log("[ERB] Fees updated:",i),console.log("[ERB] Total amount updated to:",t),Oe(i),we(t)}).catch(e=>{console.error("[ERB] Error fetching fees:",e),J(!1)})};(0,o.useEffect)(()=>{d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.GET_DICT_DATA_LIST("mode_of_study_erb")}`).then(e=>{var i;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,o,n,l,a,d;(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o?void 0:o.length)>0&&(null===e||void 0===e||null===(a=e.data)||void 0===a||null===(d=a.Data)||void 0===d||d.sort((e,i)=>(null===e||void 0===e?void 0:e.dictSort)-(null===i||void 0===i?void 0:i.dictSort)));let i=null===e||void 0===e||null===(n=e.data)||void 0===n||null===(l=n.Data)||void 0===l?void 0:l.map(e=>({label:null===e||void 0===e?void 0:e.dictLabel,value:null===e||void 0===e?void 0:e.dictValue}));de(i)}}).catch(e=>{console.log(e,"err")}),d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.GET_MASTER_TABLE_LIST("institution-master")}`).then(e=>{var i;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,o,n;const i=null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o||null===(n=o.filter(e=>""!==(null===e||void 0===e?void 0:e.InstitutionCode)&&""!==(null===e||void 0===e?void 0:e.InstitutionName)))||void 0===n?void 0:n.map(e=>({value:null===e||void 0===e?void 0:e.InstitutionCode,label:null===e||void 0===e?void 0:e.InstitutionName}));Z(i)}}).catch(e=>{console.log(e,"err")}),d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.EXPORT_DISCIPLINE_MASTER_LIST()}`).then(e=>{var i,t;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)&&null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.Data){var o,n;const i=null===e||void 0===e||null===(o=e.data)||void 0===o||null===(n=o.Data)||void 0===n?void 0:n.map(e=>({value:null===e||void 0===e?void 0:e.DisciplineTypeCode,label:null===e||void 0===e?void 0:e.DisciplineTypeCode,name:null===e||void 0===e?void 0:e.DisciplineTypeName}));oe(i)}}).catch(e=>{console.log(e,"err")}),ai(),d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.GET_MASTER_TABLE_LIST("academic-master")}`).then(e=>{var i,t;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)&&null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.Data){var o,n;const i=null===e||void 0===e||null===(o=e.data)||void 0===o||null===(n=o.Data)||void 0===n?void 0:n.map(e=>({value:null===e||void 0===e?void 0:e.AcademicCode,label:null===e||void 0===e?void 0:e.AcademicName}));ie(i)}}).catch(e=>{console.log(e,"err")}),li(),d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.GET_DICT_DATA_LIST("hkiemembershipgrade_erb")}`).then(e=>{var i;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,o,n,l,a,d;(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o?void 0:o.length)>0&&(null===e||void 0===e||null===(a=e.data)||void 0===a||null===(d=a.Data)||void 0===d||d.sort((e,i)=>(null===e||void 0===e?void 0:e.dictSort)-(null===i||void 0===i?void 0:i.dictSort)));let i=null===e||void 0===e||null===(n=e.data)||void 0===n||null===(l=n.Data)||void 0===l?void 0:l.map(e=>({label:null===e||void 0===e?void 0:e.dictLabel,value:null===e||void 0===e?void 0:e.dictValue}));je(i)}}).catch(e=>{console.log(e,"err")}),T||(R((0,N.OK)("ERB")),R({type:"SET_GRADE_OF_MEMBERSHIP",data:""}))},[]),(0,o.useEffect)(()=>{qe!==Qe.current&&(console.log("[ERB] GradeOfMembership changed to:",qe),console.log("[ERB] Calling getErbRenewalAmount API..."),Qe.current=qe,ai())},[qe]),(0,o.useEffect)(()=>
2{if(!Ue.current){if(d.A.post(`${null===L.A||void 0===L.A?void 0:L.A.GET_FORM_MASTER("ERB")}`).then(e=>{var i,t,o;ce((null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.Data)||[]),R({type:"ERB_APPLICATION_DOCUMENTS_LIST",data:(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o?void 0:o.applicationDocumentsList)||[]})}).catch(e=>{console.log(e,"err")}),T)i=T,J(!0),R({type:"SET_LEFTLOADER",data:!0}),d.A.get(`${null===L.A||void 0===L.A?void 0:L.A.GET_APPLICATION_MEMBER_DETAILS("ERB",i)}`).then(e=>{var i;if(R({type:"SET_LEFTLOADER",data:!1}),200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,o,n,l,a,d,s,r,u,c,v,p,m,f,h,A,g,E,D,y,S,_,I;V(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o?void 0:o.ApplicationDetails);const i=null===e||void 0===e||null===(n=e.data)||void 0===n||null===(l=n.Data)||void 0===l||null===(a=l.ApplicationDetails)||void 0===a||null===(d=a.HKIEQualification)||void 0===d?void 0:d.GradeOfMembership;R(i?{type:"SET_GRADE_OF_MEMBERSHIP",data:i}:{type:"SET_GRADE_OF_MEMBERSHIP",data:""}),K({...H,...null===e||void 0===e||null===(s=e.data)||void 0===s||null===(r=s.Data)||void 0===r||null===(u=r.ApplicationDetails)||void 0===u?void 0:u.PersonalDetails}),W({...Q,...null===e||void 0===e||null===(c=e.data)||void 0===c||null===(v=c.Data)||void 0===v||null===(p=v.ApplicationDetails)||void 0===p?void 0:p.ProfessionalExperience}),Y(null===e||void 0===e||null===(m=e.data)||void 0===m?void 0:m.Data),R((0,N.mI)({MemberHistoryList:(null===e||void 0===e||null===(f=e.data)||void 0===f||null===(h=f.Data)||void 0===h?void 0:h.MemberHistoryList)||[],MemberShipNo:(null===e||void 0===e||null===(A=e.data)||void 0===A||null===(g=A.Data)||void 0===g?void 0:g.MemberShipNo)||"",MemberStatus:(null===e||void 0===e||null===(E=e.data)||void 0===E||null===(D=E.Data)||void 0===D?void 0:D.MemberStatus)||""})),re(null===e||void 0===e||null===(y=e.data)||void 0===y||null===(S=y.Data)||void 0===S||null===(_=S.ApplicationDetails)||void 0===_||null===(I=_.Discipline)||void 0===I?void 0:I.map((i,t)=>{var o,n;return{value:i,label:`${null===e||void 0===e||null===(o=e.data)||void 0===o||null===(n=o.Data)||void 0===n?void 0:n.ApplicationNo}-${t+1}`}})),J(!1)}},e=>{R({type:"SET_LEFTLOADER",data:!1}),J(!1)});else{var e;R({type:"SET_GRADE_OF_MEMBERSHIP",data:""}),V({}),Oe([]),we(0);const i=null===(e=(0,s.gL)())||void 0===e?void 0:e.memberShipNo;i&&d.A.get(`${L.A.GET_ERB_MEMBER_DETAIL(i)}`).then(e=>{var i;if(200===(null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.MsgCode)){var t,o,n;const i=(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.Data)||void 0===o||null===(n=o[0])||void 0===n?void 0:n.ProfessionalQualification)||[];if(i.length>0){const e=i.map((e,i)=>({id:Date.now()+i,MembershipNo:e.MembershipNo||"",NameOfInstitution:e.NameOfInstitution||"",Grade:e.Grade||"",QualifiedDate:e.QualifiedDate||null,Evidence:e.Evidence||null}));V(i=>({...i,ProfessionalQualification:{Documents:e}}))}}}).catch(e=>console.error("[ERB] PQ pre-population failed:",e))}var i;return()=>{R({type:"APPLICATION_CODE",data:""})}}console.log("\u23ed\ufe0f Skipping reload due to internal code update")},[T]),(0,o.useEffect)(()=>{if(He.current)return He.current=!1,void console.log("[ERB] Initial load, not marking as unsaved");(0,P.Im)(U)||(console.log("[ERB] Form data changed after initial load, marking as unsaved changes"),ye(!0),Ve.current=!0)},[U]);const di=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!We.includes(Te)&&!(He.current||F||(0,P.Im)(U))&&De)return console.log("[AUTOSAVE] Form data changed, scheduling auto-save in 3 seconds..."),di.current&&clearTimeout(di.current),di.current=setTimeout(()=>{console.log("[AUTOSAVE] Triggering auto-save after 3 seconds of inactivity..."),ei()},3e3),()=>{di.current&&(clearTimeout(di.current),di.current=null)}},[U,F,ei,De,Te]),(0,o.useEffect)(()=>{Ve.current=De,console.log("[ERB] hasUnsavedChanges:",De)},[De]),(0,o.useEffect)(()=>{console.log("[ERB] Registering navigation blocker");const e=O.block((e,i)=>{const t=Ve.current,o=!(0,P.Im)(U);return console.log("[ERB NAVIGATION]",{location:e.pathname,action:i,preview:F,pendingNavigation:ge,hasChanges:t,hasData:o,shouldAllow:Ge.current}),Ge.current?(console.log("[ERB] \u2705 Allowing navigation (user confirmed)"),!0):F||ge||!t&&!o?(console.log("[ERB] \u2705 Allowing navigation (no changes)"),!0):(console.log("[ERB] \ud83d\udeab BLOCKING - Showing confirmation"),Ee(e),Ae(!0),!1)});return()=>{console.log("[ERB] Cleaning up blocker"),e&&e()}},[O,F,ge,U]),(0,o.useEffect)(()=>{8===Te&&(console.log("\ud83d\udd04 Preview step reached \u2014 syncing PersonalDetails..."),V(e=>({...e,PersonalDetails:{...Ke.current}})))},[Te]),(0,o.useEffect)(()=>{Me&&F&&$&&(console.log("\ud83d\ude80 Advancing to next step after preview switch"),setTimeout(()=>{null===$||void 0===$||$.next(),Be(!1)},50))},[Me,F,$]);const si=o.useMemo(()=>0===Pe?["payment"]:[],[Pe]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w.A,{open:he,toggle:()=>{Ae(!1),Ee(null)},acceptClick:async()=>
2{if(!(0,P.Im)(U)){const e={...U,PersonalDetails:Ke.current};await Ze(e)}ye(!1),Ve.current=!1,Ae(!1),ge&&(Ge.current=!0,O.push(ge.pathname+ge.search),setTimeout(()=>{Ge.current=!1,Ee(null)},100))},dismissClick:async()=>{const i=l.parse(window.location.search).code||(null===e||void 0===e?void 0:e.code);j&&i&&(console.log("[ERB] Deleting session-created draft:",i),await(async e=>{try{await d.A.post(`${null===L.A||void 0===L.A?void 0:L.A.DELETE_USER_APPLICATION("ERB")}`,{IDS:[e]})}catch(i){console.log(i,"error in application delete")}})(i)),ye(!1),Ve.current=!1,Ae(!1),ge&&(Ge.current=!0,O.push(ge.pathname+ge.search),setTimeout(()=>{Ge.current=!1,Ee(null)},100))}}),(0,b.jsx)(n.aF,{isOpen:z||Le,centered:!0,backdrop:"static",keyboard:!1,style:{zIndex:1060},contentClassName:"bg-transparent border-0 shadow-none",children:(0,b.jsxs)(n.cw,{className:"text-center p-5 bg-white rounded shadow",children:[(0,b.jsx)(n.y$,{color:"primary"}),(0,b.jsx)("div",{className:"mt-2 font-weight-bold",style:{color:"#000",fontSize:"1.2rem"},children:"Please wait a moment..."})]})}),(0,b.jsx)(n.mc,{children:(0,b.jsx)(n.Zp,{className:"application_wizard",children:(0,b.jsxs)(n.bw,{children:[(0,b.jsx)("div",{className:"d-flex justify-content-between align-items-center",children:(0,b.jsx)("h4",{className:"mb-0",children:(0,b.jsx)("b",{children:null===ue||void 0===ue?void 0:ue.description})})}),z?(0,b.jsx)("div",{className:"text-center w-100 mt-5",children:(0,b.jsx)(n.y$,{})}):(0,b.jsx)(r.A,{type:"modern-horizontal",ref:_,steps:null===(u=[...oi,...ni])||void 0===u?void 0:u.filter(e=>!(null!==e&&void 0!==e&&e.hide)).map(e=>({...e,content:o.isValidElement(e.content)?o.cloneElement(e.content,{previewMode:Boolean(F)}):e.content})),options:{linear:!1},hideExtraSteps:si,instance:e=>G(e),headerNavigation:!0,disabledHeaderSteps:F?[]:["payment"],defaultStep:x,onStepChange:e=>{console.log("STEP CHANGED \u2192",e),Ce(e)}}),F&&10!==x&&9!==Te&&(0,b.jsx)("div",{className:"mt-5",children:null===ue||void 0===ue||null===(S=ue.applicationInstructions)||void 0===S?void 0:S.map((e,i)=>null!==e&&void 0!==e&&e.documentFile||null!==e&&void 0!==e&&e.url?(0,b.jsx)("a",{href:"#",className:"gray-link mr-2",onClick:async i=>{if(i.preventDefault(),null!==e&&void 0!==e&&e.url)window.open(null===e||void 0===e?void 0:e.url,"_blank");else{const i=await(0,s.CQ)(null===e||void 0===e?void 0:e.documentFile);i&&window.open(i,"_blank")}},children:null===e||void 0===e?void 0:e.titleName},i):(0,b.jsx)("p",{className:"gray-link",children:null===e||void 0===e?void 0:e.titleName},i))})]})})})]})})},45395(e){e.exports=function(){"use strict";function e(){return e=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},e.apply(this,arguments)}var i=window.Element.prototype.matches,t=function(e,i){return e.closest(i)},o=function(e,i){return new window.Event(e,i)},n=function(e,i){return new window.CustomEvent(e,i)};function l(){if(window.Element.prototype.matches||(i=window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector),window.Element.prototype.closest||(t=function(e,t){if(!document.documentElement.contains(e))return null;do{if(i.call(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}),window.Event&&"function"===typeof window.Event||(o=function(e,i){i=i||{};var t=document.createEvent("Event");return t.initEvent(e,Boolean(i.bubbles),Boolean(i.cancelable)),t}),"function"!==typeof window.CustomEvent){var e=window.Event.prototype.preventDefault;n=function(i,t){var o=document.createEvent("CustomEvent");return t=t||{bubbles:!1,cancelable:!1,detail:null},o.initCustomEvent(i,t.bubbles,t.cancelable,t.detail),o.preventDefault=function(){this.cancelable&&(e.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}))},o}}}l();var a=1e3,d={ACTIVE:"active",LINEAR:"linear",BLOCK:"dstepper-block",NONE:"dstepper-none",FADE:"fade",VERTICAL:"vertical"},s="transitionend",r="bsStepper",u=function(e,i,t,o){var l=e[r];if(!l._steps[i].classList.contains(d.ACTIVE)&&!l._stepsContents[i].classList.contains(d.ACTIVE)){var a=n("show.bs-stepper",{cancelable:!0,detail:{from:l._currentIndex,to:i,indexStep:i}});e.dispatchEvent(a);var s=l._steps.filter(function(e){return e.classList.contains(d.ACTIVE)}),u=l._stepsContents.filter(function(e){return e.classList.contains(d.ACTIVE)});a.defaultPrevented||(s.length&&s[0].classList.remove(d.ACTIVE),u.length&&(u[0].classList.remove(d.ACTIVE),e.classList.contains(d.VERTICAL)||l.options.animation||u[0].classList.remove(d.BLOCK)),c(e,l._steps[i],l._steps,t),v(e,l._stepsContents[i],l._stepsContents,u,o))}},c=function(e,i,t,o){t.forEach(function(i){var t=i.querySelector(o.selectors.trigger);t.setAttribute("aria-selected","false"),e.classList.contains(d.LINEAR)&&t.setAttribute("disabled","disabled")}),i.classList.add(d.ACTIVE);var n=i.querySelector(o.selectors.trigger);n.setAttribute("aria-selected","true"),e.classList.contains(d.LINEAR)&&n.removeAttribute("disabled")},v=function(e,i,t,o,l){var a=e[r],u=t.indexOf(i),c=n("shown.bs-stepper",{cancelable:!0,detail:{from:a._currentIndex,to:u,indexStep:u}});function v(){i.classList.add(d.BLOCK),i.removeEventListener(s,v),e.dispatchEvent(c),l()}if(i.classList.contains(d.FADE)){i.classList.remove(d.NONE);var f=p(i);i.addEventListener(s,v),o.length&&o[0].classList.add(d.NONE),i.classList.add(d.ACTIVE),m(i,f)}else i.classList.add(d.ACTIVE),i.classList.add(d.BLOCK),e.dispatchEvent(c),l()},p=function(e){if(!e)return 0;var i=window.getComputedStyle(e).transitionDuration;return parseFloat(i)?(i=i.split(",")[0],parseFloat(i)*a):0},m=function(e,i){var t=!1,n=i+5;function l(){t=!0,e.removeEventListener(s,l)}e.addEventListener(s,l),window.setTimeout(function(){t||e.dispatchEvent(o(s)),e.removeEventListener(s,l)},n)},f=function(e,i){i.animation&&e.forEach(function(e){e.classList.add(d.FADE),e.classList.add(d.NONE)})},h=function(){return function(e){e.preventDefault()}},A=function(e){return function(i){i.preventDefault();var o=t(i.target,e.selectors.steps),n=t(o,e.selectors.stepper),l=n[r],a=l._steps.indexOf(o);u(n,a,e,function(){l._currentIndex=a})}},g={linear:!0,animation:!1,selectors:{steps:".step",trigger:".step-trigger",stepper:".bs-stepper"}};return function(){function i(i,t){var o=this;void 0===t&&(t={}),this._element=i,this._currentIndex=0,this._stepsContents=[],this.options=e({},g,{},t),this.options.selectors=e({},g.selectors,{},this.options.selectors),this.options.linear&&this._element.classList.add(d.LINEAR),this._steps=[].slice.call(this._element.querySelectorAll(this.options.selectors.steps)),this._steps.filter(function(e){return e.hasAttribute("data-target")}
2).forEach(function(e){o._stepsContents.push(o._element.querySelector(e.getAttribute("data-target")))}),f(this._stepsContents,this.options),this._setLinkListeners(),Object.defineProperty(this._element,r,{value:this,writable:!0}),this._steps.length&&u(this._element,this._currentIndex,this.options,function(){})}var t=i.prototype;return t._setLinkListeners=function(){var e=this;this._steps.forEach(function(i){var t=i.querySelector(e.options.selectors.trigger);e.options.linear?(e._clickStepLinearListener=h(e.options),t.addEventListener("click",e._clickStepLinearListener)):(e._clickStepNonLinearListener=A(e.options),t.addEventListener("click",e._clickStepNonLinearListener))})},t.next=function(){var e=this,i=this._currentIndex+1<=this._steps.length-1?this._currentIndex+1:this._steps.length-1;u(this._element,i,this.options,function(){e._currentIndex=i})},t.previous=function(){var e=this,i=this._currentIndex-1>=0?this._currentIndex-1:0;u(this._element,i,this.options,function(){e._currentIndex=i})},t.to=function(e){var i=this,t=e-1,o=t>=0&&t<this._steps.length?t:0;u(this._element,o,this.options,function(){i._currentIndex=o})},t.reset=function(){var e=this;u(this._element,0,this.options,function(){e._currentIndex=0})},t.destroy=function(){var e=this;this._steps.forEach(function(i){var t=i.querySelector(e.options.selectors.trigger);e.options.linear?t.removeEventListener("click",e._clickStepLinearListener):t.removeEventListener("click",e._clickStepNonLinearListener)}),this._element[r]=void 0,this._element=void 0,this._currentIndex=void 0,this._steps=void 0,this._stepsContents=void 0,this._clickStepLinearListener=void 0,this._clickStepNonLinearListener=void 0},i}()}()},1621(){"use strict"}}]);
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.