"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[49851],{49851:(n,i,s)=>{s.r(i),s.d(i,{AddonModAssignSubmissionFileComponent:()=>S});var e=s(10467),o=s(5505),t=s(20218),l=s(4175),d=s(24942),a=s(55554),m=s(57102),p=s(66016),c=s(86654),f=s(15152),u=s(54438),r=s(60177),g=s(2910),b=s(95638),A=s(31498);function AddonModAssignSubmissionFileComponent_ion_item_0_Template(n,i){if(1&n&&(u.j41(0,"ion-item",2)(1,"ion-label")(2,"p",3),u.EFF(3),u.k0s(),u.j41(4,"div"),u.nrm(5,"core-files",4),u.k0s()()()),2&n){const n=u.XpG();u.R7$(3),u.JRh(n.plugin.name),u.R7$(2),u.Y8G("files",n.files)("component",n.component)("componentId",n.assign.cmid)("alwaysDownload",!0)}}function AddonModAssignSubmissionFileComponent_div_1_Template(n,i){if(1&n&&(u.j41(0,"div")(1,"ion-item-divider",5)(2,"ion-label")(3,"p",3),u.EFF(4),u.k0s()()(),u.nrm(5,"core-attachments",6),u.k0s()),2&n){const n=u.XpG();u.R7$(),u.Y8G("sticky",!0),u.R7$(3),u.JRh(n.plugin.name),u.R7$(),u.Y8G("files",n.files)("maxSize",n.maxSize)("maxSubmissions",n.maxSubmissions)("courseId",n.assign.course)("component",n.component)("componentId",n.assign.cmid)("acceptedTypes",n.acceptedTypes)("allowOffline",n.allowOffline)}}let S=(()=>{var n;class AddonModAssignSubmissionFileComponent extends m.L{constructor(){super(...arguments),this.component=p.It,this.files=[]}ngOnInit(){var n=this;return(0,e.A)((function*(){var i,s,e;n.acceptedTypes=null===(i=n.configs)||void 0===i?void 0:i.filetypeslist,n.maxSize=null!==(s=n.configs)&&void 0!==s&&s.maxsubmissionsizebytes?parseInt(n.configs.maxsubmissionsizebytes,10):void 0,n.maxSubmissions=null!==(e=n.configs)&&void 0!==e&&e.maxfilesubmissions?parseInt(n.configs.maxfilesubmissions,10):void 0;const m=yield a.g.ignoreErrors(l.AddonModAssignOffline.getSubmission(n.assign.id),void 0);try{var p;if(null!=m&&null!==(p=m.plugindata)&&void 0!==p&&p.files_filemanager){const i=m.plugindata.files_filemanager;let s=[];i.offline&&(s=yield a.g.ignoreErrors(t.AddonModAssignHelper.getStoredSubmissionFiles(n.assign.id,f.h),[])),n.files=i.online||[],n.files=n.files.concat(s)}else n.files=o.AddonModAssign.getSubmissionPluginAttachments(n.plugin)}finally{d.CoreFileSession.setFiles(n.component,n.assign.id,n.files)}}))()}}return(n=AddonModAssignSubmissionFileComponent).ɵfac=(()=>{let i;return function AddonModAssignSubmissionFileComponent_Factory(s){return(i||(i=u.xGo(n)))(s||n)}})(),n.ɵcmp=u.VBU({type:n,selectors:[["addon-mod-assign-submission-file"]],standalone:!0,features:[u.Vt3,u.aNF],decls:2,vars:2,consts:[["class","ion-text-wrap",4,"ngIf"],[4,"ngIf"],[1,"ion-text-wrap"],[1,"item-heading"],[3,"files","component","componentId","alwaysDownload"],[1,"ion-text-wrap",3,"sticky"],[3,"files","maxSize","maxSubmissions","courseId","component","componentId","acceptedTypes","allowOffline"]],template:function AddonModAssignSubmissionFileComponent_Template(n,i){1&n&&u.DNE(0,AddonModAssignSubmissionFileComponent_ion_item_0_Template,6,5,"ion-item",0)(1,AddonModAssignSubmissionFileComponent_div_1_Template,6,10,"div",1),2&n&&(u.Y8G("ngIf",i.files&&i.files.length&&!i.edit),u.R7$(),u.Y8G("ngIf",i.edit))},dependencies:[c.n,r.bT,g.uz,g.Dg,g.he,b.V,A.Y],encapsulation:2}),AddonModAssignSubmissionFileComponent})()}}]);