@a.nemreen/dga-ui 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import*as i from"@angular/core";import{inject as $,ElementRef as ee,DestroyRef as ae,input as c,linkedSignal as te,model as T,booleanAttribute as S,signal as _,computed as p,output as z,effect as A,HostListener as q,ChangeDetectionStrategy as re,ViewEncapsulation as de,Component as ie}from"@angular/core";import{NgStyle as B}from"@angular/common";import{dgaFormStatusFromInvalid as ne,DgaFormControl as O,DgaIcon as j,dgaProvideValueAccessor as U}from"@a.nemreen/dga-ui";const H={ar:["محرم","صفر","ربيع الأول","ربيع الثاني","جمادى الأولى","جمادى الآخرة","رجب","شعبان","رمضان","شوال","ذو القعدة","ذو الحجة"],en:["Muharram","Safar","Rabi I","Rabi II","Jumada I","Jumada II","Rajab","Sha'ban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"]},J={ar:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],en:["January","February","March","April","May","June","July","August","September","October","November","December"]},G={ar:["أحد","إثن","ثلا","أرب","خمي","جمع","سبت"],en:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},se=new Intl.DateTimeFormat("en-US-u-ca-islamic-umalqura",{day:"numeric",month:"numeric",year:"numeric",timeZone:"UTC"});function W(d){return d<10?`0${d}`:String(d)}function w(d){return new Date(Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()))}function L(d,e){return parseInt(d.find(t=>t.type===e)?.value??"0",10)}function g(d,e){const t=w(d);if(e==="hijri"){const a=se.formatToParts(t);return{year:L(a,"year"),month:L(a,"month"),day:L(a,"day")}}return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()}}function v(d,e){const{year:t,month:a,day:r}=d;if(e==="gregorian")return new Date(Date.UTC(t,a-1,r));let s=Date.UTC(Math.max(622,Math.floor(t*.97+579)-3),0,1),l=Date.UTC(Math.floor(t*.97+579)+3,11,31);for(;s<=l;){const n=s+Math.floor((l-s)/2),o=new Date(n),h=g(o,"hijri"),b=h.year!==t?h.year-t:h.month!==a?h.month-a:h.day-r;if(b===0)return w(o);b<0?s=n+864e5:l=n-864e5}return w(new Date(s))}function C(d,e,t){if(t==="gregorian")return new Date(Date.UTC(d,e,0)).getUTCDate();for(let a=30;a>=29;a--){const r=v({year:d,month:e,day:a},"hijri"),s=g(r,"hijri");if(s.year===d&&s.month===e&&s.day===a)return a}return 29}function R(d,e,t){let a=d.year,r=d.month+e;for(;r>12;)r-=12,a+=1;for(;r<1;)r+=12,a-=1;const s=C(a,r,t);return{year:a,month:r,day:Math.min(d.day,s)}}function K(d){const e=/D{1,2}/.test(d),t=/M{1,2}/.test(d);return e?"day":t?"month":"year"}function D(d,e,t){const a=g(d,t);return e.replace(/YYYY|YY|MM|M|DD|D/g,r=>{switch(r){case"YYYY":return String(a.year);case"YY":return String(a.year).slice(-2);case"MM":return W(a.month);case"M":return String(a.month);case"DD":return W(a.day);case"D":return String(a.day);default:return r}})}function V(d,e,t){const a=d.trim();if(!a)return null;const r=/(YYYY|YY|MM|M|DD|D)/g;if(![...e.matchAll(r)].map(f=>f[1]).length)return null;let l="",n=0;for(const f of e.matchAll(r)){l+=Q(e.slice(n,f.index));const k=f[1];k==="YYYY"?l+="(?<YYYY>\\d{4})":k==="YY"?l+="(?<YY>\\d{2})":k==="MM"||k==="DD"?l+=`(?<${k}>\\d{2})`:l+=`(?<${k}>\\d{1,2})`,n=(f.index??0)+k.length}l+=Q(e.slice(n));const o=new RegExp(`^${l}$`).exec(a);if(!o?.groups)return null;let b=g(new Date,t).year;if(o.groups.YYYY)b=parseInt(o.groups.YYYY,10);else if(o.groups.YY){const f=parseInt(o.groups.YY,10);b=f>=70?1900+f:2e3+f}let u=1;(o.groups.MM||o.groups.M)&&(u=parseInt(o.groups.MM??o.groups.M,10));let m=1;if((o.groups.DD||o.groups.D)&&(m=parseInt(o.groups.DD??o.groups.D,10)),u<1||u>12||m<1||m>31)return null;const Y=v({year:b,month:u,day:m},t),P=g(Y,t);return P.year!==b||P.month!==u||P.day!==m?null:Y}function Q(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(d,e,t="gregorian"){if(!d||!e)return!1;const a=g(d,t),r=g(e,t);return a.year===r.year&&a.month===r.month&&a.day===r.day}function y(d,e,t="gregorian"){if(!d&&!e)return 0;if(!d)return-1;if(!e)return 1;const a=g(d,t),r=g(e,t);return a.year!==r.year?a.year-r.year:a.month!==r.month?a.month-r.month:a.day-r.day}function F(d,e,t,a="gregorian"){let r=w(d);return e&&y(r,e,a)<0&&(r=w(e)),t&&y(r,t,a)>0&&(r=w(t)),r}function E(d,e){return d==="hijri"?H[e]:J[e]}function Z(d,e,t){return v({year:d,month:e,day:1},t).getUTCDay()}function N(){const d=new Date;return new Date(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate()))}function I(d,e,t){return d==null||d===""?null:d instanceof Date?w(d):V(String(d),e,t)}const le={ar:{today:"اليوم",clear:"مسح",close:"إغلاق",save:"حفظ",prev:"السابق",next:"التالي",calendar:"فتح التقويم",clearInput:"مسح التاريخ",month:"الشهر",year:"السنة",placeholder:"يوم/شهر/سنة",rangeStart:"تاريخ البداية",rangeEnd:"تاريخ النهاية"},en:{today:"Today",clear:"Clear",close:"Close",save:"Save",prev:"Previous",next:"Next",calendar:"Open calendar",clearInput:"Clear date",month:"Month",year:"Year",placeholder:"DD/MM/YYYY",rangeStart:"Start date",rangeEnd:"End date"}};let oe=0;class x{host=$(ee);destroyRef=$(ae);inputId=`dga-date-picker-${++oe}`;panelId=`${this.inputId}-panel`;valueInput=c("",{...ngDevMode?{debugName:"valueInput"}:{},alias:"value"});value=te(this.valueInput,...ngDevMode?[{debugName:"value"}]:[]);startValue=T("",...ngDevMode?[{debugName:"startValue"}]:[]);endValue=T("",...ngDevMode?[{debugName:"endValue"}]:[]);onChange=()=>{};onTouched=()=>{};calendar=c("gregorian",...ngDevMode?[{debugName:"calendar"}]:[]);range=c(!1,{...ngDevMode?{debugName:"range"}:{},transform:S});format=c("DD/MM/YYYY",...ngDevMode?[{debugName:"format"}]:[]);mode=c(null,...ngDevMode?[{debugName:"mode"}]:[]);locale=c("ar",...ngDevMode?[{debugName:"locale"}]:[]);minDate=c(null,...ngDevMode?[{debugName:"minDate"}]:[]);maxDate=c(null,...ngDevMode?[{debugName:"maxDate"}]:[]);yearBefore=c(40,...ngDevMode?[{debugName:"yearBefore"}]:[]);yearAfter=c(5,...ngDevMode?[{debugName:"yearAfter"}]:[]);placeholder=c("",...ngDevMode?[{debugName:"placeholder"}]:[]);controlId=c("",...ngDevMode?[{debugName:"controlId"}]:[]);name=c("",...ngDevMode?[{debugName:"name"}]:[]);size=c("md",...ngDevMode?[{debugName:"size"}]:[]);disabledInput=c(!1,{...ngDevMode?{debugName:"disabledInput"}:{},alias:"disabled",transform:S});cvaDisabled=_(!1,...ngDevMode?[{debugName:"cvaDisabled"}]:[]);disabled=p(()=>this.disabledInput()||this.cvaDisabled(),...ngDevMode?[{debugName:"disabled"}]:[]);required=c(!1,{...ngDevMode?{debugName:"required"}:{},transform:S});clearable=c(!1,{...ngDevMode?{debugName:"clearable"}:{},transform:S});editable=c(!0,{...ngDevMode?{debugName:"editable"}:{},transform:S});invalid=c(!1,{...ngDevMode?{debugName:"invalid"}:{},alias:"dgaInvalid",transform:S});status=c("default",...ngDevMode?[{debugName:"status"}]:[]);rangeSeparator=c(" - ",...ngDevMode?[{debugName:"rangeSeparator"}]:[]);todayLabel=c("",...ngDevMode?[{debugName:"todayLabel"}]:[]);clearLabel=c("",...ngDevMode?[{debugName:"clearLabel"}]:[]);closeLabel=c("",...ngDevMode?[{debugName:"closeLabel"}]:[]);saveLabel=c("",...ngDevMode?[{debugName:"saveLabel"}]:[]);ariaLabel=c("",...ngDevMode?[{debugName:"ariaLabel"}]:[]);resolvedTodayLabel=p(()=>this.todayLabel()||this.labels().today,...ngDevMode?[{debugName:"resolvedTodayLabel"}]:[]);resolvedClearLabel=p(()=>this.clearLabel()||this.labels().clear,...ngDevMode?[{debugName:"resolvedClearLabel"}]:[]);resolvedCloseLabel=p(()=>this.closeLabel()||this.labels().close,...ngDevMode?[{debugName:"resolvedCloseLabel"}]:[]);resolvedSaveLabel=p(()=>this.saveLabel()||this.labels().save,...ngDevMode?[{debugName:"resolvedSaveLabel"}]:[]);valueChange=z();rangeChange=z();open=_(!1,...ngDevMode?[{debugName:"open"}]:[]);panelStyle=_({},...ngDevMode?[{debugName:"panelStyle"}]:[]);panelView=_("day",...ngDevMode?[{debugName:"panelView"}]:[]);viewParts=_(this.initialViewParts(),...ngDevMode?[{debugName:"viewParts"}]:[]);draftStart=_(null,...ngDevMode?[{debugName:"draftStart"}]:[]);draftEnd=_(null,...ngDevMode?[{debugName:"draftEnd"}]:[]);rangePickPhase=_("start",...ngDevMode?[{debugName:"rangePickPhase"}]:[]);typedValue=_(null,...ngDevMode?[{debugName:"typedValue"}]:[]);effectiveStatus=p(()=>this.status()!=="default"?this.status():ne(this.invalid()),...ngDevMode?[{debugName:"effectiveStatus"}]:[]);panelMode=p(()=>this.mode()??K(this.format()),...ngDevMode?[{debugName:"panelMode"}]:[]);labels=p(()=>le[this.locale()],...ngDevMode?[{debugName:"labels"}]:[]);resolvedPlaceholder=p(()=>this.placeholder()||this.labels().placeholder,...ngDevMode?[{debugName:"resolvedPlaceholder"}]:[]);weekdays=p(()=>G[this.locale()],...ngDevMode?[{debugName:"weekdays"}]:[]);minBound=p(()=>I(this.minDate(),this.format(),this.calendar()),...ngDevMode?[{debugName:"minBound"}]:[]);maxBound=p(()=>I(this.maxDate(),this.format(),this.calendar()),...ngDevMode?[{debugName:"maxBound"}]:[]);displayValue=p(()=>{const e=this.typedValue();if(e!==null)return e;if(this.range()){const t=this.startValue()||this.parseRangeFromValue().start,a=this.endValue()||this.parseRangeFromValue().end;return t&&a?`${t}${this.rangeSeparator()}${a}`:t||a||this.value()}return this.value()},...ngDevMode?[{debugName:"displayValue"}]:[]);viewYear=p(()=>this.viewParts().year,...ngDevMode?[{debugName:"viewYear"}]:[]);viewMonth=p(()=>this.viewParts().month,...ngDevMode?[{debugName:"viewMonth"}]:[]);monthOptions=p(()=>{const e=E(this.calendar(),this.locale()),t=this.viewYear(),a=this.draftAnchorParts();return e.map((r,s)=>{const l=s+1,n=this.isMonthDisabled(t,l);return{value:l,label:r,selected:a?.month===l&&a?.year===t,disabled:n}})},...ngDevMode?[{debugName:"monthOptions"}]:[]);yearOptions=p(()=>{const e=this.viewParts(),t=this.draftAnchorParts(),a=g(N(),this.calendar()).year,r=a-this.yearBefore(),s=a+this.yearAfter(),l=[];for(let n=r;n<=s;n+=1)l.push({value:n,selected:t?.year===n,disabled:this.isYearDisabled(n)});return l.some(n=>n.value===e.year)||(l.unshift({value:e.year,selected:t?.year===e.year,disabled:this.isYearDisabled(e.year)}),l.sort((n,o)=>n.value-o.value)),l},...ngDevMode?[{debugName:"yearOptions"}]:[]);dayCells=p(()=>{if(this.panelView()!=="day")return[];const e=this.viewYear(),t=this.viewMonth(),a=this.calendar(),r=C(e,t,a),s=Z(e,t,a),l=N(),n=this.draftStart(),o=this.draftEnd(),h=o??n,b=[];for(let u=0;u<s;u+=1)b.push({key:`e-${u}`,empty:!0});for(let u=1;u<=r;u+=1){const m=v({year:e,month:t,day:u},a),Y=this.isDateDisabled(m),P=n&&M(m,n,a)||o&&M(m,o,a),f=this.range()&&n&&h&&y(m,n,a)>=0&&y(m,h,a)<=0,k=this.range()&&n&&M(m,n,a),X=this.range()&&h&&M(m,h,a);b.push({key:`${e}-${t}-${u}`,empty:!1,day:u,today:M(m,l,a),selected:!!P,inRange:!!f,rangeStart:!!k,rangeEnd:!!X,disabled:Y,label:D(m,this.format(),a)})}return b},...ngDevMode?[{debugName:"dayCells"}]:[]);constructor(){A(()=>{this.syncDraftFromModels()}),A(()=>{const e=this.panelMode();this.open()&&this.panelView.set(e)}),this.destroyRef.onDestroy(()=>{this.open.set(!1)})}onDocumentClick(e){if(!this.open())return;const t=e.target;t&&this.host.nativeElement.contains(t)||this.closePanel(!1)}onEscape(){this.open()&&this.closePanel(!1)}onReposition(){this.open()&&this.repositionPanel()}monthLabel(e){return E(this.calendar(),this.locale())[e-1]??String(e)}togglePanel(){if(!this.disabled()){if(this.open()){this.closePanel(!1);return}this.openPanel()}}openPanel(){this.syncDraftFromModels(),this.panelView.set(this.panelMode());const e=this.draftStart()??this.minBound()??N();this.viewParts.set(g(e,this.calendar())),this.repositionPanel(),this.open.set(!0),requestAnimationFrame(()=>this.repositionPanel())}closePanel(e=!1){e&&this.syncDraftFromModels(),this.open.set(!1),this.panelStyle.set({}),this.rangePickPhase.set("start")}repositionPanel(){if(typeof document>"u")return;const t=(this.host.nativeElement.querySelector("dga-form-control")??this.host.nativeElement).getBoundingClientRect(),a=4,r=340,s=window.innerHeight-t.bottom,l=s<r&&t.top>s,n=document.documentElement.dir==="rtl";this.panelStyle.set({position:"fixed",zIndex:"var(--z-index-dropdown)",...l?{bottom:`${Math.round(window.innerHeight-t.top+a)}px`,top:"auto"}:{top:`${Math.round(t.bottom+a)}px`,bottom:"auto"},...n?{right:`${Math.round(window.innerWidth-t.right)}px`,left:"auto"}:{left:`${Math.round(t.left)}px`,right:"auto"}})}navigate(e){const t=this.panelView(),a=this.viewParts();if(t==="year"){this.viewParts.set({...a,year:a.year+e*12});return}if(t==="month"){this.viewParts.set({...a,year:a.year+e});return}this.viewParts.set(R(a,e,this.calendar()))}setPanelView(e){this.panelView.set(e)}selectDay(e){const t={year:this.viewYear(),month:this.viewMonth(),day:e},a=v(t,this.calendar());this.isDateDisabled(a)||this.applyDraftDate(a)}selectMonth(e){if(this.isMonthDisabled(this.viewYear(),e))return;const t=R({year:this.viewYear(),month:e,day:1},0,this.calendar());if(this.viewParts.set(t),this.panelMode()==="month"){this.applyDraftDate(v(t,this.calendar()));return}this.panelView.set("day")}selectYear(e){if(this.isYearDisabled(e))return;const t={...this.viewParts(),year:e};if(this.viewParts.set(t),this.panelMode()==="year"){const a=v({year:e,month:1,day:1},this.calendar());this.applyDraftDate(a);return}this.panelView.set(this.panelMode()==="month"?"month":"day")}goToday(){const e=F(N(),this.minBound(),this.maxBound(),this.calendar());this.viewParts.set(g(e,this.calendar())),this.applyDraftDate(e)}clearDraft(){this.draftStart.set(null),this.draftEnd.set(null),this.rangePickPhase.set("start")}clearAll(){this.draftStart.set(null),this.draftEnd.set(null),this.typedValue.set(null),this.emitValues("","",""),this.closePanel()}save(){const e=this.calendar(),t=this.format();if(this.range()){const a=this.draftStart(),r=this.draftEnd()??a;if(!a){this.closePanel();return}const s=D(a,t,e),l=r?D(r,t,e):s,n=`${s}${this.rangeSeparator()}${l}`;this.emitValues(n,s,l)}else{const a=this.draftStart();if(!a)this.emitValues("","","");else{const r=D(a,t,e);this.emitValues(r,r,"")}}this.typedValue.set(null),this.closePanel()}onInput(e){this.editable()&&this.typedValue.set(e)}onInputBlur(){this.onTouched();const e=this.typedValue();if(e===null)return;if(this.typedValue.set(null),!e.trim()){this.clearAll();return}if(this.range()){const[a,r]=e.split(this.rangeSeparator()),s=V(a?.trim()??"",this.format(),this.calendar()),l=V(r?.trim()??"",this.format(),this.calendar());if(s&&l){const n=y(s,l,this.calendar())<=0?{start:s,end:l}:{start:l,end:s},o=D(n.start,this.format(),this.calendar()),h=D(n.end,this.format(),this.calendar());this.emitValues(`${o}${this.rangeSeparator()}${h}`,o,h)}else if(s){const n=D(s,this.format(),this.calendar());this.emitValues(n,n,"")}return}const t=V(e.trim(),this.format(),this.calendar());if(t){const a=D(t,this.format(),this.calendar());this.emitValues(a,a,"")}}onInputKeydown(e){(e.key==="ArrowDown"||e.key==="Enter")&&(this.open()||(e.preventDefault(),this.openPanel())),e.key==="Escape"&&this.open()&&(e.preventDefault(),this.closePanel(!1))}applyDraftDate(e){const t=F(e,this.minBound(),this.maxBound(),this.calendar());if(!this.range()){this.draftStart.set(t),this.draftEnd.set(null);return}if(this.rangePickPhase()==="start"||!this.draftStart()){this.draftStart.set(t),this.draftEnd.set(null),this.rangePickPhase.set("end");return}const a=this.draftStart();y(t,a,this.calendar())<0?(this.draftStart.set(t),this.draftEnd.set(a)):this.draftEnd.set(t),this.rangePickPhase.set("start")}draftAnchorParts(){const e=this.draftEnd()??this.draftStart();return e?g(e,this.calendar()):null}syncDraftFromModels(){const e=this.calendar(),t=this.format();if(this.range()){const r=this.parseRangeFromValue(),s=I(this.startValue()||r.start,t,e),l=I(this.endValue()||r.end,t,e);this.draftStart.set(s),this.draftEnd.set(l),s&&this.viewParts.set(g(s,e));return}const a=I(this.value(),t,e);this.draftStart.set(a),this.draftEnd.set(null),a&&this.viewParts.set(g(a,e))}parseRangeFromValue(){const e=this.value();if(!e)return{start:"",end:""};const t=this.rangeSeparator(),a=e.indexOf(t);return a===-1?{start:e,end:""}:{start:e.slice(0,a).trim(),end:e.slice(a+t.length).trim()}}emitValues(e,t,a){this.value.set(e),this.startValue.set(t),this.endValue.set(a),this.valueChange.emit(e),this.rangeChange.emit({start:t,end:a}),this.range()||this.onChange(e)}writeValue(e){this.value.set(e??"")}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.cvaDisabled.set(e)}isDateDisabled(e){const t=this.minBound(),a=this.maxBound();return!!(t&&y(e,t,this.calendar())<0||a&&y(e,a,this.calendar())>0)}isMonthDisabled(e,t){const a=this.calendar(),r=v({year:e,month:t,day:1},a),s=C(e,t,a),l=v({year:e,month:t,day:s},a),n=this.minBound(),o=this.maxBound();return!!(n&&y(l,n,a)<0||o&&y(r,o,a)>0)}isYearDisabled(e){const t=this.calendar();for(let a=1;a<=12;a+=1)if(!this.isMonthDisabled(e,a))return!1;return!0}initialViewParts(){return g(N(),"gregorian")}static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:x,deps:[],target:i.ɵɵFactoryTarget.Component});static ɵcmp=i.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.0.7",type:x,isStandalone:!0,selector:"dga-date-picker",inputs:{valueInput:{classPropertyName:"valueInput",publicName:"value",isSignal:!0,isRequired:!1,transformFunction:null},startValue:{classPropertyName:"startValue",publicName:"startValue",isSignal:!0,isRequired:!1,transformFunction:null},endValue:{classPropertyName:"endValue",publicName:"endValue",isSignal:!0,isRequired:!1,transformFunction:null},calendar:{classPropertyName:"calendar",publicName:"calendar",isSignal:!0,isRequired:!1,transformFunction:null},range:{classPropertyName:"range",publicName:"range",isSignal:!0,isRequired:!1,transformFunction:null},format:{classPropertyName:"format",publicName:"format",isSignal:!0,isRequired:!1,transformFunction:null},mode:{classPropertyName:"mode",publicName:"mode",isSignal:!0,isRequired:!1,transformFunction:null},locale:{classPropertyName:"locale",publicName:"locale",isSignal:!0,isRequired:!1,transformFunction:null},minDate:{classPropertyName:"minDate",publicName:"minDate",isSignal:!0,isRequired:!1,transformFunction:null},maxDate:{classPropertyName:"maxDate",publicName:"maxDate",isSignal:!0,isRequired:!1,transformFunction:null},yearBefore:{classPropertyName:"yearBefore",publicName:"yearBefore",isSignal:!0,isRequired:!1,transformFunction:null},yearAfter:{classPropertyName:"yearAfter",publicName:"yearAfter",isSignal:!0,isRequired:!1,transformFunction:null},placeholder:{classPropertyName:"placeholder",publicName:"placeholder",isSignal:!0,isRequired:!1,transformFunction:null},controlId:{classPropertyName:"controlId",publicName:"controlId",isSignal:!0,isRequired:!1,transformFunction:null},name:{classPropertyName:"name",publicName:"name",isSignal:!0,isRequired:!1,transformFunction:null},size:{classPropertyName:"size",publicName:"size",isSignal:!0,isRequired:!1,transformFunction:null},disabledInput:{classPropertyName:"disabledInput",publicName:"disabled",isSignal:!0,isRequired:!1,transformFunction:null},required:{classPropertyName:"required",publicName:"required",isSignal:!0,isRequired:!1,transformFunction:null},clearable:{classPropertyName:"clearable",publicName:"clearable",isSignal:!0,isRequired:!1,transformFunction:null},editable:{classPropertyName:"editable",publicName:"editable",isSignal:!0,isRequired:!1,transformFunction:null},invalid:{classPropertyName:"invalid",publicName:"dgaInvalid",isSignal:!0,isRequired:!1,transformFunction:null},status:{classPropertyName:"status",publicName:"status",isSignal:!0,isRequired:!1,transformFunction:null},rangeSeparator:{classPropertyName:"rangeSeparator",publicName:"rangeSeparator",isSignal:!0,isRequired:!1,transformFunction:null},todayLabel:{classPropertyName:"todayLabel",publicName:"todayLabel",isSignal:!0,isRequired:!1,transformFunction:null},clearLabel:{classPropertyName:"clearLabel",publicName:"clearLabel",isSignal:!0,isRequired:!1,transformFunction:null},closeLabel:{classPropertyName:"closeLabel",publicName:"closeLabel",isSignal:!0,isRequired:!1,transformFunction:null},saveLabel:{classPropertyName:"saveLabel",publicName:"saveLabel",isSignal:!0,isRequired:!1,transformFunction:null},ariaLabel:{classPropertyName:"ariaLabel",publicName:"ariaLabel",isSignal:!0,isRequired:!1,transformFunction:null}},outputs:{startValue:"startValueChange",endValue:"endValueChange",valueChange:"valueChange",rangeChange:"rangeChange"},host:{listeners:{"document:click":"onDocumentClick($event)","document:keydown.escape":"onEscape()","window:resize":"onReposition()","window:scroll":"onReposition()"},classAttribute:"dga-date-picker-host"},providers:[U(x)],ngImport:i,template:`
1
+ import*as i from"@angular/core";import{inject as $,ElementRef as ee,DestroyRef as ae,input as c,linkedSignal as te,model as T,booleanAttribute as S,signal as _,computed as p,output as z,effect as A,HostListener as q,ChangeDetectionStrategy as re,ViewEncapsulation as de,Component as ie}from"@angular/core";import{NgStyle as B}from"@angular/common";import{dgaFormStatusFromInvalid as ne,DgaFormControl as O,DgaIcon as j,dgaProvideValueAccessor as U}from"@a.nemreen/dga-ui";const H={ar:["محرم","صفر","ربيع الأول","ربيع الثاني","جمادى الأولى","جمادى الآخرة","رجب","شعبان","رمضان","شوال","ذو القعدة","ذو الحجة"],en:["Muharram","Safar","Rabi I","Rabi II","Jumada I","Jumada II","Rajab","Sha'ban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"]},J={ar:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],en:["January","February","March","April","May","June","July","August","September","October","November","December"]},G={ar:["أحد","إثن","ثلا","أرب","خمي","جمع","سبت"],en:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},se=new Intl.DateTimeFormat("en-US-u-ca-islamic-umalqura",{day:"numeric",month:"numeric",year:"numeric",timeZone:"UTC"});function W(d){return d<10?`0${d}`:String(d)}function w(d){return new Date(Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()))}function L(d,e){return parseInt(d.find(t=>t.type===e)?.value??"0",10)}function g(d,e){const t=w(d);if(e==="hijri"){const a=se.formatToParts(t);return{year:L(a,"year"),month:L(a,"month"),day:L(a,"day")}}return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()}}function v(d,e){const{year:t,month:a,day:r}=d;if(e==="gregorian")return new Date(Date.UTC(t,a-1,r));let s=Date.UTC(Math.max(622,Math.floor(t*.97+579)-3),0,1),l=Date.UTC(Math.floor(t*.97+579)+3,11,31);for(;s<=l;){const n=s+Math.floor((l-s)/2),o=new Date(n),h=g(o,"hijri"),b=h.year!==t?h.year-t:h.month!==a?h.month-a:h.day-r;if(b===0)return w(o);b<0?s=n+864e5:l=n-864e5}return w(new Date(s))}function C(d,e,t){if(t==="gregorian")return new Date(Date.UTC(d,e,0)).getUTCDate();for(let a=30;a>=29;a--){const r=v({year:d,month:e,day:a},"hijri"),s=g(r,"hijri");if(s.year===d&&s.month===e&&s.day===a)return a}return 29}function R(d,e,t){let a=d.year,r=d.month+e;for(;r>12;)r-=12,a+=1;for(;r<1;)r+=12,a-=1;const s=C(a,r,t);return{year:a,month:r,day:Math.min(d.day,s)}}function K(d){const e=/D{1,2}/.test(d),t=/M{1,2}/.test(d);return e?"day":t?"month":"year"}function D(d,e,t){const a=g(d,t);return e.replace(/YYYY|YY|MM|M|DD|D/g,r=>{switch(r){case"YYYY":return String(a.year);case"YY":return String(a.year).slice(-2);case"MM":return W(a.month);case"M":return String(a.month);case"DD":return W(a.day);case"D":return String(a.day);default:return r}})}function V(d,e,t){const a=d.trim();if(!a)return null;const r=/(YYYY|YY|MM|M|DD|D)/g;if(![...e.matchAll(r)].map(f=>f[1]).length)return null;let l="",n=0;for(const f of e.matchAll(r)){l+=Q(e.slice(n,f.index));const k=f[1];k==="YYYY"?l+="(?<YYYY>\\d{4})":k==="YY"?l+="(?<YY>\\d{2})":k==="MM"||k==="DD"?l+=`(?<${k}>\\d{2})`:l+=`(?<${k}>\\d{1,2})`,n=(f.index??0)+k.length}l+=Q(e.slice(n));const o=new RegExp(`^${l}$`).exec(a);if(!o?.groups)return null;let b=g(new Date,t).year;if(o.groups.YYYY)b=parseInt(o.groups.YYYY,10);else if(o.groups.YY){const f=parseInt(o.groups.YY,10);b=f>=70?1900+f:2e3+f}let u=1;(o.groups.MM||o.groups.M)&&(u=parseInt(o.groups.MM??o.groups.M,10));let m=1;if((o.groups.DD||o.groups.D)&&(m=parseInt(o.groups.DD??o.groups.D,10)),u<1||u>12||m<1||m>31)return null;const Y=v({year:b,month:u,day:m},t),P=g(Y,t);return P.year!==b||P.month!==u||P.day!==m?null:Y}function Q(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(d,e,t="gregorian"){if(!d||!e)return!1;const a=g(d,t),r=g(e,t);return a.year===r.year&&a.month===r.month&&a.day===r.day}function y(d,e,t="gregorian"){if(!d&&!e)return 0;if(!d)return-1;if(!e)return 1;const a=g(d,t),r=g(e,t);return a.year!==r.year?a.year-r.year:a.month!==r.month?a.month-r.month:a.day-r.day}function F(d,e,t,a="gregorian"){let r=w(d);return e&&y(r,e,a)<0&&(r=w(e)),t&&y(r,t,a)>0&&(r=w(t)),r}function E(d,e){const t=e==="ar"?"ar":"en";return d==="hijri"?H[t]:J[t]}function Z(d,e,t){return v({year:d,month:e,day:1},t).getUTCDay()}function N(){const d=new Date;return new Date(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate()))}function I(d,e,t){return d==null||d===""?null:d instanceof Date?w(d):V(String(d),e,t)}const le={ar:{today:"اليوم",clear:"مسح",close:"إغلاق",save:"حفظ",prev:"السابق",next:"التالي",calendar:"فتح التقويم",clearInput:"مسح التاريخ",month:"الشهر",year:"السنة",placeholder:"يوم/شهر/سنة",rangeStart:"تاريخ البداية",rangeEnd:"تاريخ النهاية"},en:{today:"Today",clear:"Clear",close:"Close",save:"Save",prev:"Previous",next:"Next",calendar:"Open calendar",clearInput:"Clear date",month:"Month",year:"Year",placeholder:"DD/MM/YYYY",rangeStart:"Start date",rangeEnd:"End date"}};let oe=0;class x{host=$(ee);destroyRef=$(ae);inputId=`dga-date-picker-${++oe}`;panelId=`${this.inputId}-panel`;valueInput=c("",{...ngDevMode?{debugName:"valueInput"}:{},alias:"value"});value=te(this.valueInput,...ngDevMode?[{debugName:"value"}]:[]);startValue=T("",...ngDevMode?[{debugName:"startValue"}]:[]);endValue=T("",...ngDevMode?[{debugName:"endValue"}]:[]);onChange=()=>{};onTouched=()=>{};calendar=c("gregorian",...ngDevMode?[{debugName:"calendar"}]:[]);range=c(!1,{...ngDevMode?{debugName:"range"}:{},transform:S});format=c("DD/MM/YYYY",...ngDevMode?[{debugName:"format"}]:[]);mode=c(null,...ngDevMode?[{debugName:"mode"}]:[]);locale=c("ar",...ngDevMode?[{debugName:"locale"}]:[]);minDate=c(null,...ngDevMode?[{debugName:"minDate"}]:[]);maxDate=c(null,...ngDevMode?[{debugName:"maxDate"}]:[]);yearBefore=c(40,...ngDevMode?[{debugName:"yearBefore"}]:[]);yearAfter=c(5,...ngDevMode?[{debugName:"yearAfter"}]:[]);placeholder=c("",...ngDevMode?[{debugName:"placeholder"}]:[]);controlId=c("",...ngDevMode?[{debugName:"controlId"}]:[]);name=c("",...ngDevMode?[{debugName:"name"}]:[]);size=c("md",...ngDevMode?[{debugName:"size"}]:[]);disabledInput=c(!1,{...ngDevMode?{debugName:"disabledInput"}:{},alias:"disabled",transform:S});cvaDisabled=_(!1,...ngDevMode?[{debugName:"cvaDisabled"}]:[]);disabled=p(()=>this.disabledInput()||this.cvaDisabled(),...ngDevMode?[{debugName:"disabled"}]:[]);required=c(!1,{...ngDevMode?{debugName:"required"}:{},transform:S});clearable=c(!1,{...ngDevMode?{debugName:"clearable"}:{},transform:S});editable=c(!0,{...ngDevMode?{debugName:"editable"}:{},transform:S});invalid=c(!1,{...ngDevMode?{debugName:"invalid"}:{},alias:"dgaInvalid",transform:S});status=c("default",...ngDevMode?[{debugName:"status"}]:[]);rangeSeparator=c(" - ",...ngDevMode?[{debugName:"rangeSeparator"}]:[]);todayLabel=c("",...ngDevMode?[{debugName:"todayLabel"}]:[]);clearLabel=c("",...ngDevMode?[{debugName:"clearLabel"}]:[]);closeLabel=c("",...ngDevMode?[{debugName:"closeLabel"}]:[]);saveLabel=c("",...ngDevMode?[{debugName:"saveLabel"}]:[]);ariaLabel=c("",...ngDevMode?[{debugName:"ariaLabel"}]:[]);resolvedTodayLabel=p(()=>this.todayLabel()||this.labels().today,...ngDevMode?[{debugName:"resolvedTodayLabel"}]:[]);resolvedClearLabel=p(()=>this.clearLabel()||this.labels().clear,...ngDevMode?[{debugName:"resolvedClearLabel"}]:[]);resolvedCloseLabel=p(()=>this.closeLabel()||this.labels().close,...ngDevMode?[{debugName:"resolvedCloseLabel"}]:[]);resolvedSaveLabel=p(()=>this.saveLabel()||this.labels().save,...ngDevMode?[{debugName:"resolvedSaveLabel"}]:[]);valueChange=z();rangeChange=z();open=_(!1,...ngDevMode?[{debugName:"open"}]:[]);panelStyle=_({},...ngDevMode?[{debugName:"panelStyle"}]:[]);panelView=_("day",...ngDevMode?[{debugName:"panelView"}]:[]);viewParts=_(this.initialViewParts(),...ngDevMode?[{debugName:"viewParts"}]:[]);draftStart=_(null,...ngDevMode?[{debugName:"draftStart"}]:[]);draftEnd=_(null,...ngDevMode?[{debugName:"draftEnd"}]:[]);rangePickPhase=_("start",...ngDevMode?[{debugName:"rangePickPhase"}]:[]);typedValue=_(null,...ngDevMode?[{debugName:"typedValue"}]:[]);effectiveStatus=p(()=>this.status()!=="default"?this.status():ne(this.invalid()),...ngDevMode?[{debugName:"effectiveStatus"}]:[]);panelMode=p(()=>this.mode()??K(this.format()),...ngDevMode?[{debugName:"panelMode"}]:[]);labels=p(()=>{const e=this.locale()==="ar"?"ar":"en";return le[e]},...ngDevMode?[{debugName:"labels"}]:[]);resolvedPlaceholder=p(()=>this.placeholder()||this.labels().placeholder,...ngDevMode?[{debugName:"resolvedPlaceholder"}]:[]);weekdays=p(()=>{const e=this.locale()==="ar"?"ar":"en";return G[e]},...ngDevMode?[{debugName:"weekdays"}]:[]);minBound=p(()=>I(this.minDate(),this.format(),this.calendar()),...ngDevMode?[{debugName:"minBound"}]:[]);maxBound=p(()=>I(this.maxDate(),this.format(),this.calendar()),...ngDevMode?[{debugName:"maxBound"}]:[]);displayValue=p(()=>{const e=this.typedValue();if(e!==null)return e;if(this.range()){const t=this.startValue()||this.parseRangeFromValue().start,a=this.endValue()||this.parseRangeFromValue().end;return t&&a?`${t}${this.rangeSeparator()}${a}`:t||a||this.value()}return this.value()},...ngDevMode?[{debugName:"displayValue"}]:[]);viewYear=p(()=>this.viewParts().year,...ngDevMode?[{debugName:"viewYear"}]:[]);viewMonth=p(()=>this.viewParts().month,...ngDevMode?[{debugName:"viewMonth"}]:[]);monthOptions=p(()=>{const e=E(this.calendar(),this.locale()),t=this.viewYear(),a=this.draftAnchorParts();return e.map((r,s)=>{const l=s+1,n=this.isMonthDisabled(t,l);return{value:l,label:r,selected:a?.month===l&&a?.year===t,disabled:n}})},...ngDevMode?[{debugName:"monthOptions"}]:[]);yearOptions=p(()=>{const e=this.viewParts(),t=this.draftAnchorParts(),a=g(N(),this.calendar()).year,r=a-this.yearBefore(),s=a+this.yearAfter(),l=[];for(let n=r;n<=s;n+=1)l.push({value:n,selected:t?.year===n,disabled:this.isYearDisabled(n)});return l.some(n=>n.value===e.year)||(l.unshift({value:e.year,selected:t?.year===e.year,disabled:this.isYearDisabled(e.year)}),l.sort((n,o)=>n.value-o.value)),l},...ngDevMode?[{debugName:"yearOptions"}]:[]);dayCells=p(()=>{if(this.panelView()!=="day")return[];const e=this.viewYear(),t=this.viewMonth(),a=this.calendar(),r=C(e,t,a),s=Z(e,t,a),l=N(),n=this.draftStart(),o=this.draftEnd(),h=o??n,b=[];for(let u=0;u<s;u+=1)b.push({key:`e-${u}`,empty:!0});for(let u=1;u<=r;u+=1){const m=v({year:e,month:t,day:u},a),Y=this.isDateDisabled(m),P=n&&M(m,n,a)||o&&M(m,o,a),f=this.range()&&n&&h&&y(m,n,a)>=0&&y(m,h,a)<=0,k=this.range()&&n&&M(m,n,a),X=this.range()&&h&&M(m,h,a);b.push({key:`${e}-${t}-${u}`,empty:!1,day:u,today:M(m,l,a),selected:!!P,inRange:!!f,rangeStart:!!k,rangeEnd:!!X,disabled:Y,label:D(m,this.format(),a)})}return b},...ngDevMode?[{debugName:"dayCells"}]:[]);constructor(){A(()=>{this.syncDraftFromModels()}),A(()=>{const e=this.panelMode();this.open()&&this.panelView.set(e)}),this.destroyRef.onDestroy(()=>{this.open.set(!1)})}onDocumentClick(e){if(!this.open())return;const t=e.target;t&&this.host.nativeElement.contains(t)||this.closePanel(!1)}onEscape(){this.open()&&this.closePanel(!1)}onReposition(){this.open()&&this.repositionPanel()}monthLabel(e){return E(this.calendar(),this.locale())[e-1]??String(e)}togglePanel(){if(!this.disabled()){if(this.open()){this.closePanel(!1);return}this.openPanel()}}openPanel(){this.syncDraftFromModels(),this.panelView.set(this.panelMode());const e=this.draftStart()??this.minBound()??N();this.viewParts.set(g(e,this.calendar())),this.repositionPanel(),this.open.set(!0),requestAnimationFrame(()=>this.repositionPanel())}closePanel(e=!1){e&&this.syncDraftFromModels(),this.open.set(!1),this.panelStyle.set({}),this.rangePickPhase.set("start")}repositionPanel(){if(typeof document>"u")return;const t=(this.host.nativeElement.querySelector("dga-form-control")??this.host.nativeElement).getBoundingClientRect(),a=4,r=340,s=window.innerHeight-t.bottom,l=s<r&&t.top>s,n=document.documentElement.dir==="rtl";this.panelStyle.set({position:"fixed",zIndex:"var(--z-index-dropdown)",...l?{bottom:`${Math.round(window.innerHeight-t.top+a)}px`,top:"auto"}:{top:`${Math.round(t.bottom+a)}px`,bottom:"auto"},...n?{right:`${Math.round(window.innerWidth-t.right)}px`,left:"auto"}:{left:`${Math.round(t.left)}px`,right:"auto"}})}navigate(e){const t=this.panelView(),a=this.viewParts();if(t==="year"){this.viewParts.set({...a,year:a.year+e*12});return}if(t==="month"){this.viewParts.set({...a,year:a.year+e});return}this.viewParts.set(R(a,e,this.calendar()))}setPanelView(e){this.panelView.set(e)}selectDay(e){const t={year:this.viewYear(),month:this.viewMonth(),day:e},a=v(t,this.calendar());this.isDateDisabled(a)||this.applyDraftDate(a)}selectMonth(e){if(this.isMonthDisabled(this.viewYear(),e))return;const t=R({year:this.viewYear(),month:e,day:1},0,this.calendar());if(this.viewParts.set(t),this.panelMode()==="month"){this.applyDraftDate(v(t,this.calendar()));return}this.panelView.set("day")}selectYear(e){if(this.isYearDisabled(e))return;const t={...this.viewParts(),year:e};if(this.viewParts.set(t),this.panelMode()==="year"){const a=v({year:e,month:1,day:1},this.calendar());this.applyDraftDate(a);return}this.panelView.set(this.panelMode()==="month"?"month":"day")}goToday(){const e=F(N(),this.minBound(),this.maxBound(),this.calendar());this.viewParts.set(g(e,this.calendar())),this.applyDraftDate(e)}clearDraft(){this.draftStart.set(null),this.draftEnd.set(null),this.rangePickPhase.set("start")}clearAll(){this.draftStart.set(null),this.draftEnd.set(null),this.typedValue.set(null),this.emitValues("","",""),this.closePanel()}save(){const e=this.calendar(),t=this.format();if(this.range()){const a=this.draftStart(),r=this.draftEnd()??a;if(!a){this.closePanel();return}const s=D(a,t,e),l=r?D(r,t,e):s,n=`${s}${this.rangeSeparator()}${l}`;this.emitValues(n,s,l)}else{const a=this.draftStart();if(!a)this.emitValues("","","");else{const r=D(a,t,e);this.emitValues(r,r,"")}}this.typedValue.set(null),this.closePanel()}onInput(e){this.editable()&&this.typedValue.set(e)}onInputBlur(){this.onTouched();const e=this.typedValue();if(e===null)return;if(this.typedValue.set(null),!e.trim()){this.clearAll();return}if(this.range()){const[a,r]=e.split(this.rangeSeparator()),s=V(a?.trim()??"",this.format(),this.calendar()),l=V(r?.trim()??"",this.format(),this.calendar());if(s&&l){const n=y(s,l,this.calendar())<=0?{start:s,end:l}:{start:l,end:s},o=D(n.start,this.format(),this.calendar()),h=D(n.end,this.format(),this.calendar());this.emitValues(`${o}${this.rangeSeparator()}${h}`,o,h)}else if(s){const n=D(s,this.format(),this.calendar());this.emitValues(n,n,"")}return}const t=V(e.trim(),this.format(),this.calendar());if(t){const a=D(t,this.format(),this.calendar());this.emitValues(a,a,"")}}onInputKeydown(e){(e.key==="ArrowDown"||e.key==="Enter")&&(this.open()||(e.preventDefault(),this.openPanel())),e.key==="Escape"&&this.open()&&(e.preventDefault(),this.closePanel(!1))}applyDraftDate(e){const t=F(e,this.minBound(),this.maxBound(),this.calendar());if(!this.range()){this.draftStart.set(t),this.draftEnd.set(null);return}if(this.rangePickPhase()==="start"||!this.draftStart()){this.draftStart.set(t),this.draftEnd.set(null),this.rangePickPhase.set("end");return}const a=this.draftStart();y(t,a,this.calendar())<0?(this.draftStart.set(t),this.draftEnd.set(a)):this.draftEnd.set(t),this.rangePickPhase.set("start")}draftAnchorParts(){const e=this.draftEnd()??this.draftStart();return e?g(e,this.calendar()):null}syncDraftFromModels(){const e=this.calendar(),t=this.format();if(this.range()){const r=this.parseRangeFromValue(),s=I(this.startValue()||r.start,t,e),l=I(this.endValue()||r.end,t,e);this.draftStart.set(s),this.draftEnd.set(l),s&&this.viewParts.set(g(s,e));return}const a=I(this.value(),t,e);this.draftStart.set(a),this.draftEnd.set(null),a&&this.viewParts.set(g(a,e))}parseRangeFromValue(){const e=this.value();if(!e)return{start:"",end:""};const t=this.rangeSeparator(),a=e.indexOf(t);return a===-1?{start:e,end:""}:{start:e.slice(0,a).trim(),end:e.slice(a+t.length).trim()}}emitValues(e,t,a){this.value.set(e),this.startValue.set(t),this.endValue.set(a),this.valueChange.emit(e),this.rangeChange.emit({start:t,end:a}),this.range()||this.onChange(e)}writeValue(e){this.value.set(e??"")}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.cvaDisabled.set(e)}isDateDisabled(e){const t=this.minBound(),a=this.maxBound();return!!(t&&y(e,t,this.calendar())<0||a&&y(e,a,this.calendar())>0)}isMonthDisabled(e,t){const a=this.calendar(),r=v({year:e,month:t,day:1},a),s=C(e,t,a),l=v({year:e,month:t,day:s},a),n=this.minBound(),o=this.maxBound();return!!(n&&y(l,n,a)<0||o&&y(r,o,a)>0)}isYearDisabled(e){const t=this.calendar();for(let a=1;a<=12;a+=1)if(!this.isMonthDisabled(e,a))return!1;return!0}initialViewParts(){return g(N(),"gregorian")}static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:x,deps:[],target:i.ɵɵFactoryTarget.Component});static ɵcmp=i.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.0.7",type:x,isStandalone:!0,selector:"dga-date-picker",inputs:{valueInput:{classPropertyName:"valueInput",publicName:"value",isSignal:!0,isRequired:!1,transformFunction:null},startValue:{classPropertyName:"startValue",publicName:"startValue",isSignal:!0,isRequired:!1,transformFunction:null},endValue:{classPropertyName:"endValue",publicName:"endValue",isSignal:!0,isRequired:!1,transformFunction:null},calendar:{classPropertyName:"calendar",publicName:"calendar",isSignal:!0,isRequired:!1,transformFunction:null},range:{classPropertyName:"range",publicName:"range",isSignal:!0,isRequired:!1,transformFunction:null},format:{classPropertyName:"format",publicName:"format",isSignal:!0,isRequired:!1,transformFunction:null},mode:{classPropertyName:"mode",publicName:"mode",isSignal:!0,isRequired:!1,transformFunction:null},locale:{classPropertyName:"locale",publicName:"locale",isSignal:!0,isRequired:!1,transformFunction:null},minDate:{classPropertyName:"minDate",publicName:"minDate",isSignal:!0,isRequired:!1,transformFunction:null},maxDate:{classPropertyName:"maxDate",publicName:"maxDate",isSignal:!0,isRequired:!1,transformFunction:null},yearBefore:{classPropertyName:"yearBefore",publicName:"yearBefore",isSignal:!0,isRequired:!1,transformFunction:null},yearAfter:{classPropertyName:"yearAfter",publicName:"yearAfter",isSignal:!0,isRequired:!1,transformFunction:null},placeholder:{classPropertyName:"placeholder",publicName:"placeholder",isSignal:!0,isRequired:!1,transformFunction:null},controlId:{classPropertyName:"controlId",publicName:"controlId",isSignal:!0,isRequired:!1,transformFunction:null},name:{classPropertyName:"name",publicName:"name",isSignal:!0,isRequired:!1,transformFunction:null},size:{classPropertyName:"size",publicName:"size",isSignal:!0,isRequired:!1,transformFunction:null},disabledInput:{classPropertyName:"disabledInput",publicName:"disabled",isSignal:!0,isRequired:!1,transformFunction:null},required:{classPropertyName:"required",publicName:"required",isSignal:!0,isRequired:!1,transformFunction:null},clearable:{classPropertyName:"clearable",publicName:"clearable",isSignal:!0,isRequired:!1,transformFunction:null},editable:{classPropertyName:"editable",publicName:"editable",isSignal:!0,isRequired:!1,transformFunction:null},invalid:{classPropertyName:"invalid",publicName:"dgaInvalid",isSignal:!0,isRequired:!1,transformFunction:null},status:{classPropertyName:"status",publicName:"status",isSignal:!0,isRequired:!1,transformFunction:null},rangeSeparator:{classPropertyName:"rangeSeparator",publicName:"rangeSeparator",isSignal:!0,isRequired:!1,transformFunction:null},todayLabel:{classPropertyName:"todayLabel",publicName:"todayLabel",isSignal:!0,isRequired:!1,transformFunction:null},clearLabel:{classPropertyName:"clearLabel",publicName:"clearLabel",isSignal:!0,isRequired:!1,transformFunction:null},closeLabel:{classPropertyName:"closeLabel",publicName:"closeLabel",isSignal:!0,isRequired:!1,transformFunction:null},saveLabel:{classPropertyName:"saveLabel",publicName:"saveLabel",isSignal:!0,isRequired:!1,transformFunction:null},ariaLabel:{classPropertyName:"ariaLabel",publicName:"ariaLabel",isSignal:!0,isRequired:!1,transformFunction:null}},outputs:{startValue:"startValueChange",endValue:"endValueChange",valueChange:"valueChange",rangeChange:"rangeChange"},host:{listeners:{"document:click":"onDocumentClick($event)","document:keydown.escape":"onEscape()","window:resize":"onReposition()","window:scroll":"onReposition()"},classAttribute:"dga-date-picker-host"},providers:[U(x)],ngImport:i,template:`
2
2
  <div
