"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["app/task-progress-bar"],{3231(e,s,r){r.r(s),r.d(s,{TaskProgressBarItemContent:()=>g,default:()=>m});var o=r(803),n=r.n(o),t=r(397),a=r(787),l=r.n(a),i=r(95),c=r(794),p=r(396);const u=i.Locale.getSection("components.tasks.common"),g=({title:e,progress:s,output:r,errors:o,refresh:n})=>{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")),o&&a.push((0,p.jsx)(t.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")),n&&a.push((0,p.jsx)(t.Link,{onClick:n.onClick,component:t.Text,fontSize:"sm",children:n.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: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,...t}=e.toToast();return{key:s,intent:r,onClose:o,message:(0,p.jsx)(g,{...t}),closable:!t.progress,className:n()("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:o,...a})};d.propTypes={viewerId:l().number.isRequired,items:l().array.isRequired,isOpen:l().bool.isRequired,onGroupClose:l().func.isRequired};const m=d},3230(e,s,r){r.r(s),r.d(s,{default:()=>a});var o=r(396),n=r(397),t=r(3231);const a=({locale:e,container:s,...r})=>{(0,o.render)((0,o.jsx)(n.LocaleProvider,{messages:e,children:(0,o.jsx)(t.default,{...r})}),s)};r.dn(a)}}]);
//# sourceMappingURL=task-progress-bar.js.map?5ca1ca7963dde9d73f00