"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/task-progress-bar"],{2656:(e,s,r)=>{r.r(s),r.d(s,{TaskProgressBarItemContent:()=>g,default:()=>m});var n=r(601),o=r.n(n),t=r(271),a=r(272),l=r.n(a),i=r(89),c=r(602),p=r(270);const u=i.Locale.getSection("components.tasks.common"),g=({title:e,progress:s,output:r,errors:n,refresh:o})=>{const a=[];return e&&(e=(0,p.jsx)("span",{dangerouslySetInnerHTML:{__html:e}},"title")),s?a.push((0,p.jsx)(t.Progress,{children:(0,p.jsx)(t.ProgressStep,{title:e,status:"running",progress:s.value,statusText:void 0!==s.value?`${s.value}%`:void 0,children:s.onClick&&(0,p.jsx)(t.Link,{onClick:s.onClick,children:(0,p.jsx)(t.Translate,{content:"progressDialogLink"})})})},"progress")):(a.push(e),r&&a.push((0,p.jsx)(t.Text,{component:"ul",intent:"muted",fontSize:"sm",className:"task-progress-bar-item__output",children:r.map(((e,s)=>(0,p.jsx)("li",{children:e},s.toString())))},"output")),n&&a.push((0,p.jsx)(t.Text,{component:"ul",intent:"muted",fontSize:"sm",className:"task-progress-bar-item__output",children:n.map(((e,s)=>(0,p.jsx)("li",{children:e},s.toString())))},"errors")),o&&a.push((0,p.jsx)(t.Link,{onClick:o.onClick,component:t.Text,fontSize:"sm",children:o.title||(0,p.jsx)(t.Translate,{content:"refresh"})},"refresh"))),(0,p.jsx)("div",{className:"task-progress-bar-item__content",children:a})};g.propTypes={title:l().string,progress:l().shape({value:l().number,onClick:l().func}),output:l().arrayOf(l().string),errors:l().arrayOf(l().string),refresh:l().shape({title:l().string,onClick:l().func.isRequired})};const d=({viewerId:e,items:s,isOpen:r,onGroupClose:n,...a})=>{const[l,d]=(0,c.useLocalStorage)(`task-progress-bar-collapsed-${e}`,!1),m=[];if(s.forEach((e=>{e instanceof i.Task.ProgressBar.Item&&m.push((e=>{const{key:s,intent:r,onClose:n,...t}=e.toToast();return{key:s,intent:r,onClose:n,message:(0,p.jsx)(g,{...t}),closable:!t.progress,className:o()("task-progress-bar-item",{[`task-progress-bar-item--${r}`]:r}),groupKey:t.progress?"progress":r}})(e))})),!r)return null;const b=[{groupKey:"progress",intent:"info",renderHeaderLabel:({count:e},s)=>(0,p.jsx)(t.Label,{...s,icon:(0,p.jsx)(t.Spinner,{className:"task-progress-bar__loading-spinner",colorAnimation:!1}),children:u.formatMessage("progressLabel",{count:e})})},{groupKey:"success",intent:"success",renderHeaderLabelTitle:({count:e})=>u.formatMessage("successLabel",{count:e}),renderHeaderLabelTooltip:()=>u.lmsg("successLabelTooltip"),closable:!0},{groupKey:"warning",intent:"warning",renderHeaderLabelTitle:({count:e})=>u.formatMessage("warningLabel",{count:e}),renderHeaderLabelTooltip:()=>u.lmsg("warningLabelTooltip"),closable:!0},{groupKey:"danger",intent:"danger",renderHeaderLabelTitle:({count:e})=>u.formatMessage("errorLabel",{count:e}),renderHeaderLabelTooltip:()=>u.lmsg("errorLabelTooltip"),closable:!0}];return(0,p.jsx)(t.Toaster,{id:"asyncProgressBar",view:"panel",groupConfigs:b,isPanelCollapsed:l,onPanelCollapseStateChange:d,toasts:m,onToastGroupClose:n,...a})};d.propTypes={viewerId:l().number.isRequired,items:l().array.isRequired,isOpen:l().bool.isRequired,onGroupClose:l().func.isRequired};const m=d},2655:(e,s,r)=>{r.r(s),r.d(s,{default:()=>a});var n=r(270),o=r(271),t=r(2656);const a=({locale:e,container:s,...r})=>{(0,n.render)((0,n.jsx)(o.LocaleProvider,{messages:e,children:(0,n.jsx)(t.default,{...r})}),s)}}}]);
//# sourceMappingURL=task-progress-bar.js.map?80715e799863a85892ca