"use strict";(self.webpackChunk_stlite_desktop=self.webpackChunk_stlite_desktop||[]).push([[1740],{31740:(t,e,i)=>{i.r(e),i.d(e,{default:()=>c});var n=i(5057),s=i(44088),l=i(92649),d=i(38830),r=i(29968),a=i(31808),o=i(13840),u=i(96266);const c=function(t){const{disabled:e,element:i,widgetMgr:c,width:h,endpoints:b,fragmentId:f}=t,p={width:h},{libConfig:{enforceDownloadInNewTab:k=!1}}=n.useContext(a.E),w="primary"===i.type?s.nW.PRIMARY:s.nW.SECONDARY,g=(0,o.v_)(),m=!i.help||h;return(0,u.jsx)("div",{className:"stDownloadButton","data-testid":"stDownloadButton",style:p,children:(0,u.jsx)(l.t,{help:i.help,children:(0,u.jsx)(d.ZP,{kind:w,size:s.V5.SMALL,disabled:e,onClick:()=>{if(c.setTriggerValue(i,{fromUi:!0},f),i.url.startsWith("/media"))return void(0,o.uP)(g,i.url);const t=function(t,e,i){const n=document.createElement("a"),s=t.buildMediaURL(e);return n.setAttribute("href",s),i?n.setAttribute("target","_blank"):n.setAttribute("target","_self"),n.setAttribute("download",""),n}(b,i.url,k);t.click()},fluidWidth:!!i.useContainerWidth&&m,children:(0,u.jsx)(r.D,{icon:i.icon,label:i.label})})})})}}}]);