1import{n as _}from"./E1v-ICMS.js";import{Ht as S,s as v}from"./CyBclcCi.js";v();var r={DEFAULT:"default",INFO:"info",SUCCESS:"success",ERROR:"error",WARNING:"warning"},I={TOP_LEFT:"top-left",TOP_CENTER:"top-center",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center",BOTTOM_RIGHT:"bottom-right"},f=5e3,E=1e4,A={[r.DEFAULT]:f,[r.INFO]:f,[r.SUCCESS]:f,[r.ERROR]:E,[r.WARNING]:E},R=[r.ERROR,r.WARNING,r.INFO,r.SUCCESS],g=I.TOP_RIGHT,C="ÐÑоизоÑла оÑибка",D="ÐопиÑоваÑÑ ÑекÑÑ Ð¾Ñибки",P="СкопиÑовано",L="ÐопиÑоваÑÑ Ñнова",B=2e3,F=.06,N=class{toasts=S([]);timers=new Map;idCounter=0;get items(){return this.toasts.value}create(t,e={}){return this.add(r.DEFAULT,t,e)}success(t,e={}){return this.add(r.SUCCESS,t,e)}error(t,e={}){return this.add(r.ERROR,t,e)}warning(t,e={}){return this.add(r.WARNING,t,e)}info(t,e={}){return this.add(r.INFO,t,e)}add(t,e,s={}){const a=this.nextId(),u=s.timeout??A[t],d=s.showProgressBar??R.includes(t),i={id:a,type:t,title:s.title,message:e,html:s.html,extHtml:s.extHtml,actions:s.actions??[],timeout:u,pauseOnHover:s.pauseOnHover??!0,closeOnClick:s.closeOnClick??!1,position:s.position??g,showProgressBar:d,hasCopyButton:s.hasCopyButton??t===r.ERROR,copyButtonTitle:s.copyButtonTitle};return this.toasts.value=[i,...this.toasts.value].slice(0,4),u>0&&this.scheduleDismiss(a,u),a}dismiss(t){if(!t){this.toasts.value.forEach(e=>this.clearTimer(e.id)),this.toasts.value=[];return}this.clearTimer(t),this.toasts.value=this.toasts.value.filter(e=>e.id!==t)}pause(t,e=!1){const s=this.toasts.value.find(d=>d.id===t);if(!s||s.timeout<=0||!e&&!s.pauseOnHover)return;const a=this.timers.get(t);if(!a?.timeoutId)return;clearTimeout(a.timeoutId);const u=Date.now()-a.startedAt;a.remaining=Math.max(0,a.remaining-u),a.timeoutId=null}resume(t,e=!1){const s=this.toasts.value.find(u=>u.id===t);if(!s||s.timeout<=0||!e&&!s.pauseOnHover)return;const a=this.timers.get(t);!a||a.timeoutId||this.scheduleDismiss(t,a.remaining)}pauseAll(){this.toasts.value.forEach(t=>this.pause(t.id,!0))}resumeAll(){this.toasts.value.forEach(t=>this.resume(t.id,!0))}getRemainingTimeout(t){const e=this.toasts.value.find(a=>a.id===t);if(!e||e.timeout<=0)return 0;const s=this.timers.get(t);if(!s)return 0;if(s.timeoutId){const a=Date.now()-s.startedAt;return Math.max(0,Math.min(1,(s.remaining-a)/e.timeout))}return Math.max(0,Math.min(1,s.remaining/e.timeout))}nextId(){return this.idCounter+=1,`toast-${this.idCounter}-${Date.now()}`}clearTimer(t){const e=this.timers.get(t);e?.timeoutId&&clearTimeout(e.timeoutId),this.timers.delete(t)}scheduleDismiss(t,e){if(e<=0){this.dismiss(t);return}const s=Date.now(),a=setTimeout(()=>{this.dismiss(t)},e);this.timers.set(t,{remaining:e,startedAt:s,timeoutId:a})}},m=new N;function c(t,e){return m.create(t,e)}c.success=(t,e)=>m.success(t,e);c.error=(t,e)=>m.error(t,e);c.warning=(t,e)=>m.warning(t,e);c.info=(t,e)=>m.info(t,e);c.dismiss=t=>m.dismiss(t);var T=c;function H(){function t(i,n={}){return T(i,n)}function e(i,n={}){return T.info(i,n)}function s(i,n={}){return T.success(i,n)}function a(i,n={}){return T.error(i,n)}function u(i,n={}){return T.warning(i,n)}function d(i,n=C){console.error(i);const l=i?.config?.headers;l&&console.warn(`X-Request-Id: ${l["x-request-id"]}, URL: ${window.location.host}, Code: ${i.code}`);const h={data:{message:n}},o=i?.response??h;o.data=o?.data??h.data,(typeof o.data!="object"||!o.data?.message)&&(o.data={message:h.data.message}),o.data.message==="ÐÑоизоÑла оÑибка"&&n.length>0&&(o.data.message=n);const O={};return o?.data?.validation_errors&&(O.html=[...new Set(Object.values(o.data.validation_errors).flat())].map(_).join("<br>")),l?.["x-request-id"]&&(O.extHtml=`<span>Request: ${_(l["x-request-id"])}</span>`),a(o.data.message,O),o.data.message}return{createToast:t,infoToast:e,successToast:s,warningToast:u,errorToast:a,showError:d,dismiss:T.dismiss}}export{L as a,g as c,r as d,P as i,I as l,T as n,B as o,m as r,D as s,H as t,F as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.