import{r as i,h as e,H as t,g as a}from"./p-a0569a5f.js";import{I as s}from"./p-f7077f5c.js";import{c as r}from"./p-908ea343.js";import{I as n}from"./p-1dd4a9a0.js";import"./p-7737f905.js";import"./p-d343a062.js";import"./p-f46dff5e.js";let o=class{constructor(e){i(this,e),this.itemFetchState=n.init(),this.needsToFetchData=!1}componentWillLoad(){const{apiData:i,params:e={},view:t}=this;if(this.needsToFetchData=!!e.itemId,!this.needsToFetchData)return;const{query:a,table:r}=t;this.itemDataProvider=new s(i,e,r,a,(null==a?void 0:a.fields)||t.table.fields,(i=>{this.itemFetchState=i})),this.itemDataProvider.fetchData(this.itemFetchState)}componentDidUpdate(){const{itemFetchState:i}=this;i.data||i.isPending||i.error||this.itemDataProvider.fetchData(this.itemFetchState)}onInvalidation(i){var e;this.view._id===i.detail.targetViewId?this.invalidate(i):null===(e=this.el.querySelector(`#${i.detail.targetViewId}`))||void 0===e||e.invalidate(i)}async invalidate(i){this.itemDataProvider.fetchData(this.itemFetchState)}render(){const{appConfig:i,itemFetchState:a,needsToFetchData:s,view:n}=this,{ui:o}=n,l=a.data,p=o.gutters||"calc(4 * var(--spacing-unit)",c="horizontal"===o.layout&&o.views.some((i=>!!i.title)),v={appConfig:i,apiAtama:this.apiAtama,apiData:this.apiData,apiTakvim:this.apiTakvim,apiUye:this.apiUye,appContextInvalidator:this.appContextInvalidator,apiSozluk:this.apiSozluk,logger:this.logger,membership:this.membership,navigate:this.navigate,notifier:this.notifier,user:this.user,userSettings:this.userSettings};return e(t,{class:{[o.layout]:!0}},(!s||a.data||!a.isPending&&!a.error)&&e("div",{class:"view-wrappers-container",style:{flexDirection:"vertical"===o.layout?"column":"row"}},o.views.map((t=>{const{description:a,height:s,params:n={conversionConfig:{}},title:o,viewId:m,viewTag:h,weights:d}=t;let w,f=h;f||(w=i.getView(m),w&&(f=function(i){return`dvn-app-view-${i.type}`}(w)));const g=n?Object.assign(Object.assign({},n),r(n.conversionConfig,{item:l})):{};return e("div",{class:"view-wrapper",style:{"--composite-view-gutter":p,"--weigh":`${(null==d?void 0:d.small)||1}`,height:s}},(o||c)&&e("div",{class:"ml-2 mb-2"},e("small",null,e("b",null,o," ")),a&&e("small",null,e("br",null),a)),e(f,Object.assign({},v,{key:m,id:m,item:l,params:g,view:w})))}))),s&&a.isPending&&!a.data&&e("div",{class:"d-flex flex-grow-1 align-items-center justify-content-center detail-view-progress-container"},e("dvn-progress",{indefinite:!0,tint:"primary"})),a.error&&e("div",{class:"d-flex flex-grow-1 align-items-center justify-content-center flex-column detail-view-progress-container"},"Fetching data failed.",e("dvn-button",{onClick:()=>this.itemDataProvider.fetchData(this.itemFetchState)},"Retry")))}get el(){return a(this)}};o.style="dvn-app-view-composite-view-linear{margin-top:calc(4 * var(--spacing-unit));margin-bottom:calc(4 * var(--spacing-unit));--composite-view-gutter:calc(4 * var(--spacing-unit));--weigh:1;display:-ms-flexbox;display:flex}dvn-app-view-composite-view-linear .view-wrappers-container{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1}dvn-app-view-composite-view-linear.horizontal>.view-wrappers-container>.view-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:var(--weigh);flex:var(--weigh);margin-right:var(--composite-view-gutter)}dvn-app-view-composite-view-linear.horizontal>.view-wrappers-container>.view-wrapper:last-child{margin-right:0}dvn-app-view-composite-view-linear.vertical>.view-wrappers-container>.view-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin-bottom:var(--composite-view-gutter)}";export{o as dvn_app_view_composite_view_linear}