"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["app/task-progress-bar"],{3208(e,s,r){r.r(s),r.d(s,{TaskProgressBarItemContent:()=>g,default:()=>m});var o=r(778),t=r.n(o),n=r(373),a=r(762),l=r.n(a),i=r(95),c=r(769),p=r(372);const u=i.Locale.getSection("components.tasks.common"),g=({title:e,progress:s,output:r,errors:o,refresh:t})=>{const a=[];return e&&(e=(0,p.jsx)("span",{dangerouslySetInnerHTML:{__html:e}},"title")),s?a.push((0,p.jsx)(n.Progress,{children:(0,p.jsx)(n.ProgressStep,{title:e,status:"running",progress:s.value,statusText:void 0!==s.value?`${s.value}%`:void 0,children:s.onClick&&(0,p.jsx)(n.Link,{onClick:s.onClick,children:(0,p.jsx)(n.Translate,{content:"progressDialogLink"})})})},"progress")):(a.push(e),r&&a.push((0,p.jsx)(n.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")),o&&a.push((0,p.jsx)(n.Text,{component:"ul",intent:"muted",fontSize:"sm",className:"task-progress-bar-item__output",children:o.map((e,s)=>(0,p.jsx)("li",{children:e},s.toString()))},"errors")),t&&a.push((0,p.jsx)(n.Link,{onClick:t.onClick,component:n.Text,fontSize:"sm",children:t.title||(0,p.jsx)(n.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:o,...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:o,...n}=e.toToast();return{key:s,intent:r,onClose:o,message:(0,p.jsx)(g,{...n}),closable:!n.progress,className:t()("task-progress-bar-item",{[`task-progress-bar-item--${r}`]:r}),groupKey:n.progress?"progress":r}})(e))}),!r)return null;const b=[{groupKey:"progress",intent:"info",renderHeaderLabel:({count:e},s)=>(0,p.jsx)(n.Label,{...s,icon:(0,p.jsx)(n.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)(n.Toaster,{id:"asyncProgressBar",view:"panel",groupConfigs:b,isPanelCollapsed:l,onPanelCollapseStateChange:d,toasts:m,onToastGroupClose:o,...a})};d.propTypes={viewerId:l().number.isRequired,items:l().array.isRequired,isOpen:l().bool.isRequired,onGroupClose:l().func.isRequired};const m=d},3207(e,s,r){r.r(s),r.d(s,{default:()=>a});var o=r(372),t=r(373),n=r(3208);const a=({locale:e,container:s,...r})=>{(0,o.render)((0,o.jsx)(t.LocaleProvider,{messages:e,children:(0,o.jsx)(n.default,{...r})}),s)};(Object.getOwnPropertyDescriptor(a,"name")||{}).writable||Object.defineProperty(a,"name",{value:"default",configurable:!0})}}]);
//# sourceMappingURL=task-progress-bar.js.map?07cd977791f2785d4ee9