import{S as kt,d as Ot,e as It,f as Et,h as k,i as re,k as At,m as zt,n as Vt}from"./chunk-6U74XUQG.js";import{a as ue,g as Mt}from"./chunk-ZEOYAAJV.js";import{$e as ee,Ab as x,Ah as Le,As as ce,B as ge,Bb as y,Bh as He,Cb as ye,Cl as et,Db as Se,E as fe,Ff as Be,Fm as te,Gh as je,Gt as St,Ha as Te,Hf as Ne,Hh as We,Hs as Ct,Ih as qe,Is as Dt,Jd as Ee,Jh as $e,Jm as oe,Jp as lt,K as ve,Ka as l,Kc as X,Ks as Tt,La as D,Mb as le,Ms as _e,Nd as Y,Od as Ae,Os as bt,Pc as Ie,Pd as V,Qs as yt,Rb as v,Sb as T,Sk as Qe,Sl as tt,Ta as h,Tb as xe,Tr as _t,Ua as E,Ub as Pe,Va as L,Vb as O,Vr as ut,We as Re,Wq as mt,Wr as ht,Xa as a,Xq as pt,Y as Ce,a as P,b as F,cc as J,ce as ze,cm as ot,cs as pe,da as De,dc as K,de as Ve,dm as nt,ds as B,es as N,fb as s,fm as it,fs as wt,gb as d,gs as gt,hb as f,ia as U,ib as H,ic as Me,jb as j,jc as z,ji as Je,jl as Xe,kl as Ye,kp as ne,l as M,lb as g,lj as me,mc as Oe,mj as Ke,mr as ct,n as we,na as S,nc as Q,nh as Ue,ns as ft,oa as G,ob as c,q as R,qb as m,qe as ke,sm as rt,t as de,ta as _,tl as Ze,tv as ie,ua as u,ub as be,um as at,we as Fe,wo as st,xb as W,xu as xt,yb as q,ye as Z,yo as dt,ys as vt,yu as Pt,za as C,zb as $,zh as Ge}from"./chunk-J36AVOW5.js";var b=function(t){return t.Original="ORIGINAL",t.UHD_8K="8K",t.UHD_4K="4K",t.FHD="FHD",t.HD="HD",t.SD="SD",t.Custom="CUSTOM",t}(b||{}),Ft=[{id:b.Original,value:"Original"},{id:b.UHD_8K,value:"8K UHD",dimensions:{width:8100,height:4320}},{id:b.UHD_4K,value:"4K UHD",dimensions:{width:4050,height:2160}},{id:b.FHD,value:"Full HD - 1080p",dimensions:{width:2025,height:1080}},{id:b.HD,value:"HD - 720p",dimensions:{width:1350,height:720}},{id:b.SD,value:"SD - 480p",dimensions:{width:900,height:480}},{id:b.Custom,value:"Custom\u2026"}];function Rt(t){let i=t.dimensions,n=i.width>i.height;return Ft.filter(e=>e.dimensions?n?_e(i,e.dimensions):_e(i,{width:e.dimensions.height,height:e.dimensions.width}):!0)}function Bt(t){return Rt(t).map(i=>F(P({},i),{value:`${i.value} ${eo(i.id,t.dimensions)}`}))}function Nt(t){return{ungroupedItems:Rt(t).filter(i=>i.id!==b.Custom).map(i=>{let n=ae(i.id,t.dimensions);return i.id===b.Original?{name:i.value,width:n.width,height:n.height,presetId:ft,format:oe(t)}:{name:i.value,width:n.width,height:n.height}}),itemGroupTypes:[]}}function eo(t,i){if(t===b.Custom)return"";let n=ae(t,i);return` (${Ct(n)})`}function ae(t,i){let n=Ft.find(e=>e.id===t);return n.dimensions?Tt(i,to(i,n.dimensions.width,n.dimensions.height)):P({},i)}function to(t,i,n){return t.width>t.height?{width:i,height:n}:{width:n,height:i}}function Ut(t){switch(t){case b.Original:return"original";case b.Custom:return"custom";default:return"preset"}}var ro=["videoPlayer"];function ao(t,i){if(t&1){let n=g();s(0,"div",28)(1,"platform-form-field",29)(2,"platform-form-number-input",30),c("valueEdited",function(o){_(n);let r=m(2);return u(r.customSizeChange(o,"width"))}),d()(),s(3,"div",31),f(4,"platform-icon",32),d(),s(5,"platform-form-field",33)(6,"platform-form-number-input",34),c("valueEdited",function(o){_(n);let r=m(2);return u(r.customSizeChange(o,"height"))}),d()()()}if(t&2){let n=m(2);l(),a("noSpacing",!0),l(),a("value",n.downloadDimensions.width)("min",10)("max",n.originalDimensions.width),l(3),a("noSpacing",!0),l(),a("value",n.downloadDimensions.height)("min",10)("max",n.originalDimensions.height)}}function so(t,i){if(t&1){let n=g();s(0,"div",7)(1,"div",8),c("click",function(){_(n);let o=m();return u(o.togglePlay())}),s(2,"video",9,0),c("timeupdate",function(){_(n);let o=m();return u(o.stopAtEndTime())}),f(4,"source",10),v(5,"async"),y(6," Your browser does not support the video tag. "),d(),s(7,"button",11),f(8,"platform-icon",12),v(9,"async"),d(),s(10,"div",13),f(11,"platform-icon",14),y(12),d()(),s(13,"div",15)(14,"platform-form-field",16)(15,"mat-slider",17)(16,"input",18),v(17,"async"),c("input",function(o){_(n);let r=m();return u(r.changeStartTimeFromEvent(o.target))}),d(),s(18,"input",19),v(19,"async"),c("input",function(o){_(n);let r=m();return u(r.changeEndTimeFromEvent(o.target))}),d()()()(),s(20,"div",20)(21,"platform-form-field",21)(22,"input",22,1),v(24,"async"),c("change",function(){_(n);let o=x(23),r=m();return u(r.changeStartTimeFromTimecodeInput(o.value))}),d()(),s(25,"platform-form-field",23)(26,"input",24,2),v(28,"async"),c("change",function(){_(n);let o=x(27),r=m();return u(r.changeEndTimeFromTimecodeInput(o.value))}),d()(),s(29,"platform-form-field",25)(30,"platform-form-dropdown",26),v(31,"async"),c("optionSelected",function(o){_(n);let r=m();return u(r.selectSize(o))}),d()()(),h(32,ao,7,8,"div",27),v(33,"async"),d()}if(t&2){let n=m();l(2),a("controls",!1)("autoplay",!1),l(2),a("src",T(5,20,n.videoUrl),Te),l(4),a("icon",T(9,22,n.playing)?"pause":"play-arrow"),l(4),Se(" ",n.getVideoDuration()," "),l(2),a("noSpacing",!0),l(),a("min",0)("max",n.durationInMilliseconds),l(),a("value",T(17,24,n.startTime)),l(2),a("value",T(19,26,n.endTime)),l(3),a("noSpacing",!0),l(),a("dashTextMask",n.TIMECODE_TEXT_MASK)("value",n.timecodeFromMilliseconds(T(24,28,n.startTime))),l(3),a("noSpacing",!0),l(),a("dashTextMask",n.TIMECODE_TEXT_MASK)("value",n.timecodeFromMilliseconds(T(28,30,n.endTime))),l(3),a("noSpacing",!0),l(),a("selected",T(31,32,n.selectedSize))("options",n.sizeOptions),l(2),a("ngIf",T(33,34,n.selectedSize)==="CUSTOM")}}var lo="HH:mm:ss.uu",jt=(()=>{let i=class i{constructor(e,o,r){this.dialogRef=e,this.data=o,this.assetPreviewService=r,this.state=new M("trim"),this.selectedSize=new M(b.Original),this.playing=new M(!1),this.TIMECODE_TEXT_MASK=mt}ngOnInit(){let e=new te(this.data);this.videoUrl=this.assetPreviewService.videoPreviewUrlAsObservable(e),this.duration=me.fromObject({seconds:this.data.duration}),this.durationInMilliseconds=this.duration.toMillis(),this.sizeOptions=Bt(this.data),this.originalDimensions=this.data.dimensions,this.downloadDimensions=P({},this.originalDimensions),this.setupStartAndEndTimeSliders()}ngOnDestroy(){Re(this.subscriptions)}setupStartAndEndTimeSliders(){this.startTime=new M(0),this.endTime=new M(this.duration.toMillis()),this.subscriptions=[ge(this.startTime,this.endTime).pipe(Ce(2),De(20)).subscribe(e=>this.setVideoCurrentTime(e))]}downloadTrimmedResizedVideo(){let e=this.endTime.value-this.startTime.value,o=this.durationInMilliseconds!==e,r=this.selectedSize.value!==b.Original,p=o&&r?"trim and resize":r?"resize":"trim";this.dialogRef.close({startTimecode:this.timecodeFromMilliseconds(this.startTime.value),endTimecode:this.timecodeFromMilliseconds(this.endTime.value),dimensions:this.downloadDimensions,downloadType:Ut(this.selectedSize.value),transformationType:p})}getVideoDuration(){return Ht(this.endTime.value-this.startTime.value)}changeStartTime(e){e>this.endTime.value?this.updateInputValueEvenIfValueIsSameAsOldValue(this.startTime,e,this.endTime.value):this.startTime.next(e)}updateInputValueEvenIfValueIsSameAsOldValue(e,o,r){e.next(o),setTimeout(()=>e.next(r),1)}changeStartTimeFromEvent(e){this.changeStartTime(parseInt(e.value))}changeStartTimeFromTimecodeInput(e){this.changeStartTime(Gt(e))}changeEndTime(e){e<this.startTime.value?this.updateInputValueEvenIfValueIsSameAsOldValue(this.endTime,e,this.startTime.value):e>this.durationInMilliseconds?this.updateInputValueEvenIfValueIsSameAsOldValue(this.endTime,e,this.durationInMilliseconds):this.endTime.next(e)}changeEndTimeFromEvent(e){this.changeEndTime(parseInt(e.value))}changeEndTimeFromTimecodeInput(e){this.changeEndTime(Gt(e))}selectSize(e){this.downloadDimensions=ae(e,this.originalDimensions),this.selectedSize.next(e)}timecodeFromMilliseconds(e){return Ht(e)}togglePlay(){this.playing.value?this.pauseVideo():this.playVideo()}playVideo(){this.setVideoCurrentTime(this.startTime.value),this.playing.next(!0),this.videoPlayer.nativeElement.play()}pauseVideo(){this.playing.next(!1),this.videoPlayer.nativeElement.pause()}setVideoCurrentTime(e){this.videoPlayer.nativeElement.currentTime=Lt(e)}closeModal(){this.dialogRef.close()}stopAtEndTime(){this.playing.value&&this.videoPlayer.nativeElement.currentTime>=Lt(this.endTime.value)&&this.pauseVideo()}customSizeChange(e,o){isNaN(e)||(this.downloadDimensions=yt(e,o,this.originalDimensions))}};i.\u0275fac=function(o){return new(o||i)(D(Ge),D(Le),D(re))},i.\u0275cmp=S({type:i,selectors:[["dash-trim-and-resize-video-modal"]],viewQuery:function(o,r){if(o&1&&W(ro,5),o&2){let p;q(p=$())&&(r.videoPlayer=p.first)}},decls:9,vars:3,consts:[["videoPlayer",""],["inputStartTime",""],["inputEndTime",""],["size","m","height","max90"],["class","trim-video",4,"ngIf"],["first-action","","buttonId","downloadTrimmedResizedVideo","icon","file-download",3,"click"],["second-action","","buttonId","dismissDialogButton","type","text",3,"click"],[1,"trim-video"],[1,"video-preview__wrapper",3,"click"],[1,"video-preview",3,"timeupdate","controls","autoplay"],["type","video/mp4",3,"src"],["cdkMonitorElementFocus","",1,"video-preview__control"],["size","9",3,"icon"],[1,"video-preview__duration"],["size","3","icon","stopwatch"],[1,"video-scrubber"],[3,"noSpacing"],[1,"video-scrubber__slider",3,"min","max"],["id","startTimeSliderInput","matSliderStartThumb","",3,"input","value"],["id","endTimeSliderInput","matSliderEndThumb","",3,"input","value"],[1,"video-inputs"],["label","Start time",1,"video-inputs__time",3,"noSpacing"],["matInput","","id","inputStartTime","type","text",1,"video-inputs__input",3,"change","dashTextMask","value"],["label","End time",1,"video-inputs__time",3,"noSpacing"],["matInput","","id","inputEndTime","type","text",1,"video-inputs__input",3,"change","dashTextMask","value"],["label","Size/quality",1,"video-inputs__size",3,"noSpacing"],["inputId","dropdownSizeQuality",3,"optionSelected","selected","options"],["class","custom-size",4,"ngIf"],[1,"custom-size"],["label","Width",1,"custom-size__input",3,"noSpacing"],["inputId","widthInput","suffix","px",1,"WIDTH_INPUT",3,"valueEdited","value","min","max"],[1,"custom-size__connector"],["icon","lock","size","3",1,"custom-size__aspect-lock"],["label","Height",1,"custom-size__input",3,"noSpacing"],["inputId","heightInput","suffix","px",1,"HEIGHT_INPUT",3,"valueEdited","value","min","max"]],template:function(o,r){o&1&&(s(0,"dash-modal",3)(1,"dash-modal-content"),h(2,so,34,36,"div",4),v(3,"async"),d(),s(4,"dash-modal-buttons")(5,"platform-button",5),c("click",function(){return r.downloadTrimmedResizedVideo()}),y(6,"Download"),d(),s(7,"platform-button",6),c("click",function(){return r.closeModal()}),y(8,"Cancel"),d()()()),o&2&&(l(2),a("ngIf",T(3,1,r.state)==="trim"))},dependencies:[K,V,Y,ke,Fe,Z,qe,je,$e,X,pt,_t,ut,z],styles:['.video-preview__wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;position:relative}.video-preview[_ngcontent-%COMP%]{display:block;width:100%;max-height:50vh;border-radius:4px;box-shadow:0 3px 6px #00000014,0 6px 10px #0000000d;background:#35343d}.video-preview__control[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;position:absolute;width:3rem;height:3rem;background:#18171c80;color:#fff;border-radius:50%;opacity:0;transition:opacity .2s cubic-bezier(.4,0,.2,1)}.video-preview__control[_ngcontent-%COMP%]:focus{outline:0}.video-preview__wrapper[_ngcontent-%COMP%]:hover   .video-preview__control[_ngcontent-%COMP%]{opacity:.6}.video-preview__wrapper[_ngcontent-%COMP%]:hover   .video-preview__control[_ngcontent-%COMP%]:hover, .video-preview__wrapper[_ngcontent-%COMP%]:hover   .video-preview__control[_ngcontent-%COMP%]:focus{opacity:1}.video-preview__duration[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;gap:.25rem;position:absolute;right:.75rem;bottom:.75rem;z-index:10;height:1.75rem;padding-left:.5rem;padding-right:.5rem;background:#18171cb3;border-radius:4px;color:#fff;font-variant-numeric:tabular-nums;font-size:.75rem;font-weight:500}.video-scrubber[_ngcontent-%COMP%]{margin-top:.5rem}.video-scrubber__slider[_ngcontent-%COMP%]{width:calc(100% - 16px)}.video-inputs[_ngcontent-%COMP%]{display:flex;gap:1.5rem;margin-top:.5rem}@media (max-width: 33.74em){.video-inputs[_ngcontent-%COMP%]{flex-direction:column}}@media (min-width: 33.75em){.video-inputs[_ngcontent-%COMP%]{flex-direction:row}}.video-inputs__time[_ngcontent-%COMP%]{flex-basis:25%}.video-inputs__size[_ngcontent-%COMP%]{display:block;flex-basis:50%}.custom-size[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:flex-end;width:100%;margin-top:1rem}.custom-size__input[_ngcontent-%COMP%]{flex-basis:35%}.custom-size__connector[_ngcontent-%COMP%]{display:flex;align-items:center;flex-basis:30%;gap:.75rem;height:2.75rem;color:#b7b6be}.custom-size__connector[_ngcontent-%COMP%]:before, .custom-size__connector[_ngcontent-%COMP%]:after{content:"";height:.0625rem;width:100%;background:#18171c26}.custom-size__aspect-lock[_ngcontent-%COMP%]{flex-shrink:0}.video-inputs__input[_ngcontent-%COMP%]{color:#35343d;font-weight:400;position:relative;padding:.75rem;border:.0625rem solid hsla(248,8%,10%,.15);border-radius:4px;background-color:#fff;line-height:1.25;transition:border-color .05s linear}.video-inputs__input[_ngcontent-%COMP%]:focus{outline:0}.video-inputs__input[_ngcontent-%COMP%]:hover{border-color:#b7b6be}.video-inputs__input[_ngcontent-%COMP%]:focus{border-color:hsla(var(--color-theme-hue),var(--color-theme-saturation),var(--color-theme-lightness),1)}'],changeDetection:0});let t=i;return t})();function Gt(t){return me.fromISOTime(t).toMillis()}function Lt(t){return t/1e3}function Ht(t){return Ke.fromObject({hour:0,minute:0,second:0}).set({millisecond:t}).toFormat(lo)}var Wt=(()=>{let i=class i{constructor(){this.formatChanged=new C}onSelectionChange(e){e!==this.selectedFormat&&this.formatChanged.emit(e)}formatOptions(){return this.formats.map(e=>({id:e,value:e}))}};i.\u0275fac=function(o){return new(o||i)},i.\u0275cmp=S({type:i,selectors:[["dash-download-format-toggle"]],inputs:{formats:"formats",selectedFormat:"selectedFormat",label:"label"},outputs:{formatChanged:"formatChanged"},decls:6,vars:3,consts:[[1,"option-couple"],[3,"selectionChanged","options","selectedOption"],["cdkMonitorElementFocus","","tp","Help me choose","href","https://help.dash.app/en/articles/3748713","target","_blank",1,"help-link"],["icon","help","size","5"]],template:function(o,r){o&1&&(s(0,"span"),y(1),d(),s(2,"div",0)(3,"dash-radio-toggle",1),c("selectionChanged",function(w){return r.onSelectionChange(w)}),d(),s(4,"a",2),f(5,"platform-icon",3),d()()),o&2&&(l(),ye(r.label),l(2),a("options",r.formatOptions())("selectedOption",r.selectedFormat))},dependencies:[Y,X,xt,rt],styles:['[_nghost-%COMP%], .option-list[_ngcontent-%COMP%]{display:flex;align-items:center}[_nghost-%COMP%]{justify-content:space-between}.option-couple[_ngcontent-%COMP%]{display:flex}.option-list[_ngcontent-%COMP%]{margin-right:.75rem;margin-left:.5rem}.option[_ngcontent-%COMP%]{padding:0 .5rem}.option__radio[_ngcontent-%COMP%]{position:absolute;appearance:none;background:none;z-index:2;opacity:.00001}.option__label[_ngcontent-%COMP%]{position:relative;display:block;font-size:.8125rem;font-weight:500;opacity:.8;cursor:pointer}.option__radio[_ngcontent-%COMP%]:checked ~ .option__label[_ngcontent-%COMP%]{opacity:1}.option__radio[_ngcontent-%COMP%]:checked ~ .option__label[_ngcontent-%COMP%]:after{content:"";position:absolute;top:100%;left:0;height:.125rem;width:100%;background:hsla(var(--color-theme-hue),var(--color-theme-saturation),var(--color-theme-lightness),1);border-radius:4px}.help-link[_ngcontent-%COMP%]{display:block;margin-left:.5rem;opacity:.8}.help-link[_ngcontent-%COMP%]:hover{opacity:1}'],changeDetection:0});let t=i;return t})();function po(t,i){t&1&&(s(0,"div",10),f(1,"div",11)(2,"div",12),d())}var qt=(()=>{let i=class i{constructor(){this.numberOfDummyDownloadPresets=[1,2,3]}};i.\u0275fac=function(o){return new(o||i)},i.\u0275cmp=S({type:i,selectors:[["dash-asset-download-dropdown-loading"]],decls:12,vars:2,consts:[[1,"menu-item","menu-item--border"],[1,"menu-item__text"],[1,"format"],[1,"format__label"],[1,"format__option"],[1,"format__hint"],[1,"download-presets"],["class","download-preset",4,"ngFor","ngForOf"],[1,"menu-item","menu-item--no-border"],[1,"spinner",3,"inContainer"],[1,"download-preset"],[1,"download-preset__text"],[1,"download-preset__meta"]],template:function(o,r){o&1&&(s(0,"div",0),f(1,"div",1),d(),s(2,"div",2),f(3,"div",3)(4,"div",4)(5,"div",4)(6,"div",5),d(),s(7,"div",6),h(8,po,3,0,"div",7),d(),s(9,"div",8),f(10,"div",1),d(),f(11,"platform-spinner",9)),o&2&&(l(8),a("ngForOf",r.numberOfDummyDownloadPresets),l(3),a("inContainer",!0))},dependencies:[J,Ae],styles:["[_nghost-%COMP%]{position:relative;display:block}.menu-item__text[_ngcontent-%COMP%], .format__label[_ngcontent-%COMP%], .format__option[_ngcontent-%COMP%], .download-preset__text[_ngcontent-%COMP%], .download-preset__meta[_ngcontent-%COMP%]{border-radius:4px;background:#ececef}.menu-item[_ngcontent-%COMP%]{padding:1.5rem}.menu-item--border[_ngcontent-%COMP%]{border-bottom:.0625rem solid hsla(248,8%,10%,.075)}.menu-item__text[_ngcontent-%COMP%]{height:1rem;width:4.375rem}.format[_ngcontent-%COMP%]{display:flex;align-items:center;padding:1rem 1.5rem}.format[_ngcontent-%COMP%]   .format__label[_ngcontent-%COMP%]{width:5.625rem;height:1rem;margin-right:auto;opacity:.8}.format[_ngcontent-%COMP%]   .format__option[_ngcontent-%COMP%]{width:1.625rem;height:1rem;margin-left:.75rem}.format[_ngcontent-%COMP%]   .format__hint[_ngcontent-%COMP%]{width:1rem;height:1rem;margin-left:.75rem;background:#ececef;border-radius:500px}.download-presets[_ngcontent-%COMP%]{padding-bottom:.5rem;border-bottom:.0625rem solid hsla(248,8%,10%,.075)}.download-preset[_ngcontent-%COMP%]{padding:1rem 1.5rem}.download-preset[_ngcontent-%COMP%]   .download-preset__text[_ngcontent-%COMP%]{height:1rem;width:5rem}.download-preset[_ngcontent-%COMP%]   .download-preset__meta[_ngcontent-%COMP%]{height:.75rem;width:7.5rem;margin-top:.25rem;opacity:.7}.spinner[_ngcontent-%COMP%]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}"],changeDetection:0});let t=i;return t})();var $t=(()=>{let i=class i{constructor(){this.back=new C,this.downloadRequest=new C,this.width=1e3,this.height=1e3}widthSet(e){this.width=e}heightSet(e){this.height=e}downloadMultipleAsset(){let e={width:this.width,height:this.height};this.downloadRequest.emit(e)}};i.\u0275fac=function(o){return new(o||i)},i.\u0275cmp=S({type:i,selectors:[["dash-multiple-download-custom-size"]],inputs:{dimensions:"dimensions"},outputs:{back:"back",downloadRequest:"downloadRequest"},decls:14,vars:6,consts:[[1,"download__multiple__custom"],["label","Back","leftIcon","back-arrow",3,"click"],[1,"download__multiple__custom__controls"],["for","widthInput",1,"download__multiple__label","download__multiple__label--mb"],[1,"download__multiple__custom__aspect"],[1,"download__multiple__custom__aspect__set"],["inputId","widthInput","suffix","px",3,"valueEdited","value","min","max"],["for","heightInput",1,"download__multiple__label","download__multiple__label--mb","download__multiple__label--mt"],["inputId","heightInput","suffix","px",3,"valueEdited","value","min","max"],[1,"download__multiple__custom__controls__download__multiple"],["id","downloadButton","fullwidth","true","element","button","icon","file-download",3,"click"]],template:function(o,r){o&1&&(s(0,"div",0)(1,"dash-dropdown-action-button",1),c("click",function(){return r.back.emit()}),d(),s(2,"div",2)(3,"label",3),y(4,"Max Width"),d(),s(5,"div",4)(6,"div",5)(7,"platform-form-number-input",6),c("valueEdited",function(w){return r.widthSet(w)}),d(),s(8,"label",7),y(9,"Max Height"),d(),s(10,"platform-form-number-input",8),c("valueEdited",function(w){return r.heightSet(w)}),d()()(),s(11,"div",9)(12,"platform-button",10),c("click",function(){return r.downloadMultipleAsset()}),y(13," Download "),d()()()()),o&2&&(l(7),a("value",r.width)("min",100)("max",1e5),l(3),a("value",r.height)("min",100)("max",1e5))},dependencies:[V,Z,ne],styles:['.download__multiple__label[_ngcontent-%COMP%]{display:block;line-height:1.15;color:#35343d;font-weight:600}.download__multiple__label--mb[_ngcontent-%COMP%]{margin-bottom:.5rem}.download__multiple__label--mt[_ngcontent-%COMP%]{margin-top:1.5rem}.download__multiple__custom__controls[_ngcontent-%COMP%]{padding:1.5rem;border-top:.0625rem solid hsla(248,8%,10%,.15)}.download__multiple__custom__aspect[_ngcontent-%COMP%]{display:flex}.download__multiple__custom__aspect__lock[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;position:relative;padding-left:.75rem}.download__multiple__custom__aspect__lock[_ngcontent-%COMP%]:before, .download__multiple__custom__aspect__lock[_ngcontent-%COMP%]:after{content:"";position:absolute;z-index:1;right:0;display:block;height:40%;width:8px;border-right:1px solid #cbcbcb}.download__multiple__custom__aspect__lock[_ngcontent-%COMP%]:before{top:1.3125rem;border-top:1px solid #cbcbcb}.download__multiple__custom__aspect__lock[_ngcontent-%COMP%]:after{bottom:1.3125rem;border-bottom:1px solid #cbcbcb}.download__multiple__custom__aspect__icon[_ngcontent-%COMP%]{display:block;width:.625rem;opacity:.3}.download__multiple__custom__aspect__set[_ngcontent-%COMP%]{flex:1}.download__multiple__custom__controls__download__multiple[_ngcontent-%COMP%]{padding-top:1.5rem}'],changeDetection:0});let t=i;return t})();var wo=["dropdown"],Kt=()=>["JPG","PNG","WEBP"];function go(t,i){}function fo(t,i){t&1&&h(0,go,0,0,"ng-template")}function vo(t,i){if(t&1&&f(0,"dash-asset-action-expiry-warning",13),t&2){let n=m(2);a("assetIds",n.assetIds)}}function Co(t,i){if(t&1){let n=g();s(0,"dash-dropdown-action-button",22),c("click",function(){let o=_(n).$implicit,r=m(4);return u(r.downloadRequest(r.getDownloadAnalyticsData("original","Download original"),o))}),d()}if(t&2){let n=i.$implicit,e=m(4);L("data-e2e","Download ",n.name,""),a("label",n.name)("description",e.readableDimensions(n))}}function Do(t,i){if(t&1){let n=g();s(0,"div",26)(1,"dash-download-format-toggle",27),c("formatChanged",function(o){_(n);let r=m(5);return u(r.toggleMediaType(o))}),d()()}if(t&2){let n=m(5);l(),a("formats",le(2,Kt))("selectedFormat",n.mediaTypeLabel())}}function To(t,i){if(t&1){let n=g();s(0,"dash-dropdown-action-button",28),c("click",function(){let o=_(n).$implicit,r=m(5);return u(r.downloadRequest(r.getDownloadAnalyticsData("preset","Download preset",o),o))}),d()}if(t&2){let n=i.$implicit,e=m(5);L("data-e2e","Download ",n.name,""),a("label",n.name)("description",e.presetDescription(n))}}function bo(t,i){if(t&1&&(s(0,"div",23),h(1,Do,2,3,"div",24)(2,To,1,4,"dash-dropdown-action-button",25),v(3,"slice"),d()),t&2){let n=m(2).ngIf,e=m(2);l(),a("ngIf",e.shouldShowDownloadFormatToggle),l(),a("ngForOf",xe(3,2,n.ungroupedItems,1))}}function yo(t,i){if(t&1){let n=g();s(0,"dash-dropdown-action-button",29),c("click",function(){let o=_(n).$implicit,r=m(4);return u(r.selectItemGroupType(o))}),d()}if(t&2){let n=i.$implicit;be("id","group-",n.id,""),a("label",n.name),E("data-intercom-target",n.name)}}function So(t,i){if(t&1){let n=g();s(0,"dash-dropdown-action-button",30),c("click",function(){_(n);let o=m(4);return u(o.handleTrimAndResize())}),d()}}function xo(t,i){if(t&1){let n=g();s(0,"dash-dropdown-action-button",31),c("click",function(){_(n);let o=m(4);return u(o.showSizeControls())}),d()}}function Po(t,i){if(t&1&&(H(0),s(1,"div",17),h(2,Co,1,4,"dash-dropdown-action-button",18),v(3,"slice"),h(4,bo,4,5,"div",19),d(),h(5,yo,1,4,"dash-dropdown-action-button",20)(6,So,1,0,"dash-dropdown-action-button",21)(7,xo,1,0,"ng-template",null,5,O),j()),t&2){let n=x(8),e=m().ngIf,o=m(2);l(2),a("ngForOf",Pe(3,5,e.ungroupedItems,0,1)),l(2),a("ngIf",e.ungroupedItems.length>1),l(),a("ngForOf",e.itemGroupTypes),l(),a("ngIf",o.isSingleVideoAsset())("ngIfElse",n)}}function Mo(t,i){if(t&1){let n=g();s(0,"dash-multiple-download-custom-size",34),c("downloadRequest",function(o){_(n);let r=m(4);return u(r.downloadRequest(r.getDownloadAnalyticsData("custom","Download custom",o),o))})("back",function(){_(n);let o=m(4);return u(o.hideSizeControls())}),d()}}function Oo(t,i){if(t&1){let n=g();s(0,"dash-custom-size-panel",35),c("sizeChosen",function(o){_(n);let r=m(4);return u(r.downloadRequest(r.getDownloadAnalyticsData("custom","Download custom",o),o))})("back",function(){_(n);let o=m(4);return u(o.hideSizeControls())})("canCloseDropdown",function(o){_(n);let r=m(4);return u(r.canCloseDropdown=o)}),d()}if(t&2){let n=m(4);a("fileData",n.singleDownloadAssetFile)("dimensions",n.singleDownloadSize)("showMediaTypeToggle",n.shouldShowDownloadFormatToggle)("downloadMediaType",n.mediaTypeForNonOriginalDownload)}}function Io(t,i){if(t&1&&(H(0),h(1,Mo,1,0,"dash-multiple-download-custom-size",32)(2,Oo,1,4,"dash-custom-size-panel",33),j()),t&2){let n=m(3);l(),a("ngIf",!n.singleDownloadSize),l(),a("ngIf",n.singleDownloadSize)}}function Eo(t,i){if(t&1){let n=g();s(0,"div",26)(1,"dash-download-format-toggle",27),c("formatChanged",function(o){_(n);let r=m(4);return u(r.toggleMediaType(o))}),d()()}if(t&2){let n=m(4);l(),a("formats",le(2,Kt))("selectedFormat",n.mediaTypeLabel())}}function Ao(t,i){if(t&1){let n=g();s(0,"dash-dropdown-action-button",28),c("click",function(){let o=_(n).$implicit,r=m(4);return u(r.downloadRequest(r.getDownloadAnalyticsData("preset (social media)","Download preset (social media)",o),o))}),d()}if(t&2){let n=i.$implicit,e=m(4);L("data-e2e","Download ",n.name,""),a("label",n.name)("description",e.presetDescription(n)),E("data-intercom-target",n.name)}}function zo(t,i){if(t&1&&(s(0,"div",23),h(1,Eo,2,3,"div",24)(2,Ao,1,5,"dash-dropdown-action-button",25),d()),t&2){let n=i.$implicit,e=m(3);E("data-intercom-target",n.name),l(),a("ngIf",e.shouldShowDownloadFormatToggle),l(),a("ngForOf",n.items)}}function Vo(t,i){if(t&1){let n=g();s(0,"div",14),h(1,Po,9,9,"ng-container",15)(2,Io,3,2,"ng-container",15),s(3,"dash-grouped-item-picker",16),c("back",function(){_(n);let o=m(2);return u(o.selectItemGroupType(void 0))}),h(4,zo,3,3,"ng-template",null,4,O),d()()}if(t&2){let n=x(5),e=m(2);l(),a("ngIf",!e.customSizePanelVisible&&!e.selectedItemGroupType),l(),a("ngIf",e.customSizePanelVisible),l(),a("selectedItemGroupType",e.selectedItemGroupType)("itemGroupTemplate",n),E("data-intercom-target",e.selectedItemGroupType==null?null:e.selectedItemGroupType.name)}}function ko(t,i){t&1&&f(0,"dash-asset-download-dropdown-loading",36)}function Fo(t,i){if(t&1){let n=g();s(0,"dash-dropdown",7,2),v(2,"async"),c("opened",function(){_(n);let o=m();return u(o.dropdownOpened())})("closed",function(){_(n);let o=m();return u(o.dropdownClosed())}),s(3,"div",8),h(4,fo,1,0,null,9),d(),H(5,10),h(6,vo,1,1,"dash-asset-action-expiry-warning",11)(7,Vo,6,5,"div",12),v(8,"async"),h(9,ko,1,0,"ng-template",null,3,O),j(),d()}if(t&2){let n=x(10),e=m(),o=x(2);a("canClose",e.canCloseDropdown)("extraActions",o)("showExtraActions",T(2,7,e.shouldShowExtraPresetControls)),l(4),a("ngTemplateOutlet",e.downloadButtonTemplate),l(2),a("ngIf",e.showExpiryWarning),l(),a("ngIf",T(8,9,e.downloadSizes))("ngIfElse",n)}}function Ro(t,i){if(t&1){let n=g();s(0,"div",38)(1,"platform-button",39),c("click",function(){_(n);let o=m(2);return u(o.managePresetsClicked())}),y(2,"Manage presets "),d(),s(3,"platform-button",40),c("click",function(){_(n);let o=m(2);return u(o.setCropAreas.emit())}),y(4,"Set crop areas "),d()()}}function Bo(t,i){t&1&&h(0,Ro,5,0,"ng-template",37)}function No(t,i){}function Uo(t,i){t&1&&h(0,No,0,0,"ng-template")}function Go(t,i){if(t&1){let n=g();s(0,"div",41),c("click",function(){_(n);let o=m();return u(o.downloadRequest(o.getDownloadAnalyticsData("original","Download file")))}),h(1,Uo,1,0,null,9),d()}if(t&2){let n=m();l(),a("ngTemplateOutlet",n.downloadButtonTemplate)}}var Lo=1,Qt=(()=>{let i=class i{set assetDownloadData(e){Be(this._assetDownloadData,e)||(this._assetDownloadData=e,this.updateAssetDownloads(),this.isSingleVideoAsset()&&this.primeLowResVideoPreview())}get assetDownloadData(){return this._assetDownloadData}constructor(e,o,r,p,w,I,Yt,Zt){this.assetDownloadService=e,this.cropAreaService=o,this.router=r,this.dialog=p,this.pageReturnUrlService=w,this.modalScrollService=I,this.analyticsService=Yt,this.assetPreviewService=Zt,this.showExpiryWarning=!0,this.showPresetControls=!0,this.downloadIsDisabled=!1,this.downloaded=new C,this.preparingDownload=new C,this.failed=new C,this.setCropAreas=new C,this.downloadAssets=new C,this.opened=new C,this.closed=new C,this.areSomeAssetsTransformableImages=!1,this.shouldShowDownloadFormatToggle=!0,this.customSizePanelVisible=!1,this.downloadSizes=R(ue()),this.mediaTypeForNonOriginalDownload=N.JPEG,this.canCloseDropdown=!0,this.isDropdownOpen=!1,this.shouldShowExtraPresetControls=R(!0)}ngOnInit(){this.assetDownloadService.init()}ngOnDestroy(){this.assetDownloadService.clearPresetTransformationsSubscriptions()}primeLowResVideoPreview(){let e=new te(this.assetDownloadData[0]);this.assetPreviewService.requestPreviewUrlHeader(e.videoThumbnailUrl).subscribe()}dropdownOpened(){this.isDropdownOpen=!0,this.opened.emit()}dropdownClosed(){this.isDropdownOpen&&(this.updateAssetDownloads(),this.revertToPreset(),this.closed.emit()),this.isDropdownOpen=!1}updateAssetDownloads(){this.assetDownloadData&&this.assetDownloadData.length>0?(this.someAssetsAreTransformableImages()?this.setDownloadSizes():this.setDefaultDownloadSize(),this.assetIds=this.assetDownloadData.map(({assetId:e})=>e),this.shouldShowDownloadFormatToggle=!this.allAssetsAreVideos(),this.mediaTypeForNonOriginalDownload=this.getDefaultMediaTypeForNonOriginalDownload()):this.assetIds=[]}getDefaultMediaTypeForNonOriginalDownload(){return this.allAssetsAreVideos()?N.MP4:this.allAssetsUseTransparency()?N.PNG:N.JPEG}setDownloadSizes(){this.assetDownloadData&&(this.assetDownloadData.length===1?this.setSingleAssetDownloadSizes(this.assetDownloadData[0]):this.setMultipleAssetDownloadSizes(this.assetDownloadData,this.assetDownloadData.map(e=>ce(e))))}setDefaultDownloadSize(){this.assetDownloadService.presetDownloadSizesRelativeToDimension(this.assetDownloadData).pipe(ve(1)).subscribe(e=>{e.ungroupedItems.length>0&&(this.defaultDownloadSize=e.ungroupedItems[0])})}setSingleAssetDownloadSizes(e){let o=ce(e);this.singleDownloadAssetFile=e,this.singleDownloadSize=o&&{name:"Original",width:o.width,height:o.height,format:oe(e)},B(e)&&o?this.setDownloadSizesForVideo(e):o||pe(e)?this.setDownloadSizesForImage(e,o):this.setUpNoDownloadSizes()}setMultipleAssetDownloadSizes(e,o){let r=o.filter(w=>w!==void 0),p=bt(r);this.singleDownloadAssetFile=void 0,this.singleDownloadSize=void 0,this.setUpDownloadSizes(this.assetDownloadService.presetDownloadSizesSmallerThanDimension(e,p))}setDownloadSizesForVideo(e){this.setUpDownloadSizes(R(Nt(e)))}setDownloadSizesForImage(e,o){this.setUpDownloadSizes(this.assetDownloadService.presetDownloadSizesRelativeToDimension([e],o))}setUpNoDownloadSizes(){this.setUpDownloadSizes(R(ue()))}setUpDownloadSizes(e){this.downloadSizes=e,this.shouldShowExtraPresetControls=this.accountHasCustomPresets().pipe(de(o=>o&&this.showPresetControls&&!this.customSizePanelVisible&&!this.selectedItemGroupType&&this.assetDownloadData?.length===1&&this.shouldShowDownloadFormatToggle))}emitDownloadAssets({downloadAnalyticsData:e,dimensions:o,presetParameterOverrides:r={},trim:p}){let w=Jt(o,this.mediaTypeForNonOriginalDownload);this.downloadAssets.emit({downloadAnalyticsData:e,dimensions:w,presetParameterOverrides:r,trim:p})}downloadRequest(e,o){if(!this.downloadIsDisabled){this.preparingDownload.emit(!0);let r=o||this.defaultDownloadSize;vt(r)?this.handleCropPresetDownloads(e,r):this.emitDownloadAssets({downloadAnalyticsData:e,dimensions:r,presetParameterOverrides:{}}),this.dropdown&&this.areSomeAssetsTransformableImages&&this.dropdown.closePanel()}}getDownloadAnalyticsData(e,o,r){let p="original";r&&(p=Ve(r.cropX)?"crop":"resize");let w=e==="original"?void 0:r?.mediaType||this.mediaTypeForNonOriginalDownload,I=this.getLegacyAnalyticsEventLabel(e,p);return{appSource:this.appSource,type:e,mediaType:w,transformationType:p,legacyAnalyticsEventAction:o,legacyAnalyticsEventLabel:I}}getLegacyAnalyticsEventLabel(e,o){switch(e){case"original":return"Original file download";case"preset":case"preset (social media)":return`Preset ${o} download`;case"custom":return`Custom ${o} download`;case"trim & resize":return"Trim and resize download";default:return"unknown"}}toggleMediaType(e){this.mediaTypeForNonOriginalDownload=gt(e)}mediaTypeLabel(){return wt(this.mediaTypeForNonOriginalDownload)}endDownloadFailed(){this.failed.emit(),this.preparingDownload.emit(!1)}handleCropPresetDownloads(e,o){let r=this.mediaTypeForNonOriginalDownload;this.cropAreaService.getCropAreasForPresetAndAssetIds(o,this.assetDownloadData).pipe(fe(()=>(this.endDownloadFailed(),we))).subscribe(p=>{let w=Jt(o,r);this.emitDownloadAssets({downloadAnalyticsData:e,dimensions:w,presetParameterOverrides:Ne(p,I=>[P({type:Je.TypeEnum.Crop},I)])})})}handleTrimAndResize(){this.analyticsService.trackEventInIntercom({category:Ze,action:"Open trim and resize video modal",label:this.appSource}),this.analyticsService.trackEvent({object:"Asset",action:"Open trim & resize modal",appSource:this.appSource}),this.dropdownClosed(),this.dialog.open(jt,{autoFocus:!0,data:this.assetDownloadData[0]}).afterClosed().subscribe(e=>{e&&(this.preparingDownload.emit(!0),this.emitDownloadAssets({downloadAnalyticsData:F(P({},this.getDownloadAnalyticsData(e.downloadType,"Download trim & resize")),{type:e.downloadType,transformationType:e.transformationType,mediaType:this.mediaTypeForNonOriginalDownload}),dimensions:{name:"Trim",width:e.dimensions.width,height:e.dimensions.height},presetParameterOverrides:{},trim:{startTimecode:e.startTimecode,endTimecode:e.endTimecode}}))})}presetDescription(e){return`${this.readableDimensions(e)}, ${this.mediaTypeLabel()}`}readableDimensions(e){return Dt(e)}showSizeControls(){this.customSizePanelVisible=!0,this.modalScrollService.scrollToTop()}hideSizeControls(){this.customSizePanelVisible=!1}revertToPreset(){this.customSizePanelVisible=!1,this.selectItemGroupType(void 0)}someAssetsAreTransformableImages(){return this.areSomeAssetsTransformableImages=this.assetDownloadData.some(e=>pe(e)||B(e)),this.areSomeAssetsTransformableImages}allAssetsAreVideos(){return this.assetDownloadData.every(e=>B(e))}allAssetsUseTransparency(){return this.assetDownloadData.every(e=>e.usesTransparency)}selectItemGroupType(e){this.selectedItemGroupType=e,this.modalScrollService.scrollToTop()}managePresetsClicked(){this.analyticsService.trackEventInIntercom({category:et,action:ct,label:"Asset detail page"}),this.pageReturnUrlService.setPageReturnRoute(lt,this.router.url,"Browse")}isSingleVideoAsset(){return this.assetDownloadData?.length===1&&B(this.assetDownloadData[0])}accountHasCustomPresets(){return this.downloadSizes.pipe(de(e=>Mt(e)>Lo))}};i.\u0275fac=function(o){return new(o||i)(D(k),D(At),D(Ee),D(He),D(Qe),D(We),D(tt),D(re))},i.\u0275cmp=S({type:i,selectors:[["dash-download-button-presentation"]],viewQuery:function(o,r){if(o&1&&W(wo,5),o&2){let p;q(p=$())&&(r.dropdown=p.first)}},inputs:{appSource:"appSource",assetDownloadData:"assetDownloadData",downloadButtonTemplate:"downloadButtonTemplate",showExpiryWarning:"showExpiryWarning",showPresetControls:"showPresetControls",downloadIsDisabled:"downloadIsDisabled"},outputs:{downloaded:"downloaded",preparingDownload:"preparingDownload",failed:"failed",setCropAreas:"setCropAreas",downloadAssets:"downloadAssets",opened:"opened",closed:"closed"},decls:5,vars:2,consts:[["presetControls",""],["nonImageAsset",""],["dropdown",""],["loadingState",""],["itemGroupTemplate",""],["imageCustomDownload",""],["class","DOWNLOAD TEST-DROPDOWN",3,"canClose","extraActions","showExtraActions","opened","closed",4,"ngIf","ngIfElse"],[1,"DOWNLOAD","TEST-DROPDOWN",3,"opened","closed","canClose","extraActions","showExtraActions"],["openDropdownButton",""],[4,"ngTemplateOutlet"],["dropdownPanelComponent",""],[3,"assetIds",4,"ngIf"],["class","download",4,"ngIf","ngIfElse"],[3,"assetIds"],[1,"download"],[4,"ngIf"],[3,"back","selectedItemGroupType","itemGroupTemplate"],[1,"download__container"],["class","download__original",3,"label","description","click",4,"ngFor","ngForOf"],["class","download__presets",4,"ngIf"],["class","download__action-button","rightIcon","chevron-right",3,"id","label","click",4,"ngFor","ngForOf"],["id","openTrimAndResizeDownloadPanel","label","Trim/resize","rightIcon","chevron-right",3,"click",4,"ngIf","ngIfElse"],[1,"download__original",3,"click","label","description"],[1,"download__presets"],["class","download__formats",4,"ngIf"],[3,"label","description","click",4,"ngFor","ngForOf"],[1,"download__formats"],["label","Download as:",3,"formatChanged","formats","selectedFormat"],[3,"click","label","description"],["rightIcon","chevron-right",1,"download__action-button",3,"click","id","label"],["id","openTrimAndResizeDownloadPanel","label","Trim/resize","rightIcon","chevron-right",3,"click"],["id","openCustomSizeDownloadPanel","label","Custom download","rightIcon","chevron-right",3,"click"],[3,"downloadRequest","back",4,"ngIf"],["action","Download","actionIcon","file-download",3,"fileData","dimensions","showMediaTypeToggle","downloadMediaType","sizeChosen","back","canCloseDropdown",4,"ngIf"],[3,"downloadRequest","back"],["action","Download","actionIcon","file-download",3,"sizeChosen","back","canCloseDropdown","fileData","dimensions","showMediaTypeToggle","downloadMediaType"],[1,"loading-state"],["dashPermissions","","dashPermissionsResourceType","PRESET_SIZES","dashPermissionsAction","EDIT_PRESET_SIZES"],[1,"extra-actions"],["icon","settings","type","text-muted","size","small","element","label","dashRouterLink","/admin/presets",3,"click"],["icon","external","type","text-muted","size","small",3,"click"],[3,"click"]],template:function(o,r){if(o&1&&h(0,Fo,11,11,"dash-dropdown",6)(1,Bo,1,0,"ng-template",null,0,O)(3,Go,2,1,"ng-template",null,1,O),o&2){let p=x(4);a("ngIf",r.areSomeAssetsTransformableImages)("ngIfElse",p)}},dependencies:[J,K,Me,V,ne,st,Ue,Pt,zt,Vt,dt,Wt,qt,$t,z,Oe],styles:["@media (min-width: 48em){.download[_ngcontent-%COMP%]{width:20.3125rem}}.download__original[_ngcontent-%COMP%]{display:block;border-bottom:.0625rem solid hsla(248,8%,10%,.075)}.download__container[_ngcontent-%COMP%]{padding-top:.75rem;border-bottom:.0625rem solid hsla(248,8%,10%,.075)}.download__formats[_ngcontent-%COMP%]{padding-left:1.5rem;padding-right:1.5rem;padding-top:1rem;margin-bottom:.75rem}.download__presets[_ngcontent-%COMP%]{background:#faf9fa;padding-bottom:.5rem}.download__action-button[_ngcontent-%COMP%]{display:block;border-bottom:.0625rem solid hsla(248,8%,10%,.075)}.extra-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;padding:.5rem 1.5rem}@media (min-width: 48em){.loading-state[_ngcontent-%COMP%]{width:20.3125rem}}"],changeDetection:0});let t=i;return t})();function Jt(t,i){return t&&ze(t.mediaType)&&F(P({},t),{mediaType:i})||t}function jo(t,i){if(t&1&&(f(0,"dash-icon-button",2),v(1,"async")),t&2){let n=m();a("isLoading",T(1,4,n.preparingDownload))("tone",n.tone),E("aria-haspopup",!0)("aria-expanded",n.isOpen)}}var _i=(()=>{let i=class i{constructor(e,o){this.assetDownloadService=e,this.messagingService=o,this.showExpiryWarning=!0,this.started=new C,this.downloaded=new C,this.setCropAreas=new C,this.preparingDownload=new M(!1),this.isOpen=!1}dropdownOpened(){this.isOpen=!0}dropdownClosed(){this.isOpen=!1}downloadAssets({downloadAnalyticsData:e,dimensions:o,presetParameterOverrides:r,trim:p}){let w=this.assetDownloadData.length>1;this.assetDownloadService.downloadAssets({assets:this.assetDownloadData,downloadAnalyticsData:e,dimensions:o,presetParameterOverrides:r,trim:p,zip:w}).subscribe({error:()=>{this.messagingService.showError("Your download failed. Refresh the page and try again, or get in touch if it still doesn't work."),this.endDownloadFailed()},complete:()=>this.endDownloadSuccessful()}),this.started.emit()}endDownloadSuccessful(){this.downloaded.emit(),this.preparingDownload.next(!1)}endDownloadFailed(){this.preparingDownload.next(!1)}};i.\u0275fac=function(o){return new(o||i)(D(k),D(Ye))},i.\u0275cmp=S({type:i,selectors:[["dash-asset-download-button"]],inputs:{appSource:"appSource",assetDownloadData:"assetDownloadData",tone:"tone",showExpiryWarning:"showExpiryWarning",downloadButtonTemplate:"downloadButtonTemplate"},outputs:{started:"started",downloaded:"downloaded",setCropAreas:"setCropAreas"},decls:4,vars:8,consts:[["defaultDownloadButtonTemplate",""],[3,"downloadAssets","failed","setCropAreas","opened","closed","appSource","assetDownloadData","downloadButtonTemplate","showExpiryWarning","showPresetControls","downloadIsDisabled"],["buttonId","assetDownloadButton","icon","file-download","tooltipText","Download","ariaLabel","Download","intercomId","Download assets",1,"DOWNLOAD",3,"isLoading","tone"]],template:function(o,r){if(o&1){let p=g();s(0,"dash-download-button-presentation",1),v(1,"async"),c("downloadAssets",function(I){return _(p),u(r.downloadAssets(I))})("failed",function(){return _(p),u(r.endDownloadFailed())})("setCropAreas",function(){return _(p),u(r.setCropAreas.emit())})("opened",function(){return _(p),u(r.dropdownOpened())})("closed",function(){return _(p),u(r.dropdownClosed())}),d(),h(2,jo,2,6,"ng-template",null,0,O)}if(o&2){let p=x(3);a("appSource",r.appSource)("assetDownloadData",r.assetDownloadData)("downloadButtonTemplate",r.downloadButtonTemplate||p)("showExpiryWarning",r.showExpiryWarning)("showPresetControls",!0)("downloadIsDisabled",T(1,6,r.preparingDownload))}},dependencies:[at,Qt,z],encapsulation:2,changeDetection:0});let t=i;return t})();var Xt=(()=>{let i=class i{};i.\u0275fac=function(o){return new(o||i)},i.\u0275mod=G({type:i}),i.\u0275inj=U({providers:[ot,nt],imports:[Q,Xe.forRoot(it),ee,ie,Ie]});let t=i;return t})();var dr=(()=>{let i=class i{};i.\u0275fac=function(o){return new(o||i)},i.\u0275mod=G({type:i}),i.\u0275inj=U({providers:[Ot,k,It,Et],imports:[Q,ee,ie,kt,St,ht,Xt]});let t=i;return t})();export{Qt as a,_i as b,Xt as c,dr as d};
