import{_ as E}from"./EmptyStateBlock-D6U_EDq6.js";import{_ as $}from"./IconClose-ChC2G6HM.js";import{_ as D}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{c as v,o as l,a,b as h,r as T,u as A,f as S,H,D as f,C as x,w as M,aq as P,F as N,d as R,x as V,i as F}from"./index-CipWZKo_.js";import{_ as U}from"./ClausesKeeper-DVJgfLR3.js";import{_ as Y}from"./BlockBalanceAgreement-2iQbaweR.js";import{u as q}from"./notes-BiOFV6-v.js";import{u as z}from"./postings-dJpYnOCG.js";import{u as G}from"./contracts-CILh9uSu.js";import"./ButtonDefault-CghIUDY0.js";const J={class:"notes__note-container new-class"},K={class:"notes__content"},Q=["innerHTML"],W={__name:"NoteTag",props:{item:{type:String,default:""},index:{type:[String,Number],default:""}},emits:["delete"],setup(w,{emit:o}){const s=o;function i(n){let r=new Date;r.setDate(30+r.getDate()),document.cookie=`${n}=hidden; path=/; expires=${r}`,s("delete",n)}return(n,r)=>{const _=$;return l(),v("div",J,[a("div",K,[a("div",{innerHTML:w.item},null,8,Q),a("div",{class:"notes__close-button",onClick:r[0]||(r[0]=d=>i(w.index))},[h(_,{class:"notes__close-button-cross"})])])])}}},X=D(W,[["__scopeId","data-v-9f5e4b65"]]),Z={class:"section"},ee={class:"container"},te={class:"notes"},oe={__name:"NotesView",async setup(w){let o,s;const i=q(),n=T(null);z();const r=G(),_=A(),d=S(()=>_.userInfo);S(()=>Object.keys(d.value?.Contacts)?.map(e=>{if(!d.value?.Contacts?.[e]?.IsHidden)return d.value?.Contacts?.[e]})),R();const O=V("emitter"),C=[{old:"/v2/DNSmanagerSchemes",new:"/v2/AdditionalServicesOrder?ServiceID=52000"},{old:"/v2/ExtraIPSchemes",new:"/v2/AdditionalServicesOrder?ServiceID=50000"},{old:"/v2/ISPswSchemes",new:"/v2/AdditionalServicesOrder?ServiceID=51000"}],I=S(()=>{let e={};return Object.keys(i?.notesList).reverse().forEach(t=>{e[t]=i?.notesList?.[t]}),Object.keys(e).length>0?e:null});function b(){let e={};Object.keys(i?.notesList).reverse().forEach(t=>{L(t)&&(e[t]=i?.notesList?.[t])}),n.value=e}function L(e){return document.cookie.match(RegExp(`(?:^|;\\s*)${e}=([^;]*)`))===null}function j(e){return Object.values(e).map((t,y)=>{let c=t;const g=/<NOBODY>/gi;return c=c.replace(g,"<div>"),c=c.replace(/<\/NOBODY>/gi,"</div>"),C.forEach(({old:p,new:k})=>{const m=new RegExp(`<a[^>]*href="${p}"[^>]*>`,"gi");c=c.replace(m,u=>u.replace(`href="${p}"`,`href="${k}"`))}),c})}function B(e){let t=new Date;t.setDate(30+t.getDate()),delete n.value[e],document.cookie=`${e}=hidden; path=/; expires=${t}`,O.emit("notes-reduce")}return H(()=>{const e=I.value;e&&(n.value=j(e),b())}),[o,s]=f(()=>i.fetchNotes().then(()=>{b()})),await o,s(),[o,s]=f(()=>r.fetchContracts()),await o,s(),[o,s]=f(()=>r.fetchProfiles()),await o,s(),[o,s]=f(()=>_.fetchUserData()),await o,s(),(e,t)=>{const y=Y,c=U,g=$,p=X,k=E;return l(),v(N,null,[h(y),a("section",Z,[a("div",ee,[t[0]||(t[0]=a("div",{class:"section-header"},[a("h1",{class:"section-title"},"Уведомления")],-1)),h(c),a("div",te,[n.value&&Object.keys(n.value).length>0?(l(),x(P,{key:0,tag:"div",name:"list",class:"notes__transition-container tw-space-y-4"},{default:M(()=>[(l(!0),v(N,null,F(n.value,(m,u)=>(l(),v("div",{class:"tw-relative tw-border tw-border-gray-200 tw-rounded tw-py-4 tw-pl-4 tw-pr-12",key:u},[h(g,{class:"tw-absolute tw-top-4 tw-right-4 tw-size-5 tw-cursor-pointer hover:tw-text-orange-500",onClick:se=>B(u)},null,8,["onClick"]),(l(),x(p,{innerHTML:m,item:m,index:u,key:u},null,8,["innerHTML","item","index"]))]))),128))]),_:1})):(l(),x(k,{key:1,label:"Все уведомления прочитаны или они еще не пришли"}))])])])],64)}}},me=D(oe,[["__scopeId","data-v-5f688c11"]]);export{me as default};
