import{hM as m,hN as d,dF as v,o as h,r as k,E as C,p as L,hO as y,L as P,hP as b,hQ as x,hR as N,I as g,y as I,hS as w,hT as O,hU as T,hV as S,hW as V,hX as f,hY as A}from"./app-k0jcl5PQ.js";const E=m.template({1:function(t,i,o,s,a){return"disabled"},compiler:[8,">= 4.3.0"],main:function(t,i,o,s,a){var n,r=i??(t.nullContext||{}),l=t.hooks.helperMissing,c=t.escapeExpression,e=t.lookupProperty||function(p,u){if(Object.prototype.hasOwnProperty.call(p,u))return p[u]};return`<div class="p-3">
  <a class="btn previous-applink btn-outline-dark `+((n=e(o,"unless").call(r,(n=(n=i!=null?e(i,"options"):i)!=null?e(n,"cursors"):n)!=null?e(n,"previous"):n,{name:"unless",hash:{},fn:t.program(1,a,0),inverse:t.noop,data:a,loc:{start:{line:2,column:50},end:{line:2,column:105}}}))!=null?n:"")+'">'+c((e(o,"lang")||i&&e(i,"lang")||l).call(r,"previous",{name:"lang",hash:{},data:a,loc:{start:{line:2,column:107},end:{line:2,column:126}}}))+`</a>
  <a class="btn next-applink btn-outline-dark `+((n=e(o,"unless").call(r,(n=(n=i!=null?e(i,"options"):i)!=null?e(n,"cursors"):n)!=null?e(n,"next"):n,{name:"unless",hash:{},fn:t.program(1,a,0),inverse:t.noop,data:a,loc:{start:{line:3,column:46},end:{line:3,column:97}}}))!=null?n:"")+'">'+c((e(o,"lang")||i&&e(i,"lang")||l).call(r,"next",{name:"lang",hash:{},data:a,loc:{start:{line:3,column:99},end:{line:3,column:114}}}))+`</a>
</div>`},useData:!0});class U extends d{constructor(i){super(i)}get defaults(){return{cursors:{},cursorParamName:"cursor"}}get name(){return"PaginationComponent"}get template(){return E}get lang(){return"shared._pagination"}get appLinks(){const i={};if(!this.options.cursors)return{};if(this.options.cursors.previous){const o=this.options.cursors.previous,s=this.buildCursor(this.options.cursors.previous,!0);+o<=1&&this.options.allowFirstPageCursor!==!0&&delete s.params.cursor,i[".previous-applink"]=s}return this.options.cursors.next&&(i[".next-applink"]=this.buildCursor(this.options.cursors.next)),i}events(){return{"click .previous-applink":"onClickPrevious","click .next-applink":"onClickNext"}}buildCursor(i,o){const s=this.options.appLink.params;return o?s!=null&&s.previous?{application:this.options.appLink.application,action:this.options.appLink.action,args:this.options.appLink.args,params:{cursor:s==null?void 0:s.previous}}:{application:this.options.appLink.application,action:this.options.appLink.action,args:this.options.appLink.args}:{application:this.options.appLink.application,action:this.options.appLink.action,args:this.options.appLink.args,params:v({},this.options.appLink.params,{[this.options.cursorParamName]:i,previous:s.cursor})}}onClickPrevious(){this.logAction("previous")}onClickNext(){this.logAction("next")}logAction(i){const o=h.mergeOptions(this.options.analyticsOptions,{location:L.Pagination,entity:C.Pagination,actionType:k.Navigate}),s={id:this.options.collectionId,page:i};h.logUserAction(s,o)}viewOptions(){return{cursors:this.options.cursors}}onBeforeRender(){return!!this.options.cursors}}const D=m.template({compiler:[8,">= 4.3.0"],main:function(t,i,o,s,a){var n,r=t.escapeExpression,l=t.lookupProperty||function(c,e){if(Object.prototype.hasOwnProperty.call(c,e))return c[e]};return'<div class="'+r(t.lambda((n=i!=null?l(i,"options"):i)!=null?l(n,"containerClass"):n,i))+`">
  <h1 class="header border-bottom pb-2 m-0">`+r((l(o,"lang")||i&&l(i,"lang")||t.hooks.helperMissing).call(i??(t.nullContext||{}),"notifications",{name:"lang",hash:{},data:a,loc:{start:{line:2,column:44},end:{line:2,column:68}}}))+`</h1>
  <div class="list-region"></div>
  <div class="pagination-region"></div>
</div>`},useData:!0});class M extends y{constructor(i){super(i)}get name(){return"NotificationsView"}get title(){return P.getPhrase(this.lang,"title")}get lang(){return"notifications.notifications"}get template(){return D}regions(){return{notifications:{replaceElement:!0,el:".list-region",partialLoading:{component:N.ComponentCollection,options:{collectionLength:5,childOptions:{template:x,className:"px-1 py-2",viewOptions:{styles:b}}}}},pagination:{replaceElement:!0,el:".pagination-region"}}}initialize(){this.notificationService=g.getInstance(I.Notification,this),this.appVariables=g.getInstance(w.NOTIFICATIONS,this)}onData(i){this.collection=i,this.render()}getCollectionIdentifier(){return this.collectionIdentifier?this.collectionIdentifier:this.collectionIdentifier=new O({collectionPrefix:T.NOTIFICATIONS,...this.options.params})}renderNotificationList(){const i=new S({collection:this.collection,childType:V.Default,liteUrl:this.config instanceof f?this.config.get("liteUrl"):this.config.liteUrl,libraryEditorUrl:this.config instanceof f?this.config.get("libraryEditorUrl"):this.config.libraryEditorUrl,hasLite:this.options.hasLite});this.showChildView("notifications",i)}renderPagination(){if(!this.collection.length)return;const i=this.notificationService.getNotificationsCursors(this.getCollectionIdentifier()),o=new U({cursors:i,appLink:{...this.appVariables.appLinks.notifications,args:[],params:this.getCollectionIdentifier().toParams()}});this.showChildView("pagination",o)}get requiredResources(){return{config:A.config}}viewOptions(){var i;return{containerClass:((i=this.appVariables)==null?void 0:i.notificationsViewClassNames)??""}}onBeforeRender(){return this.collection||this.notificationService.getNotifications(this.options.params,this.getCollectionIdentifier(),i=>this.onData(i)),!!this.collection}onRender(){this.renderNotificationList(),this.renderPagination()}}export{M as NotificationsView};
//# sourceMappingURL=CoYrSXp_.chunk.js.map
