"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[40711],{40711:(e,o,t)=>{t.r(o),t.d(o,{AddonModDataFieldCheckboxComponent:()=>m});var n=t(10093),a=t(86654),d=t(54438),r=t(60177),l=t(89417),i=t(2910),s=t(25880),c=t(17778),p=t(58197),_=t(73955);const _c0=e=>({header:e});function AddonModDataFieldCheckboxComponent_span_0_span_1_Template(e,o){if(1&e&&d.nrm(0,"span",8),2&e){const e=d.XpG(2);d.Y8G("core-mark-required",e.field.required)}}function AddonModDataFieldCheckboxComponent_span_0_ion_select_option_6_Template(e,o){if(1&e&&(d.j41(0,"ion-select-option",9),d.nrm(1,"core-format-text",10),d.k0s()),2&e){const e=o.$implicit,t=d.XpG(2);d.Y8G("value",e.value),d.R7$(),d.Y8G("text",e.key)("contextInstanceId",null==t.database?null:t.database.coursemodule)("courseId",null==t.database?null:t.database.course)("wsNotFiltered",!0)}}function AddonModDataFieldCheckboxComponent_span_0_core_input_errors_7_Template(e,o){if(1&e&&d.nrm(0,"core-input-errors",11),2&e){const e=d.XpG(2);d.Y8G("control",e.form.controls["f_"+e.field.id])("errorText",e.error)}}function AddonModDataFieldCheckboxComponent_span_0_ion_item_8_Template(e,o){if(1&e){const e=d.RV6();d.j41(0,"ion-item",12)(1,"ion-checkbox",13),d.mxI("ngModelChange",(function AddonModDataFieldCheckboxComponent_span_0_ion_item_8_Template_ion_checkbox_ngModelChange_1_listener(o){d.eBV(e);const t=d.XpG(2);return d.DH7(t.searchFields["f_"+t.field.id+"_allreq"],o)||(t.searchFields["f_"+t.field.id+"_allreq"]=o),d.Njj(o)})),d.EFF(2),d.nI1(3,"translate"),d.k0s()()}if(2&e){const e=d.XpG(2);d.R7$(),d.Y8G("formControlName","f_"+e.field.id+"_allreq"),d.R50("ngModel",e.searchFields["f_"+e.field.id+"_allreq"]),d.R7$(),d.SpI(" ",d.bMT(3,3,"addon.mod_data.selectedrequired")," ")}}function AddonModDataFieldCheckboxComponent_span_0_Template(e,o){if(1&e&&(d.j41(0,"span",2),d.DNE(1,AddonModDataFieldCheckboxComponent_span_0_span_1_Template,1,1,"span",3),d.j41(2,"ion-select",4),d.nI1(3,"translate"),d.nI1(4,"translate"),d.nI1(5,"translate"),d.DNE(6,AddonModDataFieldCheckboxComponent_span_0_ion_select_option_6_Template,2,5,"ion-select-option",5),d.k0s(),d.DNE(7,AddonModDataFieldCheckboxComponent_span_0_core_input_errors_7_Template,1,2,"core-input-errors",6)(8,AddonModDataFieldCheckboxComponent_span_0_ion_item_8_Template,4,5,"ion-item",7),d.k0s()),2&e){const e=d.XpG();d.Y8G("formGroup",e.form),d.R7$(),d.Y8G("ngIf",e.editMode),d.R7$(),d.Y8G("formControlName","f_"+e.field.id)("placeholder",d.bMT(3,10,"addon.mod_data.menuchoose"))("cancelText",d.bMT(4,12,"core.cancel"))("okText",d.bMT(5,14,"core.ok"))("interfaceOptions",d.eq3(16,_c0,e.field.name)),d.R7$(4),d.Y8G("ngForOf",e.options),d.R7$(),d.Y8G("ngIf",e.error&&e.editMode),d.R7$(),d.Y8G("ngIf",e.searchMode)}}function AddonModDataFieldCheckboxComponent_core_format_text_1_Template(e,o){if(1&e&&d.nrm(0,"core-format-text",14),2&e){const e=d.XpG();d.Y8G("text",e.content)("filter",!1)}}let m=(()=>{var e;class AddonModDataFieldCheckboxComponent extends n.u{constructor(){super(...arguments),this.options=[]}init(){if(this.displayMode)return this.updateValue(this.value),void 0;this.searchMode&&this.addControl(`f_${this.field.id}_allreq`),this.addControl(`f_${this.field.id}`,this.getValidValues(this.value))}updateValue(e){super.updateValue(e),this.content=this.getValidValues(e).join("<br>")}getValidValues(e){var o,t;return this.options=this.field.param1.split(/\r?\n/).map((e=>({key:e,value:e}))),null!==(o=null==e||null===(t=e.content)||void 0===t?void 0:t.split("##").filter((e=>this.options.some((o=>e===o.key)))))&&void 0!==o?o:[]}}return(e=AddonModDataFieldCheckboxComponent).ɵfac=(()=>{let o;return function AddonModDataFieldCheckboxComponent_Factory(t){return(o||(o=d.xGo(e)))(t||e)}})(),e.ɵcmp=d.VBU({type:e,selectors:[["addon-mod-data-field-checkbox"]],standalone:!0,features:[d.Vt3,d.aNF],decls:2,vars:2,consts:[[3,"formGroup",4,"ngIf"],[3,"text","filter",4,"ngIf"],[3,"formGroup"],["class","core-mark-required",3,"core-mark-required",4,"ngIf"],["multiple","true","interface","alert",3,"formControlName","placeholder","cancelText","okText","interfaceOptions"],[3,"value",4,"ngFor","ngForOf"],[3,"control","errorText",4,"ngIf"],["class","ion-text-wrap",4,"ngIf"],[1,"core-mark-required",3,"core-mark-required"],[3,"value"],["contextLevel","module",3,"text","contextInstanceId","courseId","wsNotFiltered"],[3,"control","errorText"],[1,"ion-text-wrap"],[3,"ngModelChange","formControlName","ngModel"],[3,"text","filter"]],template:function AddonModDataFieldCheckboxComponent_Template(e,o){1&e&&d.DNE(0,AddonModDataFieldCheckboxComponent_span_0_Template,9,18,"span",0)(1,AddonModDataFieldCheckboxComponent_core_format_text_1_Template,1,2,"core-format-text",1),2&e&&(d.Y8G("ngIf",o.inputMode&&o.form),d.R7$(),d.Y8G("ngIf",o.displayMode&&o.content))},dependencies:[a.n,r.Sq,r.bT,l.BC,l.cb,i.eY,i.uz,i.Nm,i.Ip,i.hB,i.Je,l.j4,l.JD,s.q,c.j,p.B,_.D9],encapsulation:2}),AddonModDataFieldCheckboxComponent})()}}]);