import{h as s,F as e,r as i,c as t}from"./p-CV0Pyo1O.js";import{E as a}from"./p-Cu7hgXL1.js";import{B as r}from"./p-s8KSaX8d.js";import{m as o}from"./p-DAR2ZYdT.js";import{C as n,b as l}from"./p-DaIKrQry.js";import{J as d}from"./p-Bw3Rgnjn.js";import{c}from"./p-Bo7v8x6H.js";import{S as h}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as p}from"./p-uZ5KAseb.js";import"./p-CPKMvyV_.js";import"./p-C2jRLMNW.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BXrbGZ_R.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-Cb8cfh-k.js";import"./p-CqcLgdsl.js";const m=()=>{const i=()=>s("div",{class:"mt-5"},s(p,{width:"40%",height:"1.5rem"}),s("hr",null),s("div",{class:"row g-3"},s("div",{class:"col-12 col-md-6"},s(p,null),s(p,null),s(p,null)),s("div",{class:"col-12 col-md-6"},s(p,null),s(p,null),s(p,null))));return s(e,null,s(i,null),s(i,null),s(i,null),s(i,null))},u=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.loading=!0}componentWillLoad(){c(),this.analytics=new d(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetBusiness()}initializeGetBusiness(){this.businessId&&this.authToken?(this.getBusiness=o({id:this.businessId,authToken:this.authToken,service:new r}),this.fetchData()):(this.errorMessage="Invalid business id or auth token",this.errorEvent.emit({errorCode:l.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}updateOnPropChange(){this.getBusiness&&this.fetchData()}fetchData(){this.loading=!0,this.getBusiness({onSuccess:({business:s})=>{this.business=s,this.errorMessage=null},onError:({error:s,code:e,severity:i})=>{this.errorMessage=s,this.errorEvent.emit({errorCode:e,message:s,severity:i})},final:()=>{this.loading=!1}})}render(){return s(h,{key:"7ce48e6905cdbbf8f94470913ecfa3ef8dbb76c7"},this.loading&&s(m,{key:"7c3439e0c247436cd7951d3bdc32e7672c9f8447"}),!this.loading&&this.errorMessage&&a(this.errorMessage),!this.loading&&!this.errorMessage&&this.business&&s("justifi-details",{key:"bf57dacf2067f2704014ce3e002958e3306bba73",errorMessage:this.errorMessage},s("div",{key:"46d19a178ba0d33aa21a4f3900128e3e905731a9",slot:"detail-sections"},s("core-info-details",{key:"ac217a4cfe6b45810a85ca320760b7331f76e60b",business:this.business}),s("legal-address-details",{key:"1fc1a196a43bcf5f9eafd09bfe74c8bb7c409797",legalAddress:this.business.legal_address}),s("representative-details",{key:"1e0833606b129f69a05946726172963cbec05189",representative:this.business.representative}),s("owner-details",{key:"c974111dc67a8961ef6435c34843ca927ad8a7e5",owners:this.business.owners}),s("additional-questions-details",{key:"0951d284a373457e98a1dafc80231ec3ee057e0a",additionalQuestions:this.business.additional_questions}))))}static get watchers(){return{businessId:["propChanged"],authToken:["propChanged"],getBusiness:["updateOnPropChange"]}}};export{u as justifi_business_details}