3
3
  class="dga-date-picker"
4
4
  [class.dga-date-picker--open]="open()"
@@ -1,4 +1,4 @@
1
- import*as i from"@angular/core";import{Directive as y,inject as g,ElementRef as B,input as n,booleanAttribute as I,model as w,output as u,signal as l,contentChild as M,Injector as Y,DOCUMENT as Q,DestroyRef as W,viewChild as P,computed as s,effect as L,untracked as z,afterNextRender as S,HostListener as b,ChangeDetectionStrategy as K,Component as G}from"@angular/core";import{APP_BASE_HREF as Z,PlatformLocation as X}from"@angular/common";import{dgaSafeHref as O,dgaCx as c,DgaAvatar as A,DgaBadge as E,DgaField as H,DgaFormControl as F,DgaFormEnd as $,DgaIcon as R,DgaIconBadge as j,DgaModal as q,DgaTooltip as V}from"@a.nemreen/dga-ui";function J(k,e="/"){if(typeof window>"u")return!1;const t=O(k.trim(),e);if(!t)return!1;try{const o=new URL(t,window.location.origin);return o.protocol!=="http:"&&o.protocol!=="https:"||o.origin!==window.location.origin?!1:(window.location.assign(`${o.pathname}${o.search}${o.hash}`),!0)}catch{return!1}}class h{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:h,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:h,isStandalone:!0,selector:"[dgaHeaderLoginBeforeForm]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:h,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginBeforeForm]",standalone:!0}]}]});class x{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:x,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:x,isStandalone:!0,selector:"[dgaHeaderLoginAfterFields]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:x,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginAfterFields]",standalone:!0}]}]});class p{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:p,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:p,isStandalone:!0,selector:"[dgaHeaderLoginFooter]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:p,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginFooter]",standalone:!0}]}]});class m{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:m,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:m,isStandalone:!0,selector:"[dgaHeaderLoginForm]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:m,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginForm]",standalone:!0}]}]});function ee(k,e){const t=k.trim();if(t.endsWith("rem")){const o=Number.parseFloat(t);return Number.isFinite(o)?o*16:e}if(t.endsWith("px")){const o=Number.parseFloat(t);return Number.isFinite(o)?o:e}return e}const T="group relative inline-flex h-(--size-header-portal) shrink-0 cursor-pointer items-center gap-md rounded-sm px-xl font-sans text-body-md font-medium text-fg hover:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",te="pointer-events-none absolute start-xl end-xl bottom-0 h-[5px] rounded-full",ie="inline-flex min-h-5xl w-full cursor-pointer flex-col justify-center gap-xxs rounded-sm px-xl py-sm text-start text-body-md font-normal text-fg transition-colors hover:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",oe="inline-flex min-h-11xl w-full cursor-pointer flex-col justify-center gap-xs rounded-md border border-border bg-card px-2xl py-xl text-start transition-colors hover:border-primary hover:bg-primary-faint focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",ae="relative flex min-h-7xl w-full cursor-pointer items-center gap-lg rounded-md px-xl py-md text-start text-body-md font-medium text-fg transition-colors hover:bg-neutral-light active:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",ne="flex min-h-6xl w-full cursor-pointer flex-col justify-center gap-xxs rounded-md px-xl py-md text-start text-body-md text-fg transition-colors hover:bg-neutral-light active:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";class v{host=g(B);baseHref=g(Z,{optional:!0})??g(X).getBaseHrefFromDOM()??"/";closeTimer=null;dropdownSyncFrame=null;lastDropdownStyleKey="";collapseId="dga-nav-collapse";dropLink=ie;dropTile=oe;mobileLink=ne;brand=n("",...ngDevMode?[{debugName:"brand"}]:[]);brandSlogan=n("",...ngDevMode?[{debugName:"brandSlogan"}]:[]);brandLogo=n("",...ngDevMode?[{debugName:"brandLogo"}]:[]);brandLogoAlt=n("شعار الجهة",...ngDevMode?[{debugName:"brandLogoAlt"}]:[]);brandPlaceholder=n(!1,{...ngDevMode?{debugName:"brandPlaceholder"}:{},transform:I});brandHref=n("#",...ngDevMode?[{debugName:"brandHref"}]:[]);navLabel=n("التنقل الرئيسي",...ngDevMode?[{debugName:"navLabel"}]:[]);menuToggleLabel=n("فتح قائمة التنقل",...ngDevMode?[{debugName:"menuToggleLabel"}]:[]);menuCloseLabel=n("إغلاق قائمة التنقل",...ngDevMode?[{debugName:"menuCloseLabel"}]:[]);appearance=n("default",...ngDevMode?[{debugName:"appearance"}]:[]);mobileNav=n("sheet",...ngDevMode?[{debugName:"mobileNav"}]:[]);sticky=n(!0,{...ngDevMode?{debugName:"sticky"}:{},transform:I});items=n([],...ngDevMode?[{debugName:"items"}]:[]);actions=n([],...ngDevMode?[{debugName:"actions"}]:[]);search=n(null,...ngDevMode?[{debugName:"search"}]:[]);searchQuery=w("",...ngDevMode?[{debugName:"searchQuery"}]:[]);notifications=n(null,...ngDevMode?[{debugName:"notifications"}]:[]);login=n(null,...ngDevMode?[{debugName:"login"}]:[]);user=n(null,...ngDevMode?[{debugName:"user"}]:[]);authenticated=w(!1,...ngDevMode?[{debugName:"authenticated"}]:[]);loginSubmitting=w(!1,...ngDevMode?[{debugName:"loginSubmitting"}]:[]);loginError=w("",...ngDevMode?[{debugName:"loginError"}]:[]);actionClick=u();searchSubmit=u();searchSuggestionSelect=u();searchVoice=u();notificationAction=u();loginSubmit=u();logout=u();userLinkClick=u();navLinkClick=u();mobileOpen=l(!1,...ngDevMode?[{debugName:"mobileOpen"}]:[]);openDropdown=l(null,...ngDevMode?[{debugName:"openDropdown"}]:[]);searchOpen=l(!1,...ngDevMode?[{debugName:"searchOpen"}]:[]);notificationsOpen=l(!1,...ngDevMode?[{debugName:"notificationsOpen"}]:[]);loginOpen=l(!1,...ngDevMode?[{debugName:"loginOpen"}]:[]);userMenuOpen=l(!1,...ngDevMode?[{debugName:"userMenuOpen"}]:[]);voiceListening=l(!1,...ngDevMode?[{debugName:"voiceListening"}]:[]);expandedNotificationId=l(null,...ngDevMode?[{debugName:"expandedNotificationId"}]:[]);loginEmail=l("",...ngDevMode?[{debugName:"loginEmail"}]:[]);loginPassword=l("",...ngDevMode?[{debugName:"loginPassword"}]:[]);showLoginPassword=l(!1,...ngDevMode?[{debugName:"showLoginPassword"}]:[]);loginEmailError=l("",...ngDevMode?[{debugName:"loginEmailError"}]:[]);loginPasswordError=l("",...ngDevMode?[{debugName:"loginPasswordError"}]:[]);dropdownPanelStyle=l({},...ngDevMode?[{debugName:"dropdownPanelStyle"}]:[]);customLoginForm=M(m,...ngDevMode?[{debugName:"customLoginForm"}]:[]);customLoginFooter=M(p,...ngDevMode?[{debugName:"customLoginFooter"}]:[]);dismissedNotificationIds=l(new Set,...ngDevMode?[{debugName:"dismissedNotificationIds"}]:[]);readNotificationIds=l(new Set,...ngDevMode?[{debugName:"readNotificationIds"}]:[]);dropdownTrigger=null;dropdownActionId=null;injector=g(Y);doc=g(Q);destroyRef=g(W);searchInputRef=P("searchInput",...ngDevMode?[{debugName:"searchInputRef"}]:[]);utilLayerRef=P("utilLayer",...ngDevMode?[{debugName:"utilLayerRef"}]:[]);searchPanelId="dga-header-search-panel";notificationsPanelId="dga-header-notifications-panel";loginPanelId="dga-header-login-panel";userPanelId="dga-header-user-panel";isPortal=s(()=>this.appearance()==="portal",...ngDevMode?[{debugName:"isPortal"}]:[]);appHref(e){return O(e,this.baseHref)}searchConfig=s(()=>this.search(),...ngDevMode?[{debugName:"searchConfig"}]:[]);searchActionId=s(()=>this.search()?.actionId??"search",...ngDevMode?[{debugName:"searchActionId"}]:[]);notificationsConfig=s(()=>this.notifications(),...ngDevMode?[{debugName:"notificationsConfig"}]:[]);notificationsActionId=s(()=>this.notifications()?.actionId??"notifications",...ngDevMode?[{debugName:"notificationsActionId"}]:[]);loginConfig=s(()=>this.login(),...ngDevMode?[{debugName:"loginConfig"}]:[]);loginActionId=s(()=>this.login()?.actionId??"login",...ngDevMode?[{debugName:"loginActionId"}]:[]);userConfig=s(()=>this.user(),...ngDevMode?[{debugName:"userConfig"}]:[]);hasCustomLoginForm=s(()=>!!this.customLoginForm(),...ngDevMode?[{debugName:"hasCustomLoginForm"}]:[]);hasCustomLoginFooter=s(()=>!!this.customLoginFooter(),...ngDevMode?[{debugName:"hasCustomLoginFooter"}]:[]);utilityOverlayOpen=s(()=>this.notificationsOpen()||this.loginOpen()||this.userMenuOpen(),...ngDevMode?[{debugName:"utilityOverlayOpen"}]:[]);visibleNotifications=s(()=>{const e=this.notifications()?.items??[],t=this.dismissedNotificationIds(),o=this.readNotificationIds();return e.filter(a=>!t.has(a.id)).map(a=>({...a,read:!!a.read||o.has(a.id)}))},...ngDevMode?[{debugName:"visibleNotifications"}]:[]);unreadNotificationCount=s(()=>this.visibleNotifications().filter(e=>!e.read).length,...ngDevMode?[{debugName:"unreadNotificationCount"}]:[]);constructor(){this.destroyRef.onDestroy(()=>this.removePortaledUtilLayer()),L(()=>{this.mobileNav(),z(()=>{this.mobileOpen()&&this.closeAll()})}),L(()=>{if(!this.utilityOverlayOpen())return;this.utilLayerRef()?.nativeElement&&this.portalUtilLayer(),S(()=>this.portalUtilLayer(),{injector:this.injector})}),L(()=>{this.authenticated()&&this.loginOpen()&&z(()=>this.closeLogin())})}portalUtilLayer(){const e=this.utilLayerRef()?.nativeElement;!e||e.parentElement===this.doc.body||this.doc.body.appendChild(e)}removePortaledUtilLayer(){const e=this.utilLayerRef()?.nativeElement;e?.parentElement===this.doc.body&&e.remove()}activeWideDropdown=s(()=>{if(!this.hoverMenus()&&this.isMobileViewport())return null;const e=this.openDropdown();if(e===null)return null;const t=this.items()[e];if(!t?.dropdown)return null;const o=this.resolveVariant(t);return o==="menu"?null:{index:e,item:t,variant:o}},...ngDevMode?[{debugName:"activeWideDropdown"}]:[]);hostClasses=s(()=>c("relative z-header block overflow-visible border-b border-border-subtle bg-nav font-sans text-fg",this.sticky()&&"sticky top-0 shadow-md"),...ngDevMode?[{debugName:"hostClasses"}]:[]);innerClasses=s(()=>c("relative flex w-full gap-lg px-(--wrapper-padding)",this.appearance()==="default"&&"min-h-6xl items-center py-md",this.appearance()==="portal"&&"h-(--size-header-portal) items-stretch"),...ngDevMode?[{debugName:"innerClasses"}]:[]);desktopNavClasses=s(()=>c("min-w-0 flex-1",this.appearance()==="default"&&"flex flex-wrap items-center gap-lg self-center",this.appearance()==="portal"&&"hidden md:flex md:items-stretch"),...ngDevMode?[{debugName:"desktopNavClasses"}]:[]);actionsClasses=s(()=>c("ms-auto flex shrink-0 items-stretch empty:hidden",this.isPortal()&&this.items().length>0&&"max-md:hidden"),...ngDevMode?[{debugName:"actionsClasses"}]:[]);mobilePanelClass(){const e=this.mobileOpen(),t=this.mobileNav();return c("flex flex-col overflow-hidden bg-nav md:hidden",t==="sheet"&&"fixed top-0 bottom-0 end-0 z-20 w-[min(16rem,70vw)] max-w-[16rem] rounded-s-xl border-s border-border shadow-2xl",t==="fullscreen"&&"fixed inset-0 z-40 rounded-none border-0 shadow-none",t==="push"&&"absolute inset-x-0 top-full z-20 max-h-[min(70dvh,28rem)] border-b border-border shadow-lg",e?"dga-mobile-nav-open":"dga-mobile-nav-closed",e&&t==="sheet"&&"dga-mobile-sheet-open",e&&t==="fullscreen"&&"dga-mobile-fs-open",e&&t==="push"&&"dga-mobile-push-open")}hoverMenus(){return typeof matchMedia!="function"?!1:matchMedia("(hover: hover) and (pointer: fine)").matches}isMobileViewport(){return typeof matchMedia!="function"?!1:matchMedia("(max-width: 767px)").matches}resolveVariant(e){const t=e.dropdown;return t?t.variant?t.variant:t.featured?"featured":t.columns?.length||t.layout==="columns"||t.layout==="rows"?"mega":"menu":"menu"}resolveLayout(e){const t=e.dropdown;return t?t.layout?t.layout:t.columns?.length?"columns":"list":"list"}colCount(e){return e.dropdown?.columns?.length??0}flatLinks(e){const t=e.dropdown;return t?t.links?.length?t.links:t.columns?.flatMap(o=>o.links)??[]:[]}columnsGridClass(e){return c("grid w-full gap-2xl py-lg",e>1&&"sm:grid-cols-2",e>2&&"lg:grid-cols-3",e>3&&"xl:grid-cols-4")}featuredGridClass(e,t){return c("grid w-full gap-3xl",e==="featured"&&t&&"lg:grid-cols-[minmax(0,1fr)_minmax(14rem,18rem)]")}navItemClass(e,t=!1){return c(T,"justify-center",e&&"text-fg-primary",t&&"bg-neutral-light")}mobileItemClass(e,t=!1){return c(ae,e&&"bg-primary-faint",t&&"bg-neutral-light")}indicatorClass(e){return c(te,e?"bg-primary group-hover:bg-primary":"bg-transparent group-hover:bg-fg-disabled")}actionClass(e){return c(T,"relative justify-center")}badgeClass(){return c("dga-action-badge absolute top-lg end-md flex h-lg min-w-lg","items-center justify-center rounded-full bg-error px-xxs","text-body-2xs font-medium text-on-color")}isIconOnly(e){return e.iconOnly!==!1}isSearchAction(e){return!!this.search()&&e.id===this.searchActionId()}isNotificationsAction(e){return!!this.notifications()&&e.id===this.notificationsActionId()}isLoginAction(e){return!!this.login()&&e.id===this.loginActionId()}actionTooltip(e){return this.isLoginAction(e)&&this.authenticated()&&this.user()?.name||e.label}actionAriaLabel(e){return this.actionTooltip(e)}actionExpanded(e){return this.isSearchAction(e)?this.searchOpen():this.isNotificationsAction(e)?this.notificationsOpen():this.isLoginAction(e)?this.authenticated()?this.userMenuOpen():this.loginOpen():null}actionControls(e){return this.isSearchAction(e)?this.searchPanelId:this.isNotificationsAction(e)?this.notificationsPanelId:this.isLoginAction(e)?this.authenticated()?this.userPanelId:this.loginPanelId:null}actionIndicatorActive(e){return this.isSearchAction(e)?this.searchOpen():this.isNotificationsAction(e)?this.notificationsOpen():this.isLoginAction(e)?this.authenticated()?this.userMenuOpen():this.loginOpen():!1}clearCloseTimer(){this.closeTimer!==null&&(clearTimeout(this.closeTimer),this.closeTimer=null)}scheduleClose(){this.clearCloseTimer(),this.closeTimer=setTimeout(()=>{this.openDropdown.set(null),this.closeTimer=null},120)}setBodyScrollLocked(e){typeof document>"u"||document.documentElement.classList.toggle("dga-nav-locked",e)}unlockBodyIfIdle(){this.mobileOpen()||this.utilityOverlayOpen()||this.setBodyScrollLocked(!1)}onItemEnter(e){if(!this.isMobileViewport()){if(!this.items()[e]?.dropdown){this.hoverMenus()&&this.scheduleClose();return}this.clearCloseTimer(),this.hoverMenus()&&this.openDropdown.set(e)}}onPanelEnter(){this.clearCloseTimer()}onHostLeave(e){if(!this.hoverMenus()||this.isMobileViewport())return;const t=e.relatedTarget;t&&this.host.nativeElement.contains(t)||this.scheduleClose()}toggleMobile(){this.mobileOpen.update(e=>!e),this.openDropdown.set(null),this.setBodyScrollLocked(this.mobileOpen())}toggleDropdown(e,t){t.stopPropagation(),!(this.hoverMenus()&&!this.isMobileViewport()&&this.openDropdown()===e)&&(this.clearCloseTimer(),this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.openDropdown.update(o=>o===e?null:e))}closeAll(){this.clearCloseTimer(),this.openDropdown.set(null),this.mobileOpen.set(!1),this.closeSearch(!1),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.setBodyScrollLocked(!1)}onAction(e,t){const o=this.triggerFromEvent(t);if(this.isSearchAction(e)){this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.toggleSearch(),this.actionClick.emit(e);return}if(this.isNotificationsAction(e)){this.closeSearch(),this.closeLogin(),this.closeUserMenu(),this.toggleNotifications(o),this.actionClick.emit(e);return}if(this.isLoginAction(e)){this.closeSearch(),this.closeNotifications(),this.authenticated()?(this.closeLogin(),this.toggleUserMenu(o)):(this.closeUserMenu(),this.toggleLogin(o)),this.actionClick.emit(e);return}this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.actionClick.emit(e)}onMobileAction(e,t){const o=this.triggerFromEvent(t);if(this.isSearchAction(e)){this.mobileOpen.set(!1),this.setBodyScrollLocked(!1),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.toggleSearch(),this.actionClick.emit(e);return}if(this.isNotificationsAction(e)){this.mobileOpen.set(!1),this.closeSearch(),this.closeLogin(),this.closeUserMenu(),this.toggleNotifications(o),this.isMobileViewport()&&this.setBodyScrollLocked(!0),this.actionClick.emit(e);return}if(this.isLoginAction(e)){this.mobileOpen.set(!1),this.closeSearch(),this.closeNotifications(),this.authenticated()?(this.closeLogin(),this.toggleUserMenu(o)):(this.closeUserMenu(),this.toggleLogin(o)),this.isMobileViewport()&&this.setBodyScrollLocked(!0),this.actionClick.emit(e);return}this.actionClick.emit(e),this.closeAll()}closeUtilityOverlays(){this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu()}closePortalChromeMenus(){typeof document>"u"||document.dispatchEvent(new CustomEvent("dga-close-portal-chrome-menus"))}onCloseHeaderOverlays(){this.closeUtilityOverlays()}toggleSearch(){if(this.searchOpen()){this.closeSearch();return}this.openDropdown.set(null),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.closePortalChromeMenus(),this.searchOpen.set(!0)}onSearchModalOpenChange(e){if(e){this.searchOpen.set(!0);return}this.closeSearch()}focusSearchInput(){S(()=>this.searchInputRef()?.nativeElement.focus(),{injector:this.injector})}closeSearch(e=!0){this.searchOpen.set(!1),e&&this.stopVoice()}toggleNotifications(e){if(this.notificationsOpen()){this.closeNotifications();return}this.openDropdown.set(null),this.closeSearch(),this.closeLogin(),this.closeUserMenu(),this.closePortalChromeMenus(),this.notificationsOpen.set(!0);const t=this.visibleNotifications()[0];this.expandedNotificationId.set(t?.id??null),this.scheduleDropdownSync(this.notificationsActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeNotifications(){this.notificationsOpen.set(!1),this.expandedNotificationId.set(null),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}toggleLogin(e){if(this.loginOpen()){this.closeLogin();return}this.openDropdown.set(null),this.closeSearch(),this.closeNotifications(),this.closeUserMenu(),this.closePortalChromeMenus(),this.loginOpen.set(!0),this.scheduleDropdownSync(this.loginActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeLogin(){this.loginOpen.set(!1),this.loginSubmitting.set(!1),this.loginError.set(""),this.loginEmailError.set(""),this.loginPasswordError.set(""),this.loginEmail.set(""),this.loginPassword.set(""),this.showLoginPassword.set(!1),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}toggleUserMenu(e){if(this.userMenuOpen()){this.closeUserMenu();return}this.openDropdown.set(null),this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closePortalChromeMenus(),this.userMenuOpen.set(!0),this.scheduleDropdownSync(this.loginActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeUserMenu(){this.userMenuOpen.set(!1),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}onLoginEmailInput(e){this.loginEmail.set(e),this.loginEmailError()&&this.loginEmailError.set("")}onLoginPasswordInput(e){this.loginPassword.set(e),this.loginPasswordError()&&this.loginPasswordError.set("")}showLoginRegisterRow(e){return!!(e.registerPrompt||e.registerLabel||e.registerHref)}loginPanelOuterStyle(){const e=this.dropdownPanelStyle();if(this.isMobileViewport())return e;const t=this.loginConfig()?.panelWidth??"24rem";return{...e,width:`min(${t}, calc(100vw - 2rem))`}}loginPanelInnerStyle(){return this.isMobileViewport()?{maxHeight:`min(90svh, ${this.loginConfig()?.maxHeight??"44rem"})`}:{}}onLoginSubmit(e){e.preventDefault();const t=this.loginConfig(),o=this.loginEmail().trim(),a=this.loginPassword();this.loginEmailError.set(""),this.loginPasswordError.set(""),this.loginError.set("");let r=!1;o?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)||(this.loginEmailError.set(t?.emailInvalidMessage??"Enter a valid email address"),r=!0):(this.loginEmailError.set(t?.emailRequiredMessage??"Email is required"),r=!0),a||(this.loginPasswordError.set(t?.passwordRequiredMessage??"Password is required"),r=!0),!r&&(this.loginSubmitting.set(!0),this.loginSubmit.emit({email:o,password:a}))}onUserLink(e){if(this.userLinkClick.emit(e),e.id==="logout"||e.danger){this.authenticated.set(!1),this.logout.emit(),this.closeUserMenu();return}this.closeUserMenu()}toggleNotificationExpand(e){this.expandedNotificationId.update(t=>t===e.id?null:e.id),this.notificationAction.emit({item:e,action:"select"})}onNotificationAction(e,t){t==="read"&&this.readNotificationIds.update(o=>new Set([...o,e.id])),t==="dismiss"&&(this.dismissedNotificationIds.update(o=>new Set([...o,e.id])),this.expandedNotificationId.update(o=>o===e.id?null:o)),t==="view"&&e.href&&J(e.href,this.baseHref),this.notificationAction.emit({item:e,action:t})}markAllNotificationsRead(){const e=this.visibleNotifications().map(t=>t.id);this.readNotificationIds.update(t=>new Set([...t,...e]))}clearSearchQuery(){this.searchQuery.set(""),queueMicrotask(()=>this.searchInputRef()?.nativeElement.focus())}applySearchSuggestion(e){const t=e.value??e.label;this.searchQuery.set(t),this.searchSuggestionSelect.emit(e),queueMicrotask(()=>this.searchInputRef()?.nativeElement.focus())}onSearchFormSubmit(e){e.preventDefault();const t=this.searchQuery().trim();this.searchSubmit.emit(t);const o=this.search();if(o?.resultsHref){const a=o.queryParam??"q",r=new URL(o.resultsHref,typeof window<"u"?window.location.origin:"http://localhost");t?r.searchParams.set(a,t):r.searchParams.delete(a),typeof window<"u"&&window.location.assign(`${r.pathname}${r.search}${r.hash}`)}this.closeSearch()}onSearchVoice(){if(this.searchVoice.emit(),typeof window>"u")return;const e=window,t=e.SpeechRecognition||e.webkitSpeechRecognition;if(!t)return;this.stopVoice();const o=new t;o.lang=typeof document<"u"&&document.documentElement.lang?document.documentElement.lang:"ar-SA",o.interimResults=!1,o.maxAlternatives=1,this.voiceListening.set(!0),o.onresult=a=>{const r=a.results[0]?.[0]?.transcript?.trim();r&&this.searchQuery.set(r),this.voiceListening.set(!1)},o.onerror=()=>this.voiceListening.set(!1),o.onend=()=>this.voiceListening.set(!1),this.speechRecognition=o,o.start()}speechRecognition=null;stopVoice(){this.speechRecognition?.stop(),this.speechRecognition=null,this.voiceListening.set(!1)}triggerFromEvent(e){const t=e?.currentTarget;return t instanceof HTMLElement?t:null}scheduleDropdownSync(e,t){this.dropdownActionId=e,this.dropdownTrigger=t??null,S(()=>this.requestDropdownSync(t),{injector:this.injector})}requestDropdownSync(e){if(typeof requestAnimationFrame!="function"){this.syncDropdownPanel(e);return}this.dropdownSyncFrame===null&&(this.dropdownSyncFrame=requestAnimationFrame(()=>{this.dropdownSyncFrame=null,this.syncDropdownPanel(e)}))}clearDropdownAnchor(){this.notificationsOpen()||this.loginOpen()||this.userMenuOpen()||(this.dropdownTrigger=null,this.dropdownActionId=null,this.lastDropdownStyleKey="",this.dropdownPanelStyle.set({}))}findActionTrigger(e){const t=this.host.nativeElement.querySelectorAll(`[data-dga-action="${CSS.escape(e)}"]`);for(const o of Array.from(t)){const a=o;if(a.getClientRects().length>0)return a}return t[0]??null}activeUtilityPanelWidthPx(){if(typeof window>"u")return 448;const e=window.innerWidth-32;if(this.loginOpen()){const t=this.loginConfig()?.panelWidth??"24rem";return Math.min(ee(t,384),e)}return this.userMenuOpen()?Math.min(352,e):(this.notificationsOpen(),Math.min(448,e))}syncDropdownPanel(e){if(typeof window>"u")return;if(this.isMobileViewport()){const d={top:"auto",bottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))",left:"0.75rem",right:"0.75rem",width:"auto",maxWidth:"none"},D=`sheet|${d.bottom}`;if(D===this.lastDropdownStyleKey)return;this.lastDropdownStyleKey=D,this.dropdownPanelStyle.set(d);return}const t=e??this.dropdownTrigger??(this.dropdownActionId?this.findActionTrigger(this.dropdownActionId):null);if(!t)return;this.dropdownTrigger=t;const o=t.getBoundingClientRect();if(o.width<1&&o.height<1)return;const a=getComputedStyle(this.host.nativeElement).direction,U=(typeof document<"u"?document.documentElement.getAttribute("dir"):null)==="rtl"||a==="rtl",_=8,N=this.activeUtilityPanelWidthPx(),f={top:`${Math.round(o.bottom+_)}px`};if(U){let d=Math.round(o.left);d=Math.max(16,Math.min(d,window.innerWidth-N-16)),f.left=`${d}px`,f.right="auto"}else{let d=Math.round(window.innerWidth-o.right);d=Math.max(16,Math.min(d,window.innerWidth-N-16)),f.right=`${d}px`,f.left="auto"}const C=`${f.top}|${f.left??""}|${f.right??""}`;C!==this.lastDropdownStyleKey&&(this.lastDropdownStyleKey=C,this.dropdownPanelStyle.set(f))}onKey(e){e.key==="Escape"&&this.closeAll()}onScroll(){(this.notificationsOpen()||this.loginOpen()||this.userMenuOpen())&&this.requestDropdownSync()}onResize(){typeof window>"u"||(window.matchMedia("(max-width: 767px)").matches||(this.mobileOpen.set(!1),this.setBodyScrollLocked(!1)),(this.notificationsOpen()||this.loginOpen()||this.userMenuOpen())&&(this.lastDropdownStyleKey="",this.requestDropdownSync()))}onNavLinkClick(e,t){this.navLinkClick.emit(e),e.href||t.preventDefault()}onDocClick(e){this.searchOpen()||this.notificationsOpen()||this.loginOpen()||this.userMenuOpen()||this.hoverMenus()&&!this.isMobileViewport()||this.mobileOpen()||this.host.nativeElement.contains(e.target)||this.openDropdown.set(null)}static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:v,deps:[],target:i.ɵɵFactoryTarget.Component});static ɵcmp=i.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.0.7",type:v,isStandalone:!0,selector:"dga-header",inputs:{brand:{classPropertyName:"brand",publicName:"brand",isSignal:!0,isRequired:!1,transformFunction:null},brandSlogan:{classPropertyName:"brandSlogan",publicName:"brandSlogan",isSignal:!0,isRequired:!1,transformFunction:null},brandLogo:{classPropertyName:"brandLogo",publicName:"brandLogo",isSignal:!0,isRequired:!1,transformFunction:null},brandLogoAlt:{classPropertyName:"brandLogoAlt",publicName:"brandLogoAlt",isSignal:!0,isRequired:!1,transformFunction:null},brandPlaceholder:{classPropertyName:"brandPlaceholder",publicName:"brandPlaceholder",isSignal:!0,isRequired:!1,transformFunction:null},brandHref:{classPropertyName:"brandHref",publicName:"brandHref",isSignal:!0,isRequired:!1,transformFunction:null},navLabel:{classPropertyName:"navLabel",publicName:"navLabel",isSignal:!0,isRequired:!1,transformFunction:null},menuToggleLabel:{classPropertyName:"menuToggleLabel",publicName:"menuToggleLabel",isSignal:!0,isRequired:!1,transformFunction:null},menuCloseLabel:{classPropertyName:"menuCloseLabel",publicName:"menuCloseLabel",isSignal:!0,isRequired:!1,transformFunction:null},appearance:{classPropertyName:"appearance",publicName:"appearance",isSignal:!0,isRequired:!1,transformFunction:null},mobileNav:{classPropertyName:"mobileNav",publicName:"mobileNav",isSignal:!0,isRequired:!1,transformFunction:null},sticky:{classPropertyName:"sticky",publicName:"sticky",isSignal:!0,isRequired:!1,transformFunction:null},items:{classPropertyName:"items",publicName:"items",isSignal:!0,isRequired:!1,transformFunction:null},actions:{classPropertyName:"actions",publicName:"actions",isSignal:!0,isRequired:!1,transformFunction:null},search:{classPropertyName:"search",publicName:"search",isSignal:!0,isRequired:!1,transformFunction:null},searchQuery:{classPropertyName:"searchQuery",publicName:"searchQuery",isSignal:!0,isRequired:!1,transformFunction:null},notifications:{classPropertyName:"notifications",publicName:"notifications",isSignal:!0,isRequired:!1,transformFunction:null},login:{classPropertyName:"login",publicName:"login",isSignal:!0,isRequired:!1,transformFunction:null},user:{classPropertyName:"user",publicName:"user",isSignal:!0,isRequired:!1,transformFunction:null},authenticated:{classPropertyName:"authenticated",publicName:"authenticated",isSignal:!0,isRequired:!1,transformFunction:null},loginSubmitting:{classPropertyName:"loginSubmitting",publicName:"loginSubmitting",isSignal:!0,isRequired:!1,transformFunction:null},loginError:{classPropertyName:"loginError",publicName:"loginError",isSignal:!0,isRequired:!1,transformFunction:null}},outputs:{searchQuery:"searchQueryChange",authenticated:"authenticatedChange",loginSubmitting:"loginSubmittingChange",loginError:"loginErrorChange",actionClick:"actionClick",searchSubmit:"searchSubmit",searchSuggestionSelect:"searchSuggestionSelect",searchVoice:"searchVoice",notificationAction:"notificationAction",loginSubmit:"loginSubmit",logout:"logout",userLinkClick:"userLinkClick",navLinkClick:"navLinkClick"},host:{attributes:{role:"banner"},listeners:{mouseleave:"onHostLeave($event)","document:dga-close-header-overlays":"onCloseHeaderOverlays()","document:keydown":"onKey($event)","window:scroll":"onScroll()","window:resize":"onResize()","document:click":"onDocClick($event)"},properties:{class:"hostClasses()","attr.data-appearance":"appearance()","attr.data-mobile-nav":"mobileNav()","attr.data-mobile-open":"mobileOpen() || null"}},queries:[{propertyName:"customLoginForm",first:!0,predicate:m,descendants:!0,isSignal:!0},{propertyName:"customLoginFooter",first:!0,predicate:p,descendants:!0,isSignal:!0}],viewQueries:[{propertyName:"searchInputRef",first:!0,predicate:["searchInput"],descendants:!0,isSignal:!0},{propertyName:"utilLayerRef",first:!0,predicate:["utilLayer"],descendants:!0,isSignal:!0}],ngImport:i,template:`
1
+ import*as i from"@angular/core";import{Directive as y,inject as g,ElementRef as B,input as a,booleanAttribute as D,model as w,output as u,signal as l,contentChild as I,Injector as Y,DOCUMENT as Q,DestroyRef as W,viewChild as P,computed as n,effect as L,untracked as z,afterNextRender as C,HostListener as b,ChangeDetectionStrategy as K,Component as G}from"@angular/core";import{APP_BASE_HREF as Z,PlatformLocation as X}from"@angular/common";import{dgaSafeHref as O,dgaCx as c,DgaAvatar as A,DgaBadge as E,DgaField as H,DgaFormControl as F,DgaFormEnd as $,DgaIcon as R,DgaIconBadge as j,DgaModal as q,DgaTooltip as V}from"@a.nemreen/dga-ui";function J(k,e="/"){if(typeof window>"u")return!1;const t=O(k.trim(),e);if(!t)return!1;try{const o=new URL(t,window.location.origin);return o.protocol!=="http:"&&o.protocol!=="https:"||o.origin!==window.location.origin?!1:(window.location.assign(`${o.pathname}${o.search}${o.hash}`),!0)}catch{return!1}}class h{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:h,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:h,isStandalone:!0,selector:"[dgaHeaderLoginBeforeForm]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:h,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginBeforeForm]",standalone:!0}]}]});class x{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:x,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:x,isStandalone:!0,selector:"[dgaHeaderLoginAfterFields]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:x,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginAfterFields]",standalone:!0}]}]});class p{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:p,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:p,isStandalone:!0,selector:"[dgaHeaderLoginFooter]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:p,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginFooter]",standalone:!0}]}]});class m{static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:m,deps:[],target:i.ɵɵFactoryTarget.Directive});static ɵdir=i.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.7",type:m,isStandalone:!0,selector:"[dgaHeaderLoginForm]",ngImport:i})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:m,decorators:[{type:y,args:[{selector:"[dgaHeaderLoginForm]",standalone:!0}]}]});function ee(k,e){const t=k.trim();if(t.endsWith("rem")){const o=Number.parseFloat(t);return Number.isFinite(o)?o*16:e}if(t.endsWith("px")){const o=Number.parseFloat(t);return Number.isFinite(o)?o:e}return e}const U="group relative inline-flex h-(--size-header-portal) shrink-0 cursor-pointer items-center gap-md rounded-sm px-xl font-sans text-body-md font-medium text-fg hover:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",te="pointer-events-none absolute start-xl end-xl bottom-0 h-[5px] rounded-full",ie="inline-flex min-h-5xl w-full cursor-pointer flex-col justify-center gap-xxs rounded-sm px-xl py-sm text-start text-body-md font-normal text-fg transition-colors hover:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",oe="inline-flex min-h-11xl w-full cursor-pointer flex-col justify-center gap-xs rounded-md border border-border bg-card px-2xl py-xl text-start transition-colors hover:border-primary hover:bg-primary-faint focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",ne="relative flex min-h-7xl w-full cursor-pointer items-center gap-lg rounded-md px-xl py-md text-start text-body-md font-medium text-fg transition-colors hover:bg-neutral-light active:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",ae="flex min-h-6xl w-full cursor-pointer flex-col justify-center gap-xxs rounded-md px-xl py-md text-start text-body-md text-fg transition-colors hover:bg-neutral-light active:bg-neutral-light focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";class v{host=g(B);baseHref=g(Z,{optional:!0})??g(X).getBaseHrefFromDOM()??"/";closeTimer=null;dropdownSyncFrame=null;lastDropdownStyleKey="";collapseId="dga-nav-collapse";dropLink=ie;dropTile=oe;mobileLink=ae;brand=a("",...ngDevMode?[{debugName:"brand"}]:[]);brandSlogan=a("",...ngDevMode?[{debugName:"brandSlogan"}]:[]);brandLogo=a("",...ngDevMode?[{debugName:"brandLogo"}]:[]);brandLogoAlt=a("شعار الجهة",...ngDevMode?[{debugName:"brandLogoAlt"}]:[]);brandPlaceholder=a(!1,{...ngDevMode?{debugName:"brandPlaceholder"}:{},transform:D});brandHref=a("#",...ngDevMode?[{debugName:"brandHref"}]:[]);navLabel=a("التنقل الرئيسي",...ngDevMode?[{debugName:"navLabel"}]:[]);menuToggleLabel=a("فتح قائمة التنقل",...ngDevMode?[{debugName:"menuToggleLabel"}]:[]);menuCloseLabel=a("إغلاق قائمة التنقل",...ngDevMode?[{debugName:"menuCloseLabel"}]:[]);appearance=a("default",...ngDevMode?[{debugName:"appearance"}]:[]);mobileNav=a("sheet",...ngDevMode?[{debugName:"mobileNav"}]:[]);sticky=a(!0,{...ngDevMode?{debugName:"sticky"}:{},transform:D});items=a([],...ngDevMode?[{debugName:"items"}]:[]);actions=a([],...ngDevMode?[{debugName:"actions"}]:[]);search=a(null,...ngDevMode?[{debugName:"search"}]:[]);searchQuery=w("",...ngDevMode?[{debugName:"searchQuery"}]:[]);notifications=a(null,...ngDevMode?[{debugName:"notifications"}]:[]);login=a(null,...ngDevMode?[{debugName:"login"}]:[]);localeMenu=a(null,...ngDevMode?[{debugName:"localeMenu"}]:[]);user=a(null,...ngDevMode?[{debugName:"user"}]:[]);authenticated=w(!1,...ngDevMode?[{debugName:"authenticated"}]:[]);loginSubmitting=w(!1,...ngDevMode?[{debugName:"loginSubmitting"}]:[]);loginError=w("",...ngDevMode?[{debugName:"loginError"}]:[]);actionClick=u();searchSubmit=u();searchSuggestionSelect=u();searchVoice=u();notificationAction=u();loginSubmit=u();logout=u();userLinkClick=u();localeSelect=u();navLinkClick=u();mobileOpen=l(!1,...ngDevMode?[{debugName:"mobileOpen"}]:[]);openDropdown=l(null,...ngDevMode?[{debugName:"openDropdown"}]:[]);searchOpen=l(!1,...ngDevMode?[{debugName:"searchOpen"}]:[]);notificationsOpen=l(!1,...ngDevMode?[{debugName:"notificationsOpen"}]:[]);localeMenuOpen=l(!1,...ngDevMode?[{debugName:"localeMenuOpen"}]:[]);loginOpen=l(!1,...ngDevMode?[{debugName:"loginOpen"}]:[]);userMenuOpen=l(!1,...ngDevMode?[{debugName:"userMenuOpen"}]:[]);voiceListening=l(!1,...ngDevMode?[{debugName:"voiceListening"}]:[]);expandedNotificationId=l(null,...ngDevMode?[{debugName:"expandedNotificationId"}]:[]);loginEmail=l("",...ngDevMode?[{debugName:"loginEmail"}]:[]);loginPassword=l("",...ngDevMode?[{debugName:"loginPassword"}]:[]);showLoginPassword=l(!1,...ngDevMode?[{debugName:"showLoginPassword"}]:[]);loginEmailError=l("",...ngDevMode?[{debugName:"loginEmailError"}]:[]);loginPasswordError=l("",...ngDevMode?[{debugName:"loginPasswordError"}]:[]);dropdownPanelStyle=l({},...ngDevMode?[{debugName:"dropdownPanelStyle"}]:[]);customLoginForm=I(m,...ngDevMode?[{debugName:"customLoginForm"}]:[]);customLoginFooter=I(p,...ngDevMode?[{debugName:"customLoginFooter"}]:[]);dismissedNotificationIds=l(new Set,...ngDevMode?[{debugName:"dismissedNotificationIds"}]:[]);readNotificationIds=l(new Set,...ngDevMode?[{debugName:"readNotificationIds"}]:[]);dropdownTrigger=null;dropdownActionId=null;injector=g(Y);doc=g(Q);destroyRef=g(W);searchInputRef=P("searchInput",...ngDevMode?[{debugName:"searchInputRef"}]:[]);utilLayerRef=P("utilLayer",...ngDevMode?[{debugName:"utilLayerRef"}]:[]);searchPanelId="dga-header-search-panel";notificationsPanelId="dga-header-notifications-panel";localePanelId="dga-header-locale-panel";loginPanelId="dga-header-login-panel";userPanelId="dga-header-user-panel";isPortal=n(()=>this.appearance()==="portal",...ngDevMode?[{debugName:"isPortal"}]:[]);appHref(e){return O(e,this.baseHref)}searchConfig=n(()=>this.search(),...ngDevMode?[{debugName:"searchConfig"}]:[]);searchActionId=n(()=>this.search()?.actionId??"search",...ngDevMode?[{debugName:"searchActionId"}]:[]);notificationsConfig=n(()=>this.notifications(),...ngDevMode?[{debugName:"notificationsConfig"}]:[]);notificationsActionId=n(()=>this.notifications()?.actionId??"notifications",...ngDevMode?[{debugName:"notificationsActionId"}]:[]);localeMenuConfig=n(()=>this.localeMenu(),...ngDevMode?[{debugName:"localeMenuConfig"}]:[]);localeActionId=n(()=>this.localeMenu()?.actionId??"lang",...ngDevMode?[{debugName:"localeActionId"}]:[]);loginConfig=n(()=>this.login(),...ngDevMode?[{debugName:"loginConfig"}]:[]);loginActionId=n(()=>this.login()?.actionId??"login",...ngDevMode?[{debugName:"loginActionId"}]:[]);userConfig=n(()=>this.user(),...ngDevMode?[{debugName:"userConfig"}]:[]);hasCustomLoginForm=n(()=>!!this.customLoginForm(),...ngDevMode?[{debugName:"hasCustomLoginForm"}]:[]);hasCustomLoginFooter=n(()=>!!this.customLoginFooter(),...ngDevMode?[{debugName:"hasCustomLoginFooter"}]:[]);utilityOverlayOpen=n(()=>this.notificationsOpen()||this.localeMenuOpen()||this.loginOpen()||this.userMenuOpen(),...ngDevMode?[{debugName:"utilityOverlayOpen"}]:[]);visibleNotifications=n(()=>{const e=this.notifications()?.items??[],t=this.dismissedNotificationIds(),o=this.readNotificationIds();return e.filter(s=>!t.has(s.id)).map(s=>({...s,read:!!s.read||o.has(s.id)}))},...ngDevMode?[{debugName:"visibleNotifications"}]:[]);unreadNotificationCount=n(()=>this.visibleNotifications().filter(e=>!e.read).length,...ngDevMode?[{debugName:"unreadNotificationCount"}]:[]);constructor(){this.destroyRef.onDestroy(()=>this.removePortaledUtilLayer()),L(()=>{this.mobileNav(),z(()=>{this.mobileOpen()&&this.closeAll()})}),L(()=>{if(!this.utilityOverlayOpen())return;this.utilLayerRef()?.nativeElement&&this.portalUtilLayer(),C(()=>this.portalUtilLayer(),{injector:this.injector})}),L(()=>{this.authenticated()&&this.loginOpen()&&z(()=>this.closeLogin())})}portalUtilLayer(){const e=this.utilLayerRef()?.nativeElement;!e||e.parentElement===this.doc.body||this.doc.body.appendChild(e)}removePortaledUtilLayer(){const e=this.utilLayerRef()?.nativeElement;e?.parentElement===this.doc.body&&e.remove()}activeWideDropdown=n(()=>{if(!this.hoverMenus()&&this.isMobileViewport())return null;const e=this.openDropdown();if(e===null)return null;const t=this.items()[e];if(!t?.dropdown)return null;const o=this.resolveVariant(t);return o==="menu"?null:{index:e,item:t,variant:o}},...ngDevMode?[{debugName:"activeWideDropdown"}]:[]);hostClasses=n(()=>c("relative z-header block overflow-visible border-b border-border-subtle bg-nav font-sans text-fg",this.sticky()&&"sticky top-0 shadow-md"),...ngDevMode?[{debugName:"hostClasses"}]:[]);innerClasses=n(()=>c("relative flex w-full gap-lg px-(--wrapper-padding)",this.appearance()==="default"&&"min-h-6xl items-center py-md",this.appearance()==="portal"&&"h-(--size-header-portal) items-stretch"),...ngDevMode?[{debugName:"innerClasses"}]:[]);desktopNavClasses=n(()=>c("min-w-0 flex-1",this.appearance()==="default"&&"flex flex-wrap items-center gap-lg self-center",this.appearance()==="portal"&&"hidden md:flex md:items-stretch"),...ngDevMode?[{debugName:"desktopNavClasses"}]:[]);actionsClasses=n(()=>c("ms-auto flex shrink-0 items-stretch empty:hidden",this.isPortal()&&this.items().length>0&&"max-md:hidden"),...ngDevMode?[{debugName:"actionsClasses"}]:[]);mobilePanelClass(){const e=this.mobileOpen(),t=this.mobileNav();return c("flex flex-col overflow-hidden bg-nav md:hidden",t==="sheet"&&"fixed top-0 bottom-0 end-0 z-20 w-[min(16rem,70vw)] max-w-[16rem] rounded-s-xl border-s border-border shadow-2xl",t==="fullscreen"&&"fixed inset-0 z-40 rounded-none border-0 shadow-none",t==="push"&&"absolute inset-x-0 top-full z-20 max-h-[min(70dvh,28rem)] border-b border-border shadow-lg",e?"dga-mobile-nav-open":"dga-mobile-nav-closed",e&&t==="sheet"&&"dga-mobile-sheet-open",e&&t==="fullscreen"&&"dga-mobile-fs-open",e&&t==="push"&&"dga-mobile-push-open")}hoverMenus(){return typeof matchMedia!="function"?!1:matchMedia("(hover: hover) and (pointer: fine)").matches}isMobileViewport(){return typeof matchMedia!="function"?!1:matchMedia("(max-width: 767px)").matches}resolveVariant(e){const t=e.dropdown;return t?t.variant?t.variant:t.featured?"featured":t.columns?.length||t.layout==="columns"||t.layout==="rows"?"mega":"menu":"menu"}resolveLayout(e){const t=e.dropdown;return t?t.layout?t.layout:t.columns?.length?"columns":"list":"list"}colCount(e){return e.dropdown?.columns?.length??0}flatLinks(e){const t=e.dropdown;return t?t.links?.length?t.links:t.columns?.flatMap(o=>o.links)??[]:[]}columnsGridClass(e){return c("grid w-full gap-2xl py-lg",e>1&&"sm:grid-cols-2",e>2&&"lg:grid-cols-3",e>3&&"xl:grid-cols-4")}featuredGridClass(e,t){return c("grid w-full gap-3xl",e==="featured"&&t&&"lg:grid-cols-[minmax(0,1fr)_minmax(14rem,18rem)]")}navItemClass(e,t=!1){return c(U,"justify-center",e&&"text-fg-primary",t&&"bg-neutral-light")}mobileItemClass(e,t=!1){return c(ne,e&&"bg-primary-faint",t&&"bg-neutral-light")}indicatorClass(e){return c(te,e?"bg-primary group-hover:bg-primary":"bg-transparent group-hover:bg-fg-disabled")}actionClass(e){return c(U,"relative justify-center")}badgeClass(){return c("dga-action-badge absolute top-lg end-md flex h-lg min-w-lg","items-center justify-center rounded-full bg-error px-xxs","text-body-2xs font-medium text-on-color")}isIconOnly(e){return e.iconOnly!==!1}isSearchAction(e){return!!this.search()&&e.id===this.searchActionId()}isNotificationsAction(e){return!!this.notifications()&&e.id===this.notificationsActionId()}isLocaleAction(e){return!!this.localeMenu()&&e.id===this.localeActionId()}isLoginAction(e){return!!this.login()&&e.id===this.loginActionId()}actionTooltip(e){return this.isLoginAction(e)&&this.authenticated()&&this.user()?.name||e.label}actionAriaLabel(e){return this.actionTooltip(e)}actionExpanded(e){return this.isSearchAction(e)?this.searchOpen():this.isNotificationsAction(e)?this.notificationsOpen():this.isLocaleAction(e)?this.localeMenuOpen():this.isLoginAction(e)?this.authenticated()?this.userMenuOpen():this.loginOpen():null}actionControls(e){return this.isSearchAction(e)?this.searchPanelId:this.isNotificationsAction(e)?this.notificationsPanelId:this.isLocaleAction(e)?this.localePanelId:this.isLoginAction(e)?this.authenticated()?this.userPanelId:this.loginPanelId:null}actionIndicatorActive(e){return this.isSearchAction(e)?this.searchOpen():this.isNotificationsAction(e)?this.notificationsOpen():this.isLocaleAction(e)?this.localeMenuOpen():this.isLoginAction(e)?this.authenticated()?this.userMenuOpen():this.loginOpen():!1}clearCloseTimer(){this.closeTimer!==null&&(clearTimeout(this.closeTimer),this.closeTimer=null)}scheduleClose(){this.clearCloseTimer(),this.closeTimer=setTimeout(()=>{this.openDropdown.set(null),this.closeTimer=null},120)}setBodyScrollLocked(e){typeof document>"u"||document.documentElement.classList.toggle("dga-nav-locked",e)}unlockBodyIfIdle(){this.mobileOpen()||this.utilityOverlayOpen()||this.setBodyScrollLocked(!1)}onItemEnter(e){if(!this.isMobileViewport()){if(!this.items()[e]?.dropdown){this.hoverMenus()&&this.scheduleClose();return}this.clearCloseTimer(),this.hoverMenus()&&this.openDropdown.set(e)}}onPanelEnter(){this.clearCloseTimer()}onHostLeave(e){if(!this.hoverMenus()||this.isMobileViewport())return;const t=e.relatedTarget;t&&this.host.nativeElement.contains(t)||this.scheduleClose()}toggleMobile(){this.mobileOpen.update(e=>!e),this.openDropdown.set(null),this.setBodyScrollLocked(this.mobileOpen())}toggleDropdown(e,t){t.stopPropagation(),!(this.hoverMenus()&&!this.isMobileViewport()&&this.openDropdown()===e)&&(this.clearCloseTimer(),this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.openDropdown.update(o=>o===e?null:e))}closeAll(){this.clearCloseTimer(),this.openDropdown.set(null),this.mobileOpen.set(!1),this.closeSearch(!1),this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.setBodyScrollLocked(!1)}onAction(e,t){const o=this.triggerFromEvent(t);if(this.isSearchAction(e)){this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.toggleSearch(),this.actionClick.emit(e);return}if(this.isNotificationsAction(e)){this.closeSearch(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.toggleNotifications(o),this.actionClick.emit(e);return}if(this.isLocaleAction(e)){this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.toggleLocaleMenu(o),this.actionClick.emit(e);return}if(this.isLoginAction(e)){this.closeSearch(),this.closeNotifications(),this.closeLocaleMenu(),this.authenticated()?(this.closeLogin(),this.toggleUserMenu(o)):(this.closeUserMenu(),this.toggleLogin(o)),this.actionClick.emit(e);return}this.closeSearch(),this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.actionClick.emit(e)}onMobileAction(e,t){const o=this.triggerFromEvent(t);if(this.isSearchAction(e)){this.mobileOpen.set(!1),this.setBodyScrollLocked(!1),this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.toggleSearch(),this.actionClick.emit(e);return}if(this.isNotificationsAction(e)){this.mobileOpen.set(!1),this.closeSearch(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.toggleNotifications(o),this.isMobileViewport()&&this.setBodyScrollLocked(!0),this.actionClick.emit(e);return}if(this.isLocaleAction(e)){this.mobileOpen.set(!1),this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.toggleLocaleMenu(o),this.isMobileViewport()&&this.setBodyScrollLocked(!0),this.actionClick.emit(e);return}if(this.isLoginAction(e)){this.mobileOpen.set(!1),this.closeSearch(),this.closeNotifications(),this.closeLocaleMenu(),this.authenticated()?(this.closeLogin(),this.toggleUserMenu(o)):(this.closeUserMenu(),this.toggleLogin(o)),this.isMobileViewport()&&this.setBodyScrollLocked(!0),this.actionClick.emit(e);return}this.actionClick.emit(e),this.closeAll()}closeUtilityOverlays(){this.closeSearch(),this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu()}closePortalChromeMenus(){typeof document>"u"||document.dispatchEvent(new CustomEvent("dga-close-portal-chrome-menus"))}onCloseHeaderOverlays(){this.closeUtilityOverlays()}toggleSearch(){if(this.searchOpen()){this.closeSearch();return}this.openDropdown.set(null),this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.closePortalChromeMenus(),this.searchOpen.set(!0)}onSearchModalOpenChange(e){if(e){this.searchOpen.set(!0);return}this.closeSearch()}focusSearchInput(){C(()=>this.searchInputRef()?.nativeElement.focus(),{injector:this.injector})}closeSearch(e=!0){this.searchOpen.set(!1),e&&this.stopVoice()}toggleNotifications(e){if(this.notificationsOpen()){this.closeNotifications();return}this.openDropdown.set(null),this.closeSearch(),this.closeLocaleMenu(),this.closeLogin(),this.closeUserMenu(),this.closePortalChromeMenus(),this.notificationsOpen.set(!0);const t=this.visibleNotifications()[0];this.expandedNotificationId.set(t?.id??null),this.scheduleDropdownSync(this.notificationsActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeNotifications(){this.notificationsOpen.set(!1),this.expandedNotificationId.set(null),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}toggleLocaleMenu(e){if(this.localeMenuOpen()){this.closeLocaleMenu();return}this.openDropdown.set(null),this.closeSearch(),this.closeNotifications(),this.closeLogin(),this.closeUserMenu(),this.closePortalChromeMenus(),this.localeMenuOpen.set(!0),this.scheduleDropdownSync(this.localeActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeLocaleMenu(){this.localeMenuOpen.set(!1),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}onLocalePick(e){this.localeSelect.emit(e),this.closeLocaleMenu()}toggleLogin(e){if(this.loginOpen()){this.closeLogin();return}this.openDropdown.set(null),this.closeSearch(),this.closeNotifications(),this.closeLocaleMenu(),this.closeUserMenu(),this.closePortalChromeMenus(),this.loginOpen.set(!0),this.scheduleDropdownSync(this.loginActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeLogin(){this.loginOpen.set(!1),this.loginSubmitting.set(!1),this.loginError.set(""),this.loginEmailError.set(""),this.loginPasswordError.set(""),this.loginEmail.set(""),this.loginPassword.set(""),this.showLoginPassword.set(!1),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}toggleUserMenu(e){if(this.userMenuOpen()){this.closeUserMenu();return}this.openDropdown.set(null),this.closeSearch(),this.closeNotifications(),this.closeLocaleMenu(),this.closeLogin(),this.closePortalChromeMenus(),this.userMenuOpen.set(!0),this.scheduleDropdownSync(this.loginActionId(),e),this.isMobileViewport()&&this.setBodyScrollLocked(!0)}closeUserMenu(){this.userMenuOpen.set(!1),this.clearDropdownAnchor(),this.unlockBodyIfIdle()}onLoginEmailInput(e){this.loginEmail.set(e),this.loginEmailError()&&this.loginEmailError.set("")}onLoginPasswordInput(e){this.loginPassword.set(e),this.loginPasswordError()&&this.loginPasswordError.set("")}showLoginRegisterRow(e){return!!(e.registerPrompt||e.registerLabel||e.registerHref)}loginPanelOuterStyle(){const e=this.dropdownPanelStyle();if(this.isMobileViewport())return e;const t=this.loginConfig()?.panelWidth??"24rem";return{...e,width:`min(${t}, calc(100vw - 2rem))`}}loginPanelInnerStyle(){return this.isMobileViewport()?{maxHeight:`min(90svh, ${this.loginConfig()?.maxHeight??"44rem"})`}:{}}onLoginSubmit(e){e.preventDefault();const t=this.loginConfig(),o=this.loginEmail().trim(),s=this.loginPassword();this.loginEmailError.set(""),this.loginPasswordError.set(""),this.loginError.set("");let r=!1;o?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)||(this.loginEmailError.set(t?.emailInvalidMessage??"Enter a valid email address"),r=!0):(this.loginEmailError.set(t?.emailRequiredMessage??"Email is required"),r=!0),s||(this.loginPasswordError.set(t?.passwordRequiredMessage??"Password is required"),r=!0),!r&&(this.loginSubmitting.set(!0),this.loginSubmit.emit({email:o,password:s}))}onUserLink(e){if(this.userLinkClick.emit(e),e.id==="logout"||e.danger){this.authenticated.set(!1),this.logout.emit(),this.closeUserMenu();return}this.closeUserMenu()}toggleNotificationExpand(e){this.expandedNotificationId.update(t=>t===e.id?null:e.id),this.notificationAction.emit({item:e,action:"select"})}onNotificationAction(e,t){t==="read"&&this.readNotificationIds.update(o=>new Set([...o,e.id])),t==="dismiss"&&(this.dismissedNotificationIds.update(o=>new Set([...o,e.id])),this.expandedNotificationId.update(o=>o===e.id?null:o)),t==="view"&&e.href&&J(e.href,this.baseHref),this.notificationAction.emit({item:e,action:t})}markAllNotificationsRead(){const e=this.visibleNotifications().map(t=>t.id);this.readNotificationIds.update(t=>new Set([...t,...e]))}clearSearchQuery(){this.searchQuery.set(""),queueMicrotask(()=>this.searchInputRef()?.nativeElement.focus())}applySearchSuggestion(e){const t=e.value??e.label;this.searchQuery.set(t),this.searchSuggestionSelect.emit(e),queueMicrotask(()=>this.searchInputRef()?.nativeElement.focus())}onSearchFormSubmit(e){e.preventDefault();const t=this.searchQuery().trim();this.searchSubmit.emit(t);const o=this.search();if(o?.resultsHref){const s=o.queryParam??"q",r=new URL(o.resultsHref,typeof window<"u"?window.location.origin:"http://localhost");t?r.searchParams.set(s,t):r.searchParams.delete(s),typeof window<"u"&&window.location.assign(`${r.pathname}${r.search}${r.hash}`)}this.closeSearch()}onSearchVoice(){if(this.searchVoice.emit(),typeof window>"u")return;const e=window,t=e.SpeechRecognition||e.webkitSpeechRecognition;if(!t)return;this.stopVoice();const o=new t;o.lang=typeof document<"u"&&document.documentElement.lang?document.documentElement.lang:"ar-SA",o.interimResults=!1,o.maxAlternatives=1,this.voiceListening.set(!0),o.onresult=s=>{const r=s.results[0]?.[0]?.transcript?.trim();r&&this.searchQuery.set(r),this.voiceListening.set(!1)},o.onerror=()=>this.voiceListening.set(!1),o.onend=()=>this.voiceListening.set(!1),this.speechRecognition=o,o.start()}speechRecognition=null;stopVoice(){this.speechRecognition?.stop(),this.speechRecognition=null,this.voiceListening.set(!1)}triggerFromEvent(e){const t=e?.currentTarget;return t instanceof HTMLElement?t:null}scheduleDropdownSync(e,t){this.dropdownActionId=e,this.dropdownTrigger=t??null,C(()=>this.requestDropdownSync(t),{injector:this.injector})}requestDropdownSync(e){if(typeof requestAnimationFrame!="function"){this.syncDropdownPanel(e);return}this.dropdownSyncFrame===null&&(this.dropdownSyncFrame=requestAnimationFrame(()=>{this.dropdownSyncFrame=null,this.syncDropdownPanel(e)}))}clearDropdownAnchor(){this.notificationsOpen()||this.localeMenuOpen()||this.loginOpen()||this.userMenuOpen()||(this.dropdownTrigger=null,this.dropdownActionId=null,this.lastDropdownStyleKey="",this.dropdownPanelStyle.set({}))}findActionTrigger(e){const t=this.host.nativeElement.querySelectorAll(`[data-dga-action="${CSS.escape(e)}"]`);for(const o of Array.from(t)){const s=o;if(s.getClientRects().length>0)return s}return t[0]??null}activeUtilityPanelWidthPx(){if(typeof window>"u")return 448;const e=window.innerWidth-32;if(this.loginOpen()){const t=this.loginConfig()?.panelWidth??"24rem";return Math.min(ee(t,384),e)}return this.userMenuOpen()?Math.min(352,e):this.localeMenuOpen()?Math.min(256,e):(this.notificationsOpen(),Math.min(448,e))}syncDropdownPanel(e){if(typeof window>"u")return;if(this.isMobileViewport()){const d={top:"auto",bottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))",left:"0.75rem",right:"0.75rem",width:"auto",maxWidth:"none"},M=`sheet|${d.bottom}`;if(M===this.lastDropdownStyleKey)return;this.lastDropdownStyleKey=M,this.dropdownPanelStyle.set(d);return}const t=e??this.dropdownTrigger??(this.dropdownActionId?this.findActionTrigger(this.dropdownActionId):null);if(!t)return;this.dropdownTrigger=t;const o=t.getBoundingClientRect();if(o.width<1&&o.height<1)return;const s=getComputedStyle(this.host.nativeElement).direction,T=(typeof document<"u"?document.documentElement.getAttribute("dir"):null)==="rtl"||s==="rtl",_=8,S=this.activeUtilityPanelWidthPx(),f={top:`${Math.round(o.bottom+_)}px`};if(T){let d=Math.round(o.left);d=Math.max(16,Math.min(d,window.innerWidth-S-16)),f.left=`${d}px`,f.right="auto"}else{let d=Math.round(window.innerWidth-o.right);d=Math.max(16,Math.min(d,window.innerWidth-S-16)),f.right=`${d}px`,f.left="auto"}const N=`${f.top}|${f.left??""}|${f.right??""}`;N!==this.lastDropdownStyleKey&&(this.lastDropdownStyleKey=N,this.dropdownPanelStyle.set(f))}onKey(e){e.key==="Escape"&&this.closeAll()}onScroll(){(this.notificationsOpen()||this.localeMenuOpen()||this.loginOpen()||this.userMenuOpen())&&this.requestDropdownSync()}onResize(){typeof window>"u"||(window.matchMedia("(max-width: 767px)").matches||(this.mobileOpen.set(!1),this.setBodyScrollLocked(!1)),(this.notificationsOpen()||this.localeMenuOpen()||this.loginOpen()||this.userMenuOpen())&&(this.lastDropdownStyleKey="",this.requestDropdownSync()))}onNavLinkClick(e,t){this.navLinkClick.emit(e),e.href||t.preventDefault()}onDocClick(e){this.searchOpen()||this.notificationsOpen()||this.localeMenuOpen()||this.loginOpen()||this.userMenuOpen()||this.hoverMenus()&&!this.isMobileViewport()||this.mobileOpen()||this.host.nativeElement.contains(e.target)||this.openDropdown.set(null)}static ɵfac=i.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:v,deps:[],target:i.ɵɵFactoryTarget.Component});static ɵcmp=i.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.0.7",type:v,isStandalone:!0,selector:"dga-header",inputs:{brand:{classPropertyName:"brand",publicName:"brand",isSignal:!0,isRequired:!1,transformFunction:null},brandSlogan:{classPropertyName:"brandSlogan",publicName:"brandSlogan",isSignal:!0,isRequired:!1,transformFunction:null},brandLogo:{classPropertyName:"brandLogo",publicName:"brandLogo",isSignal:!0,isRequired:!1,transformFunction:null},brandLogoAlt:{classPropertyName:"brandLogoAlt",publicName:"brandLogoAlt",isSignal:!0,isRequired:!1,transformFunction:null},brandPlaceholder:{classPropertyName:"brandPlaceholder",publicName:"brandPlaceholder",isSignal:!0,isRequired:!1,transformFunction:null},brandHref:{classPropertyName:"brandHref",publicName:"brandHref",isSignal:!0,isRequired:!1,transformFunction:null},navLabel:{classPropertyName:"navLabel",publicName:"navLabel",isSignal:!0,isRequired:!1,transformFunction:null},menuToggleLabel:{classPropertyName:"menuToggleLabel",publicName:"menuToggleLabel",isSignal:!0,isRequired:!1,transformFunction:null},menuCloseLabel:{classPropertyName:"menuCloseLabel",publicName:"menuCloseLabel",isSignal:!0,isRequired:!1,transformFunction:null},appearance:{classPropertyName:"appearance",publicName:"appearance",isSignal:!0,isRequired:!1,transformFunction:null},mobileNav:{classPropertyName:"mobileNav",publicName:"mobileNav",isSignal:!0,isRequired:!1,transformFunction:null},sticky:{classPropertyName:"sticky",publicName:"sticky",isSignal:!0,isRequired:!1,transformFunction:null},items:{classPropertyName:"items",publicName:"items",isSignal:!0,isRequired:!1,transformFunction:null},actions:{classPropertyName:"actions",publicName:"actions",isSignal:!0,isRequired:!1,transformFunction:null},search:{classPropertyName:"search",publicName:"search",isSignal:!0,isRequired:!1,transformFunction:null},searchQuery:{classPropertyName:"searchQuery",publicName:"searchQuery",isSignal:!0,isRequired:!1,transformFunction:null},notifications:{classPropertyName:"notifications",publicName:"notifications",isSignal:!0,isRequired:!1,transformFunction:null},login:{classPropertyName:"login",publicName:"login",isSignal:!0,isRequired:!1,transformFunction:null},localeMenu:{classPropertyName:"localeMenu",publicName:"localeMenu",isSignal:!0,isRequired:!1,transformFunction:null},user:{classPropertyName:"user",publicName:"user",isSignal:!0,isRequired:!1,transformFunction:null},authenticated:{classPropertyName:"authenticated",publicName:"authenticated",isSignal:!0,isRequired:!1,transformFunction:null},loginSubmitting:{classPropertyName:"loginSubmitting",publicName:"loginSubmitting",isSignal:!0,isRequired:!1,transformFunction:null},loginError:{classPropertyName:"loginError",publicName:"loginError",isSignal:!0,isRequired:!1,transformFunction:null}},outputs:{searchQuery:"searchQueryChange",authenticated:"authenticatedChange",loginSubmitting:"loginSubmittingChange",loginError:"loginErrorChange",actionClick:"actionClick",searchSubmit:"searchSubmit",searchSuggestionSelect:"searchSuggestionSelect",searchVoice:"searchVoice",notificationAction:"notificationAction",loginSubmit:"loginSubmit",logout:"logout",userLinkClick:"userLinkClick",localeSelect:"localeSelect",navLinkClick:"navLinkClick"},host:{attributes:{role:"banner"},listeners:{mouseleave:"onHostLeave($event)","document:dga-close-header-overlays":"onCloseHeaderOverlays()","document:keydown":"onKey($event)","window:scroll":"onScroll()","window:resize":"onResize()","document:click":"onDocClick($event)"},properties:{class:"hostClasses()","attr.data-appearance":"appearance()","attr.data-mobile-nav":"mobileNav()","attr.data-mobile-open":"mobileOpen() || null"}},queries:[{propertyName:"customLoginForm",first:!0,predicate:m,descendants:!0,isSignal:!0},{propertyName:"customLoginFooter",first:!0,predicate:p,descendants:!0,isSignal:!0}],viewQueries:[{propertyName:"searchInputRef",first:!0,predicate:["searchInput"],descendants:!0,isSignal:!0},{propertyName:"utilLayerRef",first:!0,predicate:["utilLayer"],descendants:!0,isSignal:!0}],ngImport:i,template:`
2
2
  <div [class]="innerClasses()">
3
3
  <div class="relative flex min-w-0 shrink-0 items-center self-center">
4
4
  <ng-content select="[dgaHeaderBrand]" />
@@ -946,6 +946,64 @@ import*as i from"@angular/core";import{Directive as y,inject as g,ElementRef as
946
946
  </div>
947
947
  }
948
948
 
949
+ <!-- Header language picker -->
950
+ @if (localeMenuOpen() && localeMenuConfig(); as locCfg) {
951
+ <div
952
+ [id]="localePanelId"
953
+ class="dga-header-util-panel fixed w-[min(16rem,calc(100vw-2rem))] max-md:inset-x-3
954
+ max-md:bottom-3 max-md:top-auto max-md:w-auto"
955
+ role="listbox"
956
+ [attr.aria-label]="locCfg.title || 'Language'"
957
+ [style]="dropdownPanelStyle()"
958
+ >
959
+ <div
960
+ class="dga-panel-enter dga-panel-enter--anchor-end overflow-hidden rounded-2xl
961
+ border border-border bg-card shadow-xl md:rounded-md"
962
+ >
963
+ <div
964
+ class="flex items-center justify-between gap-sm border-b border-border-subtle
965
+ px-xl py-md"
966
+ >
967
+ <h2 class="m-0 text-body-md font-semibold text-display">
968
+ {{ locCfg.title || 'Language' }}
969
+ </h2>
970
+ <button
971
+ type="button"
972
+ class="inline-flex size-5xl shrink-0 cursor-pointer items-center justify-center
973
+ rounded-sm text-muted transition-colors hover:bg-neutral-light hover:text-fg
974
+ focus-visible:outline focus-visible:outline-2
975
+ focus-visible:outline-offset-2 focus-visible:outline-focus md:hidden"
976
+ [attr.aria-label]="locCfg.closeLabel || 'Close'"
977
+ (click)="closeLocaleMenu()"
978
+ >
979
+ <dga-icon name="close" size="md" />
980
+ </button>
981
+ </div>
982
+ <ul class="m-0 flex list-none flex-col gap-none p-xs" role="presentation">
983
+ @for (opt of locCfg.options; track opt.code) {
984
+ <li role="none">
985
+ <button
986
+ type="button"
987
+ role="option"
988
+ class="flex w-full cursor-pointer items-center gap-md rounded-sm px-lg py-sm
989
+ text-start text-body-md text-fg transition-colors hover:bg-neutral-light
990
+ focus-visible:outline focus-visible:outline-2
991
+ focus-visible:outline-offset-[-2px] focus-visible:outline-focus"
992
+ [attr.aria-selected]="locCfg.current === opt.code"
993
+ (click)="onLocalePick(opt.code)"
994
+ >
995
+ <span class="min-w-0 flex-1 truncate">{{ opt.nativeName }}</span>
996
+ @if (locCfg.current === opt.code) {
997
+ <dga-icon name="check" size="md" class="shrink-0 text-primary" />
998
+ }
999
+ </button>
1000
+ </li>
1001
+ }
1002
+ </ul>
1003
+ </div>
1004
+ </div>
1005
+ }
1006
+
949
1007
  <!-- Header user menu (authenticated) -->
950
1008
  @if (userMenuOpen() && userConfig(); as ucfg) {
951
1009
  <div
@@ -1305,7 +1363,7 @@ import*as i from"@angular/core";import{Directive as y,inject as g,ElementRef as
1305
1363
  }
1306
1364
  </div>
1307
1365
  }
1308
- `,isInline:!0,styles:["@keyframes dga-fade-in{0%{opacity:0}to{opacity:1}}@keyframes dga-panel-in{0%{opacity:0;transform:translateY(-.625rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chip-in{0%{opacity:0;transform:translateY(.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-notif-row-in{0%{opacity:0;transform:translateY(.35rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-expand-fade{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-spin{to{transform:rotate(360deg)}}@keyframes dga-badge-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.12)}}@keyframes dga-push-in{0%{opacity:0;transform:translateY(-.75rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in-ltr{0%{opacity:.85;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-sheet-in-rtl{0%{opacity:.85;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-fs-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in{0%{opacity:0;transform:translateY(1.25rem)}to{opacity:1;transform:translateY(0)}}:host .dga-util-backdrop,.dga-header-util-layer .dga-util-backdrop{animation:dga-fade-in .22s ease both}.dga-header-util-layer{position:fixed;inset:0;z-index:var(--z-index-urgent, 400);pointer-events:none}.dga-header-util-layer>.dga-util-backdrop,.dga-header-util-layer>.dga-header-util-panel{pointer-events:auto}:host .dga-panel-enter,.dga-header-util-layer .dga-panel-enter{animation:dga-panel-in .28s cubic-bezier(.16,1,.3,1) both;transform-origin:top center;will-change:transform,opacity}:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top right}:host-context([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host-context([dir=\"rtl\"]) .dga-header-util-layer .dga-panel-enter--anchor-end,[dir=rtl] .dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top left}@media(max-width:767px){:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{animation-name:dga-sheet-in;transform-origin:bottom center}}:host .dga-search-chip{animation:dga-chip-in .28s cubic-bezier(.16,1,.3,1) both}:host .dga-search-input{-webkit-appearance:none;appearance:none}:host .dga-search-input::-webkit-search-decoration,:host .dga-search-input::-webkit-search-cancel-button,:host .dga-search-input::-webkit-search-results-button,:host .dga-search-input::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}:host .dga-search-voice.dga-search-voice--active{color:var(--dga-text-primary, #1b8354)!important;background:var(--dga-bg-primary-faint, #f3faf6)!important}:host .dga-notif-item,.dga-header-util-layer .dga-notif-item{animation:dga-notif-row-in .26s cubic-bezier(.16,1,.3,1) both}:host .dga-notif-actions,.dga-header-util-layer .dga-notif-actions{animation:dga-expand-fade .2s ease both}:host .dga-login-spinner,.dga-header-util-layer .dga-login-spinner{animation:dga-spin .7s linear infinite}:host .dga-action-badge{animation:dga-badge-pulse 1.8s ease-in-out infinite;transform-origin:center}@media(prefers-reduced-motion:reduce){:host .dga-util-backdrop,:host .dga-panel-enter,:host .dga-search-chip,:host .dga-notif-item,:host .dga-notif-actions,.dga-header-util-layer .dga-util-backdrop,.dga-header-util-layer .dga-panel-enter{animation-duration:.01ms!important;animation-delay:0ms!important}}:host .dga-burger__box{position:relative;display:block;width:1.375rem;height:1rem}:host .dga-burger__line{position:absolute;inset-inline:0;height:2px;border-radius:1px;background:currentColor;transition:transform .22s cubic-bezier(.4,0,.2,1),opacity .16s ease,top .22s cubic-bezier(.4,0,.2,1)}:host .dga-burger__line:nth-child(1){top:0}:host .dga-burger__line:nth-child(2){top:calc(50% - 1px)}:host .dga-burger__line:nth-child(3){top:calc(100% - 2px)}:host .dga-burger--open{background:var(--color-neutral-light, #f3f4f6)}:host .dga-burger--hidden{visibility:hidden;pointer-events:none}:host .dga-burger--open .dga-burger__line:nth-child(1){top:calc(50% - 1px);transform:rotate(45deg)}:host .dga-burger--open .dga-burger__line:nth-child(2){opacity:0;transform:scaleX(.4)}:host .dga-burger--open .dga-burger__line:nth-child(3){top:calc(50% - 1px);transform:rotate(-45deg)}:host .dga-mobile-nav-closed{display:none}:host .dga-mobile-nav-open{display:flex}:host .dga-mobile-push-open{animation:dga-push-in .24s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-sheet-open{animation:dga-sheet-in-rtl .28s cubic-bezier(.4,0,.2,1) forwards}:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open{animation:dga-sheet-in-ltr .28s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-fs-open{animation:dga-fs-in .24s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host .dga-action-badge,:host .dga-mobile-push-open,:host .dga-mobile-sheet-open,:host .dga-mobile-fs-open,:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open,:host .dga-burger__line{animation:none;transition:none}}\n"],dependencies:[{kind:"component",type:A,selector:"dga-avatar",inputs:["src","name","size","alt"]},{kind:"component",type:E,selector:"dga-badge",inputs:["variant","size"]},{kind:"component",type:H,selector:"dga-field",inputs:["label","labelHint","hint","error","status","statusMessage","controlId","required"]},{kind:"component",type:F,selector:"dga-form-control",inputs:["size","status","disabled","filled","startIcon","endIcon"]},{kind:"directive",type:$,selector:"[dgaEnd]"},{kind:"component",type:R,selector:"dga-icon",inputs:["name","glyph","size","tone","label"]},{kind:"component",type:j,selector:"dga-icon-badge",inputs:["size","appearance"]},{kind:"component",type:q,selector:"dga-modal",inputs:["open","title","description","size","animation","closeLabel","closeOnBackdrop","closeOnEscape","showClose","scrollable","centered"],outputs:["openChange","closed","opened"]},{kind:"component",type:V,selector:"dga-tooltip",inputs:["text","title","placement","variant","showIcon","disabled","showDelay","hideDelay","dismissMs"]}],changeDetection:i.ChangeDetectionStrategy.OnPush})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:v,decorators:[{type:G,args:[{selector:"dga-header",standalone:!0,changeDetection:K.OnPush,imports:[A,E,H,F,$,R,j,q,V],template:`
1366
+ `,isInline:!0,styles:["@keyframes dga-fade-in{0%{opacity:0}to{opacity:1}}@keyframes dga-panel-in{0%{opacity:0;transform:translateY(-.625rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chip-in{0%{opacity:0;transform:translateY(.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-notif-row-in{0%{opacity:0;transform:translateY(.35rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-expand-fade{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-spin{to{transform:rotate(360deg)}}@keyframes dga-badge-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.12)}}@keyframes dga-push-in{0%{opacity:0;transform:translateY(-.75rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in-ltr{0%{opacity:.85;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-sheet-in-rtl{0%{opacity:.85;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-fs-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in{0%{opacity:0;transform:translateY(1.25rem)}to{opacity:1;transform:translateY(0)}}:host .dga-util-backdrop,.dga-header-util-layer .dga-util-backdrop{animation:dga-fade-in .22s ease both}.dga-header-util-layer{position:fixed;inset:0;z-index:var(--z-index-urgent, 400);pointer-events:none}.dga-header-util-layer>.dga-util-backdrop,.dga-header-util-layer>.dga-header-util-panel{pointer-events:auto}:host .dga-panel-enter,.dga-header-util-layer .dga-panel-enter{animation:dga-panel-in .28s cubic-bezier(.16,1,.3,1) both;transform-origin:top center;will-change:transform,opacity}:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top right}:host-context([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host-context([dir=\"rtl\"]) .dga-header-util-layer .dga-panel-enter--anchor-end,[dir=rtl] .dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top left}@media(max-width:767px){:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{animation-name:dga-sheet-in;transform-origin:bottom center}}:host .dga-search-chip{animation:dga-chip-in .28s cubic-bezier(.16,1,.3,1) both}:host .dga-search-input{-webkit-appearance:none;appearance:none}:host .dga-search-input::-webkit-search-decoration,:host .dga-search-input::-webkit-search-cancel-button,:host .dga-search-input::-webkit-search-results-button,:host .dga-search-input::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}:host .dga-search-voice.dga-search-voice--active{color:var(--dga-text-primary, #1b8354)!important;background:var(--dga-bg-primary-faint, #f3faf6)!important}:host .dga-notif-item,.dga-header-util-layer .dga-notif-item{animation:dga-notif-row-in .26s cubic-bezier(.16,1,.3,1) both}:host .dga-notif-actions,.dga-header-util-layer .dga-notif-actions{animation:dga-expand-fade .2s ease both}:host .dga-login-spinner,.dga-header-util-layer .dga-login-spinner{animation:dga-spin .7s linear infinite}:host .dga-action-badge{animation:dga-badge-pulse 1.8s ease-in-out infinite;transform-origin:center}@media(prefers-reduced-motion:reduce){:host .dga-util-backdrop,:host .dga-panel-enter,:host .dga-search-chip,:host .dga-notif-item,:host .dga-notif-actions,.dga-header-util-layer .dga-util-backdrop,.dga-header-util-layer .dga-panel-enter{animation-duration:.01ms!important;animation-delay:0ms!important}}:host .dga-burger__box{position:relative;display:block;width:1.375rem;height:1rem}:host .dga-burger__line{position:absolute;inset-inline:0;height:2px;border-radius:1px;background:currentColor;transition:transform .22s cubic-bezier(.4,0,.2,1),opacity .16s ease,top .22s cubic-bezier(.4,0,.2,1)}:host .dga-burger__line:nth-child(1){top:0}:host .dga-burger__line:nth-child(2){top:calc(50% - 1px)}:host .dga-burger__line:nth-child(3){top:calc(100% - 2px)}:host .dga-burger--open{background:var(--color-neutral-light, #f3f4f6)}:host .dga-burger--hidden{visibility:hidden;pointer-events:none}:host .dga-burger--open .dga-burger__line:nth-child(1){top:calc(50% - 1px);transform:rotate(45deg)}:host .dga-burger--open .dga-burger__line:nth-child(2){opacity:0;transform:scaleX(.4)}:host .dga-burger--open .dga-burger__line:nth-child(3){top:calc(50% - 1px);transform:rotate(-45deg)}:host .dga-mobile-nav-closed{display:none}:host .dga-mobile-nav-open{display:flex}:host .dga-mobile-push-open{animation:dga-push-in .24s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-sheet-open{animation:dga-sheet-in-rtl .28s cubic-bezier(.4,0,.2,1) forwards}:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open{animation:dga-sheet-in-ltr .28s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-fs-open{animation:dga-fs-in .24s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host .dga-action-badge,:host .dga-mobile-push-open,:host .dga-mobile-sheet-open,:host .dga-mobile-fs-open,:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open,:host .dga-burger__line{animation:none;transition:none}}\n"],dependencies:[{kind:"component",type:A,selector:"dga-avatar",inputs:["src","name","size","alt"]},{kind:"component",type:E,selector:"dga-badge",inputs:["variant","size"]},{kind:"component",type:H,selector:"dga-field",inputs:["label","labelHint","hint","error","status","statusMessage","controlId","required"]},{kind:"component",type:F,selector:"dga-form-control",inputs:["size","status","disabled","filled","startIcon","endIcon"]},{kind:"directive",type:$,selector:"[dgaEnd]"},{kind:"component",type:R,selector:"dga-icon",inputs:["name","glyph","size","tone","label"]},{kind:"component",type:j,selector:"dga-icon-badge",inputs:["size","appearance"]},{kind:"component",type:q,selector:"dga-modal",inputs:["open","title","description","size","animation","closeLabel","closeOnBackdrop","closeOnEscape","showClose","scrollable","centered"],outputs:["openChange","closed","opened"]},{kind:"component",type:V,selector:"dga-tooltip",inputs:["text","title","placement","variant","showIcon","disabled","showDelay","hideDelay","dismissMs","portaled"]}],changeDetection:i.ChangeDetectionStrategy.OnPush})}i.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.7",ngImport:i,type:v,decorators:[{type:G,args:[{selector:"dga-header",standalone:!0,changeDetection:K.OnPush,imports:[A,E,H,F,$,R,j,q,V],template:`
1309
1367
  <div [class]="innerClasses()">
1310
1368
  <div class="relative flex min-w-0 shrink-0 items-center self-center">
1311
1369
  <ng-content select="[dgaHeaderBrand]" />
@@ -2253,6 +2311,64 @@ import*as i from"@angular/core";import{Directive as y,inject as g,ElementRef as
2253
2311
  </div>
2254
2312
  }
2255
2313
 
2314
+ <!-- Header language picker -->
2315
+ @if (localeMenuOpen() && localeMenuConfig(); as locCfg) {
2316
+ <div
2317
+ [id]="localePanelId"
2318
+ class="dga-header-util-panel fixed w-[min(16rem,calc(100vw-2rem))] max-md:inset-x-3
2319
+ max-md:bottom-3 max-md:top-auto max-md:w-auto"
2320
+ role="listbox"
2321
+ [attr.aria-label]="locCfg.title || 'Language'"
2322
+ [style]="dropdownPanelStyle()"
2323
+ >
2324
+ <div
2325
+ class="dga-panel-enter dga-panel-enter--anchor-end overflow-hidden rounded-2xl
2326
+ border border-border bg-card shadow-xl md:rounded-md"
2327
+ >
2328
+ <div
2329
+ class="flex items-center justify-between gap-sm border-b border-border-subtle
2330
+ px-xl py-md"
2331
+ >
2332
+ <h2 class="m-0 text-body-md font-semibold text-display">
2333
+ {{ locCfg.title || 'Language' }}
2334
+ </h2>
2335
+ <button
2336
+ type="button"
2337
+ class="inline-flex size-5xl shrink-0 cursor-pointer items-center justify-center
2338
+ rounded-sm text-muted transition-colors hover:bg-neutral-light hover:text-fg
2339
+ focus-visible:outline focus-visible:outline-2
2340
+ focus-visible:outline-offset-2 focus-visible:outline-focus md:hidden"
2341
+ [attr.aria-label]="locCfg.closeLabel || 'Close'"
2342
+ (click)="closeLocaleMenu()"
2343
+ >
2344
+ <dga-icon name="close" size="md" />
2345
+ </button>
2346
+ </div>
2347
+ <ul class="m-0 flex list-none flex-col gap-none p-xs" role="presentation">
2348
+ @for (opt of locCfg.options; track opt.code) {
2349
+ <li role="none">
2350
+ <button
2351
+ type="button"
2352
+ role="option"
2353
+ class="flex w-full cursor-pointer items-center gap-md rounded-sm px-lg py-sm
2354
+ text-start text-body-md text-fg transition-colors hover:bg-neutral-light
2355
+ focus-visible:outline focus-visible:outline-2
2356
+ focus-visible:outline-offset-[-2px] focus-visible:outline-focus"
2357
+ [attr.aria-selected]="locCfg.current === opt.code"
2358
+ (click)="onLocalePick(opt.code)"
2359
+ >
2360
+ <span class="min-w-0 flex-1 truncate">{{ opt.nativeName }}</span>
2361
+ @if (locCfg.current === opt.code) {
2362
+ <dga-icon name="check" size="md" class="shrink-0 text-primary" />
2363
+ }
2364
+ </button>
2365
+ </li>
2366
+ }
2367
+ </ul>
2368
+ </div>
2369
+ </div>
2370
+ }
2371
+
2256
2372
  <!-- Header user menu (authenticated) -->
2257
2373
  @if (userMenuOpen() && userConfig(); as ucfg) {
2258
2374
  <div
@@ -2612,4 +2728,4 @@ import*as i from"@angular/core";import{Directive as y,inject as g,ElementRef as
2612
2728
  }
2613
2729
  </div>
2614
2730
  }
2615
- `,host:{role:"banner","[class]":"hostClasses()","[attr.data-appearance]":"appearance()","[attr.data-mobile-nav]":"mobileNav()","[attr.data-mobile-open]":"mobileOpen() || null","(mouseleave)":"onHostLeave($event)"},styles:["@keyframes dga-fade-in{0%{opacity:0}to{opacity:1}}@keyframes dga-panel-in{0%{opacity:0;transform:translateY(-.625rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chip-in{0%{opacity:0;transform:translateY(.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-notif-row-in{0%{opacity:0;transform:translateY(.35rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-expand-fade{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-spin{to{transform:rotate(360deg)}}@keyframes dga-badge-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.12)}}@keyframes dga-push-in{0%{opacity:0;transform:translateY(-.75rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in-ltr{0%{opacity:.85;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-sheet-in-rtl{0%{opacity:.85;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-fs-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in{0%{opacity:0;transform:translateY(1.25rem)}to{opacity:1;transform:translateY(0)}}:host .dga-util-backdrop,.dga-header-util-layer .dga-util-backdrop{animation:dga-fade-in .22s ease both}.dga-header-util-layer{position:fixed;inset:0;z-index:var(--z-index-urgent, 400);pointer-events:none}.dga-header-util-layer>.dga-util-backdrop,.dga-header-util-layer>.dga-header-util-panel{pointer-events:auto}:host .dga-panel-enter,.dga-header-util-layer .dga-panel-enter{animation:dga-panel-in .28s cubic-bezier(.16,1,.3,1) both;transform-origin:top center;will-change:transform,opacity}:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top right}:host-context([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host-context([dir=\"rtl\"]) .dga-header-util-layer .dga-panel-enter--anchor-end,[dir=rtl] .dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top left}@media(max-width:767px){:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{animation-name:dga-sheet-in;transform-origin:bottom center}}:host .dga-search-chip{animation:dga-chip-in .28s cubic-bezier(.16,1,.3,1) both}:host .dga-search-input{-webkit-appearance:none;appearance:none}:host .dga-search-input::-webkit-search-decoration,:host .dga-search-input::-webkit-search-cancel-button,:host .dga-search-input::-webkit-search-results-button,:host .dga-search-input::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}:host .dga-search-voice.dga-search-voice--active{color:var(--dga-text-primary, #1b8354)!important;background:var(--dga-bg-primary-faint, #f3faf6)!important}:host .dga-notif-item,.dga-header-util-layer .dga-notif-item{animation:dga-notif-row-in .26s cubic-bezier(.16,1,.3,1) both}:host .dga-notif-actions,.dga-header-util-layer .dga-notif-actions{animation:dga-expand-fade .2s ease both}:host .dga-login-spinner,.dga-header-util-layer .dga-login-spinner{animation:dga-spin .7s linear infinite}:host .dga-action-badge{animation:dga-badge-pulse 1.8s ease-in-out infinite;transform-origin:center}@media(prefers-reduced-motion:reduce){:host .dga-util-backdrop,:host .dga-panel-enter,:host .dga-search-chip,:host .dga-notif-item,:host .dga-notif-actions,.dga-header-util-layer .dga-util-backdrop,.dga-header-util-layer .dga-panel-enter{animation-duration:.01ms!important;animation-delay:0ms!important}}:host .dga-burger__box{position:relative;display:block;width:1.375rem;height:1rem}:host .dga-burger__line{position:absolute;inset-inline:0;height:2px;border-radius:1px;background:currentColor;transition:transform .22s cubic-bezier(.4,0,.2,1),opacity .16s ease,top .22s cubic-bezier(.4,0,.2,1)}:host .dga-burger__line:nth-child(1){top:0}:host .dga-burger__line:nth-child(2){top:calc(50% - 1px)}:host .dga-burger__line:nth-child(3){top:calc(100% - 2px)}:host .dga-burger--open{background:var(--color-neutral-light, #f3f4f6)}:host .dga-burger--hidden{visibility:hidden;pointer-events:none}:host .dga-burger--open .dga-burger__line:nth-child(1){top:calc(50% - 1px);transform:rotate(45deg)}:host .dga-burger--open .dga-burger__line:nth-child(2){opacity:0;transform:scaleX(.4)}:host .dga-burger--open .dga-burger__line:nth-child(3){top:calc(50% - 1px);transform:rotate(-45deg)}:host .dga-mobile-nav-closed{display:none}:host .dga-mobile-nav-open{display:flex}:host .dga-mobile-push-open{animation:dga-push-in .24s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-sheet-open{animation:dga-sheet-in-rtl .28s cubic-bezier(.4,0,.2,1) forwards}:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open{animation:dga-sheet-in-ltr .28s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-fs-open{animation:dga-fs-in .24s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host .dga-action-badge,:host .dga-mobile-push-open,:host .dga-mobile-sheet-open,:host .dga-mobile-fs-open,:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open,:host .dga-burger__line{animation:none;transition:none}}\n"]}]}],ctorParameters:()=>[],propDecorators:{brand:[{type:i.Input,args:[{isSignal:!0,alias:"brand",required:!1}]}],brandSlogan:[{type:i.Input,args:[{isSignal:!0,alias:"brandSlogan",required:!1}]}],brandLogo:[{type:i.Input,args:[{isSignal:!0,alias:"brandLogo",required:!1}]}],brandLogoAlt:[{type:i.Input,args:[{isSignal:!0,alias:"brandLogoAlt",required:!1}]}],brandPlaceholder:[{type:i.Input,args:[{isSignal:!0,alias:"brandPlaceholder",required:!1}]}],brandHref:[{type:i.Input,args:[{isSignal:!0,alias:"brandHref",required:!1}]}],navLabel:[{type:i.Input,args:[{isSignal:!0,alias:"navLabel",required:!1}]}],menuToggleLabel:[{type:i.Input,args:[{isSignal:!0,alias:"menuToggleLabel",required:!1}]}],menuCloseLabel:[{type:i.Input,args:[{isSignal:!0,alias:"menuCloseLabel",required:!1}]}],appearance:[{type:i.Input,args:[{isSignal:!0,alias:"appearance",required:!1}]}],mobileNav:[{type:i.Input,args:[{isSignal:!0,alias:"mobileNav",required:!1}]}],sticky:[{type:i.Input,args:[{isSignal:!0,alias:"sticky",required:!1}]}],items:[{type:i.Input,args:[{isSignal:!0,alias:"items",required:!1}]}],actions:[{type:i.Input,args:[{isSignal:!0,alias:"actions",required:!1}]}],search:[{type:i.Input,args:[{isSignal:!0,alias:"search",required:!1}]}],searchQuery:[{type:i.Input,args:[{isSignal:!0,alias:"searchQuery",required:!1}]},{type:i.Output,args:["searchQueryChange"]}],notifications:[{type:i.Input,args:[{isSignal:!0,alias:"notifications",required:!1}]}],login:[{type:i.Input,args:[{isSignal:!0,alias:"login",required:!1}]}],user:[{type:i.Input,args:[{isSignal:!0,alias:"user",required:!1}]}],authenticated:[{type:i.Input,args:[{isSignal:!0,alias:"authenticated",required:!1}]},{type:i.Output,args:["authenticatedChange"]}],loginSubmitting:[{type:i.Input,args:[{isSignal:!0,alias:"loginSubmitting",required:!1}]},{type:i.Output,args:["loginSubmittingChange"]}],loginError:[{type:i.Input,args:[{isSignal:!0,alias:"loginError",required:!1}]},{type:i.Output,args:["loginErrorChange"]}],actionClick:[{type:i.Output,args:["actionClick"]}],searchSubmit:[{type:i.Output,args:["searchSubmit"]}],searchSuggestionSelect:[{type:i.Output,args:["searchSuggestionSelect"]}],searchVoice:[{type:i.Output,args:["searchVoice"]}],notificationAction:[{type:i.Output,args:["notificationAction"]}],loginSubmit:[{type:i.Output,args:["loginSubmit"]}],logout:[{type:i.Output,args:["logout"]}],userLinkClick:[{type:i.Output,args:["userLinkClick"]}],navLinkClick:[{type:i.Output,args:["navLinkClick"]}],customLoginForm:[{type:i.ContentChild,args:[i.forwardRef(()=>m),{isSignal:!0}]}],customLoginFooter:[{type:i.ContentChild,args:[i.forwardRef(()=>p),{isSignal:!0}]}],searchInputRef:[{type:i.ViewChild,args:["searchInput",{isSignal:!0}]}],utilLayerRef:[{type:i.ViewChild,args:["utilLayer",{isSignal:!0}]}],onCloseHeaderOverlays:[{type:b,args:["document:dga-close-header-overlays"]}],onKey:[{type:b,args:["document:keydown",["$event"]]}],onScroll:[{type:b,args:["window:scroll"]}],onResize:[{type:b,args:["window:resize"]}],onDocClick:[{type:b,args:["document:click",["$event"]]}]}});export{v as DgaHeader,x as DgaHeaderLoginAfterFields,h as DgaHeaderLoginBeforeForm,p as DgaHeaderLoginFooter,m as DgaHeaderLoginForm};
2731
+ `,host:{role:"banner","[class]":"hostClasses()","[attr.data-appearance]":"appearance()","[attr.data-mobile-nav]":"mobileNav()","[attr.data-mobile-open]":"mobileOpen() || null","(mouseleave)":"onHostLeave($event)"},styles:["@keyframes dga-fade-in{0%{opacity:0}to{opacity:1}}@keyframes dga-panel-in{0%{opacity:0;transform:translateY(-.625rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes dga-chip-in{0%{opacity:0;transform:translateY(.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-notif-row-in{0%{opacity:0;transform:translateY(.35rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-expand-fade{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-spin{to{transform:rotate(360deg)}}@keyframes dga-badge-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.12)}}@keyframes dga-push-in{0%{opacity:0;transform:translateY(-.75rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in-ltr{0%{opacity:.85;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-sheet-in-rtl{0%{opacity:.85;transform:translate3d(100%,0,0)}to{opacity:1;transform:translateZ(0)}}@keyframes dga-fs-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes dga-sheet-in{0%{opacity:0;transform:translateY(1.25rem)}to{opacity:1;transform:translateY(0)}}:host .dga-util-backdrop,.dga-header-util-layer .dga-util-backdrop{animation:dga-fade-in .22s ease both}.dga-header-util-layer{position:fixed;inset:0;z-index:var(--z-index-urgent, 400);pointer-events:none}.dga-header-util-layer>.dga-util-backdrop,.dga-header-util-layer>.dga-header-util-panel{pointer-events:auto}:host .dga-panel-enter,.dga-header-util-layer .dga-panel-enter{animation:dga-panel-in .28s cubic-bezier(.16,1,.3,1) both;transform-origin:top center;will-change:transform,opacity}:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top right}:host-context([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host([dir=\"rtl\"]) .dga-panel-enter--anchor-end,:host-context([dir=\"rtl\"]) .dga-header-util-layer .dga-panel-enter--anchor-end,[dir=rtl] .dga-header-util-layer .dga-panel-enter--anchor-end{transform-origin:top left}@media(max-width:767px){:host .dga-panel-enter--anchor-end,.dga-header-util-layer .dga-panel-enter--anchor-end{animation-name:dga-sheet-in;transform-origin:bottom center}}:host .dga-search-chip{animation:dga-chip-in .28s cubic-bezier(.16,1,.3,1) both}:host .dga-search-input{-webkit-appearance:none;appearance:none}:host .dga-search-input::-webkit-search-decoration,:host .dga-search-input::-webkit-search-cancel-button,:host .dga-search-input::-webkit-search-results-button,:host .dga-search-input::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none;display:none}:host .dga-search-voice.dga-search-voice--active{color:var(--dga-text-primary, #1b8354)!important;background:var(--dga-bg-primary-faint, #f3faf6)!important}:host .dga-notif-item,.dga-header-util-layer .dga-notif-item{animation:dga-notif-row-in .26s cubic-bezier(.16,1,.3,1) both}:host .dga-notif-actions,.dga-header-util-layer .dga-notif-actions{animation:dga-expand-fade .2s ease both}:host .dga-login-spinner,.dga-header-util-layer .dga-login-spinner{animation:dga-spin .7s linear infinite}:host .dga-action-badge{animation:dga-badge-pulse 1.8s ease-in-out infinite;transform-origin:center}@media(prefers-reduced-motion:reduce){:host .dga-util-backdrop,:host .dga-panel-enter,:host .dga-search-chip,:host .dga-notif-item,:host .dga-notif-actions,.dga-header-util-layer .dga-util-backdrop,.dga-header-util-layer .dga-panel-enter{animation-duration:.01ms!important;animation-delay:0ms!important}}:host .dga-burger__box{position:relative;display:block;width:1.375rem;height:1rem}:host .dga-burger__line{position:absolute;inset-inline:0;height:2px;border-radius:1px;background:currentColor;transition:transform .22s cubic-bezier(.4,0,.2,1),opacity .16s ease,top .22s cubic-bezier(.4,0,.2,1)}:host .dga-burger__line:nth-child(1){top:0}:host .dga-burger__line:nth-child(2){top:calc(50% - 1px)}:host .dga-burger__line:nth-child(3){top:calc(100% - 2px)}:host .dga-burger--open{background:var(--color-neutral-light, #f3f4f6)}:host .dga-burger--hidden{visibility:hidden;pointer-events:none}:host .dga-burger--open .dga-burger__line:nth-child(1){top:calc(50% - 1px);transform:rotate(45deg)}:host .dga-burger--open .dga-burger__line:nth-child(2){opacity:0;transform:scaleX(.4)}:host .dga-burger--open .dga-burger__line:nth-child(3){top:calc(50% - 1px);transform:rotate(-45deg)}:host .dga-mobile-nav-closed{display:none}:host .dga-mobile-nav-open{display:flex}:host .dga-mobile-push-open{animation:dga-push-in .24s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-sheet-open{animation:dga-sheet-in-rtl .28s cubic-bezier(.4,0,.2,1) forwards}:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open{animation:dga-sheet-in-ltr .28s cubic-bezier(.4,0,.2,1) forwards}:host .dga-mobile-fs-open{animation:dga-fs-in .24s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host .dga-action-badge,:host .dga-mobile-push-open,:host .dga-mobile-sheet-open,:host .dga-mobile-fs-open,:host-context([dir=\"rtl\"]) .dga-mobile-sheet-open,:host .dga-burger__line{animation:none;transition:none}}\n"]}]}],ctorParameters:()=>[],propDecorators:{brand:[{type:i.Input,args:[{isSignal:!0,alias:"brand",required:!1}]}],brandSlogan:[{type:i.Input,args:[{isSignal:!0,alias:"brandSlogan",required:!1}]}],brandLogo:[{type:i.Input,args:[{isSignal:!0,alias:"brandLogo",required:!1}]}],brandLogoAlt:[{type:i.Input,args:[{isSignal:!0,alias:"brandLogoAlt",required:!1}]}],brandPlaceholder:[{type:i.Input,args:[{isSignal:!0,alias:"brandPlaceholder",required:!1}]}],brandHref:[{type:i.Input,args:[{isSignal:!0,alias:"brandHref",required:!1}]}],navLabel:[{type:i.Input,args:[{isSignal:!0,alias:"navLabel",required:!1}]}],menuToggleLabel:[{type:i.Input,args:[{isSignal:!0,alias:"menuToggleLabel",required:!1}]}],menuCloseLabel:[{type:i.Input,args:[{isSignal:!0,alias:"menuCloseLabel",required:!1}]}],appearance:[{type:i.Input,args:[{isSignal:!0,alias:"appearance",required:!1}]}],mobileNav:[{type:i.Input,args:[{isSignal:!0,alias:"mobileNav",required:!1}]}],sticky:[{type:i.Input,args:[{isSignal:!0,alias:"sticky",required:!1}]}],items:[{type:i.Input,args:[{isSignal:!0,alias:"items",required:!1}]}],actions:[{type:i.Input,args:[{isSignal:!0,alias:"actions",required:!1}]}],search:[{type:i.Input,args:[{isSignal:!0,alias:"search",required:!1}]}],searchQuery:[{type:i.Input,args:[{isSignal:!0,alias:"searchQuery",required:!1}]},{type:i.Output,args:["searchQueryChange"]}],notifications:[{type:i.Input,args:[{isSignal:!0,alias:"notifications",required:!1}]}],login:[{type:i.Input,args:[{isSignal:!0,alias:"login",required:!1}]}],localeMenu:[{type:i.Input,args:[{isSignal:!0,alias:"localeMenu",required:!1}]}],user:[{type:i.Input,args:[{isSignal:!0,alias:"user",required:!1}]}],authenticated:[{type:i.Input,args:[{isSignal:!0,alias:"authenticated",required:!1}]},{type:i.Output,args:["authenticatedChange"]}],loginSubmitting:[{type:i.Input,args:[{isSignal:!0,alias:"loginSubmitting",required:!1}]},{type:i.Output,args:["loginSubmittingChange"]}],loginError:[{type:i.Input,args:[{isSignal:!0,alias:"loginError",required:!1}]},{type:i.Output,args:["loginErrorChange"]}],actionClick:[{type:i.Output,args:["actionClick"]}],searchSubmit:[{type:i.Output,args:["searchSubmit"]}],searchSuggestionSelect:[{type:i.Output,args:["searchSuggestionSelect"]}],searchVoice:[{type:i.Output,args:["searchVoice"]}],notificationAction:[{type:i.Output,args:["notificationAction"]}],loginSubmit:[{type:i.Output,args:["loginSubmit"]}],logout:[{type:i.Output,args:["logout"]}],userLinkClick:[{type:i.Output,args:["userLinkClick"]}],localeSelect:[{type:i.Output,args:["localeSelect"]}],navLinkClick:[{type:i.Output,args:["navLinkClick"]}],customLoginForm:[{type:i.ContentChild,args:[i.forwardRef(()=>m),{isSignal:!0}]}],customLoginFooter:[{type:i.ContentChild,args:[i.forwardRef(()=>p),{isSignal:!0}]}],searchInputRef:[{type:i.ViewChild,args:["searchInput",{isSignal:!0}]}],utilLayerRef:[{type:i.ViewChild,args:["utilLayer",{isSignal:!0}]}],onCloseHeaderOverlays:[{type:b,args:["document:dga-close-header-overlays"]}],onKey:[{type:b,args:["document:keydown",["$event"]]}],onScroll:[{type:b,args:["window:scroll"]}],onResize:[{type:b,args:["window:resize"]}],onDocClick:[{type:b,args:["document:click",["$event"]]}]}});export{v as DgaHeader,x as DgaHeaderLoginAfterFields,h as DgaHeaderLoginBeforeForm,p as DgaHeaderLoginFooter,m as DgaHeaderLoginForm};