PageSourceSearch

https://steppo.ru/assets/headerInstruction-CkUNnFDy.js

js steppo.ru collected 2026-10-08 22:35:57 UTC 235,574 bytes, 21 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/publicPagePublic-DSl9ndik.js","assets/react-vendor-DJDEZQgo.js","assets/lodash-LFlzvllK.js","assets/index-Cfgv5Ll0.js","assets/index-zzBdMKzH.js","assets/prosemirror-DTtwTwjc.js","assets/toastOptions-C9sKTk_P.js","assets/index-BCVp6XMN.js","assets/MeetingRecorderBlock-lunhZz3J.js","assets/index-LHLcHDc2.js","assets/index-Dn-O8Fmn.js","assets/WorkspaceHeaderContext-CxyDA-in.js","assets/index-CpSz5HRc.js","assets/createLucideIcon-CsK1bMTG.js","assets/preload-helper-CKSfOHJ6.js","assets/api-CPiT7-aR.js","assets/format-BPo9NAoA.js","assets/commentNode-DND3aMFI.js","assets/MentionProfileCard-RcMPeLz2.js","assets/licenseContext-my7rfzFX.js","assets/yandexMetrika-m_4Niw9W.js","assets/users-IyG-ybWO.js","assets/index-BG-9wiPx.js","assets/companyHelpers-BHkC0xo-.js","assets/file-text-mJ7r21LW.js","assets/clipboard-uOAnoYcX.js","assets/useEditorFloatingPanels-BZ084u6I.js","assets/editorPageNotionLayout-CNMg_kbb.js","assets/ArrowBack-DA_dH5qX.js","assets/skeleton-iR163uRi.js","assets/EmbeddedInstructionCard-CFCnJRmp.js","assets/drawer-content-CO5KLwpe.js","assets/modal-header-DPvzzezM.js","assets/play-6G5jBbY9.js","assets/licenseBranding-Dl3-DRh-.js","assets/ProBadge-Cn5NCEBn.js","assets/index-CxtYbnAM.js","assets/image-CeffXirS.js","assets/chevron-down-DvNpnSfp.js","assets/volume-2-Crzf9SAk.js","assets/download-CT22UHm4.js","assets/collapse-B4Ciyz9e.js","assets/DockTooltip-BYnLbIff.js","assets/chevron-left-CU5WbyNs.js","assets/chevron-right-CMta_ySC.js","assets/check-FZZhYzpS.js","assets/menu-divider-CqJR_Z2c.js","assets/index-CbjDJg3j.js","assets/index-7kmpOzQ6.js","assets/options-Lz4Jd_F2.js","assets/kbd-C6Qi1QQ7.js","assets/ChevronRight-DOsOHBpe.js","assets/ElasticSlider-BH1dBOL6.js","assets/simple-grid-CrAbUAYL.js","assets/mediaSession-CKt0GIFc.js","assets/list-4pz9pXrR.js","assets/circular-progress-DZX2Iol7.js","assets/index-CdfyrPZ1.js","assets/index-Dl5ceR2Z.js","assets/index--uvsKs4n.js","assets/index-DMsyrwY3.js","assets/index-Dg62e69K.js","assets/index-C7vS4FZV.js","assets/header-B_p4iv9P.js","assets/DotField-B5wGAQv7.js","assets/colorpicker-D_cTdHpa.js","assets/index-dydxNKMt.js","assets/modal-footer-JrKNdHCa.js","assets/authHelpers-BT1Z8bUx.js","assets/CoolMode-DLdMQt5k.js","assets/wrap-Bd__aT89.js","assets/PublicPageNotionHeader-VhDf3h7B.js","assets/TopBlurStack-CajGAYIC.js","assets/PublicSidebarBrand-CiDFeOGx.js","assets/PublicFolderDocumentContext-BeeBIXQe.js","assets/video-B_-olds1.js","assets/index-B18pRc_7.js","assets/index.esm-IcPZOCMN.js","assets/spacer-Bw5SyJNZ.js","assets/PublicDocumentHeaderActions-B18nlBjB.js","assets/PublicFolderHeaderContext-D8FnrhPW.js","assets/toastOptions-C3X3Bcz_.css","assets/index-XvfDh6xA.css","assets/commentNode-BeFkOLAn.css","assets/ElasticSlider-C2DLfC92.css","assets/DotField-BoHnZsUZ.css","assets/MeetingRecorderBlock-BnHzmPjy.css"])))=>i.map(i=>d[i]);
2import{r as e,j as r,e as i,u as o,f as n}from"./react-vendor-DJDEZQgo.js";import{M as t,g as s,h as l,A as a,p as d,a as c,u as p,S as x,i as u,j as h,P as g,r as b,s as m,v as f,b as v,f as j}from"./licenseContext-my7rfzFX.js";import{b as y,u as S,I as w}from"./index-DUcCl7Su.js";import{l as C,f as k,i as z,a as W}from"./index-BG-9wiPx.js";import{af as R,C as F,aU as I,aV as A,aW as D,aX as E,l as _,aw as M,c as T,I as O,aY as P,aZ as $,a_ as B,a$ as L,b0 as H,b1 as U,b2 as N,b3 as V,b4 as Y,b5 as X,r as G,b6 as K,e as q,s as J,b7 as Q,b8 as Z,aN as ee,K as re,aO as ie,aP as oe,b9 as ne,ba as te,bb as se,bc as le,n as ae,t as de,E as ce,J as pe,bd as xe,F as ue,be as he,bf as ge,p as be,H as me,bg as fe,bh as ve}from"./api-CPiT7-aR.js";import{u as je,D as ye,aC as Se,aD as we,ax as Ce,I as ke,b as ze,F as We,A as Re,d as Fe,B as Ie,aa as Ae,a as De,l as Ee}from"./index-CpSz5HRc.js";import"./yandexMetrika-m_4Niw9W.js";import{B as _e,a as Me,b as Te,T as Oe}from"./header-B_p4iv9P.js";import{L as Pe,g as $e,h as Be,c as Le,i as He}from"./index-DMsyrwY3.js";import{c as Ue,H as Ne,V as Ve,L as Ye,R as Xe,u as Ge,T as Ke,S as qe,U as Je}from"./createLucideIcon-CsK1bMTG.js";import{k as Qe,e as Ze}from"./index-Dn-O8Fmn.js";import{P as er}from"./video-B_-olds1.js";import{m as rr,C as ir}from"./colorpicker-D_cTdHpa.js";import{c as or}from"./clipboard-uOAnoYcX.js";
2import{g as nr,h as tr,i as sr,j as lr,k as ar,l as dr,m as cr}from"./index-B18pRc_7.js";import{c as pr,d as xr}from"./index-C7vS4FZV.js";import{I as ur,U as hr}from"./index-vlBp10Qt.js";import{h as gr,A as br,B as mr,p as fr,C as vr,D as jr,E as yr,o as Sr,G as wr}from"./index-LHLcHDc2.js";import{ad as Cr,J as kr,ae as zr,af as Wr,ag as Rr,z as Fr,b as Ir,T as Ar,I as Dr,B as Er,k as _r,c as Mr,u as Tr,S as Or,P as Pr,W as $r,j as Br,l as Lr,m as Hr,A as Ur,a5 as Nr,ah as Vr}from"./toastOptions-C9sKTk_P.js";import{M as Yr,a as Xr,b as Gr,c as Kr,S as qr}from"./users-IyG-ybWO.js";import{a as Jr,M as Qr}from"./modal-header-DPvzzezM.js";import{P as Zr}from"./ProBadge-Cn5NCEBn.js";import{w as ei,b as ri,c as ii,d as oi,r as ni,u as ti}from"./WorkspaceHeaderContext-CxyDA-in.js";import{b as si,c as li,d as ai,e as di,A as ci,f as pi}from"./FileTree-B0prbtTq.js";import{C as xi}from"./collapse-B4Ciyz9e.js";import{e as ui}from"./licenseBranding-Dl3-DRh-.js";import{M as hi}from"./menu-divider-CqJR_Z2c.js";import{C as gi}from"./chevron-down-DvNpnSfp.js";import{C as bi}from"./chevron-right-CMta_ySC.js";import{I as mi}from"./image-CeffXirS.js";import{_ as fi}from"./preload-helper-CKSfOHJ6.js";import{H as vi,a as ji}from"./index-Dl5ceR2Z.js";import{M as yi}from"./mediaSession-CKt0GIFc.js";import{D as Si,a as wi}from"./drawer-content-CO5KLwpe.js";import{M as Ci}from"./modal-footer-JrKNdHCa.js";import{S as ki}from"./spacer-Bw5SyJNZ.js";import{f as zi}from"./format-BPo9NAoA.js";import{u as Wi,g as Ri,h as Fi,i as Ii}from"./index-dydxNKMt.js";import{D as Ai}from"./DockTooltip-BYnLbIff.js";import{G as Di}from"./DotField-B5wGAQv7.js";import{u as Ei,a as _i}from"./use-spring-BSY9u327.js";import{g as Mi,w as Ti}from"./editorPageNotionLayout-CNMg_kbb.js";import{S as Oi}from"./simple-grid-CrAbUAYL.js";import{X as Pi}from"./x-MnAtMA9y.js";import{T as $i,a as Bi,b as Li,c as Hi,d as Ui}from"./tab-panels-Bw-qaxrG.js";import{T as Ni,R as Vi}from"./triangle-alert-DEXELNOq.js";import{b as Yi}from"./index-CxtYbnAM.js";import{C as Xi}from"./ChevronRight-DOsOHBpe.js";import{j as Gi,k as Ki,I as qi,l as Ji}from"./InviteUsersFields-s7T1Ux3J.js";import{F as Qi}from"./form-label-C383Yy0Q.js";import{P as Zi}from"./companyHelpers-BHkC0xo-.js";function eo(e,r){const i=Ei(r()),o=()=>i.set(r());return o(),kr(()=>{const r=()=>zr.update(o,!1,!0),i=e.map(e=>e.on("change",r));return()=>{i.forEach(e=>e()),Wr(o)}}),i}function ro(e,r,i,o){if("function"==typeof e)return function(e){Rr.current=[],e();const r=eo(Rr.current,e);return Rr.current=void 0,r}(e);const n="function"==typeof r?r:function(...e){const r=!Array.isArray(e[0]),i=r?0:-1,o=e[0+i],n=e[1+i],t=e[2+i],s=e[3+i],l=Cr(n,t,{mixer:(a=t[0],(e=>e&&"object"==typeof e&&e.mix)(a)?a.mix:void 0),...s});var a;return r?l(o):l}(r,i,o);return Array.isArray(e)?io(e,n):io([e],([e])=>n(e))}function io(e,r){const i=Fr(()=>[]);return eo(e,()=>{i.length=0;const o=e.length;for(let r=0;r<o;r++)i[r]=e[r].get();return r(i)})}const oo=Ue("calendar-days",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]),no=Ue("clock-3",[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),to=Ue("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),so=Ue("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),lo=Ue("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),ao=Ue("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);function co(e,r=1){3===(e=e.replace(/^#/,"")).length&&(e=e.split("").map(e=>e+e).join(""));const i=parseInt(e,16);return`rgba(${i>>16&255},${i>>8&255},${255&i},${r})`}const po=e=>{if(!e)return"";const{title:r="",description:i="",url:o="",tags:n=[],steps:t=[]}=e,s=[];if(r&&s.push(`# ${r.trim()}`),i&&s.push(`\n${i.trim()}`),o&&s.push(`\n**URL:** [${o}](${o})`),null==n?void 0:n.length){const e=n.map(e=>`\`${e}\``).join(" ");s.push(`\n**Теги:** ${e}`)}const l=[...t].filter(e=>!e.isDeleted).sort((e,r)=>e.order-r.order);let a=0;return l.forEach(r=>{if(r.text||r.s3Url){switch(r.type){case"header":s.push(`\n\n### ${rr(r.text.trim())}`);break;case"section":s.push(`\n\n## ${rr(r.text.trim())}`);break;case"notification":s.push(`<div style="background:rgba(52,199,89,0.25);border:1px solid #34C759;border-radius:8px; padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:3px;margin-bottom:16px;overflow:hidden;color:#0B461A;max-width:720px">\n<div style="display: flex; align-items: start;margin-bottom:7px;">\n<span style="width:1.5rem;text-align:center;border-radius:99px;font-size: 16px; line-height: 1.5; font-weight: bold; margin-right: 10px;background:rgba(52,199,89,0.5">i</span>\n<span style="font-size: 16px; line-height: 1.5;">${rr(r.text.trim())}</span>\n</div>`);break;case"warning":s.push(`<div style="background:rgba(255,59,48,0.25);border:1px solid #FF3B30;border-radius:8px; padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:3px;margin-bottom:16px;overflow:hidden;color:#6A0E20;max-width:720px">\n<div style="display: flex; align-items: start;margin-bottom:7px;">\n<span style="width:1.5rem;text-align:center;border-radius:99px;font-size: 16px; line-height: 1.5; font-weight: bold; margin-right: 10px;background:rgba(255,59,48,0.5">!</span>\n<span style="font-size: 16px; line-height: 1.5;">${rr(r.text.trim())}</span>\n</div>`);break;default:a+=1,s.push(`<div style="background:#EBEDF0;border-radius:8px; padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:10px;margin-bottom:16px;overflow:hidden;max-width:720px">\n<div style="display: flex; align-items: start;">\n<span style="font-size: 16px; line-height: 1.5; font-weight: bold; margin-right: 10px;">${a}.</span>\n<span style="font-size: 16px; line-height: 1.5;">${rr(r.text.trim())}</span>\n</div>\n`)}if(r.s3Url&&null===r.positionX&&(r.fileName||r.id,s.push(`\n<div style="text-align:center;">\n<img style="border-radius:5px;width:100%" src="${r.s3Url}" width="100%" height="100%" />\n</div>`)),null!=r.positionX&&null!=r.positionY&&r.s3Url){const i=function(e,r,i,o=20,n="#FB923C"){return`<div style="position:relative;margin-top:10px;">\n  <img style="border-radius:5px;width:100%" src="${e}" width="100%" height="100%" />\n  <span \n    style="position:absolute;\n           top:${i}%;\n           left:${r}%;\n           transform:translate(-50%,-50%);\n           display:block;\n           width:${2*o}px;\n           height:${2*o}px;\n           border-radius:50%;\n           border:2px solid ${co(n,.75)};\n           background:${co(n,.5)};">\n  </span>\n</div>`}(r.s3Url,r.positionX,r.positionY,20,e.targetColor);s.push(`${i}\n</div>`)}s.push("</div>")}}),s.push("\n\n"),s.join("\n\n")},xo=e=>{if(!e)return"";const{title:r="",description:i="",url:o="",tags:n=[],steps:t=[]}=e,s=[];if(r&&s.push(`# ${r.trim()}`),i&&s.push(`\n${i.trim()}`),o&&s.push(`\n**URL:** [${o}](${o})`),null==n?void 0:n.length){const e=n.map(e=>`\`${e}\``).join(" ");s.push(`\n**Теги:** ${e}`)}const l=[...t].filter(e=>!e.isDeleted).sort((e,r)=>e.order-r.order);let a=0;return l.forEach(r=>{var i;if(r.text||r.s3Url){switch(r.type){case"header":s.push(`\n\n## ${r.text.trim()}`);break;case"section":s.push(`\n\n### ${r.text.trim()}`);break;case"notification":s.push(`\n\n> ℹ️ ${r.text.trim()}`);break;case"warning":s.push(`\n\n> ⚠️ ${r.text.trim()}`);break;default:a+=1,s.push(`\n\n${a}. ${r.text.trim()}`)}if(r.s3Url){const o=(null==(i=e.targetColor)?void 0:i.replace("#",""))||"FB923C";null!==r.positionX&&null!==r.positionY?s.push(`\n\n![](https://steppo.ru/api/images/image-proxy?url=${encodeURIComponent(r.s3Url)}&x=${r.positionX}&y=${r.positionY}&color=${o}&radius=10)`):s.push(`\n\n![](https://steppo.ru/api/images/image-proxy?url=${encodeURIComponent(r.s3Url)}&radius=10)`),r.description&&r.description.trim()&&s.push(`\n\n*${r.description.trim()}*`)}}}),s.push("\n"),s.join("\n")},uo=({instruction:i,iconSize:o="md",...n})=>{const c=je(),p=e.useCallback(()=>{const e=po(i);e?or(e).then(e=>{c(e?{title:"Инструкция скопирована в буфер",status:"success",duration:1500,isClosable:!0}:{title:"Не удалось скопировать",description:"Браузер запретил доступ к буферу обмена.",status:"error",duration:2500,isClosable:!0})}):c({title:"Нечего копировать",status:"warning",duration:2e3,isClosable:!0})},[i,c]),x=e.useCallback(()=>{const e=xo(i);e?or(e).then(e=>{c(e?{title:"Инструкция скопирована в буфер",status:"success",duration:1500,isClosable:!0}:{title:"Не удалось скопировать",description:"Браузер запретил доступ к буферу обмена.",status:"error",duration:2500,isClosable:!0})}):c({title:"Нечего копировать",status:"warning",duration:2e3,isClosable:!0})},[i,c]);return r.jsxs(Ne,{spacing:"0",children:[r.jsx(Ir,{onClick:x,borderRadius:"5px",borderRightRadius:"0",maxWidth:"fit-content",h:"fit-content",py:"3px",px:"0px",bg:"#CBD5E0",_hover:{bg:"#A
20AEC0"},_active:{bg:"#718096"},children:r.jsx(Ar,{p:"0",px:"12px",fontWeight:"400",fontSize:"0.825rem",children:"Скопировать"})}),r.jsxs(t,{placement:"bottom-end",children:[r.jsx(s,{as:Dr,icon:r.jsx(l,{w:"12px",p:0}),py:"0px",h:"21.84px",px:"0px",borderRadius:"5px",borderLeftRadius:0,borderLeft:"1px solid #A0AEC0",bg:"#CBD5E0",_hover:{bg:"#A0AEC0"},_active:{bg:"#718096"}}),r.jsx(a,{children:r.jsx(d,{onClick:p,children:r.jsx(Ar,{fontSize:".825rem",children:"MarkDown + HTML"})})})]})]})},ho=_r`
3  0% { transform: scale(0.4); opacity: 0; }
4  60% { transform: scale(1.1); opacity: 1; }
5  100% { transform: scale(1); opacity: 1; }
6`,go=[{icon:nr,title:"Файл не обновляется",text:"Изменится один шаг — и скачанные копии уже врут: кто-то откроет старую и сделает не так. По ссылке все видят актуальную версию."},{icon:tr,title:"Файл не видит читателя",text:"Отправьте ссылку — и увидите, кто открыл инструкцию и на каком шаге застрял. Файл об этом не скажет ничего."},{icon:pr,title:"Файл не отвечает",text:"Вопросы и предложения читателей в файле некуда написать — а вопросы будут. В Steppo они попадают в обсуждения у шагов."},{icon:sr,title:"Файлы плодят версии",text:"Через месяц в чатах лежат пять копий, и никто не помнит, какая свежая. Ссылка одна — и всегда верная."}],bo=({icon:e,iconColor:i,textTool:o,onClick:n,isMobile:t})=>r.jsx(Mr,{hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",label:o,children:r.jsx(F,{p:t?2.5:3,bg:"gray.100",borderRadius:"99px",transition:"all 0.2s ease",border:"1px solid",w:"fit-content",borderColor:"gray.300",onClick:n,boxShadow:"sm",_hover:{bg:"gray.200",transform:"scale(1.075)"},cursor:"pointer",_active:{bg:"gray.300",transform:"scale(0.98)"},children:r.jsx(e,{size:t?"18px":"20px",color:i})})});function mo({isOpen:i,onClose:o,format:n="pdf",instruction:t,publicUrl:s,onCopyLink:l,onShareVia:a,isMobile:d=!1}){const[p,x]=e.useState(!1),u="pdf"===n,h=(new Date).toLocaleDateString("ru-RU"),g=(null==t?void 0:t.title)||"Документ",b=u?"PDF скачан":"Word-файл скачан",m=`«${g}» — ${u?"снимок для печати":"копия для правок"} на ${h}. Дальше ${u?"он":"она"} не изменится — `,f=u?"Файл — для печати. Ссылка — для читателей.":"Файл — для разовой передачи. Ссылка — для работы.";e.useEffect(()=>{i&&R("exportSuccessModalShown",(null==t?void 0:t.id)?String(t.id):null).catch(()=>{})},[i,null==t?void 0:t.id]);return r.jsxs(Yr,{isOpen:i,onClose:o,isCentered:!0,scrollBehavior:"inside",children:[r.jsx(Xr,{backdropFilter:"blur(6px)"}),r.jsxs(Gr,{borderRadius:"20px",maxW:d?"calc(100vw - 2rem)":"480px",w:d?"calc(100vw - 2rem)":"auto",mx:"4",my:"1rem",maxH:"calc(100dvh - 2rem)",boxShadow:"0 24px 80px rgba(0,0,0,0.18)",children:[r.jsx(Kr,{borderRadius:"full",top:"12px",right:"12px",_hover:{bg:"gray.100"}}),r.jsx(Jr,{px:d?"20px":"28px",pt:"20px",pb:"24px",children:r.jsxs(Ve,{spacing:"14px",align:"stretch",children:[r.jsxs(Ve,{spacing:"8px",align:"stretch",pr:"32px",children:[r.jsxs(Ne,{spacing:"10px",align:"center",children:[r.jsx(Er,{flexShrink:0,animation:`${ho} 0.45s ease-out`,children:r.jsx(c,{color:"#16A34A",boxSize:"20px"})}),r.jsx(Ar,{fontSize:d?"1rem":"1.125rem",fontWeight:"700",color:"gray.800",children:b})]}),r.jsxs(Ar,{fontSize:d?"0.8rem":"0.875rem",color:"gray.500",lineHeight:"1.5",children:[m,r.jsx(Ar,{as:"span",fontWeight:"600",color:"gray.700",children:"живая версия остаётся в Steppo."})]})]}),r.jsx(ye,{borderColor:"gray.100"}),r.jsx(Ar,{fontSize:d?"0.85rem":"0.925rem",fontWeight:"700",color:"gray.700",children:"Этот файл уже начал устаревать"}),r.jsx(Ve,{spacing:"12px",align:"stretch",children:go.map(({icon:e,title:i,text:o})=>r.jsxs(Ne,{spacing:"10px",align:"flex-start",children:[r.jsx(Er,{p:"7px",borderRadius:"full",bg:"#F1EDF9",flexShrink:0,children:r.jsx(e,{size:"14px",color:"#5B438E"})}),r.jsxs(Ve,{spacing:"2px",align:"start",children:[r.jsx(Ar,{fontSize:d?"0.8rem":"0.875rem",fontWeight:"600",color:"gray.800",children:i}),r.jsx(Ar,{fontSize:d?"0.75rem":"0.825rem",color:"gray.500",lineHeight:"1.45",children:o})]})]},i))}),r.jsx(ye,{borderColor:"gray.100"}),r.jsxs(Ve,{spacing:"10px",align:"stretch",children:[r.jsx(Ar,{fontSize:d?"0.8rem":"0.875rem",fontWeight:"600",color:"gray.700",children:"Пригласите читателей туда, где инструкция живая"}),r.jsxs(Ne,{spacing:d?"8px":"12px",w:"100%",align:"center",children:[r.jsx(Ir,{h:"44px",flex:"1",minW:"0",px:d?"8px":"16px",borderRadius:"full",color:"white",bg:"#4F378A",fontSize:d?"0.82rem":"0.9rem",fontWeight:"500",leftIcon:p?r.jsx(c,{boxSize:"14px"}):r.jsx(Pe,{size:"14px"}),onClick:async()=>{l&&(await l(),x(!0),R("exportSuccessModalLinkCopied",(null==t?void 0:t.id)?String(t.id):null).cat
6ch(()=>{}),window.setTimeout(()=>x(!1),2500))},_hover:{opacity:.75},_active:{opacity:1},_focusVisible:{boxShadow:"0 0 0 2px #FFFFFF, 0 0 0 4px #4F378A"},transition:"opacity 0.15s",children:p?"Скопировано":"Скопировать ссылку"}),r.jsx(bo,{icon:_e,iconColor:"#0088cc",textTool:"Отправить ссылку в Telegram",onClick:()=>null==a?void 0:a(`https://t.me/share/url?url=${encodeURIComponent(s||"")}`),isMobile:d}),r.jsx(bo,{icon:Me,iconColor:"#25D366",textTool:"Отправить ссылку в WhatsApp",onClick:()=>null==a?void 0:a(`https://api.whatsapp.com/send?text=${encodeURIComponent(s||"")}`),isMobile:d}),r.jsx(bo,{icon:Te,iconColor:"#EA4335",textTool:"Отправить ссылку по Email",onClick:()=>null==a?void 0:a(`mailto:?subject=${encodeURIComponent(g)}&body=${encodeURIComponent(s||"")}`),isMobile:d})]}),r.jsx(Ar,{fontSize:"0.75rem",color:"gray.400",textAlign:"center",pt:"2px",children:f})]})]})})]})]})}const fo=e=>{var r;return((null==(r=null==e?void 0:e.steps)?void 0:r.filter(e=>!e.isDeleted))||[]).some(e=>"step"===e.type&&e.s3Url||"video"===e.type&&e.videoUrl)},vo=(e,r)=>{var i,o;return{...e,...r,author:{...(null==e?void 0:e.author)||{},...(null==r?void 0:r.author)||{},License:(null==(i=null==r?void 0:r.author)?void 0:i.License)??(null==(o=null==e?void 0:e.author)?void 0:o.License)},folder:(null==r?void 0:r.folder)??(null==e?void 0:e.folder),isPublic:(null==r?void 0:r.isPublic)??(null==e?void 0:e.isPublic),seo:(null==r?void 0:r.seo)??(null==e?void 0:e.seo)}},jo=[{id:"emerald-sky",label:"Изумрудное небо",file:"/emerald-sky.mp3"},{id:"retreat-ambient",label:"Уединение",file:"/retreat-ambient.mp3"},{id:"sunny-day",label:"Солнечный день",file:"/sunny-day.mp3"},{id:"sunset-riders",label:"Всадники на закате",file:"/sunset-riders.mp3"},{id:"sunset-waves",label:"Волны на закате",file:"/sunset-waves.mp3"}],yo=[{id:"celestial-odyssey",label:"Звёздная одиссея",file:"/celestial-odyssey.mp3"},{id:"golden-summer",label:"Золотое лето",file:"/golden-summer.mp3"},{id:"moonlit-love",label:"Под луной",file:"/moonlit-love.mp3"},{id:"morning-festivity",label:"Утренний праздник",file:"/morning-festivity.mp3"},{id:"summer-groove",label:"Летний ритм",file:"/summer-groove.mp3"}],So=[...jo,...yo],wo=({tabs:e,activeTab:i,onChange:o,isMobile:n})=>r.jsx(Ne,{bg:"gray.100",p:"4px",borderRadius:"12px",spacing:"4px",w:"100%",boxShadow:"inset 0 0 5px rgba(0,0,0,0.08)",children:e.map(e=>r.jsx(Ir,{flex:"1",size:"sm",bg:i===e.id?"white":"transparent",color:i===e.id?"gray.900":"gray.500",fontWeight:"500",fontSize:n?".75rem":".875rem",borderRadius:"10px",border:i===e.id?"1px solid":"1px solid transparent",borderColor:i===e.id?"gray.200":"transparent",boxShadow:i===e.id?"0 1px 3px rgba(0,0,0,0.08)":"none",onClick:()=>o(e.id),_hover:{color:"gray.700"},transition:"all 0.2s ease",children:e.label},e.id))}),Co=({selectedAccess:i,onChange:o,canUseGlobal:n,globalDisabledReason:a,instruction:d,authorIsPro:p,onAuthorPlanUpgrade:x,authorPlanRequiredLabel:g,isMobile:b})=>{const[m,f]=e.useState(!1),v=[{value:"none",label:"Не опубликовано",icon:ur,color:"#F97316",description:"Документ не доступен для читателей в хранилище и не доступен по ссылке"},{value:"public",label:"Командный доступ",icon:Ce,color:"#3B82F6",description:"Документ доступен по прямой ссылке и в хранилище команды, Ð
6½Ð¾ не отображается в публичных папках для неавторизованных пользователей"},{value:"global",label:"Глобальный доступ",icon:xr,color:"#22C55E",disabled:!n,description:"Документ доступен по ссылке и в опубликованной папке с глобальным доступом для всех"}],j=v.find(e=>e.value===i),y=null==j?void 0:j.icon;return r.jsxs(t,{placement:"bottom-start",isOpen:m,onOpen:()=>f(!0),onClose:()=>f(!1),matchWidth:!0,w:"100%",strategy:"fixed",children:[r.jsx(s,{as:Ir,variant:"outline",px:b?"3px":"4px",pr:b?"0.75rem":"1rem",w:"100%",py:b?"0.75rem":"1rem",h:b?"42px":"46px",borderRadius:"99px",borderColor:"gray.200",bg:"white",boxShadow:"sm",rightIcon:r.jsx(l,{transform:m?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}),leftIcon:r.jsx(Er,{p:b?2:2.5,borderRadius:"99px",bg:`${null==j?void 0:j.color}25`,border:"1px solid",borderColor:`${null==j?void 0:j.color}50`,boxShadow:"sm",children:r.jsx(y,{size:b?"14px":"16px",color:null==j?void 0:j.color})}),_hover:{bg:"gray.50",borderColor:"gray.300"},_active:{bg:"gray.100"},transition:"all 0.15s ease",children:r.jsxs(Ve,{spacing:"2px",w:"100%",align:"start",children:[r.jsx(Ar,{w:"100%",align:"start",fontSize:b?".75rem":".875rem",fontWeight:"500",children:null==j?void 0:j.label}),r.jsx(Ar,{w:"100%",align:"start",fontSize:b?".65rem":".75rem",fontWeight:"400",color:"gray.500",maxW:b?"200px":"500px",overflowX:"hidden",textOverflow:"ellipsis",children:null==j?void 0:j.description})]})}),r.jsx(Pr,{children:r.jsxs(u,{borderRadius:"23px",py:"0",border:"1px solid",borderColor:"gray.200",minW:b?"280px":"200px",overflow:"hidden",zIndex:1500,position:"relative",children:[!p&&r.jsx(Er,{transform:"scale(1)",style:{opacity:1},position:"absolute",top:"143px",left:b?"160px":"200px",zIndex:2e3,children:r.jsx(Zr,{type:"PRO",onClick:x,tooltipLabel:g})}),v.map(e=>{const n=e.icon,t=i===e.value,s=r.jsx(h,{onClick:()=>{return r=e.value,void(e.disabled||(o(r),f(!1)));var r},isDisabled:e.disabled,py:b?"8px":"10px",px:b?"10px":"12px",borderRadius:"0",fontSize:b?".75rem":".875rem",transition:"all 0.15s ease",children:r.jsxs(Ne,{spacing:b?"8px":"10px",w:"100%",align:"center",children:[r.jsx(Er,{p:b?2:2.5,bg:`${e.color}25`,borderRadius:"99px",border:"1px solid",borderColor:`${null==e?void 0:e.color}50`,boxShadow:"sm",children:r.jsx(n,{size:b?"14px":"16px",color:e.color})}),r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ne,{children:r.jsx(Ar,{flex:"1",fontSize:b?".75rem":".875rem",fontWeight:"500",children:e.label})}),r.jsx(Ar,{flex:"1",fontSize:b?".65rem":".75rem",fontWeight:"400",maxW:b?"200px":"500px",color:"gray.500",children:e.description})]}),r.jsx(Er,{h:"100%",children:t&&r.jsx(c,{color:"black",boxSize:b?"10px":"12px"})})]})},e.value);if(e.disabled){const i="not_team_folder"===a?"Перенесите документ в командную папку хранилища, чтобы установить глобальный доступ":g||"Глобальный доступ доступен на тарифе PRO автора документа";return r.jsx(Mr,{label:i,hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",children:s},e.value)}return s})]})})]})},ko=({url:e,publicUrl:i=!0,onCopy:o,copied:n,isPublished:t,isMobile:s})=>r.jsxs(ke,{size:"md",boxShadow:"sm",borderRadius:"99px",children:[r.jsx(O,{value:e,isReadOnly:!0,bg:"gray.50",border:"1px solid",borderColor:"gray.200",borderRadius:"99px",fontSize:s?".75rem":".875rem",fontWeight:"500",h:s?"40px":"44px",color:"gray.500",pr:"120px",_focus:{borderColor:"gray.300"},transition:"all 0.2s ease",overflow:"hidden",noOfLines:1,textOverflow:"ellipsis",wordBreak:"break-all"}),i&&r.jsx(ze,{w:"auto",pr:s?"4px":"6px",h:"100%",children:r.jsx(Mr,{hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",label:"Просто скопировать ссылку",children:r.jsx(Ir,{size:"sm",h:s?"28px":"32px",px:s?"10px":"14px",color:"white",fontSize:s?".75rem":".875rem",fontWeight:"500",borderRadius:"99px",boxShadow:"base",leftIcon:n?r.jsx(c,{boxSize:s?"10px":"12px"}):r.jsx(Pe,{size:s?"12px":"14px"}),onClick:o,transition:"all 0.15s ease",bg:"#007AFF",_hover:{bg:"#005BBE"},_active:{bg:"#00428A",transform:"scale(0.98)"},children:n?"Готово":"Копировать"})})})]}),zo=({onClick:e,label:i="Копировать",successLabel:o="Скопировано",icon:n=Pe,isSuccess:a,isDisabled:d,isLoading:p,progress:x,hasDropdown:g,dropdownItems:b,isMobile:m,onDisabledClick:f})=>{const v=r.jsx(Ir,{onClick:e,variant:"outline",size:"sm",h:m?"28px":"32px",px:m?"10px":"14px",borderRadius:g?"99px 0px 0px 99px":"99px",fontWeight:"500",fontSize:m?".75rem":".875rem",borderColor:"gray.200",boxShadow:"sm",bg:"white",color:a?"#22C55E":"gray.700",isDisabled:d||p,pointerEvents:d&&f?"none":"auto",leftIcon:p?r.jsx(Or,{size:"xs"}):a?r.jsx(c,{boxSize:m?"10px":"12px",color:"#22C55E"}):r.jsx(n,{size:m?"12px":"14px"}),_hover:{bg:"gray.50",borderColor:"gray.300"},_active:{transform:"scale(0.98)"},_disabled:{opacity:.4,cursor:f?"pointer":"not-allowed",bg:"gray.50",borderColor:"gray.200",color:"gray.500"},transition:"all 0.15s ease",children:p?null!=x?`${x}%`:i:a?o:i}),j=d&&f?r.jsx(Er,{display:"inline-block",position:"relative",curs
6or:"pointer",onClick:f,children:v}):v;return g&&b?r.jsxs(Ne,{spacing:"0",children:[j,r.jsxs(t,{placement:"bottom-end",children:[r.jsx(s,{as:Dr,icon:r.jsx(l,{}),variant:"outline",size:"sm",h:m?"28px":"32px",w:m?"32px":"38px",boxShadow:"sm",borderLeft:"0",borderRadius:"0 99px 99px 0",borderColor:"gray.200",bg:"white",_hover:{bg:"gray.50",borderColor:"gray.300"},transition:"all 0.15s ease"}),r.jsx(u,{borderRadius:"12px",py:"0",border:"1px solid",borderColor:"gray.100",overflow:"hidden",children:b.map((e,i)=>r.jsx(h,{fontSize:m?".75rem":".875rem",onClick:e.onClick,py:m?"8px":"10px",_hover:{bg:"gray.100"},transition:"all 0.15s ease",children:e.label},i))})]})]}):j},Wo=({icon:e,iconBg:i="gray.100",iconColor:o="#6B7280",title:n,subtitle:t,badge:s,rightElement:l,isMobile:a})=>r.jsxs(Ne,{justify:"space-between",py:a?"10px":"12px",children:[r.jsxs(Ne,{spacing:a?"10px":"12px",children:[r.jsx(Er,{p:a?"8px":"10px",bg:"gray.100",border:"1px solid",borderColor:"gray.300",boxShadow:"sm",borderRadius:"99px",transition:"all 0.2s ease",children:r.jsx(e,{size:a?"18px":"20px",color:o})}),r.jsxs(Ve,{spacing:"2px",align:"start",children:[r.jsxs(Ne,{spacing:a?"6px":"8px",children:[r.jsx(Ar,{fontSize:a?".75rem":".875rem",fontWeight:"500",color:"gray.800",children:n}),s]}),t&&r.jsx(Ar,{fontSize:a?".65rem":".75rem",color:"gray.500",children:t})]})]}),r.jsx(Er,{w:"fit-content",children:l})]}),Ro=({icon:e,iconBg:i="gray.100",iconColor:o="#6B7280",title:n,subtitle:t,badge:s,clickOn:l,textTool:a,isMobile:d})=>r.jsx(Mr,{hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",label:a,children:r.jsx(F,{p:d?2.5:3,bg:"gray.100",borderRadius:"99px",transition:"all 0.2s ease",border:"1px solid",w:"fit-content",borderColor:"gray.300",onClick:l,boxShadow:"sm",_hover:{bg:"gray.200",transform:"scale(1.075)"},cursor:"pointer",_active:{bg:"gray.300",transform:"scale(0.98)"},children:r.jsx(e,{size:d?"18px":"20px",color:o})})}),Fo=({children:e,isActive:i})=>r.jsx(Er,{opacity:i?1:0,transform:i?"translateY(0)":"translateY(8px)",transition:"all 0.2s ease",display:i?"block":"none",children:e}),Io=i.memo(({isOpen:i,onClose:o,instruction:n,currentUser:a,companyData:d,license:g,isMobile:b,handlePublishModalAccessChange:m,handlePublishClick:f,handlePublishClickInteractive:v,handlePublishFrameClick:j,handlePublishVideoClick:S,handlePublishSlideshowClick:w,handleSeoChange:z,handleStartTest:W,generatePdf:O,generateDocx:B,toast:L,copyMarkdown:H,PublicSequencePageNew:U,hideDownloadForPublic:N,onInstructionRefresh:V,commentsForReaders:Y=!1,onCommentsForReadersChange:X=null})=>{var G,K,q,J,Q,Z,ee,re,ie,oe,ne,te,se,le,ae,de,ce;const[pe,xe]=e.useState("link"),[ue,he]=e.useState("none"),[ge,be]=e.useState(!1),[me,fe]=e.useState(!1),[ve,je]=e.useState(!1),[Ce,ke]=e.useState((null==(G=So[0])?void 0:G.id)||"emerald-sky"),[ze,We]=e.useState(!1),[Re,Fe]=e.useState(null),[Ie,Ae]=e.useState(!1),[De,Ee]=e.useState(null),[Oe,Pe]=e.useState(!1),[Le,He]=e.useState(!1),[Ue,Ge]=e.useState(!1),[Ke,qe]=e.useState(!1),[Je,Ze]=e.useState(!1),[er,rr]=e.useState(!1),[ir,nr]=e.useState(!1),tr=Tr({defaultIsOpen:!1}),[sr,dr]=e.useState(!1),[cr,xr]=e.useState(!1),[ur,hr]=e.useState(!1),br=Tr({defaultIsOpen:!1}),[mr,fr]=e.useState(!1),[vr,jr]=e.useState(!1),[yr,Sr]=e.useState(!1),[wr,Cr]=e.useState(!1),[kr,zr]=e.useState(0),[Wr,Rr]=e.useState(!1),[Fr,_r]=e.useState(0),[$r,Br]=e.useState(null),Lr=Tr({defaultIsOpen:!1}),[Hr,Ur]=e.useState("loading"),[Nr,Vr]=e.useState(""),[qr,ni]=e.useState([]),[ti,si]=e.useState(""),[li,ai]=e.useState(""),[di,ci]=e.useState([]),[pi,gi]=e.useState(!1),[bi,mi]=e.useState(!1),[fi,vi]=e.useState(null),[ji,yi]=e.useState(null),[Si,wi]=e.useState(null),{openLicenseModal:Ci}=p();e.useEffect(()=>{i&&(null==n?void 0:n.id)&&R("openedDocumentShareMenu",n.instructionType).finally(()=>window.dispatchEvent(new Event("workspace:onboarding:share-menu-opened")))},[i,null==n?void 0:n.id,null==n?void 0:n.instructionType]),e.useEffect(()=>{},[]);const ki="REGULATION"===(null==(K=Re??n)?void 0:K.instructionType);e.useEffect(()=>{if(!i)return;let e=!1;return Ur("loading"),vi(null),wi(null),I().then(r=>{if(e)return;const i=r.find(e=>"confluence"===e.provider);Ur(i?"connected":"disconnected"),Vr((null==i?void 0:i.displayName)||"")}).catch(()=>{e||Ur("disconnected")}),yi(null),(null==n?void 0:n.id)&&A(n.id).then(r=>{e||yi(r.find(e=>"confluence"===e.provider)||null)}
6).catch(()=>{}),()=>{e=!0}},[i,null==n?void 0:n.id]),e.useEffect(()=>{if("connected"!==Hr||!qi)return;let e=!1;return D().then(r=>{e||ni(r.spaces||[])}).catch(r=>{e||wi(r.message)}),()=>{e=!0}},[Hr]),e.useEffect(()=>{if(ti||!qr.length)return;const e=ji&&qr.find(e=>String(e.id)===String(ji.containerId)),r=Do(),i=r&&qr.find(e=>e.key===r.spaceKey);si((e||i||qr[0]).key)},[qr,ji,ti]),e.useEffect(()=>{if(!ti||!Lr.isOpen||!qi)return;let e=!1;gi(!0);const r=qr.find(e=>e.key===ti);return E((null==r?void 0:r.id)||ti).then(r=>{if(e)return;ci(r);const i=Do();i&&i.spaceKey===ti&&i.parentPageId&&r.some(e=>String(e.id)===String(i.parentPageId))&&ai(String(i.parentPageId))}).catch(()=>{e||ci([])}).finally(()=>{e||gi(!1)}),()=>{e=!0}},[ti,qr,Lr.isOpen]);const zi=["REGULATION","INSTRUCTION"].includes(null==(q=Re??n)?void 0:q.instructionType),Wi=N&&ki,Ri="none"!==ue,Fi=Re??n,Ii=null==(J=null==Fi?void 0:Fi.author)?void 0:J.License,Ai=null==(Q=null==Fi?void 0:Fi.author)?void 0:Q.id,Di=null==Ai||Number(Ai)===Number(null==a?void 0:a.id),Ei=null!=Ai&&Number(Ai)!==Number(null==a?void 0:a.id),_i=Ii??(Di?g:null),Mi=null==_i?void 0:_i.type,Ti="START"===Mi||"BASIC"===Mi||"PRO"===Mi,Oi="BASIC"===Mi||"PRO"===Mi,Pi=!(!(null==_i?void 0:_i.createdAt)||!(null==_i?void 0:_i.expiresAt)),$i=Pi?(new Date(_i.expiresAt)-new Date(_i.createdAt))/864e5:null,Bi=Pi&&null!=$i&&$i<=7,Li=!!_i&&Ti&&!Bi,Hi=!!_i&&Oi&&!Bi,Ui=Hi,Ni=Hi&&!ki,Vi="PRO"===Mi&&null!=(null==_i?void 0:_i.expiresAt)&&Pi&&null!=$i&&$i<=7,Yi=!Li,Xi=!Hi;null==Re||Re.folderId;const Gi=!(!(null==Re?void 0:Re.folder)||!1!==Re.folder.isPersonal),Ki="PRO"===Mi,qi=!!_i&&Ki&&!Bi,Ji=Ki,Qi="PRO"===(Number(null==d?void 0:d.userCreator)===Number(null==a?void 0:a.id)?(null==g?void 0:g.type)??(null==(ee=null==(Z=null==d?void 0:d.creator)?void 0:Z.License)?void 0:ee.type):(null==(ne=null==(oe=null==(ie=null==(re=null==Fi?void 0:Fi.folder)?void 0:re.company)?void 0:ie.creator)?void 0:oe.License)?void 0:ne.type)??(null==(se=null==(te=null==d?void 0:d.creator)?void 0:te.License)?void 0:se.type)),Zi=Ki&&Gi,eo=(null==(le=null==Fi?void 0:Fi.author)?void 0:le.name)||(null==(ae=null==Fi?void 0:Fi.author)?void 0:ae.email)||null,ro=Ei?void 0:Ci,io=e=>Ei?`Чтобы снять ограничение, нужен тариф ${e} у автора документа${eo?` (${eo})`:""}`:`Доступно на тарифе ${e} автора документа`,oo=e=>ro?`${io(e)}. Нажмите, чтобы оформить подписку`:io(e),no=e=>r.jsx(Zr,{type:e,onClick:ro,tooltipLabel:oo(e)}),to=Ei?"Экспорт доступен на платном тарифе автора документа":"Экспорт доступен по подписке на месяц/год",so="Полный функционал экспорта доступен на платном тарифе BASIC или PRO",lo=io("PRO"),ao="Индексация доступна на тарифе PRO владельца команды",co=fo(Fi);e.useEffect(()=>{if(!i||!n)return void(i||(Fe(null),Ae(!1),Ee(null),Pe(!1)));const e=e=>{if(null==e?void 0:e.isPublic){const r="none"===e.isPublic?"none":"public"===e.isPublic?"public":"global";he(r)}null!=(null==e?void 0:e.seo)&&We(e.seo),Fe(e)};if(!n.uuid)return e(n),void Ae(!1);if(fo(n)&&"REGULATION"!==n.instructionType)return e(n),void Ae(!1);let r=!1;Ae(!0),e(n);const o=e=>{Ee(e||null),X||Pe(oi(null==e?void 0:e.content))};return(async()=>{try{const{instruction:i,page:t}=await _(n.uuid);if(r)return;return e(vo(n,i)),void o(t)}catch(i){}try{const i=await T(n.uuid);if(r)return;e(vo(n,i)),o(null==i?void 0:i.publicPage)}catch(t){}})().finally(()=>{r||Ae(!1)}),()=>{r=!0}},[i,n,X]),e.useEffect(()=>{i&&X&&Pe(Boolean(Y))},[i,Y,X]);const uo=e.useCallback(async e=>{if(!Ji)return void(null==ro||ro());const r=Oe;Pe(e),He(!0);try{if(X)return void(await X(e));if(!(null==n?void 0:n.uuid))throw new Error("public page not found");const r=await _(n.uuid,!0),i=null==r?void 0:r.page;if(Ee(i||null),!(null==i?void 0:i.id))throw new Error("public page not found");const o=ei(i.content||{type:"doc",content:[]},{...ri(i.content),commentsForReaders:e}),t=ii(i.bgConfig,e);await M(i.id,o,t,i.allowComments),Ee({...i,content:o,bgConfig:t})}catch{Pe(r),L({title:"Не удалось сохранить настройку обсуждений",status:"error",duration:3e3})}finally{He(!1)}},[Oe,null==n?void 0:n.uuid,Ji,ro,X,L]),ho=()=>{"none"===ue&&(he("public"),m("public"))},go=async()=>{ho(),await f(),Ge(!0),setTimeout(()=>Ge(!1),2e3)},bo=e.useCallback(()=>{const e=po(Fi);nr(!0),or(e).then(e=>{L(e?{title:"Инструкция скопирована в буфер",status:"success",duration:1500,isClosable:!0}:{title:"Не удалось скопировать",description:"Браузер запретил доступ к буферу обмена.",status:"error",duration:2500,isClosable:!0})}),setTimeout(()=>nr(!1),2e3)},[Fi,L]),Io=e.useCallback(()=>{const e=xo(Fi);rr(!0),or(e).then(e=>{L(e?{title:"Инструкция скопирована в буфер",status:"success",duration:1500,isClosable:!0}:{title:"Не удалось скопировать",description:"Браузер запретил доступ к буферу обмена.",status:"error",duration:2500,isClosable:!0})}),setTimeout(()=>rr(!1),2e3)},[Fi,L]),_o=()=>ki?`https://steppo.ru/p/public-page/${null==n?void 0:n.uuid}`:`https://steppo.ru/public/${null==n?void 0:n.uuid}`,Mo=e.useCallback(()=>{const e=null==n?void 0:n.uuid;if(!e)return"https://steppo.ru/embed/";const r=`https://steppo.ru/embed/${e}`,i=new URLSearchParams;ge&&i.set("autoPlay","1"),me&&i.set("theme","dark"),ve&&(i.set("accompaniment","1"),Ce&&i.set("accompanimentTrack",Ce));const o=i.toString();return o?`${r}?${o}`:r},[null==n?void 0:n.uuid,ge,me,ve,Ce]);return r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{isOpen:i,onClose:o,isCentered:!0,scrollBehavior:"inside",motionPreset:"slideInBottom",children:[r.jsx(Xr,{backdropFilter:"blur(12px)",pointerEvents:"auto"}),r.jsxs(Gr,{"data-mobile-fullscreen-modal":"true",borderRadius:"1rem",minW:b?"auto":"800px",maxW:b?"100vw":"800px",w:b?"100vw":"auto",m:b?"1rem":"auto",maxH:"calc(100dvh - 2rem)",display:"flex",flexDirection:"column",pointerEvents:"auto",children:[r.jsx(Qr,{children:r.jsx(Ar,{fontSize:b?"1.125rem":"1.25rem",fontWeight:"600",children:"Поделиться документом"})}),r.jsx(Kr,{borderRadius:"full",_hover:{bg:"gray.100"},transition:"all 0.15s ease"}),r.jsx(Jr,{flex:"1",minH:"0",overflowY:"auto",overscrollBehavior:"contain",pb:b?"0":"1rem",children:r.jsxs(Ve,{spacing:b?"16px":"20px",align:"stretch",mb:"1rem",children:[r.jsx(wo,{tabs:[{id:"link",label:"Поделиться"},{id:"embed",label:"Встроить"}
6],activeTab:pe,onChange:xe,isMobile:b}),r.jsx(Fo,{isActive:"link"===pe,children:r.jsxs(Ve,{px:b?"0":"0.5rem",spacing:b?"0.75rem":"0.5rem",align:"stretch",children:[r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:b?".875rem":"1rem",fontWeight:"700",color:"gray.700",children:"Настройки доступа"}),r.jsx(Ar,{fontSize:b?".75rem":".875rem",color:"gray.500",children:"Измените уровень доступа и поделитесь обновляемым документом"})]}),r.jsxs(Ne,{w:"100%",children:[r.jsx(Co,{selectedAccess:ue,onChange:e=>{("global"!==e||Zi)&&(he(e),m(e),"global"!==e&&ze&&(We(!1),z({target:{checked:!1}})))},canUseGlobal:Zi,globalDisabledReason:Ki?Gi?null:"not_team_folder":"no_pro",instruction:n,authorIsPro:Ki,onAuthorPlanUpgrade:ro,authorPlanRequiredLabel:io("PRO"),isMobile:b}),r.jsxs(Ne,{w:"fit-content",children:[r.jsx(Ro,{icon:_e,iconBg:"blue.50",iconColor:"#0088cc",title:"Telegram",textTool:"Отправить ссылку в Telegram",clickOn:()=>window.open(`https://t.me/share/url?url=${_o()}`,"_blank"),isMobile:b}),!b&&r.jsx(Ro,{icon:Me,iconBg:"green.50",iconColor:"#25D366",title:"WhatsApp",textTool:"Отправить ссылку в WhatsApp",clickOn:()=>window.open(`https://api.whatsapp.com/send?text=${_o()}`,"_blank"),isMobile:b}),r.jsx(Ro,{icon:Te,iconBg:"red.50",iconColor:"#EA4335",title:"Email",textTool:"Отправить ссылку по Email",clickOn:()=>window.open(`mailto:?subject=${null==n?void 0:n.title}&body=${_o()}`,"_blank"),isMobile:b})]})]}),r.jsx(ko,{url:_o(),onCopy:go,copied:Ue,isPublished:Ri,isMobile:b}),!ki&&r.jsx(r.Fragment,{children:r.jsx(Wo,{icon:lr,iconBg:"purple.50",iconColor:"#7C3AED",title:"Режим презентации",subtitle:"Каждый шаг – отдельный экран, позволяет повысить погруженность читателя во время ознакомления с документом",rightElement:r.jsx(zo,{onClick:async()=>{ho(),await v(),qe(!0),setTimeout(()=>qe(!1),2e3)},isSuccess:Ke,isMobile:b}),isMobile:b})}),r.jsx(Wo,{icon:gr,title:"Индексация",subtitle:Qi?Gi?"Документ будет доступен в поиске Google, Yandex и других поисковых системах":"Глобальный доступ и индексация доступны для документов в командных папках хранилища":ao,iconColor:"green",badge:Qi?null:r.jsx(Zr,{type:"PRO",tooltipLabel:ao}),rightElement:r.jsx(Mr,{isDisabled:Qi&&Gi&&"global"===ue,label:Qi?Gi?"global"!==ue?"Чтобы включить индексацию, назначьте документу глобальный доступ":"":"Чтобы включить индексацию, перенесите документ в командную папку хранилища":ao,hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",children:r.jsx(Er,{children:r.jsx(x,{colorScheme:"purple",size:b?"md":"lg",isChecked:ze,onChange:e=>{We(e.target.checked),z(e)},isDisabled:!Qi||!Gi||"global"!==ue})})}),isMobile:b}),zi&&r.jsx(Wo,{icon:pr,iconBg:"purple.50",iconColor:"#7C3AED",title:"Обсуждения для читателей",subtitle:Ji?ki?"Читатели документа видят обсуждения у блоков и выделений и могут отвечать на них":"Читатели инструкции видят обсуждения у шагов и могут отвечать на них":lo,badge:Ji?null:r.jsx(Zr,{type:"PRO",onClick:ro,tooltipLabel:lo}),rightElement:r.jsx(Mr,{isDisabled:Ji,label:lo,hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",children:r.jsx(Er,{children:r.jsx(x,{colorScheme:"purple",size:b?"md":"lg",isChecked:Oe,onChange:e=>{uo(e.target.checked)},isDisabled:!Ji||Le})})}),isMobile:b}),!Wi&&r.jsxs(Ve,{spacing:b?"0.75rem":"0.5rem",align:"stretch",children:[r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:b?".875rem":"1rem",fontWeight:"700",color:"gray.700",children:"Скачать док
6умент"}),r.jsx(Ar,{fontSize:b?".75rem":".875rem",color:"gray.500",children:"Экспортированные файлы не обновляются автоматически"})]}),!ki&&r.jsxs(r.Fragment,{children:[r.jsx(Wo,{icon:Qe,iconBg:"red.50",iconColor:"#DC2626",title:"Экспорт в PDF",subtitle:Bi?to:"Для быстрой печати",badge:Yi?no("START"):null,rightElement:r.jsxs(Ne,{spacing:2,children:[r.jsx(Mr,{label:Ui?tr.isOpen?"Скрыть настройки":"Настройки экспорта":io("BASIC"),hasArrow:!0,openDelay:250,borderRadius:"12px",px:"12px",py:"8px",children:r.jsxs(Er,{position:"relative",display:"inline-block",children:[r.jsx(Dr,{"aria-label":"Настройки PDF",icon:r.jsx(y,{size:18}),size:"sm",variant:"ghost",colorScheme:"gray",borderRadius:"99px",isDisabled:!Ui,onClick:tr.onToggle,isActive:tr.isOpen}),!Ui&&ro&&r.jsx(Er,{position:"absolute",top:0,left:0,right:0,bottom:0,cursor:"pointer",onClick:ro,zIndex:1})]})}),r.jsx(zo,{onClick:async()=>{Cr(!0),zr(0);try{await O(null==n?void 0:n.uuid,e=>zr(e),{noMeta:!!Ui&&sr,scaleImages:!!Ui&&cr,includeTranscript:!!Ui&&ur}),Br("pdf")}catch(e){L({title:e.message,status:"error"})}finally{Cr(!1)}},label:"Скачать",successLabel:"Готово",icon:$e,isLoading:wr,progress:kr,isDisabled:!Li,onDisabledClick:ro,isMobile:b})]}),isMobile:b}),r.jsx(xi,{in:tr.isOpen,animateOpacity:!0,children:r.jsx(Er,{w:"100%",mt:2,mb:2,borderRadius:"12px",border:"1px solid",borderColor:"gray.200",p:3,bg:"gray.50",boxShadow:"sm",children:r.jsxs(Ve,{w:"100%",align:"stretch",spacing:3,children:[r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Без метаинформации"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:sr,onChange:e=>dr(e.target.checked)})]}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:"Только наÐ
6·Ð²Ð°Ð½Ð¸Ðµ, описание и шаги (без даты создания и ссылки)"})]}),r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Масштабировать изображения"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:cr,onChange:e=>xr(e.target.checked)})]}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:"Ограничивать размер изображений с целью клика, как в шагах"})]}),r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Транскрипт аудио"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:ur,onChange:e=>hr(e.target.checked)})]}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:"Добавлять расшифровку голосовых заметок под шаÐ
6³Ð°Ð¼Ð¸"})]})]})})})]}),r.jsx(Wo,{icon:ar,iconBg:"blue.50",iconColor:"#2563EB",title:"Экспорт в Microsoft Word",subtitle:Bi?to:"Чтобы продолжить редактирование",badge:Xi?no("BASIC"):null,rightElement:r.jsxs(Ne,{spacing:2,children:[!ki&&r.jsx(Mr,{label:Ni?br.isOpen?"Скрыть настройки":"Настройки экспорта":io("BASIC"),hasArrow:!0,openDelay:250,borderRadius:"12px",px:"12px",py:"8px",children:r.jsxs(Er,{position:"relative",display:"inline-block",children:[r.jsx(Dr,{"aria-label":"Настройки Word",icon:r.jsx(y,{size:18}),size:"sm",variant:"ghost",colorScheme:"gray",borderRadius:"99px",isDisabled:!Ni,onClick:br.onToggle,isActive:br.isOpen}),!Ni&&ro&&r.jsx(Er,{position:"absolute",top:0,left:0,right:0,bottom:0,cursor:"pointer",onClick:ro,zIndex:1})]})}),r.jsx(zo,{onClick:async()=>{Rr(!0),_r(0);try{await B(null==n?void 0:n.uuid,e=>_r(e),{scaleImages:!!Ni&&mr,pageBreaks:!!Ni&&vr,includeTranscript:!!Ni&&yr}),Br("docx")}catch(e){L({title:e.message,status:"error"})}finally{Rr(!1)}},label:"Скачать",successLabel:"Готово",icon:$e,isLoading:Wr,progress:Fr,isDisabled:!Hi,onDisabledClick:ro,isMobile:b})]}),isMobile:b}),!ki&&r.jsx(xi,{in:br.isOpen,animateOpacity:!0,children:r.jsx(Er,{w:"100%",mt:2,mb:2,borderRadius:"12px",border:"1px solid",borderColor:"gray.200",p:3,bg:"gray.50",boxShadow:"sm",children:r.jsxs(Ve,{w:"100%",align:"stretch",spacing:3,children:[r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Приблизить к цели клика"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:mr,onChange:e=>fr(e.target.checked)})]}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:"Кадрировать скриншот вокруг точки клика, как в шагах"})]}),r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Каждый шаг с новой страницы"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:vr,onChange:e=>jr(e.target.checked)})]}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:"Разрыв страницы между шагами — удобно для печати"})]}),r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Транскрипт аудио"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:yr,onChange:e=>Sr(e.target.checked)})]}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:"Добавлять расшифровку голосовых заметок под шаÐ
6³Ð°Ð¼Ð¸"})]})]})})}),!Ei&&!(null==g?void 0:g.isProTested)&&"FREE"===(null==g?void 0:g.type)&&r.jsx(F,{children:r.jsxs(Ir,{fontSize:b?".75rem":".825rem",fontWeight:"400",color:"gray.700",bgColor:"rgba(255,255,255,.6)",boxShadow:"sm",border:"1px",colorScheme:"whiteAlpha",borderColor:"rgba(0,0,0,.15)",textAlign:"center",px:b?"8px":"10px",h:b?"28px":"30px",w:"fit-content",borderRadius:"8px",overflow:"hidden",onClick:()=>W(a.id),position:"relative",leftIcon:r.jsx(C,{color:"purple",fontSize:b?".875rem":"1rem"}),_hover:{textDecoration:"none",bgColor:"rgba(255,255,255,.8)",transform:"scale(1.07) rotate(-0.8deg)",boxShadow:"lg"},transition:".2s cubic-bezier(0.73, -0.6, 0.55, 1.65)",children:["Получить ",r.jsx("b",{style:{padding:b?2:3},children:" Steppo PRO "})," на 7 дней бесплатно"]})})]}),!Wi&&r.jsxs(Ve,{spacing:b?"0.75rem":"0.5rem",align:"stretch",children:[r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:b?".875rem":"1rem",fontWeight:"700",color:"gray.700",children:"Интеграции"}),r.jsx(Ar,{fontSize:b?".75rem":".875rem",color:"gray.500",children:"Связать текущий документ с документом во внешней платформе"})]}),r.jsx(Wo,{icon:Se,iconBg:"blue.50",iconColor:"#1868DB",title:"Экспорт в Confluence",subtitle:"disconnected"===Hr?"Подключите аккаунт Atlassian, чтобы создавать страницы в Confluence":"Создать страницу на основе текущего документа",badge:qi?null:no("PRO"),rightElement:"connected"===Hr?r.jsxs(Ne,{spacing:2,children:[r.jsx(Mr,{label:qi?Lr.isOpen?"Скрыть настройки":"Куда экспортировать":io("PRO"),hasArrow:!0,openDelay:250,borderRadius:"12px",px:"12px",py:"8px",children:r.jsxs(Er,{position:"relative",display:"inline-block",children:[r.jsx(Dr,{"aria-label":"Настройки экспорта в Confluence",icon:r.
6jsx(y,{size:18}),size:"sm",variant:"ghost",colorScheme:"gray",borderRadius:"99px",isDisabled:!qi,onClick:Lr.onToggle,isActive:Lr.isOpen}),!qi&&ro&&r.jsx(Er,{position:"absolute",top:0,left:0,right:0,bottom:0,cursor:"pointer",onClick:ro,zIndex:1})]})}),r.jsx(Mr,{label:qi?ji?"Связанная страница будет обновлена":"Будет создана новая страница":io("PRO"),hasArrow:!0,openDelay:250,borderRadius:"12px",px:"12px",py:"8px",children:r.jsx(Er,{display:"inline-block",children:r.jsx(zo,{onClick:async()=>{var e;if(!qi)return null==ro?void 0:ro();if(!bi&&(null==n?void 0:n.id))if(ti||ji){mi(!0),wi(null),vi(null);try{const r=qr.find(e=>e.key===ti),i=await P({instructionId:n.id,spaceId:null==r?void 0:r.id,spaceKey:ti||void 0,spaceName:null==r?void 0:r.name,parentPageId:li||void 0}),o="updated"===i.mode;(null==(e=i.uploadErrors)?void 0:e.length)?L({title:o?"Страница обновлена, но не все скриншоты загрузились":"Страница создана, но не все скриншоты загрузились",description:i.uploadErrors.join("; "),status:"warning",duration:6e3,isClosable:!0}):L({title:o?"Связанная страница обновлена":"Опубликовано в Confluence",status:"success",duration:3e3,isClosable:!0}),vi(i.pageUrl),i.link&&yi(i.link),function(e){try{localStorage.setItem(Ao,JSON.stringify(e))}catch{}}({spaceKey:ti,spaceId:null==r?void 0:r.id,spaceName:null==r?void 0:r.name,parentPageId:li||null})}catch(r){wi(r.message||"Не удалось опубликовать в Confluence")}finally{mi(!1)}}else Lr.onOpen()},label:"Экспорт",successLabel:"Готово",icon:Se,isLoading:bi,isDisabled:!qi,onDisabledClick:ro,isMobile:b})})})]}):"disconnected"===Hr?r.jsx(zo,{onClick:async()=>{if(!qi)return null==ro?void 0:ro();try{const e=await $();window.location.href=e}catch(e){L({title:e.message||"Не удалось начать подключение Confluence",status:"error",duration:4e3,isClosable:!0})}},label:"Подключить",icon:Se,isDisabled:!qi,onDisabledClick:ro,isMobile:b}):r.jsx(Or,{size:"sm",color:"#4F378A"}),isMobile:b}),"connected"===Hr&&r.jsx(xi,{in:Lr.isOpen,animateOpacity:!0,children:r.jsx(Er,{w:"100%",mt:2,mb:2,borderRadius:"12px",border:"1px solid",borderColor:"gray.200",p:3,bg:"gray.50",boxShadow:"sm",children:r.jsxs(Ve,{w:"100%",align:"stretch",spacing:3,children:[Nr&&r.jsx(Ar,{fontSize:"xs",color:"gray.500",children:Eo(Nr)}),r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Пространство"}),r.jsx($o,{spaces:qr,value:ti,onChange:e=>{si(e),ai("")},isLoading:!qr.length,lastSpace:Do()})]}),r.jsxs(Ve,{w:"100%",align:"stretch",spacing:1,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Родительская страница"}),r.jsx(Uo,{pages:di,value:li,onChange:ai,isLoading:pi})]}),Si&&r.jsx(Ar,{fontSize:"xs",color:"red.500",children:Si}),(fi||(null==ji?void 0:ji.externalUrl))&&r.jsx(Ye,{href:fi||ji.externalUrl,isExternal:!0,fontSize:"xs",color:"#4F378A",fontWeight:"500",children:(null==ji?void 0:ji.title)?`Связанная страница: ${ji.title} →`:"Открыть созданную страницу в Confluence →"})]})})})]}),Wi&&r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:b?".875rem":"1rem",fontWeight:"700",color:"gray.700",children:"Документ можно скачать в формате Microsoft Word"}),r.jsx(Ar,{fontSize:b?".75rem":".875rem",color:"gray.500",children:"Чтобы скачать данный документ, необходимо его открыть и перейти в меню Поделиться"})]}),Vi&&!Wi&&r.jsx(Er,{pt:1,pb:1,children:r.jsxs(Ne,{justify:"space-between",align:"center",py:"6px",pr:"6px",pl:5,borderRadius:"99px",bg:"orange.50",border:"1px solid",borderColor:"orange.200",boxShadow:"sm",children:[r.jsx(Ar,{fontSize:b?".8rem":".875rem",color:"orange.700",fontWeight:"600",children:so}),r.jsx(Ir,{size:"sm",variant:"solid",leftIcon:r.jsx(k,{fontSize:"1rem",color:"#ED8936"}),colorScheme:"orange",onClick:Ci,fontWeight:"500",borderRadius:"99px",borderColor:"orange.300",boxShadow:"sm",children:"Купить"})]})})]})}),r.jsx(Fo,{isActive:"embed"===pe,children:r.jsxs(Ve,{px:b?"0":"0.5rem",spacing:b?"0.75rem":"0.5rem",align:"stretch",children:[r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:b?".875rem":"1rem",fontWeight:"700",color:"gray.700",children:"Встроить на другом сайте"}),r.jsx(Ar,{fontSize:b?".75rem":".875rem",color:"gray.500",children:"Вставьте код на страницу для отображения документа"})]}),r.jsx(Wo,{icon:Be,title:"iframe код",subtitle:"Виджет, втсроенный напрямую в ваши любимые приложения",iconColor:"blue",rightElement:r.jsx(zo,{onClick:async()=>{ho(),await j(),Ze(!0),setTimeout(()=>Ze(!1),2e3)},isSuccess:Je,hasDropdown:!ki,dropdownItems:[{label:"Встроить демо с автопроигрыванием",onClick:()=>{ho(),S(Mo()),Ze(!0),setTimeout(()=>Ze(!1),2e3)}},{label:"Встроить живое демо",onClick:()=>{ho(),w(Mo()),Ze(!0),setTimeout(()=>Ze(!1),2e3)}}],isMobile:b}),isMobile:b}),!ki&&r.jsx(r.Fragment,{children:r.jsx(Wo,{icon:Xe,title:"Markdown",subtitle:Bi?to:"Отлично работает с Notion, GitHub и другими приложениями",iconColor:"#353636",badge:Xi?no("BASIC"):null,rightElement:r.jsx(zo,{onClick:Io,isSuccess:er,isDisabled:!Hi,onDisabledClick:ro,isMobile:b}),isMobile:b})}),!ki&&r.jsxs(r.Fragment,{children:[r.jsx(Wo,{icon:we,title:"HTML",subtitle:Bi?to:"Отлично работает с Microsoft Word, Google Docs и другими приложениями",iconColor:"#29a7df",badge:Xi?no("BASIC"):null,rightElement:r.jsx(zo,{onClick:bo,isSuccess:ir,isDisabled:!Hi,onDisabledClick:ro,isMobile:b}),isMobile:b}),Vi&&r.jsx(Er,{pt:1,pb:1,children:r.jsxs(Ne,{justify:"space-between",align:"center",py:"6px",pr:"6px",pl:5,borderRadius:"99px",bg:"orange.50",border:"1px solid",borderColor:"orange.200",boxShadow:"sm",children:[r.jsx(Ar,{fontSize:b?".8rem":".875rem",color:"orange.700",fontWeight:"600",children:so}),r.jsx(Ir,{size:"sm",leftIcon:r.jsx(k,{fontSize:"1rem",color:"#ED8936"}),variant:"solid",colorScheme:"orange",onClick:Ci,fontWeight:"500",borderRadius:"99px",borderColor:"orange.300",boxShadow:"sm",children:"Купить"})]})}),!b&&r.jsx(ye,{borderColor:"gray.100"})]}),!ki&&!b&&r.jsxs(Ve,{w:"100%",spacing:3,children:[r.jsxs(Ve,{w:"100%",align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:b?".875rem":"1rem",fontWeight:"700",color:"gray.700",children:"Пример встраивания живого демо"}),r.jsx(Ar,{fontSize:b?".75rem":".875rem",color:"gray.500",children:"Ссылка с учётом настроек видео (можно скопировать)"})]}),r.jsx(Er,{w:"100%",borderRadius:"12px",border:"1px solid",borderColor:"gray.200",p:3,bg:"gray.50",boxShadow:"sm",children:r.jsxs(Ve,{w:"100%",align:"stretch",spacing:3,children:[r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Автопроигрывание"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:ge,onChange:e=>be(e.target.checked)})]}),r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Тёмная тема"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:me,onChange:e=>fe(e.target.checked)})]}),r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Фоновая музыка"}),r.jsx(x,{colorScheme:"purple",size:"sm",isChecked:ve,onChange:e=>je(e.target.checked)})]}),ve&&r.jsxs(Ne,{justify:"space-between",align:"center",w:"100%",pt:1,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",color:"gray.700",children:"Композиция"}),r.jsxs(t,{placement:"bottom-end",children:[r.jsx(s,{as:Ir,size:"sm",rightIcon:r.jsx(l,{}),variant:"outline",borderRadius:"99px",borderColor:"gray.200",bg
6:"white",boxShadow:"sm",fontWeight:"500",fontSize:".875rem",children:(null==(de=So.find(e=>e.id===Ce))?void 0:de.label)||Ce}),r.jsx(Pr,{children:r.jsxs(u,{borderRadius:"16px",py:"0",border:"1px solid",borderColor:"gray.200",minW:"160px",overflow:"hidden",zIndex:1500,children:[r.jsx(ui,{title:"Спокойные",children:jo.map(e=>r.jsx(h,{onClick:()=>ke(e.id),py:"8px",px:"12px",fontSize:".875rem",transition:"all 0.15s ease",children:r.jsxs(Ne,{w:"100%",justify:"space-between",children:[r.jsx(Ar,{fontWeight:"500",children:e.label}),Ce===e.id&&r.jsx(c,{color:"black",boxSize:"12px"})]})},e.id))}),r.jsx(hi,{}),r.jsx(ui,{title:"Энергичные",children:yo.map(e=>r.jsx(h,{onClick:()=>ke(e.id),py:"8px",px:"12px",fontSize:".875rem",transition:"all 0.15s ease",children:r.jsxs(Ne,{w:"100%",justify:"space-between",children:[r.jsx(Ar,{fontWeight:"500",children:e.label}),Ce===e.id&&r.jsx(c,{color:"black",boxSize:"12px"})]})},e.id))})]})})]})]})]})}),r.jsx(ko,{url:Mo(),onCopy:()=>{or(Mo()),L({title:"Ссылка скопирована",status:"success",duration:2e3})}}),r.jsx(Er,{overflow:"hidden",h:"100%",w:"100%",boxShadow:"sm",children:Ie||!co?r.jsx(F,{h:"280px",w:"100%",children:r.jsx(Or,{size:"md",color:"gray.400"})}):"embed"===pe?r.jsx(U,{instruction:Fi,uuid:null==Fi?void 0:Fi.uuid,autoPlayEnabled:ge,themeDark:me,accompanimentEnabled:ve,accompanimentTrack:Ce,embedded:!0,previewVisible:"embed"===pe,fetchExpandedForPreview:!1},`${null==Fi?void 0:Fi.uuid}-${(null==(ce=null==Fi?void 0:Fi.steps)?void 0:ce.length)||0}-${ge}-${me}-${ve}-${Ce}`):r.jsx(F,{h:"280px",w:"100%",bg:"gray.50",borderRadius:"8px"})})]})]})})]})})]})]}),r.jsx(mo,{isOpen:null!==$r,onClose:()=>Br(null),format:$r??"pdf",instruction:Fi,publicUrl:_o(),onCopyLink:go,onShareVia:e=>{ho(),window.open(e,"_blank","noopener,noreferrer")},isMobile:b})]})}),Ao="steppo:confluence:lastExport";function Do(){try{const e=localStorage.getItem(Ao);return e?JSON.parse(e):null}catch{return null}}function Eo(e=""){return e.charAt(0).toUpperCase()+e.slice(1)}const _o=["#0C66E4","#22A06B","#CA3521","#F5990C","#8270DB","#1D7AFC","#BF63F3","#0B8A9F","#C9372C","#5E6DC2"];function Mo(e=""){let r=0;for(let i=0;i<e.length;i++)r=31*r+e.charCodeAt(i)>>>0;return _o[r%_o.length]}function To({icon:i,name:o,size:n="20px"}){const[t,s]=e.useState(!1),l=(o||"?").trim().charAt(0).toUpperCase();return(null==i?void 0:i.url)&&!t?r.jsx(mi,{src:i.url,alt:o||"",boxSize:n,borderRadius:"4px",objectFit:"cover",onError:()=>s(!0)}):r.jsx(We,{boxSize:n,borderRadius:"4px",bg:Mo(o),color:"white",align:"center",justify:"center",fontSize:".6875rem",fontWeight:"700",flexShrink:0,children:l})}const Oo=49;function Po({space:e,isSelected:i,onSelect:o}){return r.jsx(h,{borderRadius:"8px",h:"100%",closeOnSelect:!0,onClick:o,children:r.jsxs(Ne,{spacing:"8px",w:"100%",children:[r.jsx(To,{icon:e.icon,name:e.name}),r.jsxs(Er,{minW:"0",children:[r.jsx(Ar,{fontSize:".8125rem",isTruncated:!0,children:e.name}),r.jsxs(Ar,{fontSize:".6875rem",color:"gray.400",children:[e.key,"personal"===e.type?" · личное":""]})]}),i&&r.jsx(c,{color:"#4F378A",boxSize:"12px",ml:"auto"})]})})}function $o({spaces:i,value:o,onChange:n,isLoading:a,lastSpace:d}){const[p,x]=e.useState(""),g=e.useRef(null),b=i.find(e=>e.key===o),m=d?i.find(e=>e.key===d.spaceKey):null,f=i.filter(e=>{var r,i;const o=p.trim().toLowerCase();return!o||((null==(r=e.name)?void 0:r.toLowerCase().includes(o))||(null==(i=e.key)?void 0:i.toLowerCase().includes(o)))}),v=m&&!p.trim()?f.filter(e=>e.key!==m.key):f,j=v.findIndex(e=>e.key===o);e.useEffect(()=>{g.current&&j>=0&&g.current.scrollToItem(j,"smart")},[j,v.length]);const y=Boolean(m)&&!p.trim();return r.jsxs(t,{closeOnSelect:!1,matchWidth:!0,children:[r.jsx(s,{as:Ir,w:"100%",size:"sm",h:"auto",minH:"32px",py:"6px",px:"10px",borderRadius:"8px",fontWeight:"400",fontSize:".8125rem",borderColor:"gray.200",boxShadow:"sm",bg:"white",textAlign:"left",variant:"outline",rightIcon:r.jsx(l,{}),isDisabled:a,children:r.jsx(Ne,{spacing:"8px",w:"100%",overflow:"hidden",children:b?r.jsxs(r.Fragment,{children:[r.jsx(To,{icon:b.icon,name:b.name}),r.jsx(Ar,{isTruncated:!0,children:b.name}),r.jsx(Ar,{color:"gray.400",fontSize:".75rem",flexShrink:0,children:b.key})]}):r.jsx(Ar,{color:a||!i.length?"gray.400":"gray.700",children:a?"Загружаем пространства…":i.length?"Выберите пространство":"Нет доступных пространств"})})}),r.jsxs(u,{borderRadius:"12px",p:"6px",minW:"300px",children:[r.jsx(Er,{px:"2px",pb:"6px",children:r.jsx(O,{size:"sm",borderRadius:"8px",focusBorderColor:"#4F378A",placeholder:"Поиск пространства…",value:p,onChange:e=>x(e.target.value)})}),y&&r.jsxs(r.Fragment,{children:[r.jsx(h,{borderRadius:"8px",closeOnSelect:!0,onClick:()=>n(m.key),children:r.jsxs(Ne,{spacing:"8px",w:"100%",children:[r.jsx(To,{icon:m.icon,name:m.name}),r.jsxs(Er,{minW:"0",children:[r.jsx(Ar,{fontSize:".8125rem",isTruncated:!0,children:m.name}
6),r.jsxs(Ne,{spacing:"4px",children:[r.jsx(no,{size:10,color:"gray.400"}),r.jsx(Ar,{fontSize:".6875rem",color:"gray.400",children:"Последнее использованное"})]})]}),m.key===o&&r.jsx(c,{color:"#4F378A",boxSize:"12px",ml:"auto"})]})}),r.jsx(ye,{my:"4px"})]}),r.jsx(si,{ref:g,height:Math.min(220,Math.max(v.length,1)*Oo),width:"100%",itemCount:v.length,itemSize:Oo,itemKey:e=>v[e].key,itemData:{rows:v,value:o,onSelect:n},children:({index:e,style:i,data:o})=>{const n=o.rows[e];return r.jsx("div",{style:i,children:r.jsx(Po,{space:n,isSelected:n.key===o.value,onSelect:()=>{o.onSelect(n.key),x("")}})},n.key)}}),!a&&0===v.length&&r.jsx(Ar,{px:"10px",py:"8px",fontSize:".8125rem",color:"gray.400",children:i.length?"Ничего не найдено":"Нет доступных пространств"})]})]})}function Bo({color:e,size:i=14}){return r.jsx("svg",{fill:"none",viewBox:"0 0 16 16",role:"presentation",width:i,height:i,style:{color:e,flexShrink:0},children:r.jsx("path",{fill:"currentcolor",fillRule:"evenodd",clipRule:"evenodd",d:"M1 3a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2zm2-.5a.5.5 0 0 0-.5.5v10a.5.5 0 0 0 .5.5h10a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5zM12 6H4V4.5h8zm-2 3.5H4V8h6z"})})}const Lo=31,Ho=20;function Uo({pages:i,value:o,onChange:n,isLoading:a}){const[d,c]=e.useState([]),p=e.useMemo(()=>{const e={},r=new Set(i.map(e=>String(e.id)));return i.forEach(i=>{const o=i.parentId&&r.has(String(i.parentId))?String(i.parentId):null;(e[o]=e[o]||[]).push(i)}),Object.values(e).forEach(e=>e.sort((e,r)=>{const i=e=>"folder"===e.type?0:1;return i(e)-i(r)||e.title.localeCompare(r.title)})),e},[i]);e.useEffect(()=>{if(!o)return;const e={};i.forEach(r=>{e[String(r.id)]=r.parentId?String(r.parentId):null});const r=[];let n=String(o);for(;n&&e[n];)r.push(e[n]),n=e[n];
6r.length&&c(e=>[...new Set([...e,...r])])},[o,i]);const x=e.useMemo(()=>{const e=[{type:"root"}],r=(i,o)=>{(p[i]||[]).forEach(i=>{const n=(p[String(i.id)]||[]).length>0;e.push({type:"page",page:i,depth:o,hasChildren:n}),n&&d.includes(String(i.id))&&r(String(i.id),o+1)})};return r(null,0),e},[p,d]),h=e.useRef(null),g=x.findIndex(e=>"page"===e.type&&String(e.page.id)===String(o));e.useEffect(()=>{h.current&&g>=0&&h.current.scrollToItem(g,"smart")},[g,x.length]);const b=e.useCallback(e=>{c(r=>r.includes(e)?r.filter(r=>r!==e):[...r,e])},[]),m=e.useMemo(()=>({rows:x,value:o,onSelect:n,onToggle:b,selectedColor:"#1868DB"}),[x,o,n,b]),f=i.find(e=>String(e.id)===String(o));return r.jsx(t,{closeOnSelect:!1,matchWidth:!0,children:({onClose:e})=>r.jsxs(r.Fragment,{children:[r.jsx(s,{as:Ir,w:"100%",size:"sm",h:"auto",minH:"32px",py:"6px",px:"10px",borderRadius:"8px",fontWeight:"400",fontSize:".8125rem",borderColor:"gray.200",boxShadow:"sm",bg:"white",textAlign:"left",variant:"outline",rightIcon:r.jsx(l,{}),isDisabled:a,children:r.jsx(Ne,{spacing:"6px",overflow:"hidden",children:r.jsx(Ar,{isTruncated:!0,color:f||""===o?"gray.700":"gray.400",children:a?"Загружаем страницы…":f?f.title:i.length?"Корень пространства":"В пространстве пока нет страниц"})})}),r.jsx(u,{borderRadius:"12px",p:"6px",minW:"300px",children:a||0!==i.length?r.jsx(si,{ref:h,height:Math.min(300,Math.max(x.length,1)*Lo),width:"100%",itemCount:x.length,itemSize:Lo,itemKey:e=>"root"===x[e].type?"root":x[e].page.id,itemData:m,children:({index:i,style:o,data:n})=>{const t=n.rows[i],s="root"===t.type,l=s?""===n.value:String(n.value)===String(t.page.id),a=(t.depth||0)*Ho,c=!s&&d.includes(String(t.page.id));return r.jsx("div",{style:o,children:r.jsxs(We,{role:"group",align:"center",position:"relative",minW:"0",ml:`${a}px`,w:`calc(100% - ${a}px)`,cursor:"pointer",transition:"background 0.12s ease",...li,color:l?n.selectedColor:"gray.700",fontWeight:l?500:400,bg:l?"#E9F2FF":"transparent",_before:{content:'""',position:"absolute",left:"0",top:"50%",transform:"translateY(-50%)",w:"3px",h:"16px",borderRadius:"full",bg:l?n.selectedColor:"#CBD5E0",opacity:l?1:0,transition:"opacity 0.12s ease"},_hover:{bg:l?"#DEEBFF":"gray.100",_before:{opacity:1}},onClick:()=>{n.onSelect(s?"":t.page.id),e()},children:[r.jsx(Er,{...ai,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:"gray.500",transition:"background 0.12s ease, color 0.12s ease",cursor:t.hasChildren?"pointer":"default",_hover:t.hasChildren?{bg:"gray.200",color:"gray.700"}:void 0,onClick:e=>{t.hasChildren&&(e.stopPropagation(),n.onToggle(String(t.page.id)))},children:s?r.jsx(Le,{size:14}):t.hasChildren?c?r.jsx(gi,{size:14,strokeWidth:1.5}):r.jsx(bi,{size:14,strokeWidth:1.5}):r.jsx(Er,{w:"5px",h:"5px",borderRadius:"full",bg:l?n.selectedColor:"gray.400"})}),r.jsxs(Ne,{spacing:"6px",minW:"0",flex:"1",overflow:"hidden",children:[!s&&("folder"===t.page.type?r.jsx(Er,{display:"flex",flexShrink:0,color:l?n.selectedColor:"gray.500",children:r.jsx(Le,{size:14})}):r.jsx(Bo,{color:l?n.selectedColor:"gray.500"})),r.jsx(Ar,{fontSize:".8125rem",isTruncated:!0,children:s?"Корень пространства":t.page.title})]})]})})}}):r.jsx(Ar,{px:"10px",py:"8px",fontSize:".8125rem",color:"gray.400",children:"В пространстве пока нет страниц — публикация будет в корень"})})]})})}const No=/`[^`\n]+`|\[[^\]\n]*\]\([^)\s]+\)/g;function Vo(e){return e.split(/(\s+)/).filter(Boolean)}function Yo(e){if(null==e||""===e)return[];const r=String(e),i=[];let o=0;No.lastIndex=0;let n=No.exec(r);for(;null!==n;)n.index>o&&i.push(...Vo(r.slice(o,n.index))),i.push(n[0]),o=n.index+n[0].length,n=No.exec(r);return o<r.length&&i.push(...Vo(r.slice(o))),i}function Xo(e,r){const i=e.length,o=r.length,n=Array(i+1).fill(null).map(()=>Array(o+1).fill(0));for(let a=1;a<=i;a++)for(let i=1;i<=o;i++)n[a][i]=e[a-1]===r[i-1]?n[a-1][i-1]+1:Math.max(n[a][i-1],n[a-1][i]);const t=[];let s=i,l=o;for(;s>0&&l>0;
6)e[s-1]===r[l-1]?(t.unshift([s-1,l-1]),s--,l--):n[s][l-1]>=n[s-1][l]?l--:s--;return t}function Go(e,r){const i=Yo(e??""),o=Yo(r??""),n=Xo(i,o),t=[],s=(e,r)=>{r&&(t.length&&t[t.length-1].type===e?t[t.length-1].text+=r:t.push({type:e,text:r}))};let l=0,a=0;for(const[d,c]of n){for(;l<d;)s("removed",i[l++]);for(;a<c;)s("added",o[a++]);s("same",i[d]),l=d+1,a=c+1}for(;l<i.length;)s("removed",i[l++]);for(;a<o.length;)s("added",o[a++]);return t}const Ko=e.lazy(()=>fi(()=>import("./publicPagePublic-DSl9ndik.js").then(e=>e.p),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86])).then(e=>({default:e.PublicSOPPublic}))),qo=_r`
7  from { opacity: 1; transform: translateY(0); }
8  to { opacity: 0; transform: translateY(20px); }
9`,Jo=_r`
10  from { transform: translateX(0); }
11  to { transform: translateX(200%); }
12`;function Qo(e){const r=new Date(e),i=Date.now()-r.getTime(),o=i/6e4;if(i/1e3<50)return"Только что";if(o<2.5)return"Пару минут назад";if(o<60){const e=Math.max(1,Math.floor(o)),r=e%10,i=e%100;return i>=11&&i<=14?`${e} минут назад`:1===r?`${e} минуту назад`:r>=2&&r<=4?`${e} минуты назад`:`${e} минут назад`}if(o<70)return"час назад";if(o<120)return"более часа назад";if(i<108e5){const e=Math.floor(o/60),r=e%10,i=e%100;return i>=11&&i<=14?`${e} часов назад`:1===r?`${e} час назад`:r>=2&&r<=4?`${e} часа назад`:`${e} часов назад`}return zi(r,"HH:mm",{locale:ni})}function Zo(e){const r=(e||"").match(/\(п\.\s*(\d+)\)/);if(!r)return{stepNum:null,labelShort:e||""};return{stepNum:parseInt(r[1],10),labelShort:(e||"").replace(/\s*\(п\.\s*\d+\)\s*$/,"").trim()||e}}function en(e){if(!e)return!1;const r=String(e);return r.startsWith("Изменён текст шага")||r.startsWith("Изменено описание шага")||r.startsWith("Изменён заголовок шага")||"Изменены теги"===r||r.startsWith("Изменён заголовок инструкции")||r.startsWith("Изменено описание инструкции")}const rn="Изменена иконка инструкции";function on(e){const r=null==e?void 0:e.changeDetails;return!!(null==r?void 0:r.length)&&r.every(e=>(e.label||"").startsWith("Изменён порядок шага")&&/^\d+$/.test(String(e.was??"").trim())&&/^\d+$/.test(String(e.became??"").trim()))}const nn="Изменён заголовок инструкции",tn="Изменено описание инструкции";function sn(e){if(!(null==e?void 0:e.length))return!1;const r=e.map(e=>(e.label||"").trim()),i=r.includes(nn),o=r.includes(tn);return e.every(e=>{const r=(e.label||"").trim();return r===nn||r===tn})&&(i||o)}const ln={step:"Добавлен новый шаг",video:"Добавлен новый видео шаг",portal:"Добавлен новый портал",header:"Добавлен новый заголовок",section:"Добавлен новый раздел",notification:"Добавлено новое уведомление",warning:"Добавлено новое предупреждение"};function an(e){const r=[];let i=null,o=[];return e.forEach(e=>{const n=new Date(e.createdAt),t=zi(n,"yyyy-MM-dd");t!==i?(o.length&&r.push({date:i,dateLabel:zi(new Date(o[0].createdAt),"d MMMM yyyy",{locale:ni}),versions:o}),i=t,o=[e]):o.push(e)}),o.length&&r.push({date:i,dateLabel:zi(new Date(o[0].createdAt),"d MMMM yyyy",{locale:ni}),versions:o}),r}const dn=({isOpen:o,onClose:n,instructionId:t,documentType:s="instruction",onRestored:l,onMarkAsRead:a,socket:d=null,currentUserId:c=null,authorLicenseType:p=null,openLicenseModal:x=null,onTryPro:u=null,isProTested:h=!1,updateLocked:g=!1})=>{var b,m,f;const v=["FREE","START"].includes(p),[j,y]=e.useState([]),[S,w]=e.useState(!1),[z,W]=e.useState(null),[R,I]=e.useState(null),[A,D]=e.useState(null),{isOpen:E,onOpen:_,onClose:M}=Tr(),[T,O]=e.useState(null),[P,$]=e.useState(!1),[Y,X]=e.useState(null),[G,K]=e.useState(!1),[q,J]=e.useState(null),Q=je(),[Z]=Ge("(max-width: 840px)",{ssr:!1}),[ee,re]=e.useState([]),[ie,oe]=e.useState([]),[ne,te]=e.useState([]),[se,le]=e.useState([]),ae=e.useRef([]),de=e.useRef(null),ce=e.useRef(null),pe=e.useRef(a);pe.current=a;const xe=$r("white","gray.800"),ue=$r("white","gray.800"),he=$r("gray.50","gray.700"),ge=$r("gray.200","gray.600"),be=$r("0 1px 3px rgba(0,0,0,0.08)","0 1px 3px rgba(0,0,0,0.25)"),me=$r("purple.100","purple.900"),fe=$r("purple.300","purple.600"),ve=$r("purple.700","purple.200"),ye=$r("gray.800","gray.200"),Se=$r("yellow.200","yellow.700"),we=$r("blue.100","blue.900"),Ce=$r("0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04)","0 4px 24px rgba(0,0,0,0.2)"),ke=$r("purple.50","purple.900"),ze=$r("purple.500","purple.300"),Ie=$r("gray.800","gray.100"),Ae=$r("gray.500","gray.400"),De=$r("gray.100","gray.600"),Ee=$r("gray.100","gray.700"),_e=$r("gray.300","gray.500"),Me=e.useMemo(()=>j.filter(e=>!function(e){var r;const i=null==e?void 0:e.changeDetails;return!!(null==i?void 0:i.length)&&!(!i.every(e=>(e.label||"")===rn)||e.beforeSummary||e.afterSummary||(null==(r=e.changeSummary)?void 0:r.length))}(e)),[j]),Te=e.useMemo(()=>an(Me),[Me]),{pinnedVersions:Oe,groupedUnpinned:Pe}=e.useMemo(()=>
12{if("regulation"!==s)return{pinnedVersions:[],groupedUnpinned:Te};return{pinnedVersions:Me.filter(e=>!0===e.savedForever),groupedUnpinned:an(Me.filter(e=>!0!==e.savedForever))}},[s,Me,Te]),$e="PRO"===p?100:12,Be="regulation"===s&&Oe.length>=$e,Le="PRO"===p?"Достигнут лимит закреплённых версий – 100 шт.":"Достигнут лимит закреплённых версий – 12 шт. Лимит в PRO — до 100 шт.",He=e.useCallback(async(e={})=>{var r,i,o;const{silent:n=!1}=e;if(t){n||(w(!0),W(null),y([]));try{const e=(await B(t)).versions||[];if(n){const i=new Set(ae.current.map(e=>e.id)),o=new Set(e.map(e=>e.id)),n=e.filter(e=>{var r;return!i.has(e.id)&&(null==c||(null==(r=e.author)?void 0:r.id)!==c)}).map(e=>e.id),t=ae.current.filter(e=>!o.has(e.id)).map(e=>e.id),s=ae.current.filter(e=>!o.has(e.id));t.length>0&&(te(t),le(s),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>{te([]),le([]),ce.current=null},500)),n.length>0&&oe(e=>[...new Set([...e,...n])]),y(e),null==(r=pe.current)||r.call(pe)}else{const r=(e=>`steppo:lastSeenVersionId:${e}`)(t),n=parseInt(localStorage.getItem(r),10),s=Number.isFinite(n)?n:0,l=e.filter(e=>{var r;return e.id>s&&(null==c||(null==(r=e.author)?void 0:r.id)!==c)}).map(e=>e.id);re(l);const a=null==(i=e[0])?void 0:i.id;null!=a&&localStorage.setItem(r,String(a)),null==(o=pe.current)||o.call(pe),y(e)}ae.current=e}catch(s){n||W(s.message||"Ошибка загрузки версий")}finally{n||w(!1)}}},[t,c]);e.useEffect(()=>{o&&t&&(v||(te([]),le([]),oe([]),He()))},[o,t,v,He]);const Ue=e.useRef(He);Ue.current=He;const Ye=e.useRef(null);e.useEffect(()=>{if(!o||!t||!d||v)return;const e=e=>{(null==e?void 0:e.id)===t&&(Ye.current&&clearTimeout(Ye.current),Ue.current({silent:!0}),Ye.current=setTimeout(()=>{Ue.current({silent:!0}),Ye.current=null},500))};return d.on("instruction:update",e),()=>{d.off("instruction:update",e),Ye.current&&(clearTimeout(Ye.current),Ye.current=null)}},[o,t,d,v]),e.useEffect(()=>{if(o&&(0!==ee.length||0!==ie.length))return de.current&&clearTimeout(de.current),de.current=setTimeout(()=>{re([]),oe([]),de.current=null},3e4),()=>{de.current&&clearTimeout(de.current)}},[o,ee.length,ie.length]);const Xe=e.useCallback(e=>{re(r=>r.filter(r=>r!==e)),oe(r=>r.filter(r=>r!==e))},[]),qe=e.useCallback(()=>{re([]),oe([])},[]),Je=e=>{g?W("Идёт обновление инструкции — восстановить версию можно будет после разбора правок"):(D(null),O(e),_())},Qe=()=>{D(null),O(null),M()},Ze=e.useCallback(async()=>{var e;if(t&&"regulation"===s){K(!0);try{const{content:r}=await L(t);if(null==r)return void Q({title:"Нет сохранённого контента",status:"warning",isClosable:!0});await H(t,r),Q({title:"Версия создана и сохранена навсегда",status:"success",isClosable:!0}),null==(e=Ue.current)||e.call(Ue)}catch(r){Q({title:(null==r?void 0:r.message)||"Ошибка создания версии",status:"error",isClosable:!0})}finally{K(!1)}}},[t,s,Q]),er=e.useCallback(async(e,r)=>{var i;if(t){J(e);try{r?(await U(t,e),Q({title:"Версия сохранена навсегда",status:"success",isClosable:!0})):(await N(t,e),Q({title:"Закрепление снято",status:"success",isClosable:!0})),null==(i=Ue.current)||i.call(Ue)}catch(o){Q({title:(null==o?void 0:o.message)||"Ошибка",status:"error",isClosable:!0})}finally{J(null)}}},[t,Q]),rr=e=>e.author?e.author.name||e.author.email||`ID ${e.author.id}`:"Неизвестно",ir=e=>e.changeDetails&&e.changeDetails.length>0||e.beforeSummary||e.afterSummary||e.changeSummary&&e.changeSummary.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Si,{isOpen:o,placement:"right",onClose:n,size:Z?"full":"lg",returnFocusOnClose:!1,blockScrollOnMount:!Y,children:[r.jsx(Xr,{backdropFilter:"blur(8px)"}),r.jsxs(wi,{bg:xe,pointerEvents:Y?"none":"auto",w:Z?"100vw":void 0,maxW:Z?"100vw":void 0,h:Z?"var(--app-height, 100vh)":void 0,maxH:Z?"var(--app-height, 100vh)":void 0,overflow:"hidden",children:[r.jsx(Kr,{borderRadius:"99px",zIndex:"1501",top:Z?"calc(env(safe-area-inset-top, 0px) + 12px)":void 0,right:Z?"12px":void 0}),r.jsx(Qr,{zIndex:"1500",bg:"whiteAlpha.400",position:Z?"sticky":"fixed",top:0,w:"100%",backdropFilter:"blur(8px)",pt:Z?"calc(env(safe-area-inset-top, 0px) + 16px)":void 0,pr:Z?"60px":void 0,flexShrink:0,children:r.jsx(Ne,{bg:"transparent",justify:"space-between",w:"full",children:r.jsxs(Ne,{children:[r.jsx(vi,{size:20}),r.jsx(Ar,{children:"regulation"===s?"История версий":"История изменений"})]})})}),r.jsx(Jr,{overflowY:Y?"hidden":"auto",overflowX:"hidden",minW:0,p:v&&x?0:2,mt:Z?0:6,pb:Z?"calc(env(safe-area-inset-bottom, 0px) + 16px)":void 0,children:v&&x?r.jsxs(Er,{position:"relative",overflow:"hidden",children:[r.jsx(Er,{as:"video",src:"https://s3.regru.cloud/steppo.bucket/Example/changelog.mp4",autoPlay:!0,muted:!0,loop:!0,playsInl
12ine:!0,onCanPlayThrough:()=>$(!0),transition:"opacity 0.75s ease-in-out",opacity:P?.6:0,style:{filter:"blur(4px)",zIndex:1,alignSelf:"end",width:"100%",position:"absolute",top:0,left:0}}),r.jsxs(Ve,{justify:"center",spacing:6,textAlign:"center",flex:1,zIndex:2,h:"100vh",children:[r.jsx(Er,{p:6,bgGradient:"linear(to-b, gray.50, gray.100)",borderRadius:"full",boxShadow:"md",border:"2px dashed",borderColor:"gray.300",position:"relative",overflow:"hidden",zIndex:2,sx:{_dark:{bgGradient:"linear(to-b, gray.700, gray.800)",borderColor:"gray.600"},"&::after":{content:'""',position:"absolute",top:0,left:"-200%",width:"200%",height:"100%",background:"linear-gradient(85deg, transparent, rgba(255,255,255,0.4), transparent)",pointerEvents:"none",zIndex:1,animation:`${Jo} 1.25s 2 alternate`}},children:r.jsx(ji,{size:48,color:"#A0AEC0",style:{position:"relative",zIndex:2}})}),r.jsxs(Ne,{px:2,py:1,bg:"rgba(225,226,230,0.35)",border:"1px solid",borderColor:"gray.200",backdropFilter:"blur(12px)",borderRadius:"8px",boxShadow:"md",zIndex:2,sx:{_dark:{bg:"rgba(45,55,72,0.5)",borderColor:"gray.600"}},children:[r.jsx(Ar,{fontSize:"lg",fontWeight:"600",color:"gray.700",_dark:{color:"gray.200"},children:"regulation"===s?"История версий":"История изменений"}),r.jsx(Zr,{type:"BASIC",onClick:x})]}),!h&&u?r.jsx(F,{zIndex:2,children:r.jsxs(Ir,{fontSize:".825rem",fontWeight:"400",color:"gray.700",bgColor:"rgba(255,255,255,.6)",boxShadow:"sm",border:"1px",colorScheme:"whiteAlpha",borderColor:"rgba(0,0,0,.15)",textAlign:"center",px:"10px",h:"30px",w:"fit-content",borderRadius:"8px",overflow:"hidden",onClick:u,position:"relative",leftIcon:r.jsx(C,{color:"purple",fontSize:"1rem"}),_hover:{textDecoration:"none",bgColor:"rgba(255,255,255,.8)",transform:"scale(1.07) rotate(-0.8deg)",boxShadow:"lg"},transition:".2s cubic-bezier(0.73, -0.6, 0.55, 1.65)",_dark:{color:"gray.100",bgColor:"rgba(255,255,255,.15)",borderColor:"gray.500"},children:["Получить ",r.jsx("b",{style:{padding:3},children:" Steppo PRO "})," на 7 дней бесплатно"]})}):r.jsx(F,{zIndex:2,children:r.jsx(Ir,{fontSize:".825rem",fontWeight:"500",h:"33px",borderRadius:"99px",border:"1px solid",borderColor:"green.600",boxShadow:"sm",colorScheme:"green",onClick:x,leftIcon:r.jsx(k,{fontSize:"1rem",color:"#ED8936"}),children:r.jsxs(Ar,{children:["Купить ",r.jsx("b",{children:"PRO"})," или ",r.jsx("b",{children:"BASIC"})]})})})]})]}):r.jsxs(Er,{p:Z?2:4,minW:0,maxW:"100%",children:[S&&r.jsx(F,{py:12,children:r.jsx(Or,{size:"lg",colorScheme:"purple",thickness:"3px"})}),z&&r.jsxs(Br,{status:"error",borderRadius:"md",mb:4,children:[r.jsx(Lr,{}),z]}),"BASIC"===p&&!S&&r.jsxs(Br,{status:"info",border:"1px solid",borderColor:"blue.300",boxShadow:"sm",borderRadius:"1rem",my:4,fontSize:"sm",children:[r.jsx(Lr,{}),"На тарифе BASIC в истории отображаются только последние 12 ","regulation"===s?"версий":"изменений","."]}),!S&&0===j.length&&!z&&r.jsx(We,{flex:1,minH:"calc(100vh - 10rem)",align:"center",justify:"center",px:4,children:r.jsxs(Er,{as:"article",maxW:"320px",w:"100%",p:8,borderRadius:"2xl",borderWidth:"1px",borderColor:ge,bg:ue,boxShadow:Ce,textAlign:"center",children:[r.jsx(F,{w:"14",h:"14",mx:"auto",mb:4,borderRadius:"1rem",bg:ke,color:ze,children:r.jsx(ji,{size:28,strokeWidth:1.5})}),r.jsx(Ar,{fontSize:"1.125rem",fontWeight:"700",color:Ie,mb:2,children:"regulation"===s?"Пока нет версий":"Пока нет изменений"}),r.jsx(Ar,{fontSize:".875rem",color:Ae,lineHeight:"tall",children:"regulation"===s?"История версий появится после первых сохранений регламента.":"История изменений появится после первых правок инструкции."})]})}),!S&&("regulation"===s?Oe.length>0||Pe.length>0:Te.length>0)&&r.jsx(Ve,{spacing:6,align:"stretch",children:"regulation"===s?r.jsxs(r.Fragment,{children:[Oe.length>0?r.jsxs(Er,{children:[r.jsxs(Ne,{justify:"space-between",align:"center",mb:5,mt:4,pl:1,children:[r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:"gray.500",_dark:{color:"gray.400"},textTransform:"capitalize",children:"Закрепленные"}),r.jsx(Mr,{label:Be?Le:"",placement:"bottom",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Ir,{size:"sm",variant:"outline",fontSize:"xs",onClick:Ze,isLoading:G,isDisabled:Be,leftIcon:G?void 0:r.jsx(ji,{size:14}),borderRadius:"99px",boxShadow:"sm",children:"Создать версию"})})})]}),r.jsx(Ve,{spacing:6,align:"stretch",children:Oe.map((e,i)=>{var o,n;const t=j.findIndex(r=>
12r.id===e.id),s=t>=0?j.length-t:1;return r.jsx(qr,{in:!0,offsetY:12,transition:{enter:{duration:.3,delay:.05*i}},children:r.jsx(Er,{flex:1,minW:0,children:r.jsxs(Er,{cursor:"pointer",onClick:()=>X(e),borderRadius:"1rem",boxShadow:be,bg:Ee,borderWidth:"1px",borderColor:_e,p:4,_hover:{bg:De},_active:{bg:De},transition:"background 0.15s",children:[r.jsxs(Ne,{justify:"space-between",align:"flex-start",mb:1,gap:2,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",s," · ",zi(new Date(e.createdAt),"d MMMM yyyy",{locale:ni})," · ",Qo(e.createdAt),"restore"===e.changeType?" · Восстановление":"update-recording"===e.changeType?" · Обновление через перезапись":""]}),r.jsx(Er,{onClick:e=>e.stopPropagation(),children:r.jsx(Mr,{label:"Снять закрепление",placement:"top",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Dr,{"aria-label":"Снять закрепление",size:"sm",variant:"ghost",borderRadius:"99px",color:"gray.600",_dark:{color:"gray.400"},bg:"gray.100",_hover:{bg:"gray.200",_dark:{bg:"gray.500"}},icon:e.savedForever?r.jsx(dr,{size:16}):r.jsx(cr,{size:16}),isLoading:q===e.id,onClick:()=>er(e.id,!1)})})})})]}),"restore"===e.changeType&&e.restoredFromVersion?r.jsxs(Ar,{fontSize:"sm",color:ye,children:["Восстановлено до версии ",(()=>{const r=j.findIndex(r=>{var i;return r.id===(null==(i=e.restoredFromVersion)?void 0:i.id)});return r>=0?j.length-r:"?"})()," от ",zi(new Date(e.restoredFromVersion.createdAt),"d MMMM yyyy, HH:mm",{locale:ni})]}):r.jsx(Er,{position:"relative",overflow:"hidden",maxHeight:"2.8em",sx:{maskImage:"linear-gradient(to bottom, black 0%, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, black 50%, transparent 100%)"},children:r.jsx(Ar,{fontSize:"sm",color:ye,children:(null==(o=e.afterSummary)?void 0:o.preview)||e.changeSummary&&e.changeSummary[0]||"Изменение сохранено"})}),(e.savedForever||"restore"===e.changeType)&&r.jsxs(Ne,{align:"center",spacing:3,pt:2,mt:2,borderTopWidth:"1px",borderColor:ge,children:[r.jsx(Re,{size:"sm",boxShadow:"base",name:rr(e),src:null==(n=e.author)?void 0:n.avatarUrl,bg:"gray.300",_dark:{bg:"gray.600"}}),r.jsxs(Ve,{align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"700",children:rr(e)}),r.jsxs(Ar,{fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},children:["Закреплено: ",zi(new Date(e.savedForeverAt||e.createdAt),"d MMMM yyyy",{locale:ni})," · ",zi(new Date(e.savedForeverAt||e.createdAt),"HH:mm",{locale:ni})]})]})]})]})})},e.id)})})]},"pinned"):null,Pe.map(({dateLabel:e,versions:i},o)=>r.jsxs(Er,{children:[r.jsxs(Ne,{justify:"space-between",align:"center",mb:5,mt:4,pl:1,children:[r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:"gray.500",_dark:{color:"gray.400"},textTransform:"capitalize",children:e}),0===Oe.length&&0===o&&r.jsx(Mr,{label:Be?Le:"",placement:"bottom",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Ir,{size:"sm",variant:"outline",fontSize:"xs",onClick:Ze,isLoading:G,isDisabled:Be,leftIcon:G?void 0:r.jsx(ji,{size:14}),borderRadius:"99px",boxShadow:"sm",children:"Создать версию"})})})]}),r.jsx(Ve,{spacing:6,align:"stretch",children:i.map((e,i)=>{var n,t;const s=j.findIndex(r=>
12r.id===e.id),l=s>=0?j.length-s:1,a=ie.includes(e.id);return r.jsx(qr,{in:!0,offsetY:a?-20:12,transition:{enter:{duration:a?.4:.3,delay:a?0:.07*(5*o+i)}},children:r.jsx(Er,{flex:1,minW:0,children:r.jsxs(Er,{cursor:"pointer",onClick:()=>X(e),borderRadius:"1rem",boxShadow:be,bg:e.savedForever?Ee:he,borderWidth:"1px",borderColor:e.savedForever?_e:ge,p:4,_hover:{bg:De},_active:{bg:De},transition:"background 0.15s",children:[r.jsxs(Ne,{justify:"space-between",align:"flex-start",mb:1,gap:2,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",l," · ",Qo(e.createdAt),"restore"===e.changeType?" · Восстановление":"update-recording"===e.changeType?" · Обновление через перезапись":""]}),r.jsx(Er,{onClick:e=>e.stopPropagation(),children:r.jsx(Mr,{label:Be&&!e.savedForever?Le:e.savedForever?"Снять закрепление":"Закрепить",placement:"top",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Dr,{"aria-label":e.savedForever?"Снять закрепление":"Закрепить",size:"sm",variant:"ghost",borderRadius:"99px",color:e.savedForever?"gray.700":"gray.500",_dark:{color:e.savedForever?"gray.200":"gray.400"},bg:e.savedForever?"gray.100":void 0,_hover:e.savedForever?{bg:"gray.100",_dark:{bg:"gray.600"}}:{bg:"gray.100",_dark:{bg:"gray.600"},color:"gray.700"},icon:e.savedForever?r.jsx(dr,{size:16}):r.jsx(cr,{size:16}),isLoading:q===e.id,isDisabled:Be&&!e.savedForever,onClick:()=>er(e.id,!e.savedForever)})})})})]}),"restore"===e.changeType&&e.restoredFromVersion?r.jsxs(Ar,{fontSize:"sm",color:ye,children:["Восстановлено до версии ",(()=>{const r=j.findIndex(r=>{var i;return r.id===(null==(i=e.restoredFromVersion)?void 0:i.id)});return r>=0?j.length-r:"?"})()," от ",zi(new Date(e.restoredFromVersion.createdAt),"d MMMM yyyy, HH:mm",{locale:ni})]}):r.jsx(Er,{position:"relative",overflow:"hidden",maxHeight:"2.8em",sx:{maskImage:"linear-gradient(to bottom, black 0%, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, black 50%, transparent 100%)"},children:r.jsx(Ar,{fontSize:"sm",color:ye,children:(null==(n=e.afterSummary)?void 0:n.preview)||e.changeSummary&&e.changeSummary[0]||"Изменение сохранено"})}),(e.savedForever||"restore"===e.changeType)&&r.jsxs(Ne,{align:"center",spacing:3,pt:2,mt:2,borderTopWidth:"1px",borderColor:ge,children:[r.jsx(Re,{size:"sm",boxShadow:"base",name:rr(e),src:null==(t=e.author)?void 0:t.avatarUrl,bg:"gray.300",_dark:{bg:"gray.600"}}),r.jsxs(Ve,{align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"700",children:rr(e)}),r.jsxs(Ar,{fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",l," · ",Qo(e.createdAt)]})]})]})]})})},e.id)})})]},e))]}):Te.map(({dateLabel:e,versions:o},n)=>r.jsxs(Er,{children:[r.jsxs(Ne,{justify:"space-between",align:"center",mb:5,mt:4,pl:1,children:[r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:"gray.500",_dark:{color:"gray.400"},textTransform:"capitalize",children:e}),0===n&&(ee.length>0||ie.length>0)&&r.jsx(Ir,{size:"sm",variant:"outline",fontSize:"xs",onClick:qe,borderRadius:"99px",boxShadow:"sm",children:"Отметить все прочитанными"})]}),r.jsx(Ve,{spacing:6,align:"stretch",children:o.map((e,o)=>{var t,l,a;const d=j.findIndex(r=>
12r.id===e.id),c=d>=0?d<j.length-1?j[d+1]:j[d]:null,p=d>=0?Math.max(1,j.length-d):1;null!=c&&Math.max(0,j.length-d-1);const x=d>=0?j.length-d:1,u=(e.changeDetails||[]).filter(e=>(e.label||"")!==rn),h=ie.includes(e.id),g=ee.includes(e.id)||h;return r.jsx(qr,{in:!0,offsetY:h?-20:12,transition:{enter:{duration:h?.4:.3,delay:h?0:.07*(5*n+o)}},children:r.jsx(Er,{flex:1,minW:0,children:"regulation"===s?r.jsxs(Er,{cursor:"pointer",onClick:()=>X(e),borderRadius:"1rem",boxShadow:be,bg:e.savedForever?Ee:he,borderWidth:"1px",borderColor:e.savedForever?_e:ge,p:4,_hover:{bg:De},_active:{bg:De},transition:"background 0.15s",children:[r.jsxs(Ne,{justify:"space-between",align:"flex-start",mb:1,gap:2,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",x," · ",Qo(e.createdAt),"restore"===e.changeType?" · Восстановление":"update-recording"===e.changeType?" · Обновление через перезапись":""]}),r.jsx(Er,{onClick:e=>e.stopPropagation(),children:r.jsx(Mr,{label:Be&&!e.savedForever?Le:e.savedForever?"Снять закрепление":"Закрепить",placement:"top",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Dr,{"aria-label":e.savedForever?"Снять закрепление":"Закрепить",size:"sm",variant:"ghost",borderRadius:"99px",color:e.savedForever?"gray.700":"gray.500",_dark:{color:e.savedForever?"gray.200":"gray.400"},bg:e.savedForever?"gray.100":void 0,_hover:e.savedForever?{bg:"gray.100",_dark:{bg:"gray.600"}}:{bg:"gray.100",_dark:{bg:"gray.600"},color:"gray.700"},icon:e.savedForever?r.jsx(dr,{size:16}):r.jsx(cr,{size:16}),isLoading:q===e.id,isDisabled:Be&&!e.savedForever,onClick:()=>er(e.id,!e.savedForever)})})})})]}),"restore"===e.changeType&&e.restoredFromVersion?r.jsxs(Ar,{fontSize:"sm",color:ye,children:["Восстановлено до версии ",(()=>{const r=j.findIndex(r=>{var i;return r.id===(null==(i=e.restoredFromVersion)?void 0:i.id)});return r>=0?j.length-r:"?"})()," от ",zi(new Date(e.restoredFromVersion.createdAt),"d MMMM yyyy, HH:mm",{locale:ni})]}):r.jsx(Er,{position:"relative",overflow:"hidden",maxHeight:"2.8em",sx:{maskImage:"linear-gradient(to bottom, black 0%, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, black 50%, transparent 100%)"},children:r.jsx(Ar,{fontSize:"sm",color:ye,children:(null==(t=e.afterSummary)?void 0:t.preview)||e.changeSummary&&e.changeSummary[0]||"Изменение сохранено"})}),(e.savedForever||"restore"===e.changeType)&&r.jsxs(Ne,{align:"center",spacing:3,pt:2,mt:2,borderTopWidth:"1px",borderColor:ge,children:[r.jsx(Re,{size:"sm",boxShadow:"base",name:rr(e),src:null==(l=e.author)?void 0:l.avatarUrl,bg:"gray.300",_dark:{bg:"gray.600"}}),r.jsxs(Ve,{align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"700",children:rr(e)}),r.jsxs(Ar,{fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",x," · ",Qo(e.createdAt)]})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsx(Ne,{justify:"space-between",flexWrap:"wrap",gap:2,mb:ir(e)?4:0,children:r.jsx(Er,{flex:1,minW:0})}),ir(e)&&r.jsxs(Er,{position:"relative",children:[g&&r.jsx(Mr,{label:"Отметить как прочитанное",hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",children:r.jsx(Er,{position:"absolute",top:2,right:2,w:"14px",h:"14px",borderRadius:"full",bg:"blue.500",cursor:"pointer",zIndex:1,onClick:r=>{r.stopPropagation(),Xe(e.id)},role:"button","aria-label":"Отметить как прочитанное",_hover:{bg:"blue.600",transform:"scale(1.1)"},_active:{bg:"blue.700"},transition:"background 0.15s, transform 0.15s"})}),r.jsx(Ve,{align:"stretch",spacing:3,children:on({...e,changeDetails:u})?(()=>{const e=function(e){if(!(null==e?void 0:e.length))return null;let r=null,i=-1;for(const o of e){const e=parseInt(o.was,10),n=parseInt(o.became,10);if(Number.isNaN(e)||Number.isNaN(n))continue;const t=Math.abs(n-e);t>i&&(i=t,r=o)}return r}(u);return e?r.jsxs(Er,{borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · Изменён порядок шагов"]}),r.jsxs(Ne,{spacing:2,align:"center",children:[r.jsx(F,{borderRadius:"99px",minW:"28px",h:"28px",flexShrink:0,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:"xs",fontWeight:"700",color:ve,children:e.was})}),r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0}),r.jsx(F,{borderRadius:"99px",minW:"28px",h:"28px",flexShrink:0,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:"xs",fontWeight:"700",color:ve,children:e.became})})]})]}):null})():sn(u)?(()=>{const{titleWas:e,titleBecame:i,descWas:o,descBecame:n}=function(e){let r="—",i="—",o="—",n="—";for(const t of e||[])(t.label||"").trim()===nn?(r=t.was??"—",i=t.became??"—"):(t.label||"").trim()===tn&&(o=t.was??"—",n=t.became??"—");return{titleWas:r,titleBecame:i,descWas:o,descBecame:n}}(u);return r.jsxs(Er,{borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · Сгенерировано наÐ
12·Ð²Ð°Ð½Ð¸Ðµ и описание"]}),r.jsxs(Ne,{align:"stretch",spacing:2,flexWrap:"wrap",children:[r.jsxs(Er,{flex:1,minW:Z?0:"100px",fontSize:".875rem",maxH:"120px",overflowY:"auto",wordBreak:"break-word",whiteSpace:"pre-wrap",color:ye,children:[r.jsx(Ar,{fontWeight:"600",fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},mb:1,children:"Название"}),r.jsx(Ar,{children:e}),r.jsx(Ar,{fontWeight:"600",fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},mt:2,mb:1,children:"Описание"}),r.jsx(Ar,{children:o})]}),r.jsx(F,{flexShrink:0,alignSelf:"center",children:r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),r.jsxs(Er,{flex:1,minW:Z?0:"100px",fontSize:".875rem",maxH:"120px",overflowY:"auto",wordBreak:"break-word",whiteSpace:"pre-wrap",color:ye,children:[r.jsx(Ar,{fontWeight:"600",fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},mb:1,children:"Название"}),r.jsx(Ar,{children:i}),r.jsx(Ar,{fontWeight:"600",fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},mt:2,mb:1,children:"Описание"}),r.jsx(Ar,{children:n})]})]})]})})():u.length>0?u.map((e,o)=>{const{stepNum:n,labelShort:t}=Zo(e.label),s=e.stepOrder??n;if("step_copied"===e.changeType||e.label&&String(e.label).startsWith("Скопирован шаг")){const i=e.portalInstructionTitle?r.jsxs(Ar,{children:[r.jsx("b",{children:"Портал:"})," ",e.portalInstructionTitle]}):e.copiedStepTitle||e.became||"без названия",t=null!=e.newStepOrder?e.newStepOrder:n??"";return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[""!==t&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:t})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · Создана копия шага",""!==t?" "+(t-1):""]}),r.jsx(Ar,{fontSize:"sm",fontWeight:"400",color:ye,noOfLines:3,children:i})]})]},o)}if("target_click_added"===e.changeType||"target_click_removed"===e.changeType||"target_click_changed"===e.changeType)return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=s&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:s})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · ",e.label]}),"target_click_changed"===e.changeType&&(e.was||e.became)&&r.jsxs(Ne,{align:"stretch",spacing:2,flexWrap:"wrap",children:[r.jsx(Ar,{fontSize:"sm",color:ye,children:e.was}),r.jsx(F,{flexShrink:0,alignSelf:"center",children:r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),r.jsx(Ar,{fontSize:"sm",color:ye,children:e.became})]}),"target_click_changed"!==e.changeType&&r.jsx(Ar,{fontSize:"sm",color:ye,children:e.label})]})]},o);if("image_added"===e.changeType)return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=s&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:s})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · Добавлено изображение"]}),r.jsx(Er,{as:"img",src:e.imageUrl,alt:"",maxH:"200px",objectFit:"contain",borderRadius:"md",borderWidth:"1px",borderColor:ge,boxShadow:"base"})]})]},o);if("image_removed"===e.changeType)return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=s&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:s})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p]}),r.jsx(Ar,{fontSize:"sm",color:ye,children:"Удалено изображение"})]})]},o);if("image_edited"===e.changeType&&e.wasImageUrl&&e.becameImageUrl)return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=s&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:s})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · Отредактировано изображение в шаге"]}),r.jsxs(Ne,{align:"center",spacing:3,children:[r.jsx(Er,{flex:1,minW:0,display:"flex",flexDir:"column",children:r.jsx(Er,{as:"img",src:e.wasImageUrl,alt:"",w:"100%",objectFit:"contain",borderRadius:"md",borderWidth:"1px",borderColor:ge,boxShadow:"base"})}),r.jsx(F,{flexShrink:0,children:r.jsx(Fe,{fontSize:"0.875rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),r.jsx(Er,{flex:1,minW:0,display:"flex",flexDir:"column",children:r.jsx(Er,{as:"img",src:e.becameImageUrl,alt:"",w:"100%",objectFit:"contain",borderRadius:"md",borderWidth:"1px",borderColor:ge,boxShadow:"base"})})]})]})]},o);if("portal_target_changed"===e.changeType)return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=s&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:s})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p," · Изменена целевая инструкция портала"]}),r.jsxs(Ne,{align:"stretch",spacing:2,flexWrap:"wrap",children:[r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:"sm",wordBreak:"break-word",children:r.jsx(Ar,{color:ye,children:e.was||"—"})}),r.jsx(F,{flexShrink:0,alignSelf:"center",children:r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:"sm",wordBreak:"break-word",children:r.jsx(Ar,{color:ye,children:e.became||"—"})})]})]})]},o);if("step_added"===e.changeType||"—"===e.was&&(e.label||"").startsWith("Добавлен ")){const i=e.stepTypeKey||((l=e.stepType)&&{"видео":"video","портал":"portal","заголовок":"header","раздел":"section","уведомление":"notification","предупреждение":"warning"}[l]||"step"),n=ln[i]||ln.step;return r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=s&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:s})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p]}),r.jsx(Ar,{fontSize:"sm",color:ye,children:n})]})]},o)}var l;return e.label&&String(e.label).startsWith("Удалён")||!e.became||"—"===e.became?r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=n&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:n})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p,t?` · ${t}`:""]}),r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:"sm",maxH:"120px",overflowY:"auto",wordBreak:"break-word",children:e.portalInstru
12ctionTitle?r.jsxs(Ar,{fontSize:".875rem",color:ye,children:[r.jsx(Ar,{as:"b",children:"Портал:"})," ",e.portalInstructionTitle]}):r.jsx(yi,{text:e.was||"—",fontSize:".875rem",color:ye})})]})]},o):r.jsxs(Ne,{align:"flex-start",spacing:3,flexWrap:"wrap",children:[null!=n&&r.jsx(F,{borderRadius:"99px",minW:"32px",h:"32px",flexShrink:0,mt:2,bg:me,borderWidth:"1px",borderColor:fe,boxShadow:"base",children:r.jsx(Ar,{fontSize:".9rem",fontWeight:"700",color:ve,children:n})}),r.jsxs(Er,{flex:1,minW:Z?0:"200px",borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p,t?` · ${t}`:""]}),r.jsx(Ne,{align:"stretch",spacing:2,flexWrap:"wrap",children:en(e.label)?(()=>{const{wasSegments:o,becameSegments:n}=function(e,r){const i=Yo(e),o=Yo(r),n=Xo(i,o),t=new Set(n.map(([e])=>e)),s=new Set(n.map(([,e])=>e)),l=(e,r,i)=>{const o=[];for(let n=0;n<e.length;n++){const t=r.has(n)?"same":i,s=e[n];o.length>0&&o[o.length-1].type===t?o[o.length-1].text+=s:o.push({type:t,text:s})}return o};return{wasSegments:l(i,t,"removed"),becameSegments:l(o,s,"added")}}(e.was||"—",e.became||"—");return r.jsxs(r.Fragment,{children:[r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:".875rem",maxH:"120px",overflowY:"auto",wordBreak:"break-word",whiteSpace:"pre-wrap",color:ye,as:"span",display:"block",children:o.map((e,o)=>"removed"===e.type?r.jsx(Er,{as:"span",bg:we,px:"2px",borderRadius:"2px",display:"inline",children:e.text},o):r.jsx(i.Fragment,{children:e.text},o))}),r.jsx(F,{flexShrink:0,alignSelf:"center",children:r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:".875rem",maxH:"120px",overflowY:"auto",wordBreak:"break-word",whiteSpace:"pre-wrap",color:ye,as:"span",display:"block",children:n.map((e,o)=>"added"===e.type?r.jsx(Er,{as:"span",bg:Se,px:"2px",borderRadius:"2px",display:"inline",children:e.text},o):r.jsx(i.Fragment,{children:e.text},o))})]})})():r.jsxs(r.Fragment,{children:[r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:"sm",maxH:"120px",overflowY:"auto",wordBreak:"break-word",children:r.jsx(yi,{text:e.was||"—",fontSize:".875rem",color:ye})}),r.jsx(F,{flexShrink:0,alignSelf:"center",children:r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),r.jsx(Er,{flex:1,minW:Z?0:"100px",fontSize:"sm",maxH:"120px",overflowY:"auto",wordBreak:"break-word",children:r.jsx(yi,{text:e.became||"—",fontSize:".875rem",color:ye})})]})})]})]},o)}):r.jsxs(Er,{borderRadius:"1rem",boxShadow:be,bg:he,borderWidth:"1px",borderColor:ge,overflow:"hidden",px:4,py:3,children:[r.jsxs(Ar,{fontSize:"xs",fontWeight:"600",color:"gray.500",_dark:{color:"gray.400"},mb:2,children:["Изменение ",p,"restore"===e.changeType?" · Восстановление инструкции":""]}),"restore"===e.changeType&&e.restoredFromVersion?(()=>{const i=j.findIndex(r=>{var i;return r.id===(null==(i=e.restoredFromVersion)?void 0:i.id)}),o=i>=0?Math.max(0,j.length-i):null,n=Qo(e.restoredFromVersion.createdAt),t=/^\d{1,2}:\d{2}$/.test(n)?`в ${n}`:n;return r.jsxs(Ar,{fontSize:"sm",color:ye,children:["Инструкция была восстановлена до изменения ",null!=o?o:"?",", созданного ",t]})})():r.jsxs(Ne,{align:"stretch",spacing:2,minW:0,children:[e.beforeSummary&&r.jsx(Er,{flex:1,minW:0,children:null!=e.beforeSummary.title?r.jsxs(Ar,{fontSize:"sm",noOfLines:2,children:["«",e.beforeSummary.title,"»",null!=e.beforeSummary.stepsCount?` · шагов: ${e.beforeSummary.stepsCount}`:""]}):r.jsx(Ar,{fontSize:"sm",noOfLines:3,fontStyle:"italic",children:e.beforeSummary.preview||"—"})}),e.beforeSummary&&e.afterSummary&&r.jsx(F,{flexShrink:0,alignSelf:"center",children:r.jsx(Fe,{fontSize:"0.75rem",color:"var(--chakra-colors-gray-400)","aria-hidden":!0})}),e.afterSummary&&r.jsx(Er,{flex:1,minW:0,children:null!=e.afterSummary.title?r.jsxs(Ar,{fontSize:"sm",noOfLines:2,children:["«",e.afterSummary.title,"»",null!=e.afterSummary.stepsCount?` · шагов: ${e.afterSummary.stepsCount}`:""]}):r.jsx(Ar,{fontSize:"sm",noOfLines:3,fontStyle:"italic",children:e.afterSummary.preview||"—"})})]})]})})]}),r.jsxs(Ne,{align:"center",justify:"space-between",spacing:3,pt:2,mt:1,pl:(null==u?void 0:u.some(e=>null!=Zo(e.label).stepNum||null!=e.stepOrder))?12:0,children:[r.jsxs(Ne,{align:"center",spacing:3,children:[r.jsx(Re,{size:"sm",boxShadow:"base",n
12ame:rr(e),src:null==(a=e.author)?void 0:a.avatarUrl,bg:"gray.300",_dark:{bg:"gray.600"}}),r.jsxs(Ve,{align:"start",spacing:0,children:[r.jsx(Ne,{spacing:2,align:"center",children:r.jsx(Ar,{fontSize:"sm",fontWeight:"700",children:rr(e)})}),r.jsxs(Ar,{fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",x," · ",Qo(e.createdAt)]})]})]}),r.jsx(Mr,{hasArrow:!0,openDelay:250,closeDelay:100,borderRadius:"12px",px:"12px",py:"8px",label:"Отменить текущее изменение и все предыдущие",children:r.jsx(Ir,{bgColor:"#4F378A",color:"white",size:"sm",borderRadius:"40px",fontSize:"0.775rem",fontWeight:"400",_hover:{opacity:.75},_active:{opacity:1},onClick:()=>c&&Je(c),isLoading:!!c&&R===c.id,isDisabled:!!R||!c,leftIcon:r.jsx(Ke,{fontSize:".775rem"}),children:"Отменить"})})]})]})})},e.id)})})]},e))}),!S&&se.length>0&&r.jsx(Ve,{spacing:3,align:"stretch",mt:4,pt:4,borderTopWidth:"1px",borderColor:ge,children:se.map(e=>{var i;return r.jsx(Er,{sx:{animation:`${qo} 500ms ease-out forwards`},borderRadius:"xl",borderWidth:"1px",borderColor:ge,bg:he,p:4,children:r.jsxs(Ne,{align:"center",spacing:3,justify:"space-between",children:["regulation"!==s?r.jsxs(r.Fragment,{children:[r.jsx(Re,{size:"sm",name:e.author?e.author.name||e.author.email:"?",src:null==(i=e.author)?void 0:i.avatarUrl,bg:"gray.300",_dark:{bg:"gray.600"}}),r.jsxs(Ve,{align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"700",children:e.author?e.author.name||e.author.email||`ID ${e.author.id}`:"Неизвестно"}),r.jsx(Ar,{fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},children:Qo(e.createdAt)})]})]}):r.jsx(Ar,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:Qo(e.createdAt)}),r.jsx(Ar,{fontSize:"xs",color:"gray.400",_dark:{color:"gray.500"},ml:"auto",children:"Удалено (лимит версий)"})]})},`leaving-${e.id}`)})})]})})]})]}),"regulation"===s&&Y&&r.jsxs(Yr,{isOpen:!!Y,onClose:()=>X(null),isCentered:!0,scrollBehavior:"inside",blockScrollOnMount:!0,motionPreset:"slideInBottom",children:[r.jsx(Xr,{bg:"blackAlpha.600",backdropFilter:"blur(4px)"}),r.jsxs(Gr,{boxShadow:"2xl",borderRadius:"1rem",maxW:"800px",w:"800px",maxH:"90vh",minH:0,display:"flex",flexDir:"column",overflow:"hidden",children:[r.jsx(Qr,{py:"4",borderBottomWidth:"1px",borderColor:ge,flexShrink:0,children:r.jsxs(Ve,{align:"stretch",spacing:2,children:[r.jsxs(Ne,{justify:"space-between",align:"center",flexWrap:"wrap",gap:2,children:[r.jsxs(Ne,{align:"center",spacing:3,flex:1,minW:0,children:[!(Y.savedForever||"restore"===Y.changeType)&&r.jsx(Mr,{label:Be&&!Y.savedForever?Le:Y.savedForever?"Снять закрепление":"Закрепить",placement:"bottom",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Dr,{"aria-label":Y.savedForever?"Снять закрепление":"Закрепить",size:"sm",variant:"ghost",borderRadius:"99px",color:Y.savedForever?"gray.700":"gray.500",_dark:{color:Y.savedForever?"gray.200":"gray.400"},bg:Y.savedForever?"gray.100":void 0,_hover:Y.savedForever?{bg:"gray.100",_dark:{bg:"gray.600"}}:{bg:"gray.100",_dark:{bg:"gray.600"},color:"gray.700"},icon:Y.savedForever?r.jsx(dr,{size:16}):r.jsx(cr,{size:16}),isLoading:q===Y.id,isDisabled:Be&&!Y.savedForever,onClick:async()=>{await er(Y.id,!Y.savedForever),X(e=>e?{...e,savedForever:!e.savedForever}:null)}})})}),r.jsxs(Ar,{fontSize:"1.125rem",fontWeight:"700",children:["Версия ",(()=>{const e=j.findIndex(e=>e.id===(null==Y?void 0:Y.id));return e>=0?j.length-e:1})()," · ",zi(new Date(Y.createdAt),"d MMMM yyyy, HH:mm",{locale:ni}),"restore"===Y.changeType?" · Восстановление":""]})]}),r.jsx(Kr,{position:"relative",top:0,right:0,borderRadius:"99px"})]}),"restore"===Y.changeType&&Y.restoredFromVersion&&r.jsxs(Ar,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["Восстановлено до версии ",(()=>{const e=j.findIndex(e=>{var r;return e.id===(null==(r=Y.restoredFromVersion)?void 0:r.id)});return e>=0?j.length-e:"?"})()," от ",zi(new Date(Y.restoredFromVersion.createdAt),"d MMMM yyyy, HH:mm",{locale:ni})]}),(Y.savedForever||"restore"===Y.changeType)&&r.jsxs(Ne,{align:"center",spacing:3,justify:"space-between",w:"100%",children:[r.jsxs(Ne,{align:"center",spacing:3,children:[r.jsx(Re,{size:"sm",boxShadow:"base",n
12ame:rr(Y),src:null==(b=Y.author)?void 0:b.avatarUrl,bg:"gray.300",_dark:{bg:"gray.600"}}),r.jsxs(Ve,{align:"start",spacing:0,children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"700",children:rr(Y)}),r.jsxs(Ar,{fontSize:"xs",color:"gray.500",_dark:{color:"gray.400"},children:["Версия ",(()=>{const e=j.findIndex(e=>e.id===(null==Y?void 0:Y.id));return e>=0?j.length-e:1})()," · ",zi(new Date(Y.createdAt),"d MMMM yyyy, HH:mm",{locale:ni})]})]})]}),r.jsx(Mr,{label:Be&&!Y.savedForever?Le:Y.savedForever?"Снять закрепление":"Закрепить",placement:"bottom",children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(Dr,{"aria-label":Y.savedForever?"Снять закрепление":"Закрепить",size:"sm",variant:"ghost",borderRadius:"99px",color:Y.savedForever?"gray.700":"gray.500",_dark:{color:Y.savedForever?"gray.200":"gray.400"},bg:Y.savedForever?"gray.100":void 0,_hover:Y.savedForever?{bg:"gray.100",_dark:{bg:"gray.600"}}:{bg:"gray.100",_dark:{bg:"gray.600"},color:"gray.700"},icon:Y.savedForever?r.jsx(dr,{size:16}):r.jsx(cr,{size:16}),isLoading:q===Y.id,isDisabled:Be&&!Y.savedForever,onClick:async()=>{await er(Y.id,!Y.savedForever),X(e=>e?{...e,savedForever:!e.savedForever}:null)}})})})]})]})}),r.jsx(Jr,{flex:1,minH:0,overflowY:"auto",overflowX:"hidden",py:4,sx:{overscrollBehavior:"contain",WebkitOverflowScrolling:"touch"},children:r.jsx(Er,{w:"100%",minH:0,children:r.jsx(e.Suspense,{fallback:null,children:r.jsx(Ko,{previewContent:null==(m=Y.snapshot)?void 0:m.content,previewBgConfig:null==(f=Y.snapshot)?void 0:f.bgConfig,showHeader:!1})})},null==Y?void 0:Y.id)}),r.jsx(Ci,{borderTopWidth:"1px",borderColor:ge,py:4,flexShrink:0,children:r.jsxs(Ne,{w:"100%",justify:"flex-end",spacing:3,children:[r.jsx(Ir,{variant:"ghost",onClick:()=>X(null),borderRadius:"40px",fontSize:"0.875rem",children:"Закрыть"}),r.jsx(Ir,{bgColor:"#4F378A",color:"white",borderRadius:"40px",fontSize:"0.875rem",_hover:{opacity:.85},_active:{opacity:1},leftIcon:r.jsx(Ke,{fontSize:".875rem"}),onClick:()=>{Je(Y),X(null)},isLoading:R===(null==Y?void 0:Y.id),isDisabled:!!R,children:"Восстановить"})]})})]})]}),r.jsxs(Yr,{isOpen:E,onClose:Qe,isCentered:!0,children:[r.jsx(Xr,{bg:"rgba(0,0,0,0.35)",backdropBlur:4,backdropFilter:"blur(4px)"}),r.jsx(Gr,{boxShadow:"4px 4px 15px rgba(0, 0, 0, 0.15)",borderRadius:"1rem",mx:4,px:"30px",py:"20px",children:r.jsxs(Ve,{align:"start",w:"100%",spacing:"20px",children:[r.jsx(Qr,{p:"0",w:"100%",children:r.jsx(Ar,{fontSize:"1.125rem",fontWeight:"700",children:"regulation"===s?"Восстановить версию?":"Отменить изменение?"})}),r.jsx(Kr,{borderRadius:"99px",mt:"5px"}),r.jsx(Jr,{p:"0",w:"100%",children:A?r.jsxs(Br,{status:"error",borderRadius:"md",mb:2,children:[r.jsx(Lr,{}),A]}):r.jsxs(Ve,{spacing:4,children:[r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",color:"gray.600",_dark:{color:"gray.400"},children:"regulation"===s?"Документ будет восстановлен до выбранной версии. Текущее содержимое будет заменено содержимым этой версии.":"Выбранное изменение документа будет отменено, вслед за ним будут отменены и все изменения идущие выше."}),r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",color:"gray.600",_dark:{color:"gray.400"},children:"regulation"===s?"Это действие создаст новую запись в истории версий.":"Это действие создаст новую запись в истории изменений."})]})}),r.jsx(Ci,{p:"0",w:"100%",children:r.jsxs(Ne,{w:"100%",spacing:"auto",p:"0",children:[r.jsx(Ir,{variant:"ghost",onClick:Qe,borderRadius:"40px",h:"40px",fontSize:"0.875rem",fontWeight:"400",children:"regulation"===s?"Нет, не восстанавливать":"Нет, не отменять"}),r.jsx(ki,{}),r.jsx(Ir,{onClick:async()=>{if(T)if(t){D(null),I(T.id);try{const e=await V(t,T.id);Qe();const r=null==l?void 0:l(e);r&&"function"==typeof r.then&&await r,n()}catch(e){const r=String((null==e?void 0:e.message)??(null==e?void 0:e.error)??e??"Ошибка восстановления");W(r),D(r)}finally{I(null)}}else D("Не указана инструкция")},isLoading:!!R,bgColor:"#4F378A",color:"white",borderRadius:"40px",fontSize:"0.875rem",fontWeight:"400",_hover:{opacity:.75},_active:{opacity:1},children:"regulation"===s?"Да, восстановить":"Да, отменить"})]})})]})})]})]})};function cn(r,i){var o;const n=Wi(),t=(null==i?void 0:i.id)??null,[s,l]=e.useState(null),a=e.useRef(null),d=e.useCallback(e=>{e&&!0===e.locked?l(e):l(null)},[]);e.useEffect(()=>{const e=Number(r);
12if(!Number.isFinite(e))return void l(null);let i=!1;null!=t&&X(e).then(e=>{i||d(e)}).catch(()=>{});const o=r=>{Number(null==r?void 0:r.instructionId)===e&&d(r)};return n.on("instruction:lock",o),()=>{i=!0,n.off("instruction:lock",o)}},[n,r,t,d]),e.useEffect(()=>{if(a.current&&(clearTimeout(a.current),a.current=null),!(null==s?void 0:s.expiresAt))return;const e=new Date(s.expiresAt).getTime()-Date.now();if(!(e<=0))return a.current=setTimeout(()=>l(null),e+1e3),()=>{a.current&&clearTimeout(a.current),a.current=null};l(null)},[null==s?void 0:s.expiresAt]);const c=Boolean(s&&Number(null==(o=s.user)?void 0:o.id)===Number(null==i?void 0:i.id));return e.useMemo(()=>({lock:s,isHolder:c,isLocked:Boolean(s)&&("recording"===s.kind||!c)}),[s,c])}function pn(r,i){e.useEffect(()=>{const e=Number(r);if(!Number.isFinite(e)||!i)return;let o=!1;const n=()=>{o||G(e,{kind:"review",proposalUuid:i}).catch(()=>{})};n();const t=window.setInterval(n,45e3);return()=>{o=!0,window.clearInterval(t),Y(e).catch(()=>{})}},[r,i])}const xn="rgba(50, 62, 88, 0.72)",un=xn,hn="rgba(255, 255, 255, 0.1)",gn={backdropFilter:"blur(16px) saturate(1.15)",WebkitBackdropFilter:"blur(16px) saturate(1.15)",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08)"},bn="rgba(255, 255, 255, 0.75)",mn="#4DBCF0",fn={position:"relative",width:"max-content",minWidth:"min-content",margin:"0 auto",overflow:"visible",padding:20},vn={position:"relative",borderRadius:16,overflow:"visible"},jn={position:"absolute",inset:0,borderRadius:16,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:0},yn={position:"absolute",inset:0,borderRadius:16,overflow:"hidden",pointerEvents:"none",zIndex:1},Sn={position:"absolute",inset:0,border:"1px solid rgba(255, 255, 255, 0.1)",boxShadow:"inset 0 1px 0 rgba(255, 255, 255, 0.08)","--glass-tint-bg":xn},wn={position:"relative",width:"max-content",maxWidth:"calc(100vw - 24px)",minWidth:"min-content",margin:"0 auto",overflow:"visible",padding:0},Cn={position:"relative",borderRadius:9999,overflow:"hidden"},kn={position:"absolute",inset:0,borderRadius:9999,border:"1px solid rgba(60, 60, 67, 0.18)",boxShadow:"0 12px 28px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.92), inset 0 -1px 0 rgba(255, 255, 255, 0.2)",pointerEvents:"none",zIndex:0},zn={position:"absolute",inset:0,borderRadius:9999,overflow:"hidden",pointerEvents:"none",zIndex:1},Wn={position:"absolute",inset:0,border:"1px solid rgba(60, 60, 67, 0.18)",boxShadow:"inset 0 1px 0 rgba(255, 255, 255, 0.92), inset 0 -1px 0 rgba(255, 255, 255, 0.2)","--glass-tint-bg":"rgba(255, 255, 255, 0.65)"},Rn={position:"relative",zIndex:2,display:"flex",height:46,alignItems:"center",justifyContent:"center",gap:4,padding:"3px 6px",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"},Fn={initial:{opacity:0,y:28},animate:{opacity:1,y:0},transition:{duration:.52,ease:[.16,1,.3,1]}},In={position:"relative",zIndex:2,display:"flex",height:58,alignItems:"center",justifyContent:"center",gap:8,padding:"8px 10px",overflow:"visible"};function An(r){const i=[];return e.Children.forEach(r,r=>{null!=r&&!1!==r&&(e.isValidElement(r)&&r.type===e.Fragment?i.push(...An(r.props.children)):i.push(r))}),i}function Dn({children:i,iconSize:o=40,iconMagnification:n=60,disableMagnification:t=!1,interactionPaused:s=!1,iconDistance:l=140,direction:a="middle",variant:d="desktop",style:c,className:p,...x}){const u=Ei(1/0),h="mobile"===d;e.useEffect(()=>{s&&u.set(1/0)},[s,u]);const g=t||s,b="top"===a?"flex-start":"bottom"===a?"flex-end":"center",m=An(i).map((r,i)=>{const t=r.key??i;return function(r){var i;return e.isValidElement(r)&&(r.type===En||"DockIcon"===(null==(i=r.type)?void 0:i.displayName))}(r)?e.cloneElement(r,{key:t,variant:r.props.variant??d,mouseX:u,size:r.props.size??o,magnification:r.props.magnification??n,disableMagnification:r.props.disableMagnification??g,distance:r.props.distance??l}):e.isValidElement(r)?e.cloneElement(r,{key:t,variant:r.props.variant??d}):r});return r.jsx(Hr.div,{onMouseMove:e=>{s||u.set(e.pageX)},onMouseLeave:()=>u.set(1/0),className:p,style:{...h?wn:fn,...c},...x,children:r.jsxs("div",{"data-dock-frame":"true",style:h?Cn:vn,children:[r.jsx("div",{"aria-hidden":!0,style:h?kn:jn}),r.jsx("div",{"aria-hidden":!0,style:h?zn:yn,children:r.jsx(Di,{width:"100%",height:"100%",borderRadius:h?9999:16,borderWidth:h?.05:void 0,brightness:h?65:void 0,opacity:h?.93:void 0,backgroundOpacity:h?.65:.72,saturation:h?1:1.15,blur:h?18:16,displace:h?3.9:4,distortionScale:h?-180:-55,redOffset:0,greenOffset:h?-13:2,blueOffset:h?20:4,mixBlendMode:h?"screen":void 0,style:h?Wn:Sn})}),r.jsx("div",{style:h?Rn:{...In,alignItems:b},children:m})]})})}function En({size:i=40,magnification:o=60,disableMagnification:n=!1,distance:t=140,mouseX:s,badge:l=0,tooltip:a,tooltipDisabled:d,children:c,style:p,className:x,onClick:u,onKeyDown:h,role:g,tabIndex:b,"aria-label":m,variant:f="desktop",...v}){const j=e.useRef(null),y=Ei(1/0),S=Math.max(6,.2*i),w=Boolean(u),C="mobile"===f,k=n?i:o,z=ro(s??y,e=>{var r;if(!Number.isFinite(e))return t+1;const i=(null==(r=j.current)?void 0:r.getBoundingClientRect())??{x:0,width:0};return e-i.x-i.width/2}),W=ro(z,e=>!Number.isFinite(e)||Math.abs(e)>t?i:e<=0?i+(k-i)*(1+e/t):i+(k-i)*(1-e/t)),R=_i(W,{mass:.1,stiffness:150,damping:12});return r.jsx(Hr.div,{ref:j,className:x,role:g??(w?"button":void 0),tabIndex:b??(w?0:void 0),"aria-label":m,onClick:u,onKeyDown:h??(w?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),null==u||u(e))}:void 0),style:{width:R,height:R,padding:S,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"9999px",cursor:w?"pointer":"default",flexShrink:0,transition:n?"background-color 0.15s ease":void 0,...p},whileHover:n?{backgroundColor:C?"rgba(79, 55, 138, 0.08)":"rgba(255, 255, 255, 0.1)"}:void 0,whileTap:C&&w?{scale:.9}:void 0,...v,children:r.jsxs("div",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[a&&!C?r.jsx(Ai,{label:a,isDisabled:d,children:c}):c,l>0&&r.jsx("span",{style:{position:"absolute",top:-5,right:-7,display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:18,height:18,padding:"0 4px",boxSizing:"border-box",borderRadius:9999,background:"#E53935",color:"#fff",fontSize:11,fontWeight:700,lineHeight:1,border:"2px s
12olid #fff",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.28)",pointerEvents:"none",zIndex:1},children:l>9?"9+":l})]})})}function _n({variant:e="desktop"}){const i="mobile"===e;return r.jsx("div",{"aria-hidden":!0,style:{width:1,height:28,margin:"0 2px",background:i?"rgba(60, 60, 67, 0.18)":"rgba(255, 255, 255, 0.14)",flexShrink:0,borderRadius:1}})}En.displayName="DockIcon",_n.displayName="DockDivider";const Mn=["#FF9500","#FFBF00","#1FA6E4","#267EDB","#5B2AD2","#CF2AD2","#D22A70"],Tn=["#EBD4F7","#FFA6B8","#FFB98E","#FFE66D","#74E2D7","#85B6FF","#81D3F8"];function On({targetColor:e,accentColor:i,commentsEnabled:o=!0,onTargetColorChange:n,onAccentColorChange:t,onCommentsToggle:s,locked:l=!1,updateLocked:a=!1,onOpenLicenseModal:d,onStartProTest:c,isProTested:p=!1,compact:u=!1}){return r.jsxs(Er,{position:"relative",children:[r.jsxs(Ve,{align:"stretch",spacing:u?3:4,p:u?3:4,minW:"260px",opacity:l||a?.45:1,pointerEvents:l||a?"none":"auto",children:[r.jsx(Er,{children:r.jsx(Ar,{fontSize:"sm",fontWeight:"600",color:"gray.200",mb:2,children:"Настройки инструкции"})}),r.jsxs(Ve,{align:"stretch",spacing:2,children:[r.jsx(Ar,{fontSize:"xs",fontWeight:"500",color:"gray.400",children:"Цвет цели клика"}),r.jsx(ir,{compact:!0,theme:"dark",palette:Mn,targetColor:e,onColorChange:n})]}),r.jsx(ye,{borderColor:"rgba(255, 255, 255, 0.14)"}),r.jsxs(Ve,{align:"stretch",spacing:2,children:[r.jsx(Ar,{fontSize:"xs",fontWeight:"500",color:"gray.400",children:"Цвет оформления"}),r.jsx(ir,{compact:!0,theme:"dark",palette:Tn,targetColor:i,onColorChange:t})]}),r.jsx(ye,{borderColor:"rgba(255, 255, 255, 0.14)"}),r.jsxs(Ne,{justify:"space-between",align:"center",children:[r.jsx(Ar,{fontSize:"xs",fontWeight:"500",color:"gray.200",children:"Комментарии"}),r.jsx(x,{colorScheme:"green",size:"sm",isChecked:o,onChange:s})]})]}),!l&&a&&r.jsx(Er,{position:"absolute",inset:0,bg:"rgba(44, 51, 73, 0.73)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,backdropFilter:"blur(2px)",borderRadius:"14px",px:3,children:r.jsx(Ar,{userSelect:"none",pointerEvents:"none",color:"white",fontWeight:"400",fontSize:"sm",textAlign:"center",children:"Идёт обновление инструкции — настройки временно закрыты"})}),l&&r.jsxs(Er,{position:"absolute",inset:0,bg:"rgba(44, 51, 73, 0.73)",display:"flex",flexDir:"column",alignItems:"center",justifyContent:"center",zIndex:2,backdropFilter:"blur(2px)",borderRadius:"14px",px:3,children:[r.jsxs(Ar,{userSelect:"none",pointerEvents:"none",color:"white",fontWeight:"400",fontSize:"sm",textAlign:"center",mb:3,children:["Данный функционал доступен в ",r.jsx("b",{children:"Steppo BASIC"})]}),r.jsx(Ir,{fontSize:"xs",fontWeight:"500",px:"1rem",h:"33px",borderRadius:"99px",border:"1px solid",borderColor:"green.600",boxShadow:"sm",colorScheme:"green",onClick:d,children:r.jsxs(Ne,{spacing:"5px",children:[r.jsx(k,{fontSize:"1rem",color:"#ED8936"}),r.jsxs(Ar,{children:["Купить ",r.jsx("b",{children:"BASIC"})]})]})}),!p&&c&&r.jsx(Ye,{mt:"10px",userSelect:"none",textDecoration:"underline",color:"#FFFFFF",onClick:c,fontSize:"xs",children:"Разблокировать PRO на 7 дней"})]})]})}function Pn({targetColor:i,accentColor:o,commentsEnabled:n,onTargetColorChange:t,onAccentColorChange:s,onCommentsToggle:l,locked:a=!1,updateLocked:d=!1,onOpenLicenseModal:c,onStartProTest:p,isProTested:x=!1,disableMagnification:u=!1,onOpenChange:h,tooltip:v="Настройки инструкции",variant:j="desktop"}){const[S,w]=e.useState(!1),C="mobile"===j,k=e=>{w(e),null==h||h(e)};return r.jsxs(g,{placement:"top",isLazy:!0,gutter:14,isOpen:S,onOpen:()=>k(!0),onClose:()=>k(!1),children:[r.jsx(Ai,{label:v,isDisabled:S||C,shouldWrapChildren:!0,children:r.jsx(b,{children:r.jsx(Er,{as:"span",display:"inline-flex",children:r.jsx(En,{"aria-label":v,disableMagnification:u,variant:j,style:S?{backgroundColor:C?"rgba(79, 55, 138, 0.1)":"rgba(255, 255, 255, 0.12)"}:void 0,children:r.jsx(Er,{as:"span",display:"inline-flex",color:C?"rgba(26, 26, 26, 0.72)":bn,children:r.jsx(y,{size:24,strokeWidth:1.5})})})})})}),r.jsx(Pr,{children:r.jsx(m,{w:"auto",maxW:"320px",bg:un,border:"1px solid",borderColor:hn,borderRadius:"14px",sx:gn,_focus:{boxShadow:gn.boxSh
12adow},zIndex:9999,onClick:e=>e.stopPropagation(),children:r.jsx(f,{p:0,children:r.jsx(On,{compact:!0,targetColor:i,accentColor:o,commentsEnabled:n,onTargetColorChange:t,onAccentColorChange:s,onCommentsToggle:l,locked:a,updateLocked:d,onOpenLicenseModal:()=>{k(!1),window.setTimeout(()=>null==c?void 0:c(),0)},onStartProTest:p,isProTested:x})})})})]})}const $n=["linear(to-r, #60a5fa 0%, #22d3ee 50%, #a78bfa 100%)","linear(to-r, #f093fb 0%, #f5576c 100%)","linear(to-r, #4facfe 0%, #00f2fe 100%)","linear(to-r, #43e97b 0%, #38f9d7 100%)","linear(to-r, #fa709a 0%, #fee140 100%)","linear(to-r, #30cfd0 0%, #330867 100%)","linear(to-r, #a8edea 0%, #fed6e3 100%)","linear(to-r, #ff9a9e 0%, #fecfef 100%)","linear(to-r, #ffecd2 0%, #fcb69f 100%)","linear(to-r, #ff8a80 0%, #ea6100 100%)","linear(to-r, #667eea 0%, #764ba2 100%)","linear(to-r, #f093fb 0%, #4facfe 100%)"],Bn=["#60a5fa","#a78bfa","#22d3ee","#43e97b","#fee140","#fa709a"];const Ln=[{value:"gradient",label:"Градиент"},{value:"color",label:"Цвет"},{value:"image",label:"Фото"},{value:"off",label:"Без фона"}],Hn={title:"gray.200",label:"gray.400",body:"gray.400",tabsBg:"rgba(255, 255, 255, 0.08)",tabActiveBg:"rgba(255, 255, 255, 0.14)",tabActiveColor:"gray.100",tabColor:"gray.400",tabHoverBg:"rgba(255, 255, 255, 0.06)"},Un={title:"gray.800",label:"gray.500",body:"gray.500",tabsBg:"gray.100",tabActiveBg:"white",tabActiveColor:"gray.800",tabColor:"gray.600",tabHoverBg:"blackAlpha.50"};function Nn({bgConfig:i,onBgConfigChange:o,pageId:n,compact:t=!1,variant:s="dark",mobileSheet:l=!1}){const a="dark"===s?Hn:Un,d=je(),c=e.useRef(null),[p,x]=e.useState("gradient"),[u,h]=e.useState(0),[g,b]=e.useState("color"===(null==i?void 0:i.type)?i.value:Bn[0]),[m,f]=e.useState(!1),v=Mi(i);e.useEffect(()=>{var e;if(i)if("gradient"===i.type){x("gradient");const r=(e=i.value)?$n.findIndex(r=>r===e):-1;h(r>=0?r:0)}else"color"===i.type?(x("color"),b(i.value)):"image"===i.type?x("image"):x("off");else x("off")},[i]);const j=e=>{null==o||o(e)},y=e=>{if(x(e),"gradient"===e){const e=$n[u]??$n[0];return void j({type:"gradient",value:e})}"color"!==e?"image"!==e?j({type:"off",value:null}):"image"===(null==i?void 0:i.type)&&i.value&&j({type:"image",value:i.value,coverOffsetY:v}):j({type:"color",value:g})};return r.jsxs(Ve,{align:"stretch",spacing:l?5:t?3:4,p:l?0:t?3:4,minW:l?0:"260px",w:"100%",children:[r.jsxs(Er,{children:[r.jsx(Ar,{fontSize:l?"md":"sm",fontWeight:"600",color:a.title,mb:2,children:"Фон страницы"}),r.jsx(Oi,{columns:2,spacing:1,p:"3px",bg:a.tabsBg,borderRadius:"10px",children:Ln.map(e=>{const i=p===e.value;return r.jsx(Ir,{size:"xs",h:l?"36px":"28px",fontSize:l?"sm":"xs",fontWeight:"500",borderRadius:"8px",variant:"ghost",bg:i?a.tabActiveBg:"transparent",color:i?a.tabActiveColor:a.tabColor,boxShadow:i&&"light"===s?"sm":"none",_hover:{bg:i?a.tabActiveBg:a.tabHoverBg},onClick:()=>y(e.value),children:e.label},e.value)})})]}),"gradient"===p&&r.jsxs(Er,{children:[r.jsx(Ar,{fontSize:"xs",fontWeight:"500",color:a.label,mb:2,children:"Выберите градиент"}),r.jsx(Oi,{columns:4,spacing:2,children:$n.map((e,i)=>{const o=u===i;return r.jsx(Er,{as:"button",type:"button","aria-label":`Градиент ${i+1}`,"aria-pressed":o,w:"100%",h:l?"48px":"36px",borderRadius:l?"10px":"8px",bgGradient:e,cursor:"pointer",position:"relative",overflow:"hidden",border:"1px solid",borderColor:o?"#4F378A":"transparent",outline:"none",transition:"border-color 0.15s ease",onClick:()=>(e=>{h(e),j({type:"gradient",value:$n[e]})})(i)},i)})})]}),"color"===p&&r.jsxs(Er,{children:[r.jsx(Ar,{fontSize:"xs",fontWeight:"500",color:a.label,mb:2,children:"Выберите цвет"}),r.jsx(ir,{compact:!0,theme:"dark"===s?"dark":"light",palette:Bn,targetColor:g,onColorChange:e=>{b(e),j({type:"color",value:e})}})]}),"image"===p&&r.jsxs(Ve,{align:"stretch",spacing:3,children:[r.jsx(Ar,{fontSize:"xs",fontWeight:"500",color:a.label,children:"Изображение в шапке страницы"}),"image"===(null==i?void 0:i.type)&&i.value?r.jsx(Er,{borderRadius:"10px",overflow:"hidden",border:"1px solid",borderColor:"dark"===s?"whiteAlpha.200":"gray.200",h:l?"120px":"88px",position:"relative",children:r.jsx(mi,{src:i.value,alt:"",objectFit:"cover",objectPosition:"center",w:"100%",h:"100%"})}):r.jsx(Ar,{fontSize:"xs",color:a.body,lineHeight:"1.5",children:"Загрузите своё изображение — оно появится в декоративной области сверху страницы."}),r.jsx("input",{ref:c,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",hidden:!0,onChange:async e=>{var r;const i=null==(r=e.target.files)?void 0:r[0];if(e.target.value="",i)if(i.type.startsWith("image/"))if(n){f(!0);try{const e=await K(n,i);if(!(null==e?void 0:e.url))throw new Error("Не удалось получить ссылку на изображение");j({type:"image",value:e.url,coverOffsetY:0}),d({title:"Изображение загружено",status:"success",duration:2e3,isClosable:!0})}catch(o){d({title:"Ошибка загрузки",description:o.message||"Не удалось загрузить изображение",status:"error",duration:4e3,isClosable:!0})}finally{f(!1)}}else d({title:"Страница не готова",description:"Подождите загрузки документа и попробуйте снова",status:"warning",duration:3e3,isClosable:!0});else d({title:"Неверный формат",description:"Можно загрузить только изображение",status:"warning",duration:3e3,isClosable:!0})}}),r.jsx(Ir,{size:l?"md":"sm",h:l?"44px":void 0,borderRadius:l?"12px":void 0,colorScheme:"purple",variant:"dark"===s?"solid":"outline",isLoading:m,loadingText:"Загрузка...",onClick:()=>{var e;return null==(e=c.current)?void 0:e.click()},isDisabled:!n,children:"image"===(null==i?void 0:i.type)&&i.value?"Заменить изображение":"Загрузить изображение"}),"image"===(null==i?void 0:i.type)&&i.value&&r.jsx(Ar,{fontSize:"xs",color:a.body,lineHeight:"1.5",children:"Позицию можно менять перетаскиванием прямо на обложке страницы."}),"image"===(null==i?void 0:i.type)&&i.value&&0!==v&&r.jsx(Ir,{size:"xs",variant:"ghost",color:a.tabColor,_hover:{color:a.tabActiveColor},onClick:()=>{"image"===(null==i?void 0:i.type)&&j(Ti(i,0))},children:"Сбросить позицию"}),"image"===(null==i?void 0:i.type)&&i.value&&r.jsx(Ir,{size:"xs",variant:"ghost",color:a.tabColor,_hover:{color:a.tabActiveColor},onClick:()=>{j({type:"off",value:null})},children:"Удалить изображение"})]}),"off"===p&&r.jsx(Ar,{fontSize:"xs",color:a.body,lineHeight:"1.5",children:"Страница отображается на нейтральном фоне без декоративного оформления."})]})}const Vn="#FFFFFF",Yn="#37352F",Xn="#787774",Gn="#9B9A97",Kn="rgba(55,53,47,0.09)",qn=e=>{if(!e)return"—";const r=new Date(e);return Number.isNaN(r.getTime())?"—":zi(r,"d MMMM yyyy, HH:mm",{locale:ni})},Jn=e=>(null==e?void 0:e.isPersonal)?"Личная папка":"document"===(null==e?void 0:e.kind)?"public"===(null==e?void 0:e.isPublic)?"Командный доступ":"global"===(null==e?void 0:e.isPublic)?"ГлобаÐ
12»ÑŒÐ½Ñ‹Ð¹ доступ":"Не опубликовано":"team"===(null==e?void 0:e.isPublic)?"Доступ выбранным группам":"public"===(null==e?void 0:e.isPublic)?"Доступ по ссылке":"Доступ всей команде";function Qn({icon:e,label:i,children:o}){return r.jsxs(Ne,{align:"start",spacing:3,py:3,children:[r.jsx(Er,{color:Gn,pt:"2px",children:e}),r.jsxs(Er,{minW:0,flex:"1",children:[r.jsx(Ar,{color:Xn,fontSize:"12px",mb:.5,children:i}),o]})]})}function Zn({entity:i,isOpen:o,onClose:n,bgConfig:t,onBgConfigChange:s,pageId:l}){const[a,d]=e.useState(null),[c,p]=e.useState(!1),[x]=Ge("(max-width: 640px)"),u="document"===(null==i?void 0:i.kind);if(e.useEffect(()=>{if(!o||!u||!(null==i?void 0:i.id))return;let e=!1;return p(!0),B(i.id).then(({versions:r=[]})=>{var i;e||d((null==(i=r[0])?void 0:i.author)||null)}).catch(()=>{e||d(null)}).finally(()=>{e||p(!1)}),()=>{e=!0}},[null==i?void 0:i.id,u,o]),!i)return null;const h=i.author||i.creator||null,g=i.modifiedAt||i.updatedAt,b=(e=>(null==e?void 0:e.isPersonal)?{bg:"#F1EDF9",color:"#5B438E"}:"team"===(null==e?void 0:e.isPublic)?{bg:"#EAF2FF",color:"#2764B0"}:"public"===(null==e?void 0:e.isPublic)||"global"===(null==e?void 0:e.isPublic)?{bg:"#FFF1E6",color:"#B35A17"}:{bg:"#F1F3F5",color:"#59636E"})(i),m=u&&Boolean(s),f=r.jsxs(Ve,{align:"stretch",spacing:0,px:4,py:1,children:[r.jsx(Qn,{icon:r.jsx(hr,{size:16}),label:"Создал",children:r.jsxs(Ne,{spacing:2,children:[r.jsx(Re,{size:"xs",name:(null==h?void 0:h.name)||(null==h?void 0:h.email)||"Неизвестно",src:null==h?void 0:h.avatarUrl}),r.jsx(Ar,{fontSize:"sm",fontWeight:"500",children:(null==h?void 0:h.name)||(null==h?void 0:h.email)||"Неизвестно"})]})}),r.jsx(Qn,{icon:r.jsx(oo,{size:16}),label:"Дата создания",children:r.jsx(Ar,{fontSize:"sm",fontWeight:"500",children:qn(i.createdAt)})}),r.jsx(Qn,{icon:r.jsx(no,{size:16}),label:"Последнее изменение",children:r.jsx(Ar,{fontSize:"sm",fontWeight:"500",children:qn(g)})}),u&&r.jsx(Qn,{icon:r.jsx(hr,{size:16}),label:"Последний редактор",children:c?r.jsx(Or,{size:"sm",color:"#4F378A"}):r.jsxs(Ne,{spacing:2,children:[r.jsx(Re,{size:"xs",name:(null==a?void 0:a.name)||(null==a?void 0:a.email)||"Нет данных",src:null==a?void 0:a.avatarUrl}),r.jsx(Ar,{fontSize:"sm",fontWeight:"500",children:(null==a?void 0:a.name)||(null==a?void 0:a.email)||"Нет данных"})]})}),r.jsx(ye,{my:2,borderColor:Kn}),r.jsx(Qn,{icon:i.isPersonal?r.jsx(lo,{size:16}):r.jsx(to,{size:16}),label:"Доступ",children:r.jsx(Ie,{px:2,py:.5,borderRadius:"full",bg:b.bg,color:b.color,fontWeight:"500",children:Jn(i)})})]});return r.jsxs(Yr,{isOpen:o,onClose:n,size:x?"full":"md",isCentered:!x,motionPreset:"slideInBottom",children:[r.jsx(Xr,{bg:"rgba(15,15,15,0.4)",backdropFilter:"blur(2px)"}),r.jsxs(Gr,{"data-mobile-fullscreen-modal":"true",bg:Vn,borderRadius:x?0:"12px",border:"none",boxShadow:"0 14px 40px rgba(15,15,15,0.16)",overflow:"hidden",maxW:x?"100%":"540px",m:x?0:4,h:x?"var(--app-height, 100vh)":void 0,maxH:x?"var(--app-height, 100vh)":"calc(100vh - 2rem)",display:"flex",flexDirection:"column",children:[r.jsxs(We,{px:4,pt:x?"calc(env(safe-area-inset-top, 0px) + 0.75rem)":3.5,pb:3,borderBottom:"1px solid",borderColor:Kn,align:"center",gap:3,flexShrink:0,children:[r.jsxs(Er,{flex:"1",minW:0,children:[r.jsx(Ar,{color:Xn,fontSize:"12px",mb:1,children:m?"Настройки документа":u?"Документ":"Папка"}),r.jsx(Ar,{color:Yn,fontSize:"15px",fontWeight:"600",noOfLines:1,children:i.title||i.name})]}),r.jsx(Dr,{"aria-label":"Закрыть",icon:r.jsx(Pi,{size:20,strokeWidth:1.8}),size:"sm",minW:"38px",h:"38px",borderRadius:"12px",variant:"ghost",bg:"#F4F3F1",color:Yn,_hover:{bg:"#ECEAE7"},_active:{bg:"#E4E1DD"},onClick:n})]}),r.jsx(Jr,{p:0,display:"flex",flexDirection:"column",minH:0,overflow:"hidden",children:m?r.jsxs($i,{display:"flex",flexDirection:"column",flex:"1",minH:0,colorScheme:"purple",children:[r.jsx(Bi,{mx:4,mt:3,p:"3px",border:"none",borderRadius:"12px",bg:"#F3F2F0",flexShrink:0,children:["Сведения","Оформление"].map(e=>r.jsx(Li,{flex:"1",h:"36px",borderRadius:"9px",border:"none",fontSize:"sm",fontWeight:"600",color:Xn,_selected:{color:Yn,bg:"white",boxShadow:"0 1px 4px rgba(15,15,15,0.1)"},children:e},e))}),r.jsxs(Hi,{flex:"1",minH:0,overflowY:"auto",overscrollBehavior:"contain",sx:{WebkitOverflowScrolling:"touch"},children:[r.jsx(Ui,{p:0,pb:"calc(env(safe-area-inset-bottom, 0px) + 1rem)",children:f}),r.jsx(Ui,{px:4,pt:4,pb:"calc(env(safe-area-inset-bottom, 0px) + 1.5rem)",children:r.jsx(Nn,{bgConfig:t,onBgConfigChange:s,pageId:l,variant:"light",mobileSheet:!0})})]})]}):r.jsx(Er,{overflowY:"auto",pb:x?"env(safe-area-inset-bottom, 0px)":0,children:f})})]})]})}const et="#FFFFFF",rt="#4F378A",it="#402C72",ot="#36245F",nt="#111111",tt="#6B7280",st="#9CA3AF",lt="rgba(0, 0, 0, 0.06)",at="rgba(0, 0, 0, 0.03)";function dt(e){if(!e)return"Дата не указана";const r=new Date(e);return Number.isNaN(r.getTime())?"Дата не указана":zi(r,"d MMMM yyyy, HH:mm",{locale:ni})}function ct(e){const r=e%10,i=e%100;return 1===r&&11!==i?"раз":r>=2&&r<=4&&(i<12||i>14)?"раза":"раз"}function pt(e){return"TrialPro"===e?"пробного PRO":e}function xt(e){return(null==e?void 0:e.name)||(null==e?void 0:e.email)||"Автор не указан"}const ut=/https?:\/\/[^\s<>"'()\[\]{}]+/i;function ht(e){if("string"!=typeof e)return"";const r=e.match(ut);return r?r[0].replace(/[.,;:!?)\]}»"']+$/,"").trim():""}function gt({isOpen:i,onClose:n,instruction:t,currentUser:s,onOpenLicenseModal:l}){var a,d,c,x,u,h,g,b;const m=o(),f=je(),[v]=Ge("(max-width: 640px)"),{license:j,refreshLicense:y}=p(),[S,w]=e.useState(""),[C,k]=e.useState(!1),[z,W]=e.useState(!1),[R,F]=e.useState(null),I=(null==R?void 0:R.proposalUuid)||null,A=(null==R?void 0:R.quota)||null,D=!(I||!A)&&!1===A.allowed,E=!["PRO","TrialPro"].includes(null==A?void 0:A.licenseType),_=(null==t?void 0:t.authorId)??(null==(a=null==t?void 0:t.author)?void 0:a.id),M=null!=_&&null!=(null==s?void 0:s.id)&&String(_)===String(s.id)&&"FREE"===(null==j?void 0:j.type)&&!(null==j?void 0:j.isProTested),T=e.useMemo(()=>function(e,r){var i;const o=(e||[]).filter(e=>!e.isDeleted).sort((e,r)=>(e.order||0)-(r.order||0))[0],n=ht(null==o?void 0:o.text)||ht(null==o?void 0:o.description);if(n)return n;const t="string"==typeof(null==(i=null==o?void 0:o.elementInfo)?void 0:i.url)?o.elementInfo.url.trim():"";return t||("string"==typeof r?r.trim():"")}(null==t?void 0:t.steps,null==t?void 0:t.url),[null==t?void 0:t.steps,null==t?void 0:t.url]),P=!T||/^desctop/i.test(String((null==t?void 0:t.url)||"")),$=e.useMemo(()=>function(e){var r;const i=new Map;for(const s of e||[]){const e=null==(r=null==s?void 0:s.elementInfo)?void 0:r.viewport,o=Number(null==e?void 0:e.width),n=Number(null==e?void 0:e.he
12ight);if(!Number.isFinite(o)||!Number.isFinite(n)||o<200||n<200)continue;const t=`${Math.round(o)}x${Math.round(n)}`;i.set(t,(i.get(t)||0)+1)}if(!i.size)return null;const[o]=[...i.entries()].sort((e,r)=>r[1]-e[1])[0],[n,t]=o.split("x").map(Number);return{width:n,height:t}}(null==t?void 0:t.steps),[null==t?void 0:t.steps]),[B,L]=e.useState(null);e.useEffect(()=>{if(!i||$)return;const e=function(e){var r;return(null==(r=(e||[]).filter(e=>!e.isDeleted&&"string"==typeof e.s3Url&&e.s3Url).sort((e,r)=>(e.order||0)-(r.order||0))[0])?void 0:r.s3Url)||null}(null==t?void 0:t.steps);if(!e)return;let r=!1;const o=new Image;return o.onload=()=>{!r&&o.naturalWidth&&L({width:o.naturalWidth,height:o.naturalHeight})},o.src=e,()=>{r=!0}},[i,$,null==t?void 0:t.steps]);const H=$||(B?{width:Math.round(B.width/(window.devicePixelRatio||1)),height:Math.round(B.height/(window.devicePixelRatio||1)),fromScreenshot:!0}:null),U=e.useCallback(async()=>{if(null==t?void 0:t.id)try{const e=await q(t.id);F(e||null)}catch{}},[null==t?void 0:t.id]),N=e=>{const r=new URLSearchParams(window.location.search);r.get("update")?n():(r.set("update",e),n(),m({search:`?${r.toString()}`}))};e.useEffect(()=>{i&&(w(T||""),F(null),U())},[i,T,U]),e.useEffect(()=>{if(!i)return;const e=e=>{var r,i;if(e.source!==window||"STEPPO_EXTENSION"!==(null==(r=e.data)?void 0:r.source))return;if("recordingFinished"!==(null==(i=e.data)?void 0:i.type))return;const o=e.data.payload||{};"update"===o.mode&&o.proposalUuid&&N(o.proposalUuid)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[i,n,m]);const V=async()=>{if(S&&/^https?:\/\//i.test(S.trim())){k(!0);try{if(!(await Ri({toast:f})))return;const{available:e,payload:r}=await Fi();if(e&&((null==r?void 0:r.isRecording)||(null==r?void 0:r.isPaused)))return void f({title:(null==r?void 0:r.isPaused)?"⏸️ Запись на паузе":"⏺️ Запись уже идет",description:"Завершите текущую запись перед началом обновления",status:"warning",duration:4e3,isClosable:!0});Ii({authorId:null==s?void 0:s.id,targetInstructionId:t.id,instructionSlug:t.uuid,targetUrl:S.trim(),sourceScreenshot:B}),f({title:"Запись обновления запущена",description:"Пройдите процесс заново от начала до конца — изменения предложим после завершения",status:"success",duration:6e3,isClosable:!0}),n()}finally{k(!1)}}else f({title:"Нужен корректный URL",description:"Укажите адрес страницы, с которой начинается процесс",status:"warning",duration:4e3,isClosable:!0})};return r.jsxs(Yr,{isOpen:i,onClose:()=>!C&&n(),size:v?"full":"md",isCentered:!v,motionPreset:"slideInBottom",closeOnEsc:!C,closeOnOverlayClick:!C,children:[r.jsx(Xr,{bg:"rgba(15, 15, 15, 0.4)",backdropFilter:"blur(2px)"}),r.jsxs(Gr,{"data-mobile-fullscreen-modal":"true","data-mobile-update-fullscreen":v?"true":void 0,bg:et,borderRadius:v?0:"20px",border:"none",boxShadow:"0 14px 40px rgba(15, 15, 15, 0.16)",overflow:"hidden",w:v?"100%":void 0,h:v?"var(--app-height, 100vh)":"auto",maxW:v?"100%":"540px",m:v?0:4,maxH:v?"var(--app-height, 100vh)":"calc(100vh - 2rem)",display:"flex",flexDirection:"column",children:[r.jsxs(We,{px:4,pt:v?"calc(env(safe-area-inset-top, 0px) + 0.75rem)":3.5,pb:3,borderBottom:"1px solid",borderColor:lt,align:"center",gap:3,flexShrink:0,children:[r.jsxs(Er,{flex:"1",minW:0,children:[r.jsx(Ar,{color:tt,fontSize:"12px",mb:1,children:"Обновление инструкции"}),r.jsx(Ar,{color:nt,fontSize:"15px",lineHeight:"1.35",fontWeight:"600",noOfLines:1,children:(null==t?void 0:t.title)||"Без названия"})]}),r.jsx(Dr,{"aria-label":"Закрыть",icon:r.jsx(Pi,{size:20,strokeWidth:1.8}),size:"sm",minW:"38px",h:"38px",borderRadius:"full",variant:"ghost",bg:"#F4F3F1",color:nt,isDisabled:C,_hover:{bg:"#ECEAE7"},_active:{bg:"#E4E1DD"},onClick:n})]}),r.jsx(Jr,{p:0,display:"flex",flexDirection:"column",minH:0,overflowY:"auto",children:r.jsx(Ve,{spacing:"14px",alignItems:"stretch",children:I?r.jsxs(r.Fragment,{children:[r.jsxs(We,{position:"relative",align:"flex-start",ga
12p:"12px",m:4,p:"12px",borderRadius:"12px",bg:"#F7F7F6",children:[r.jsx(We,{w:"26px",h:"26px",flexShrink:0,align:"center",justify:"center",color:st,children:r.jsx(no,{size:15,strokeWidth:2})}),r.jsxs(Er,{minW:"0",flex:"1",children:[r.jsx(Ar,{pr:"64px",fontSize:"14px",lineHeight:"1.35",fontWeight:"500",color:nt,children:"Есть непринятые правки"}),r.jsxs(Ne,{mt:"6px",spacing:"6px",minW:0,children:[r.jsx(Re,{w:"18px",h:"18px",fontSize:"8px",name:xt(null==R?void 0:R.author),src:(null==(d=null==R?void 0:R.author)?void 0:d.avatarUrl)||void 0}),r.jsxs(Ar,{minW:0,fontSize:"12px",lineHeight:"1.35",color:st,noOfLines:1,children:[xt(null==R?void 0:R.author)," · ",dt(null==R?void 0:R.createdAt)]})]}),r.jsx(Ar,{mt:"3px",fontSize:"13px",lineHeight:"1.45",color:tt,children:"Сначала завершите текущее сравнение, затем можно будет запустить новую запись."})]}),r.jsxs(Ne,{position:"absolute",top:"10px",right:"10px",h:"24px",px:"6px",spacing:"6px",borderRadius:"6px",bg:"rgba(255, 255, 255, 0.72)",title:`Добавлено: ${(null==(c=null==R?void 0:R.counts)?void 0:c.added)||0}, удалено: ${(null==(x=null==R?void 0:R.counts)?void 0:x.removed)||0}`,"aria-label":`Добавлено: ${(null==(u=null==R?void 0:R.counts)?void 0:u.added)||0}, удалено: ${(null==(h=null==R?void 0:R.counts)?void 0:h.removed)||0}`,children:[r.jsxs(Ar,{fontSize:"12px",lineHeight:"1",fontWeight:"600",color:"#1B5E20",children:["+",(null==(g=null==R?void 0:R.counts)?void 0:g.added)||0]}),r.jsxs(Ar,{fontSize:"12px",lineHeight:"1",fontWeight:"600",color:"#8B1D1D",children:["−",(null==(b=null==R?void 0:R.counts)?void 0:b.removed)||0]})]})]}),(null==R?void 0:R.outdated)&&r.jsxs(We,{align:"flex-start",gap:"12px",mx:4,mb:4,p:"12px",borderRadius:"12px",bg:"#FFF7ED",children:[r.jsx(We,{w:"26px",h:"26px",flexShrink:0,align:"center",justify:"center",color:"#C2410C",children:r.jsx(Ni,{size:15,strokeWidth:2})}),r.jsxs(Er,{minW:"0",children:[r.jsx(Ar,{fontSize:"14px",lineHeight:"1.35",fontWeight:"500",color:"#7C2D12",children:"Инструкция изменилась после записи"}),r.jsx(Ar,{mt:"3px",fontSize:"13px",lineHeight:"1.45",color:"#9A3412",children:"Сравнение построено на прежнем состоянии шагов. Часть правок может не совпасть с текущим текстом и скриншотами, а при применении понадобится пересчитать сравнение."})]})]})]}):D?r.jsxs(Er,{px:4,py:4,children:[r.jsx(Ar,{mb:"6px",fontSize:"15px",lineHeight:"1.3",fontWeight:"600",color:nt,children:(null==A?void 0:A.limit)?"Обновления закончились":"Обновление пока недоступно"}),r.jsx(Ar,{fontSize:"14px",lineHeight:"1.5",color:tt,children:(null==A?void 0:A.limit)?E?`Эту инструкцию обновляли ${A.used} ${ct(A.used)} — столько даёт тариф ${pt(A.licenseType)}. На тарифе выше обновлений больше.`:`Эту инструкцию обновляли ${A.used} ${ct(A.used)} — это предел ${pt(A.licenseType)}. Дальше шаги правятся вручную в редакторе.`:"Повторный проход процесса перезаписывает шаги существующей инструкции — это платная возможность."}),M&&r.jsxs(Ar,{mt:"10px",fontSize:"13px",lineHeight:"1.45",color:st,children:["Тестовый период PRO открывает ",10," обновлений инструкции и остальной функционал на 7 дней."]})]}):P?r.jsxs(Er,{px:4,py:4,children:[r.jsxs(Ne,{spacing:"8px",mb:"6px",children:[r.jsx(We,{flexShrink:0,color:"#C2410C",children:r.jsx(Ni,{size:16,strokeWidth:2})}),r.jsx(Ar,{fontSize:"15px",lineHeight:"1.3",fontWeight:"600",color:nt,children:"Перезапись недоступна"})]}),r.jsx(Ar,{fontSize:"14px",lineHeight:"1.5",color:tt,children:"В инструкции нет веб-адреса первого шаÐ
12³Ð°. Обновить таким способом можно только запись из браузера."})]}):r.jsxs(Er,{px:4,py:4,children:[r.jsx(Ar,{mb:4,fontSize:"14px",lineHeight:"1.5",color:tt,children:"Повторите процесс в актуальном интерфейсе. После записи можно будет принять только нужные изменения."}),r.jsx(Ar,{fontSize:"12px",lineHeight:"1.2",color:tt,children:"Страница для записи"}),r.jsxs(ke,{mt:"8px",children:[r.jsx(Ae,{h:"42px",pointerEvents:"none",color:st,children:r.jsx(to,{size:16,strokeWidth:1.9})}),r.jsx(O,{value:S,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"!==e.key||C||V()},placeholder:"https://…",h:"42px",pl:"40px",borderRadius:"8px",borderColor:lt,bg:et,fontSize:"14px",color:nt,focusBorderColor:rt,_hover:{borderColor:"rgba(0, 0, 0, 0.12)"},_focusVisible:{boxShadow:"0 0 0 2px rgba(79, 55, 138, 0.12)"}})]}),r.jsx(Ar,{mt:"7px",fontSize:"12px",lineHeight:"1.4",color:st,children:"Используем адрес первого шага. При необходимости его можно изменить."}),r.jsxs(Ne,{mt:"16px",py:"12px",spacing:"12px",align:"flex-start",borderTop:"1px solid",borderColor:H?lt:"#FED7AA",children:[r.jsx(We,{mt:"1px",color:H?tt:"#C2410C",flexShrink:0,children:r.jsx(ao,{size:15,strokeWidth:1.9})}),r.jsxs(Er,{minW:"0",children:[r.jsx(Ar,{fontSize:"13px",lineHeight:"1.35",fontWeight:"500",color:H?nt:"#7C2D12",children:H?`Окно записи: ${H.width} × ${H.height}`:"Размер исходного окна не найден"}),r.jsx(Ar,{mt:"2px",fontSize:"12px",lineHeight:"1.4",color:H?st:"#9A3412",children:H?`Новое окно будет подогнано под исходную запись${H.fromScreenshot?" — размер определён по первому скриншоту":""}.`:"Новые скриншоты могут отличаться от текущих по ширине."})]})]})]})})}),r.jsx(Ci,{px:4,pt:3,pb:v?"calc(env(safe-area-inset-bottom, 0px) + 0.75rem)":3,borderTop:"1px solid",borderColor:lt,bg:et,flexShrink:0,children:D&&!I&&(M||E)?r.jsxs(Ne,{w:"100%",spacing:"8px",justify:"space-between",children:[r.jsx(Ir,{variant:"ghost",h:"40px",px:"16px",borderRadius:"full",fontSize:"14px",fontWeight:"500",color:tt,_hover:{bg:at,color:nt},isDisabled:z,onClick:n,children:"Понятно"}),r.jsx(Ir,{h:"40px",px:"20px",borderRadius:"full",flexShrink:0,bg:rt,color:"#FFFFFF",fontSize:"14px",fontWeight:"500",_hover:{bg:it},_active:{bg:ot},isLoading:z,loadingText:"Активируем",onClick:M?async()=>{if(!z){W(!0);try{await J(),f({title:"Тестовый период активирован",description:"Обновление инструкции и остальной функционал PRO доступны 7 дней",status:"success",duration:4e3,isClosable:!0}),await U()}catch(e){f({title:"Ошибка при активации тестового периода",description:e.message||"Не удалось активировать тестовый период.",status:"error",duration:4e3,isClosable:!0})}finally{W(!1),y()}}}:()=>{n(),null==l||l()},children:M?"Попробовать PRO":"Выбрать тариф"})]}):!P&&!D||I?r.jsxs(Ne,{w:"100%",spacing:"8px",justify:"space-between",children:[r.jsx(Ar,{minW:0,fontSize:"12px",lineHeight:"1.35",color:st,noOfLines:2,children:!I&&(null==A?void 0:A.limit)>0?1===A.left?"Это обновление — последнее из доступных":`Осталось ${A.left} из ${A.limit} обновлений`:""}),r.jsxs(Ne,{spacing:"8px",flexShrink:0,children:[r.jsx(Ir,{variant:"ghost",h:"40px",px:"16px",borderRadius:"full",fontSize:"14px",fontWeight:"500",color:tt,_hover:{bg:at,color:nt},onClick:n,isDisabled:C,children:"Отмена"}),r.jsx(Ir,{h:"40px",px:"20px",borderRadius:"full",bg:rt,color:"#FFFFFF",fontSize:"14px",fontWeight:"500",_hover:{bg:it},_active:{bg:ot},onClick:I?()=>N(I):V,isLoading:C,loadingText:"Запускаем",children:I?"Открыть правки":"Начать запись"})]})]}):r.jsx(Ne,{w:"100%",justify:"flex-end",children:r.jsx(Ir,{h:"40px",px:"20px",borderRadius:"full",bg:rt,color:"#FFFFFF",fontSize:"14px",fontWeight:"500",_hover:{bg:it},_active:{bg:ot},onClick:n,children:"Понятно"})})})]})]})}const bt=Hr(Er),mt=_r`
13  0%, 100% { transform: scale(1); }
14  50% { transform: scale(1.15); }
15`,ft=_r`
16  0% { transform: scale(1); opacity: 0.55; }
17  100% { transform: scale(2.4); opacity: 0; }
18`,vt=6e3,jt={initial:e=>({x:"prev"===e?-14:14,y:"prev"===e?10:-10,scale:.982,opacity:0}
18),animate:{x:0,y:0,scale:1,opacity:1},exit:e=>({x:"prev"===e?38:-38,y:24,scale:.93,opacity:0,rotate:"prev"===e?2:-2})},yt={type:"spring",stiffness:240,damping:26,mass:.9};function St({eyebrow:e,description:i,accent:o="#4F378A",bodyBg:n="white",onPrimaryAction:t,primaryActionLabel:s,primaryActionIcon:l,onAdvance:a,isMobile:d=!1}){const c=l;return r.jsxs(Er,{position:"relative",borderRadius:"12px",px:"14px",py:"14px",bg:n,color:"gray.800",boxShadow:"0 4px 16px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04)",overflow:"hidden",h:"160px",minH:"160px",w:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",children:[r.jsx(Dr,{"aria-label":"Закрыть карточку",icon:r.jsx(Nr,{w:"8px",h:"8px"}),size:"xs",variant:"ghost",position:"absolute",top:"10px",right:"10px",minW:"22px",h:"22px",zIndex:4,color:"gray.500",_hover:{color:"gray.800",bg:"gray.100"},onClick:()=>{null==a||a()}}),r.jsxs(Er,{pr:"24px",children:[r.jsxs(Ne,{spacing:"7px",align:"center",mb:"8px",children:[r.jsx(Er,{w:"7px",h:"7px",borderRadius:"full",bg:"#3B82F6",flexShrink:0,position:"relative",animation:`${mt} 1.6s ease-in-out 8`,_after:{content:'""',position:"absolute",inset:0,borderRadius:"full",bg:"rgba(59, 130, 246, 0.55)",animation:`${ft} 1.6s ease-out 8`}}),r.jsx(Ar,{fontSize:"0.8125rem",fontWeight:"600",lineHeight:"1.45",color:"gray.900",children:e})]}),r.jsx(Ar,{fontSize:"0.75rem",lineHeight:"1.55",color:"gray.600",noOfLines:4,children:i})]}),r.jsx(Ne,{justify:"space-between",align:"end",pt:"16px",children:r.jsx(Ir,{size:"sm",variant:"ghost",color:o,fontSize:"0.75rem",fontWeight:"600",h:"30px",px:"12px",borderRadius:"9999px",border:"1px solid",borderColor:`${o}25`,bg:`${o}08`,_hover:{bg:`${o}12`},onClick:()=>{null==t||t(),null==a||a()},children:r.jsxs(Ne,{spacing:"6px",children:[c&&r.jsx(c,{size:14}),r.jsx(Ar,{children:s})]})})})]})}function wt({card:e,direction:i,onAdvance:o,isMobile:n}){const t=Vr();return r.jsx(bt,{position:"absolute",inset:0,zIndex:t?100:90,willChange:"transform, opacity",custom:i,variants:jt,initial:"initial",animate:"animate",exit:"exit",transition:yt,pointerEvents:t?"auto":"none",children:r.jsx(St,{...e,isMobile:n,eyebrow:e.eyebrow,onPrimaryAction:e.onPrimaryAction,primaryActionLabel:e.primaryActionLabel,onAdvance:t?o:void 0})})}function Ct({isOpen:i,onPrimaryAction:o,onOpenShare:n,onOpenHistory:t,onOpenCollaboration:s,primaryActionLabel:l="Улучшить инструкцию",isMobile:a=!1}){const d=e.useMemo(()=>[{id:"ai",eyebrow:"ИИ-улучшение инструкции",description:"ИИ поможет уточнить шаги, улучшить структуру и переписать формулировки так, чтобы инструкция читалась быстрее и понятнее.",primaryActionLabel:l,primaryActionIcon:Ze,onPrimaryAction:o},{id:"share",eyebrow:"Поделиться",description:"Ссылка, Telegram, email или встраивание на сайт. Один документ можно показать коллегам и клиентам без лишних копий.",primaryActionLabel:"Поделиться",primaryActionIcon:Yi,onPrimaryAction:n},{id:"history",eyebrow:"История изменений",description:"История версий помогает быстро откатывать правки, разбирать изменения и сохранять контроль над качеством инструкции.",primaryActionLabel:"Открыть историю",primaryActionIcon:vi,onPrimaryAction:t},{id:"collab",eyebrow:"Совместное редактирование",description:"Команда может редактировать документ без пересылок и конфликтов: быстрее согласовывайте текст и доводите материал до готовности.",primaryActionLabel:"Добавить коллег",primaryActionIcon:Ce,onPrimaryAction:s}],[s,t,n,o,l]),[c,p]=e.useState(0),[x,u]=e.useState(!1),[h,g]=e.useState("next"),[b,m]=e.useState(()=>new Set),f=e.useRef(null),j=e.useRef(null),y=e.useRef(vt),S=e.useRef(1),w=e.useRef(!1),C=e.useMemo(()=>d.filter(e=>!b.has(e.id)),[d,b]);e.useEffect(()=>{i&&0!==C.length&&p(e=>e%C.length)},[C.length,i]);const k=(e,r)=>{e!==c&&(g(r),p(e))},z=C.length>0?c%C.length:0;if(e.useEffect(()=>{w.current=x},[x]),e.useEffect(()=>{if(f.current&&(window.clearTimeout(f.current),f.current=null),j.current=null,y.current=vt,i&&!(C.length<=1))return S.current=w.current?.3:1,j.current=Date.now(),f.current=window.setTimeout(()=>{g("next"),p(e=>(e+1)%C.length),f.current=null},y.current/S.current),()=>{f.current&&(window.clearTimeout(f.current),f.current=null),j.current=null}},[c,i,C.length]),e.useEffect(()=>{if(!i||C.length<=1||!f.current||!j.current)return;const e=Date.now(),r=e-j.current;y.current=Math.max(0,y.current-r*S.current),window.clearTimeout(f.current),S.current=x?.3:1,j.current=e,f.current=window.setTimeout(()=>{g("next"),p(e=>(e+1)%C.length),f.current=null},y.current/S.current)},[x,i,C.length]),!i||0===C.length)return null;const W=C.map((e,r)=>C[(z+r)%C.length]),R=W[0],F=W.slice(1,4);return r.jsx(Pr,{children:r.jsxs(Er,{position:"fixed",top:"97px",right:a?"16px":"20px",left:a?"16px":"auto",zIndex:1400,pointerEvents:"auto",maxW:a?"unset":"420px",w:a?"auto":"420px",onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[r.jsxs(Ne,{align:"stretch",spacing:"0",position:"relative",minH:"160px",px:"24px",zIndex:20,children:[r.jsx(Dr,{"aria-label":"Предыдущая карточка",icon:r.
18jsx(v,{boxSize:4}),isRound:!0,size:"sm",variant:"ghost",position:"absolute",left:"-4px",top:"50%",transform:"translateY(-50%)",zIndex:80,bg:"transparent",color:"gray.400",_hover:{color:"gray.700"},_active:{color:"gray.900"},onClick:()=>{k((z-1+C.length)%C.length,"prev")},opacity:x||a?1:0,pointerEvents:x||a?"auto":"none",transition:"opacity 180ms ease"}),r.jsxs(Er,{flex:"1",position:"relative",h:"160px",overflow:"visible",children:[F.map((e,i)=>{const o=((e,r)=>{const i=[{x:r?10:12,y:r?-8:-10,scale:.982,opacity:.82,zIndex:30},{x:r?20:24,y:r?-16:-20,scale:.958,opacity:.58,zIndex:20},{x:r?30:36,y:r?-24:-30,scale:.935,opacity:.34,zIndex:10}];return i[e]||i[i.length-1]})(i,a);return r.jsx(bt,{position:"absolute",inset:0,zIndex:o.zIndex,willChange:"transform, opacity",initial:!1,animate:{x:o.x,y:o.y,scale:o.scale,opacity:o.opacity},transition:{type:"spring",stiffness:260,damping:28,mass:.9,delay:.05*i},pointerEvents:"none",children:r.jsx(St,{...e,isMobile:a,eyebrow:e.eyebrow,onPrimaryAction:e.onPrimaryAction,primaryActionLabel:e.primaryActionLabel})},e.id)}),r.jsx(Ur,{initial:!1,custom:h,children:r.jsx(wt,{card:R,direction:h,onAdvance:()=>{return e=R.id,g("next"),void m(r=>{const i=new Set(r);return i.add(e),i});var e},isMobile:a},R.id)})]}),r.jsx(Dr,{"aria-label":"Следующая карточка",icon:r.jsx(Xi,{boxSize:4}),isRound:!0,size:"sm",variant:"ghost",position:"absolute",right:"-4px",top:"50%",transform:"translateY(-50%)",zIndex:80,bg:"transparent",color:"gray.400",_hover:{color:"gray.700"},_active:{color:"gray.900"},onClick:()=>{k((z+1)%C.length,"next")},opacity:x||a?1:0,pointerEvents:x||a?"auto":"none",transition:"opacity 180ms ease"})]}),r.jsx(Ne,{justify:"center",spacing:"7px",pt:"8px",zIndex:25,position:"relative",opacity:x||a?1:0,pointerEvents:x||a?"auto":"none",transition:"opacity 180ms ease",children:C.map((e,i)=>{const o=i===z;return r.jsx(Er,{as:"button","aria-label":`Показать карточку ${i+1}`,type:"button",onClick:()=>{k(i,i>z?"next":"prev")},position:"relative",overflow:"hidden",w:o?"24px":"7px",h:"7px",borderRadius:"9999px",bg:"rgba(79, 55, 138, 0.18)",transition:"width 220ms ease",_hover:{bg:o?"rgba(79, 55, 138, 0.18)":"rgba(79, 55, 138, 0.32)"},children:o&&r.jsx(bt,{position:"absolute",inset:0,borderRadius:"9999px",bg:"#4F378A",transformOrigin:"left",initial:{scaleX:0},animate:{scaleX:1},transition:{duration:(x?2e4:vt)/1e3,ease:"linear"}},`${e.id}-${z}`)},e.id)})})]})})}const kt=Object.freeze({sent:"Письмо отправлено",delivery_failed:"Письмо не отправлено — приглашение сохранено",invalid_email:"Проверьте формат email",already_in_team:"Уже состоит в команде",already_invited:"Уже есть активное приглашение",duplicate:"Повторяется в списке",forbidden_role:"Недостаточно прав для выбранной роли",inaccessible_document:"Эта роль не может открыть документ"});function zt(e){return String(e||"").trim().toLowerCase()}function Wt(e){const r={};return e.forEach((e,i)=>{const o=String((null==e?void 0:e.email)||"").trim();o&&!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(zt(o))&&(r[i]="Проверьте формат email")}),r}const Rt=[{value:1,label:"1 день"},{value:7,label:"7 дней"},{value:30,label:"30 дней"}],Ft={"& > .chakra-button__icon":{marginStart:0,marginEnd:{base:"8px",sm:0}}};function It(){var e;return"undefined"!=typeof window&&!0===(null==(e=window.matchMedia)?void 0:e.call(window,"(prefers-reduced-motion: reduce)").matches)}function At(e){return{email:"",role:e}}const Dt={expired:"Истекла",revoked:"Отозвана"},Et={reader:"Для читателей",member:"Для создателей",admin:"Для администраторов"};function _t(e){if(!e)return"—";const r=new Date(e);return Number.isNaN(r.getTime())?"—":r.toLocaleDateString("ru-RU",{day:"numeric",month:"short",year:"numeric"})}function Mt(e){const r=Number(e)||0,i=r%10,o=r%100,n=1===i&&11!==o?"регистрация":i>=2&&i<=4&&(o<12||o>14)?"регистрации":"регистраций";
18return`${r.toLocaleString("ru-RU")} ${n}`}function Tt({label:e,valueLabel:i,children:o}){return r.jsxs(re,{children:[r.jsx(Qi,{fontSize:"0.8125rem",fontWeight:"500",color:"gray.600",mb:"6px",children:e}),r.jsxs(t,{placement:"bottom-start",matchWidth:!0,children:[r.jsx(s,{as:Ir,"aria-label":`${e}: ${i}`,rightIcon:r.jsx(l,{}),w:"100%",h:"40px",px:"12px",border:"1px solid",borderColor:"gray.200",borderRadius:"full",bg:"white",color:"gray.700",fontSize:"0.875rem",fontWeight:"400",textAlign:"left",justifyContent:"space-between",_hover:{borderColor:"gray.300",bg:"gray.50"},_active:{borderColor:"#4F378A",bg:"white"},_focusVisible:{boxShadow:"0 0 0 2px rgba(79, 55, 138, 0.22)"},children:i}),r.jsx(Pr,{children:r.jsx(a,{zIndex:1500,minW:"100%",w:"100%",position:"relative",children:o})})]})]})}function Ot({isOpen:i,onClose:o,currentCompanyRole:n,companyData:t,isMobile:s,instructionUuid:l=null}){var a,c,x,u,h,g,b,m,f,v;const j=je(),{openLicenseModal:y}=p(),S=e.useRef(null),w=e.useRef(null),C="reader"===n?"reader":"member",[k,W]=e.useState([At(C)]);e.useEffect(()=>{W([At("reader"===n?"reader":"member")])},[n]);const[F,I]=e.useState(!1),[A,D]=e.useState([]),[E,_]=e.useState(!1),[M,T]=e.useState(0),[O,P]=e.useState(7),[$,B]=e.useState(C),[L,H]=e.useState([]),[U,N]=e.useState(!1),[V,Y]=e.useState(""),[X,G]=e.useState(""),[K,q]=e.useState(!1),[J,re]=e.useState(null),[le,ae]=e.useState(null),[de,ce]=e.useState(null),[pe,xe]=e.useState(null),[ue,he]=e.useState(null),[ge,be]=e.useState(null),[me,fe]=e.useState(!1),[ve,Se]=e.useState(""),[we,Ce]=e.useState(null),[ke,ze]=e.useState({}),[We,Re]=e.useState(null),[Fe,Ae]=e.useState(null),[De,Ee]=e.useState(null),_e=e.useRef(null),Me=e.useRef(null),Te=e.useRef(null);e.useEffect(()=>()=>{clearTimeout(Me.current),clearTimeout(Te.current)},[]),e.useEffect(()=>{var e;if(!We)return;null==(e=_e.current)||e.scrollIntoView({block:"nearest",behavior:It()?"auto":"smooth"});const r=setTimeout(()=>Re(null),900);return()=>clearTimeout(r)},[We]);const Oe=(null==ge?void 0:ge.isProCompany)??"PRO"===(null==(c=null==(a=null==t?void 0:t.creator)?void 0:a.License)?void 0:c.type),Pe=i&&!ge||me||Boolean(ve)||!Oe&&"reader"===n;e.useEffect(()=>{B("reader"===n?"reader":"member")},[n]),e.useEffect(()=>{i?(T(0),Ce(null),ze({}),R("inviteModalOpened",l?"document":"team")):(ae(null),he(null))},[i]);const $e=e.useCallback(async()=>{var e,r;const i=Number(localStorage.getItem("selectedCompanyId"));if(Number.isInteger(i)){fe(!0),Se("");try{const o=await Q(i,l);be(o);const n=(null==(e=o.roles)?void 0:e.find(e=>e.role===C&&e.allowed))||(null==(r=o.roles)?void 0:r.find(e=>e.allowed));n&&(B(n.role),W(e=>e.map(e=>({...e,role:o.roles.some(r=>r.role===e.role&&r.allowed)?e.role:n.role}))))}catch(o){be(null),Se(o.message||"Проверьте соединение и попробуйте ещё раз")}finally{fe(!1)}}},[C,l]),Be=e.useCallback(async()=>{const e=localStorage.getItem("selectedCompanyId");if(e){N(!0),Y("");try{const r=await Z(parseInt(e,10),l,{includeDocumentLinks:!l});H(r)}catch(r){Y(r.message||"Проверьте соединение и попробуйте ещё раз")}finally{N(!1)}}},[l]),Le=e.useCallback(async()=>{const e=localStorage.getItem("token"),r=localStorage.getItem("selectedCompanyId");if(e&&r){_(!0),G("");try{const i=await ee(parseInt(r,10),e);D(i)}catch(i){G(i.message||"Проверьте соединение и попробуйте ещё раз")}finally{_(!1)}}},[]);e.useEffect(()=>{i&&(0===M&&Be(),2===M&&Le())},[M,i,Le,Be]),e.useEffect(()=>{i&&($e(),Le())},[i,$e,Le]);const He=async e=>{var r,i;const o=localStorage.getItem("token");ce(e);try{const r=await ne(e,o);(null==r?void 0:r.invite)&&D(i=>i.map(i=>i.id===e?{...i,...r.invite}:i)),Ce(i=>{var o;return i?{...i,results:null==(o=i.results)?void 0:o.map(i=>{var o;return i.inviteId===e?{...i,status:r.status,inviteUrl:(null==(o=r.invite)?void 0:o.inviteUrl)||i.inviteUrl}:i})}:i}),j({title:"sent"===r.status?"Приглашение отправлено":"Письмо не отправлено",description:"sent"===r.status?"Срок приглашения обновлён":"Приглашение сохранено — повторите отправку или скопируйте ссылку",status:"sent"===r.status?"success":"warning",duration:3e3,isClosable:!0})}catch(n){j({title:"Ошибка",description:(null==(i=null==(r=n.response)?void 0:r.data)?void 0:i.error)||"Не удалось отправить приглашение",status:"error",duration:3e3,isClosable:!0})}finally{ce(null)}},Ue=async e=>{if(!e.inviteUrl)return;const r=await or(e.inviteUrl);j({title:r?"Ссылка скопирована":"Не удалось скопировать ссылку",status:r?"success":"warning",duration:2200,isClosable:!0}),r&&R("personalInviteLinkCopied","pending_invite")},Ye=Ji({currentCompanyRole:n,isProCompany:Oe}),Xe=function(e,r=[]){return Array.isArray(null==e?void 0:e.roles)?e.roles.map(e=>({value:e.role,label:e.label,description:e.description,isProLocked:Boolean(e.proLocked),isDisabled:!e.allowed&&!e.proLocked,reason:e.reason})):r}(ge,Ye),Ge=function(e){const r=new Map;
18return(Array.isArray(e)?e:[]).forEach(e=>{var i;const o=String((null==(i=e.invitor)?void 0:i.id)??"unknown");r.has(o)||r.set(o,{invitor:e.invitor||null,invites:[]}),r.get(o).invites.push(e)}),[...r.values()].sort((e,r)=>{var i,o,n,t,s,l;return(null==(i=e.invitor)?void 0:i.isCurrentUser)?-1:(null==(o=r.invitor)?void 0:o.isCurrentUser)?1:String((null==(n=e.invitor)?void 0:n.name)||(null==(t=e.invitor)?void 0:t.email)||"").localeCompare(String((null==(s=r.invitor)?void 0:s.name)||(null==(l=r.invitor)?void 0:l.email)||""),"ru")})}(A),Ke=(e,{showTopBorder:i,showDocument:o})=>{var n;const t="active"===e.status,s=Dt[e.status],a=Et[e.role]||`Роль: ${e.roleName||Gi(e.role)}`,d=o?(null==(n=e.document)?void 0:n.title)||"Документ недоступен":a,c=[s,o?a:null,t?`До ${_t(e.expiresAt)}`:null,Mt(e.registrationsCount),(null==ge?void 0:ge.canViewAllInvites)&&e.creator?`Автор: ${e.creator.isCurrentUser?"вы":e.creator.name||e.creator.email}`:null].filter(Boolean).join(" · "),p=We===e.id,x=Fe===e.id;return r.jsxs(qe,{ref:p?_e:void 0,direction:{base:"column",sm:"row"},align:{base:"stretch",sm:"center"},spacing:{base:"8px",sm:"12px"},borderTop:i?"1px solid rgba(0, 0, 0, 0.07)":"0",px:{base:"12px",sm:"14px"},py:"10px",transition:"background-color .2s ease",animation:p?"invite-link-arrive 460ms cubic-bezier(.22, .8, .32, 1) both":void 0,sx:{"@keyframes invite-link-arrive":{"0%":{opacity:0,transform:"translateY(-6px)",boxShadow:"inset 0 0 0 1px rgba(79, 55, 138, .28)"},"60%":{opacity:1,transform:"translateY(0)",boxShadow:"inset 0 0 0 1px rgba(79, 55, 138, .14)"},"100%":{opacity:1,transform:"translateY(0)",boxShadow:"inset 0 0 0 1px rgba(79, 55, 138, 0)"}},"@media (prefers-reduced-motion: reduce)":{animation:"none"}},children:[r.jsxs(Er,{flex:"1",minW:0,children:[r.jsx(Ar,{fontSize:"0.875rem",fontWeight:500,color:t?"gray.700":"gray.500",transition:"color .2s ease",noOfLines:1,children:d}),r.jsx(Ar,{mt:"2px",fontSize:"0.75rem",color:"gray.500",children:c})]}),t&&(e.canCopy||e.canRevoke)&&r.jsxs(Ne,{spacing:"4px",flexShrink:0,children:[e.canCopy&&r.jsx(Ir,{variant:"ghost",leftIcon:x?r.jsx(Sr,{size:14}):r.jsx(vr,{size:14}),h:"36px",px:"12px",borderRadius:"full",color:"#4F378A",fontSize:"0.8125rem",fontWeight:500,onClick:()=>(async e=>{await or(e.inviteUrl)?(Ae(e.id),clearTimeout(Me.current),Me.current=setTimeout(()=>Ae(null),1600),R("teamInviteLinkCopied",l?"document":"team")):j({title:"Не удалось скопировать ссылку",description:"Выделите адрес и скопируйте его вручную",status:"warning",duration:2200,isClosable:!0})})(e),_hover:{bg:"#F3EEFF"},_focusVisible:{boxShadow:"0 0 0 2px rgba(79, 55, 138, 0.22)"},children:r.jsx(Er,{as:"span",animation:"invite-copy-label 160ms ease both",sx:{"@keyframes invite-copy-label":{from:{opacity:0}
18,to:{opacity:1}},"@media (prefers-reduced-motion: reduce)":{animation:"none"}},children:x?"Скопировано":"Копировать"},x?"copied":"idle")}),e.canRevoke&&r.jsx(Ir,{variant:"ghost",leftIcon:r.jsx(wr,{size:14}),h:"36px",px:"12px",borderRadius:"full",color:"gray.500",fontSize:"0.8125rem",fontWeight:500,isLoading:J===e.id,onClick:()=>ae(e),_hover:{bg:"red.50",color:"red.600"},_focusVisible:{boxShadow:"0 0 0 2px rgba(217, 45, 32, 0.2)"},children:"Отозвать"})]})]},e.id)},Je=l?[{key:"current",title:"Ссылки в документе",links:L}]:[{key:"team",title:"Ссылки в команде",links:L.filter(e=>!e.instructionUuid)},{key:"documents",title:"Ссылки в документах",links:L.filter(e=>Boolean(e.instructionUuid))}].filter(e=>e.links.length>0),Qe=A.length,Ze=k.length<20;return r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{isOpen:i,onClose:o,isCentered:!0,scrollBehavior:"inside",motionPreset:"slideInBottom",children:[r.jsx(Xr,{backdropFilter:"blur(4px)"}),r.jsx(Gr,{"data-mobile-fullscreen-modal":"true",boxShadow:"4px 4px 15px rgba(0, 0, 0, 0.15)",borderRadius:"20px",px:{base:"18px",sm:"28px"},pt:"20px",pb:"20px",maxW:s?"calc(100vw - 20px)":"580px",maxH:"calc(100dvh - 24px)",overflow:"hidden",children:r.jsxs(Ve,{align:"stretch",w:"100%",flex:"1",spacing:"14px",minH:"0",children:[r.jsxs(Qr,{p:"0",pr:"40px",w:"100%",children:[r.jsxs(Ne,{spacing:"10px",children:[r.jsx(Er,{display:"grid",placeItems:"center",flexShrink:0,color:"#4F378A",children:r.jsx(z,{size:19})}),r.jsx(Ar,{fontSize:{base:"1rem",sm:"1.125rem"},lineHeight:"1.3",fontWeight:"700",children:"Доступ и приглашения"})]}),r.jsx(Ar,{mt:"4px",fontSize:"0.75rem",fontWeight:400,color:"gray.500",children:(null==(x=null==ge?void 0:ge.document)?void 0:x.title)?`Документ: ${ge.document.title}`:(null==(u=null==ge?void 0:ge.company)?void 0:u.name)?`Команда: ${ge.company.name}`:"Выбранная команда"})]}),r.jsx(Kr,{"aria-label":"Закрыть",w:{base:"40px",sm:"32px"},h:{base:"40px",sm:"32px"},top:{base:"12px",sm:"16px"},right:{base:"14px",sm:"22px"},borderRadius:"full",_hover:{bg:"gray.100"},_focusVisible:{boxShadow:"0 0 0 2px rgba(79, 55, 138, 0.28)"}}),r.jsxs(Jr,{p:"0",px:"4px",mx:"-4px",minH:"0",overflowY:"auto",overscrollBehavior:"contain",children:[ve&&r.jsxs(Ne,{mb:"12px",p:"10px 12px",borderRadius:"12px",bg:"#FFF7F6",color:"#B42318",role:"alert",align:"start",children:[r.jsx(br,{size:16}),r.jsxs(Er,{flex:"1",children:[r.jsx(Ar,{fontSize:"0.8125rem",fontWeight:600,children:"Не удалось загрузить права доступа"}),r.jsx(Ar,{fontSize:"0.75rem",children:ve})]}),r.jsx(Ir,{size:"xs",variant:"ghost",onClick:$e,children:"Повторить"})]}),r.jsxs($i,{position:"relative",variant:"unstyled",index:M,onChange:e=>{T(e),R("inviteModalMethodSelected",["link","email","pending"][e])},children:[r.jsx(Bi,{borderBottom:"1px solid rgba(0, 0, 0, 0.08)",w:"100%",gap:{base:"8px",sm:"16px"},children:[{label:"По ссылке"},{label:"По почте"},{label:"Приглашения",count:Qe,separated:!0}].map(e=>r.jsx(Li,{h:"44px",px:{base:"5px",sm:"8px"},ml:e.separated?"auto":void 0,color:"gray.600",fontSize:"0.875rem",fontWeight:"400",_selected:{color:"#4F378A",fontWeight:600},_focusVisible:{boxShadow:"inset 0 0 0 2px rgba(79, 55, 138, 0.28)",borderRadius:"8px 8px 0 0"},children:r.jsxs(Ne,{spacing:"6px",children:[r.jsx(Ar,{as:"span",fontSize:"inherit",fontWeight:"inherit",children:e.label}),e.count>0&&r.jsx(Ie,{borderRadius:"full",bg:"gray.100",color:"gray.600",px:"7px",py:"1px",fontSize:"0.6875rem",fontWeight:500,textTransform:"none",children:e.count})]})},e.label))}),r.jsx(di,{mt:"-2px",height:"2px",bg:"#4F378A",borderRadius:"1px"}),r.jsxs(Hi,{w:"100%",children:[r.jsx(Ui,{px:"0",pb:"0",children:r.jsxs(Ve,{align:"stretch",spacing:"18px",children:[r.jsxs(Er,{children:[r.jsx(Ar,{fontSize:"0.875rem",color:"gray.700",children:"Любой, у кого есть ссылка, сможет присоединиться к команде с выбранной ролью."}),l&&r.jsx(Ar,{mt:"4px",fontSize:"0.75rem",color:"gray.500",children:"После входа у пользователя сразу откроется текущий документ."})]}),r.jsxs(Er,{display:"grid",gridTemplateColumns:{base:"1fr",sm:"1fr 1fr"},gap:"12px",children:[r.jsx(Tt,{label:"Роль",valueLabel:Gi($),children:r.jsx(Ki,{options:Xe,selectedValue:$,onSelect:B,onProClick:y}
18)}),r.jsx(Tt,{label:"Срок действия",valueLabel:null==(h=Rt.find(e=>e.value===O))?void 0:h.label,children:Rt.map(e=>r.jsx(d,{onClick:()=>P(e.value),color:O===e.value?"#4F378A":"gray.700",fontWeight:O===e.value?600:400,children:e.label},e.value))})]}),r.jsx(Ir,{alignSelf:{base:"stretch",sm:"flex-end"},w:{base:"100%",sm:"auto"},leftIcon:r.jsx(mr,{}),bg:"#4F378A",color:"white",h:"40px",px:"20px",borderRadius:"full",fontSize:"0.875rem",fontWeight:500,isLoading:K,loadingText:"Создаём ссылку",isDisabled:Pe,onClick:async()=>{const e=Number(localStorage.getItem("selectedCompanyId"));if(Number.isInteger(e)){q(!0);try{const r=await ie(e,{role:$,expiresInDays:O,instructionUuid:l});H(e=>[r,...e.filter(e=>e.id!==r.id)]),Re(r.id),window.dispatchEvent(new Event("workspace:onboarding:invites-sent"))}catch(r){j({title:"Не удалось создать ссылку",description:r.message,status:"error",duration:3e3,isClosable:!0})}finally{q(!1)}}else j({title:"Выберите команду",description:"Ссылка создаётся для выбранной команды",status:"warning",duration:3e3,isClosable:!0})},_hover:{opacity:.75},_active:{opacity:1},_focusVisible:{boxShadow:"0 0 0 3px rgba(79, 55, 138, 0.24)"},children:"Создать ссылку"}),r.jsxs(Er,{children:[r.jsx(ye,{mb:"16px",borderColor:"rgba(0, 0, 0, 0.08)"}),U?r.jsxs(Ne,{justify:"center",minH:"104px","aria-live":"polite",children:[r.jsx(Or,{size:"sm",color:"#4F378A"}),r.jsx(Ar,{fontSize:"0.8125rem",color:"gray.500",children:"Загружаем ссылки…"})]}):V?r.jsxs(Ve,{align:"start",spacing:"10px",border:"1px solid rgba(217, 45, 32, 0.16)",borderRadius:"14px",bg:"#FFF7F6",px:"14px",py:"13px",role:"alert",children:[r.jsxs(Ne,{spacing:"8px",color:"#B42318",children:[r.jsx(br,{size:16}),r.jsx(Ar,{fontSize:"0.8125rem",fontWeight:600,children:"Не удалось загрузить ссылки"})]}),r.jsx(Ar,{fontSize:"0.75rem",color:"#8A3B34",children:V}),r.jsx(Ir,{size:"sm",variant:"ghost",borderRadius:"full",color:"#B42318",onClick:Be,children:"Попробовать снова"})]}):0===L.length?r.jsx(Er,{minH:"96px",display:"grid",placeItems:"center",border:"1px dashed",borderColor:"gray.200",borderRadius:"14px",bg:"gray.50",px:"20px",children:r.jsx(Ar,{fontSize:"0.8125rem",color:"gray.500",textAlign:"center",children:l?"Ссылки для этого документа появятся здесь":"Ссылки в команде и в документах появятся здесь"})}):r.jsx(Ve,{align:"stretch",spacing:"14px","aria-live":"polite",children:Je.map(e=>r.jsxs(Er,{children:[e.title&&r.jsx(Ar,{mb:"8px",fontSize:"0.8125rem",fontWeight:600,color:"gray.700",children:e.title}),r.jsx(Er,{border:"1px solid rgba(0, 0, 0, 0.08)",borderRadius:"14px",overflow:"hidden",children:e.links.map((r,i)=>Ke(r,{showTopBorder:i>0,showDocument:"documents"===e.key}))})]},e.key))})]})]})}),r.jsx(Ui,{px:"0",pb:"0",children:r.jsx("form",{onSubmit:async e=>{var r,i,n,t,s,a;e.preventDefault();const d=localStorage.getItem("token"),c=localStorage.getItem("selectedCompanyId");if(!d||!c)return void j({title:"Ошибка авторизации",description:"Выберите команду для приглашения пользователей",status:"error",duration:3e3,isClosable:!0});const p=k.filter(e=>""!==e.email.trim()).map(({email:e,role:r})=>({email:zt(e),role:r}));if(0===p.length)return void j({title:"Введите email хотя бы для одного приглашения",status:"warning",duration:3e3,isClosable:!0});const x=Wt(k);ze(x);if(k.some((e,r)=>""!==e.email.trim()&&!x[r])){I(!0);try{const e=await oe(d,parseInt(c,10),p,{expiresInDays:O,instructionUuid:l});Ce(e),R("teamInviteBatchResult",JSON.stringify(e.summary||{})),await Le();if(!((null==(r=e.summary)?void 0:r.total)>0&&e.summary.sent===e.summary.total)){const r=(u=e.results,(Array.isArray(u)?u:[]).filter(e=>["invalid_email","forbidden_role","inaccessible_document"].includes(e.status)).map(e=>({email:e.email||"",role:e.role||"member"})));return W(r.length?r:[At(C)]),ze(Wt(r)),void j({title:"Приглашения обработаны частично",description:`Отправлено: ${(null==(i=e.summary)?void 0:i.sent)||0}, требуют внимания: ${((null==(n=e.summary)?void 0:n.failed)||0)+((null==(t=e.summary)?void 0:t.skipped)||0)}`,status:"warning",duration:5e3,isClosable:!0})}j({title:"Приглашения отправлены",status:"success",duration:3e3,isClosable:!0}),window.dispatchEvent(new Event("workspace:onboarding:invites-sent")),o(),W([At(C)])}catch(h){j({title:"Ошибка отправки приглашений",description:(null==(a=null==(s=h.response)?void 0:s.data)?void 0:a.error)||h.message,status:"error",duration:3e3,isClosable:!0})}finally{I(!1)}var u}else j({title:"Проверьте email",description:"Нужен хотя бы один корректный адрес",status:"warning",duration:3e3,isClosable:!0})},children:r.jsxs(Ve,{align:"stretch",spacing:"18px",children:[r.jsx(Ar,{fontSize:"0.875rem",color:"gray.700",children:"Отправим письмо с персональной ссылкой. Список адресов можно вставить целиком — он разложится по строкам."}),(null==(g=null==we?void 0:we.results)?void 0:g.length)>0&&r.jsxs(Er,{border:"1px solid",borderColor:"orange.200",bg:"orange.50",borderRadius:"14px",p:"12px","aria-live":"polite",children:[r.jsxs(Ar,{fontSize:"0.8125rem",fontWeight:600,color:"gray.700",children:["Отправлено: ",(null==(b=we.summary)?void 0:b.sent)||0," · Не отправлено: ",(null==(m=we.summary)?void 0:m.failed)||0," · Пропущено: ",(null==(f=we.summary)?void 0:f.skipped)||0]}),r.jsx(Ve,{mt:"8px",align:"stretch",spacing:"5px",children:we.results.map((e,i)=>r.jsxs(qe,{direction:{base:"column",sm:"row"},align:{base:"start",sm:"center"},justify:"space-between",spacing:"6px",children:[r.jsxs(Ar,{fontSize:"0.75rem",color:"gray.600",children:[e.email||"Пустой адрес"," — ",kt[e.status]||e.status]}),"delivery_failed"===e.status&&r.jsxs(Ne,{spacing:"4px",children:[r.jsx(Ir,{type:"button",size:"xs",variant:"ghost",isLoading:de===e.inviteId,onClick:()=>He(e.inviteId),children:"Повторить"}),r.jsx(Ir,{type:"button",size:"xs",variant:"ghost",onClick:()=>
18Ue({inviteUrl:e.inviteUrl}),children:"Копировать ссылку"})]})]},`${e.email}-${e.status}-${i}`))})]}),r.jsx(Er,{display:"grid",gridTemplateColumns:{base:"1fr",sm:"1fr 1fr"},gap:"12px",children:r.jsx(Tt,{label:"Срок действия приглашения",valueLabel:null==(v=Rt.find(e=>e.value===O))?void 0:v.label,children:Rt.map(e=>r.jsx(d,{onClick:()=>P(e.value),color:O===e.value?"#4F378A":"gray.700",fontWeight:O===e.value?600:400,children:e.label},e.value))})}),r.jsxs(Er,{children:[r.jsx(qi,{invitees:k,onEmailChange:(e,r)=>{W(i=>i.map((i,o)=>o===e?{...i,email:r}:i)),ze(r=>{if(!r[e])return r;const i={...r};return delete i[e],i})},onRoleChange:(e,r)=>{W(i=>i.map((i,o)=>o===e?{...i,role:r}:i))},onRemoveRow:e=>{W(r=>r.length<=1?r:r.filter((r,i)=>i!==e))},onBulkEmails:(e,r)=>{W(i=>{const o=[...i];return r.forEach((r,i)=>{const n=e+i;n<o.length?o[n]={...o[n],email:r}:o.length<20&&o.push({...At(C),email:r})}),o});e+r.length-20>0&&j({title:"Добавлены первые 20 адресов",description:"Остальные можно пригласить следующим письмом",status:"info",duration:3500,isClosable:!0})},currentCompanyRole:n,companyData:t,isProCompany:Oe,roleOptions:Xe,emailErrors:ke,disabled:Pe}),r.jsx(Ir,{mt:"10px",h:"36px",px:"12px",variant:"ghost",borderRadius:"full",leftIcon:r.jsx(fr,{}),color:"#4F378A",fontSize:"0.875rem",fontWeight:500,isDisabled:Pe||!Ze,onClick:()=>{W(e=>e.length>=20?e:[...e,At(C)])},_hover:{bg:"#F3EEFF"},_focusVisible:{boxShadow:"0 0 0 2px rgba(79, 55, 138, 0.22)"},children:"Добавить ещё"})]}),l&&r.jsx(Ar,{fontSize:"0.75rem",color:"gray.500",children:"После входа пользователь сразу перейдёт в этот документ."}),r.jsxs(qe,{w:"100%",direction:{base:"column-reverse",sm:"row"},justify:"flex-end",spacing:"8px",children:[r.jsx(Ir,{variant:"ghost",borderRadius:"full",h:"40px",w:{base:"100%",sm:"auto"},onClick:o,px:"24px",children:r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",children:"Отмена"})}),r.jsx(Ir,{bgColor:"#4F378A",borderRadius:"full",_hover:{opacity:"0.75"},_active:{opacity:"1"},_focusVisible:{boxShadow:"0 0 0 3px rgba(79, 55, 138, 0.24)"},h:"40px",w:{base:"100%",sm:"auto"},px:"24px",type:"submit",isDisabled:F||Pe||me,children:F?r.jsxs(Ne,{spacing:"10px",children:[r.jsx(Or,{size:"sm",color:"white"}),r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",color:"white",children:"Отправка..."})]}):r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",color:"white",children:"Отправить приглашения"})})]})]})})}),r.jsx(Ui,{px:"0",pb:"0",children:r.jsx(Ve,{spacing:"12px",h:"100%",align:"stretch",children:E?r.jsxs(Ne,{justify:"center",minH:"104px","aria-live":"polite",children:[r.jsx(Or,{size:"sm",color:"#4F378A"}),r.jsx(Ar,{fontSize:"0.8125rem",color:"gray.500",children:"Загружаем приглашения…"})]}):X?r.jsxs(Ve,{align:"start",spacing:"10px",border:"1px solid rgba(217, 45, 32, 0.16)",borderRadius:"14px",bg:"#FFF7F6",px:"14px",py:"13px",role:"alert",children:[r.jsxs(Ne,{spacing:"8px",color:"#B42318",children:[r.jsx(br,{size:16}),r.jsx(Ar,{fontSize:"0.8125rem",fontWeight:600,children:"Не удалось загрузить приглашения"})]}),r.jsx(Ar,{fontSize:"0.75rem",color:"#8A3B34",children:X}),r.jsx(Ir,{size:"sm",variant:"ghost",borderRadius:"full",color:"#B42318",onClick:Le,children:"Попробовать снова"})]}):0===A.length?r.jsx(Er,{minH:"104px",display:"grid",placeItems:"center",border:"1px dashed",borderColor:"gray.200",borderRadius:"14px",bg:"gray.50",px:"20px",children:r.jsx(Ar,{fontSize:"0.8125rem",color:"gray.500",textAlign:"center",children:"Нет ожидающих приглашений"})}):r.jsx(Ve,{align:"stretch",spacing:"14px",children:Ge.map(e=>{var i,o,n,t;return r.jsxs(Er,{children:[r.jsx(Ar,{mb:"8px",fontSize:"0.8125rem",fontWeight:600,color:"gray.700",children:(null==(i=e.invitor)?void 0:i.isCurrentUser)?"Вы":(null==(o=e.invitor)?void 0:o.name)||(null==(n=e.invitor)?void 0:n.email)||"Неизвестный автор"}),r.jsx(Er,{border:"1px solid rgba(0, 0, 0, 0.08)",borderRadius:"14px",overflow:"hidden",children:e.invites.map((e,i)=>r.jsxs(qe,{direction:{base:"column",sm:"row"},align:{base:"stretch",sm:"center"},spacing:{base:"8px",sm:"12px"},px:"12px",py:"10px",borderTop:0===i?"0":"1px solid rgba(0, 0, 0, 0.07)",animation:De===e.id?"invite-row-leave 200ms ease-in both":void 0,sx:{"@keyframes invite-row-leave":{from:{opacity:1,transform:"translateY(0)"},to:{opacity:0,transform:"translateY(8px)"}}},children:[r.jsxs(Er,{flex:"1",minW:0,children:[r.jsxs(Ne,{spacing:"7px",flexWrap:"wrap",children:[r.jsx(Ar,{fontSize:"0.875rem",fontWeight:500,color:"gray.700",overflowWrap:"anywhere",children:e.invitedEmail}),r.jsx(Ie,{borderRadius:"full",textTransform:"none",colorScheme:"failed"===e.deliveryStatus?"red":"sent"===e.deliveryStatus?"green":"gray",children:"failed"===e.deliveryStatus?"Письмо не отправлено":"sent"===e.deliveryStatus?"Отправлено":"Статус неизвестен"})]}),r.jsxs(Ar,{mt:"2px",fontSize:"0.75rem",color:"gray.500",children:[e.roleName||Gi(e.role)," · до ",_t(e.expiresAt)]})]}),r.jsxs(Ne,{spacing:"6px",justify:{base:"flex-start",sm:"initial"},flexShrink:0,children:[e.canCopy&&e.inviteUrl&&r.jsx(Mr,{label:"Скопировать персональную ссылку",openDelay:300,children:r.jsx(Ir,{"aria-label":"Скопировать персональную ссылку",leftIcon:r.jsx(vr,{size:15}),h:{base:"40px",sm:"36px"},minW:{base:"auto",sm:"36px"},px:{base:"12px",sm:"0"},borderRadius:"full",variant:"outline",sx:Ft,onClick:()=>Ue(e),children:r.jsx(Er,{as:"span",display:{base:"inline",sm:"none"},children:"Копировать"})})}),e.canResend&&r.jsx(Mr,{label:"Отправить повторно",openDelay:300,children:r.jsx(Ir,{"aria-label":"Отправить приглашение повторно",leftIcon:r.jsx(jr,{size:15}),h:{base:"40px",sm:"36px"},minW:{base:"auto",sm:"36px"},px:{base:"12px",sm:"0"},borderRadius:"full",variant:"outline",sx:Ft,isLoading:de===e.id,isDisabled:pe===e.id,onClick:()=>He(e.id),children:r.jsx(Er,{as:"span",display:{base:"inline",sm:"none"},children:"Отправить снова"})})}),e.canCancel&&r.jsx(Mr,{label:"Отменить приглашение",openDelay:300,children:r.jsx(Ir,{"aria-label":"Отменить приглашение",leftIcon:r.jsx(yr,{size:15}),h:{base:"40px",sm:"36px"},minW:{base:"auto",sm:"36px"},px:{base:"12px",sm:"0"},borderRadius:"full",variant:"outline",color:"gray.600",sx:Ft,isLoading:pe===e.id,isDisabled:de===e.id,onClick:()=>he(e),_hover:{bg:"red.50",color:"red.600",borderColor:"red.100"},children:r.jsx(Er,{as:"span",display:{base:"inline",sm:"none"},children:"Отменить"})})})]})]},e.id))})]},(null==(t=e.invitor)?void 0:t.id)||"unknown")})})})})]})]})]})]})})]}),r.jsx(ci,{isOpen:Boolean(le),leastDestructiveRef:S,onClose:()=>!J&&ae(null),isCentered:!0,children:r.jsx(Xr,{backdropBlur:4,backdropFilter:"blur(4px) !important",children:r.jsx(pi,{borderRadius:"20px",boxShadow:"4px 4px 15px rgba(0, 0, 0, 0.15)",px:"30px",py:"20px",maxW:s?"calc(100vw - 20px)":"450px",children:r.jsxs(Ve,{align:"start",w:"100%",spacing:"20px",children:[r.jsx(Qr,{p:"0",w:"100%",children:r.jsx(Ar,{fontSize:"1.125rem",fontWeight:"700",children:"Отозвать ссылку"})}),r.jsx(Jr,{p:"0",w:"100%",children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Новые пользователи больше не смогут присоединиться по этой ссылке. Те, кто уже зарегистрировался, останутся в команде."})}),r.jsx(Ci,{p:"0",w:"100%",children:r.jsxs(Ne,{w:"100%",spacing:"auto",children:[r.jsx(Ir,{ref:S,variant:"ghost",borderRadius:"40px",h:"40px",isDisabled:Boolean(J),onClick:()=>ae(null),children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Отмена"})}),r.jsx(ki,{}),r.jsx(Ir,{bg:"#D92D20",color:"white",borderRadius:"40px",h:"40px",_hover:{bg:"#B42318"},_active:{bg:"#D92D20"},isLoading:Boolean(J),onClick:()=>le&&(async e=>{re(e);try{const r=await te(e);H(i=>i.map(i=>i.id===e?{...i,...r,document:i.document}:i)),ae(null),j({title:"Ссылка отозвана",status:"success",duration:2200,isClosable:!0})}catch(r){j({title:"Не удалось отозвать ссылку",description:r.message,status:"error",duration:3e3,isClosable:!0})}finally{re(null)}})(le.id),children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Отозвать"})})]})})]})})})}),r.jsx(ci,{isOpen:Boolean(ue),leastDestructiveRef:w,onClose:()=>!pe&&he(null),isCentered:!0,children:r.jsx(Xr,{backdropBlur:4,backdropFilter:"blur(4px) !important",children:r.jsx(pi,{borderRadius:"20px",boxShadow:"4px 4px 15px rgba(0, 0, 0, 0.15)",px:"30px",py:"20px",maxW:s?"calc(100vw - 20px)":"450px",children:r.jsxs(Ve,{align:"start",w:"100%",spacing:"20px",children:[r.jsx(Qr,{p:"0",w:"100%",children:r.jsx(Ar,{fontSize:"1.125rem",fontWeight:"700",children:"Отменить приглашение"})}),r.jsx(Jr,{p:"0",w:"100%",children:r.jsxs(Ar,{fontSize:"0.875rem",fontWeight:"400",overflowWrap:"anywhere",children:["Приглашение для «",null==ue?void 0:ue.invitedEmail,"» перестанет действовать: ссылка из письма больше не сработает. Отправить приглашение заново можно в любой момент."]})}),r.jsx(Ci,{p:"0",w:"100%",children:r.jsxs(Ne,{w:"100%",spacing:"auto",children:[r.jsx(Ir,{ref:w,variant:"ghost",borderRadius:"40px",h:"40px",isDisabled:Boolean(pe),onClick:()=>he(null),children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Оставить"})}),r.jsx(ki,{}),r.jsx(Ir,{bg:"#D92D20",color:"white",borderRadius:"40px",h:"40px",_hover:{bg:"#B42318"},_active:{bg:"#D92D20"},isLoading:Boolean(pe),onClick:()=>ue&&(async e=>{var r,i;const o=localStorage.getItem("token");xe(e);try{await se(e,o),he(null);const r=()=>D(r=>r.filter(r=>r.id!==e));It()?r():(Ee(e),Te.current=setTimeout(()=>{r(),Ee(null)},200)),j({title:"Приглашение отменено",description:"Ссылка из письма больше не сработает",status:"success",duration:3e3,isClosable:!0})}catch(n){j({title:"Ошибка",description:(null==(i=null==(r=n.response)?void 0:r.data)?void 0:i.error)||"Не удалось отменить приглашение",status:"error",duration:3e3,isClosable:!0})}finally{xe(null)}})(ue.id),children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Отменить приглашение"})})]})})]})})})})]})}
18const Pt="steppo:instruction-ai-improve-banner-dismissed:";const $t=_r`
19  from { transform: translateX(0); }
20  to { transform: translateX(200%); }
21`;function Bt({instruction:x,currentCompanyRole:g,isMobile:b,onRestoreRefetch:m,hideBackButton:f=!1,workspaceToolbar:v=!1,targetColor:y,accentColor:C,commentsEnabled:k,onTargetColorChange:z,onAccentColorChange:R,onCommentsToggle:F,settingsLocked:I=!1,onStartProTest:A,isProTested:D=!1,showAiImproveBanner:E=!1,headerPresence:_=null,onToggleDiscussions:M=null,activeDiscussionsCount:T=0}){var P,$,L,H,U,N,V,Y;const X=o(),G=n(),K=S(w,e=>null==e?void 0:e.refetchInstruction),Q=S(w,e=>null==e?void 0:e.setInstruction),Z=m??K,[ee,re]=e.useState(!1),[ie,oe]=e.useState(!1),ne=je(),{isOpen:te,onOpen:se,onClose:ye}=Tr(),{isOpen:Se,onOpen:we,onClose:Ce}=Tr(),[ke,ze]=e.useState(0),{isOpen:Fe,onOpen:Ae,onClose:Me}=Tr(),[Pe,$e]=e.useState(null),Be=new URLSearchParams(G.search).get("update"),Le=Boolean(Be),Ue=Wi(),{currentUser:Xe,refreshToken:Ge,logout:Ke,beginSignOut:qe}=e.useContext(De),{isLocked:Qe}=cn(null==x?void 0:x.id,Xe),rr=e.useCallback(()=>{Le||Qe?Me():Ae()},[Le,Qe,Me,Ae]),[ir,nr]=e.useState(!1),[tr,sr]=e.useState(!1),lr=ti(),ar=null==lr?void 0:lr.setHeaderInviteAction,dr=null==lr?void 0:lr.clearHeaderInviteAction,cr=e.useCallback(()=>sr(!0),[]);e.useEffect(()=>{if(v&&ar)return ar(cr),()=>null==dr?void 0:dr()},[v,ar,dr,cr]);const pr=e.useCallback(()=>{ze(0)},[]),xr=e.useCallback(async e=>{if(!(null==x?void 0:x.id))return;const r=await le(x.id,e);null==Q||Q(e=>e?{...e,discussionsForReaders:r.discussionsForReaders}:e)},[null==x?void 0:x.id,Q]),ur=e.useRef(()=>{});ur.current=()=>{if(!(null==x?void 0:x.id)||null==(null==Xe?void 0:Xe.id))return;const e=`steppo:lastSeenVersionId:${x.id}`;B(x.id).then(r=>{const i=(null==r?void 0:r.versions)||[],o=parseInt(localStorage.getItem(e),10),n=Number.isFinite(o)?o:0,t=i.filter(e=>{var r;return e.id>n&&(null==(r=e.author)?void 0:r.id)!==Xe.id}).length;ze(t)}).catch(()=>{})},e.useEffect(()=>{if(!Ue||!(null==x?void 0:x.id))return;let e=null;const r=r=>{(null==r?void 0:r.id)===x.id&&(null==r?void 0:r.userId)!==(null==Xe?void 0:Xe.id)&&(ze(e=>e+1),e&&clearTimeout(e),e=setTimeout(()=>ur.current(),800))};return Ue.on("instruction:update",r),()=>{Ue.off("instruction:update",r),e&&clearTimeout(e)}},[Ue,null==x?void 0:x.id,null==Xe?void 0:Xe.id]),e.useEffect(()=>{ur.current()},[null==x?void 0:x.id,null==Xe?void 0:Xe.id]),e.useEffect(()=>{Le&&Fe&&Me()},[Le,Fe,Me]);const hr="reader"!==g&&"REGULATION"!==(null==x?void 0:x.instructionType)&&!!(null==x?void 0:x.recordingEndedAt);e.useEffect(()=>{if(!hr||!(null==x?void 0:x.id))return void $e(null);let e=!1;return q(x.id).then(r=>{e||$e((null==r?void 0:r.proposalUuid)||null)}).catch(()=>{}),()=>{e=!0}},[hr,null==x?void 0:x.id]);const{isOpen:gr,onOpen:br,onClose:mr}=Tr(),[fr,vr]=e.useState(""),[jr,yr]=e.useState(""),[Sr,wr]=e.useState(""),[Cr,kr]=e.useState(""),[zr,Wr]=e.useState("fast"),[Rr,Fr]=e.useState(null),[_r,Pr]=e.useState(0),$r=e.useRef(null),[Br,Lr]=e.useState(0),[Hr,Ur]=e.useState(""),[Nr,Vr]=e.useState(""),[Zr,ei]=e.useState(!1),[ri,ii]=e.useState(0),[oi,ni]=e.useState(0),[si,li]=e.useState(""),[ai,di]=e.useState(""),[ci,pi]=e.useState(!1),[xi,ui]=e.useState(0),[hi,gi]=e.useState(!1),[bi,mi]=e.useState(!1),[fi,ji]=e.useState(!1),{resetCompany:yi,companyData:Si}=e.useContext(j),{resetLicense:wi,license:zi,refreshLicense:Ri,openLicenseModal:Fi}=p(),Ii=localStorage.getItem("token"),Ai=(null==zi?void 0:zi.createdAt)&&(null==zi?void 0:zi.expiresAt)?(new Date(zi.expiresAt)-new Date(zi.createdAt))/864e5:null,Di="PRO"===(null==zi?void 0:zi.type)&&null!=Ai&&Ai<=7,Ei=(null==(P=null==zi?void 0:zi.user)?void 0:P.trialEnrichAttemptsUsed)??0,_i=Di?Math.max(0,3-Ei):null,Mi=Di&&_i<=0;e.useEffect(()=>{const e=null==x?void 0:x.uuid;!b&&E&&e&&!function(e){if(!e)return!0;try{return"1"===localStorage.getItem(`${Pt}${e}`)}catch{return!1}}(e)?nr(!0):nr(!1)},[null==x?void 0:x.uuid,b,E]);const Ti=e.useCallback(()=>{(null==x?void 0:x.uuid)&&function(e){if(e)try{localStorage.setItem(`${Pt}${e}`,"1")}catch{}}(x.uuid),nr(!1)},[null==x?void 0:x.uuid]),Oi=e.useCallback(()=>{"PRO"!==(null==zi?void 0:zi.type)||Mi?Mi||Fi():br()},[Mi,null==zi?void 0:zi.type,br,Fi]),Pi=r.jsx(Ct,{isOpen:ir,onDismiss:Ti,onPrimaryAction:Oi,onOpenShare:()=>io(!0),onOpenHistory:we,onOpenCollaboration:()=>sr(!0),primaryActionLabel:"PRO"!==(null==zi?void 0:zi.type)||Mi?"Повысить тариф":"Улучшить инструкцию",isMobile:b}),[$i,Bi]=e.useState((null==Xe?void 0:Xe.avatarUrl)||""),Li=e.useRef(null);e.useEffect(()=>{Bi((null==Xe?void 0:Xe.avatarUrl)||"")},[Xe]),e.useEffect(()=>{x&&eo(x.isPublic)},[x]);const Hi=async()=>
21{if(x)try{const e=`https://steppo.ru/public/${x.uuid}`,r=await or(e);"none"===x.isPublic&&(await be(x.id),eo("public")),ne(r?{title:"Публичная ссылка скопирована в буфер обмена",status:"success"}:{title:"Не удалось скопировать",description:e,status:"warning"}),io(!1)}catch(e){ne({title:"Ошибка публикации",description:e.message,status:"error"})}},Ui=async()=>x?("none"!==x.isPublic||(await be(x.id),eo("public")),`https://steppo.ru/public/${x.uuid}`):null,[Ni,Xi]=e.useState(""),[Gi,Ki]=e.useState(""),[qi,Ji]=e.useState(""),[Qi,eo]=e.useState(null),[ro,io]=e.useState(!1),[oo,no]=e.useState(null),[to,lo]=e.useState(!1),[ao,co]=e.useState(!1);e.useEffect(()=>{Xe&&Ii&&ae().then(e=>{const r=e.name||"";Xi(r),Ki(r)}).catch(e=>{var r,i;e.response&&403===e.response.status?po():ne({title:"Ошибка при загрузке профиля",description:(null==(i=null==(r=e.response)?void 0:r.data)?void 0:i.error)||e.message,status:"error",duration:3e3,isClosable:!0})})},[Xe,ne,X]),e.useEffect(()=>{te&&Ji(Ni)},[te,Ni]),localStorage.getItem("selectedCompanyId");const po=async e=>{try{null==qe||qe(),de(!0);try{await ce()}catch(r){}Ke(),localStorage.removeItem("token"),localStorage.removeItem("userEmail"),localStorage.removeItem("selectedCompanyId"),localStorage.removeItem("choosenFolder"),localStorage.removeItem("role"),localStorage.removeItem(`choosenFolder_${e}`),yi(),wi(),window.postMessage({action:"AUTH_LOGOUT"},"*"),X("/login")}catch(i){}};null==x||x.folder;const xo=async e=>{try{await J(e),ne({title:"Тестовый период активирован",description:"Теперь вы можете использовать функционал Steppo PRO в течение 7 дней",status:"success",duration:4e3,isClosable:!0}),null==K||K()}catch(r){ne({title:"Ошибка при активации тестового периода",description:r.message||"Не удалось активировать тестовый период.",status:"error",duration:4e3,isClosable:!0})}finally{Ri()}};e.useEffect(()=>{var e;x&&(eo(x.isPublic),lo(x.seo||!1),(null==(e=x.author)?void 0:e.email)&&pe(x.author.email).then(e=>no(e.type)).catch(console.error))},[x,null==zi?void 0:zi.type]);const uo=Mi?"Лимит улучшений на тестовом периоде (3 попытки). Оформите подписку PRO для неограниченного использования.":"PRO"===(null==zi?void 0:zi.type)?Di&&null!=_i?`Продвинутый анализ скриншотов. Осталось попыток: ${_i}`:"Продвинутый анализ скриншотов и генерация подробных описаний шагов":r.jsxs(Ve,{spacing:2,align:"stretch",children:[r.jsx(Ar,{fontSize:"sm",fontWeight:"500",children:"Продвинутый анализ скриншотов доступен в тарифе PRO"}),r.jsx("video",{src:"https://s3.regru.cloud/steppo.bucket/Example/aienrich.mp4",playsInline:!0,muted:!0,loop:!0,autoPlay:!0,style:{borderRadius:"4px",width:"100%"}})]}),ho=b?"rgba(26, 26, 26, 0.72)":bn,go=r.jsxs(Dn,{direction:"middle",variant:b?"mobile":"desktop",disableMagnification:b,interactionPaused:bi,children:[r.jsx(En,{onClick:Hi,"aria-label":"Скопировать прямую ссылку на инструкцию",tooltip:"Скопировать прямую ссылку на инструкцию",children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:r.jsx(He,{size:24,strokeWidth:1.5})})}),"reader"!==g&&r.jsxs(r.Fragment,{children:[r.jsx(_n,{}),M&&r.jsx(En,{onClick:M,badge:T,"aria-label":"Обсуждения",tooltip:"Обсуждения",children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:r.jsx(Je,{size:22})})}),r.jsx(En,{onClick:Mi||!(null==($=null==x?void 0:x.steps)?void 0:$.length)||Qe?void 0:"PRO"!==(null==zi?void 0:zi.type)||Mi?Fi:br,"aria-label":"Улучшить описания шагов",tooltip:Qe?"Идёт обновление инструкции":uo,tooltipDisabled:gr,style:{opacity:Mi||!(null==(L=null==x?void 0:x.steps)?void 0:L.length)||Qe?.4:1},children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:hi?r.jsx(Or,{size:"sm"}):r.jsx(Ze,{size:24})})}),r.jsx(En,{onClick:we,badge:ke,"aria-label":"История изменений",tooltip:"История изменений",tooltipDisabled:Se,children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:r.jsx(vi,{size:24,strokeWidth:1.5})})}),hr&&r.jsx(En,{onClick:Le||Qe?void 0:rr,badge:Pe?1:0,"aria-label":"Обновить инструкцию",tooltip:Le?"Правки уже открыты":Qe?"Инструкция сейчас обновляется":Pe?"Есть предложенные изменения":"Обновить инструкцию перезаписью",style:{opacity:Le||Qe?.42:1},children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:r.jsx(Vi,{size:24,strokeWidth:1.5})})}),r.jsx(En,{onClick:()=>io(!0),"aria-label":"Поделиться",tooltip:"Поделиться",children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:r.jsx(Yi,{size:28})})}),v&&z&&R&&F&&r.jsx(Pn,{targetColor:y,accentColor:C,commentsEnabled:k,onTargetColorChange:z,onAccentColorChange:R,onCommentsToggle:F,locked:I,updateLocked:Qe,onOpenLicenseModal:Fi,onStartProTest:A,isProTested:D,disableMagnification:b,onOpenChange:mi})]}),r.jsx(En,{onClick:()=>ji(!0),"aria-label":"Информация о документе",tooltip:"Информация",children:r.jsx(Er,{as:"span",display:"inline-flex",color:ho,children:r.jsx(so,{size:22,strokeWidth:1.7})})}),r.jsx(_n,{}),r.jsx(En,{onClick:async()=>{try{const e=await Ui();if(!e)return;window.open(`https://t.me/share/url?url=${encodeURIComponent(e)}`,"_blank","noopener,noreferrer")}catch(e){ne({title:"Ошибка отправки",description:e.message,status:"error"})}},"aria-label":"Отправить в Telegram",tooltip:"Отправить ссылку в Telegram",children:r.jsx(Er,{as:"span",display:"inline-flex",color:mn,children:r.jsx(_e,{size:24})})}),r.jsx(En,{onClick:async()=>{try{const e=await Ui();if(!e)return;window.open(`mailto:?subject=${encodeURIComponent((null==x?void 0:x.title)||"")}&body=${encodeURIComponent(e)}`,"_blank")}catch(e){ne({title:"Ошибка отправки",description:e.message,status:"error"})}},"aria-label":"Отправить по Email",tooltip:"Отправить ссылку по Email",children:r.jsx(Er,{as:"span",display:"inline-flex",color:"#EA4335",children:r.jsx(Te,{size:24})})})]}),bo=r.jsx(r.Fragment,{children:r.jsxs(Ne,{spacing:v?"6px":"15px",children:[r.jsx(Mr,{PortalProps:{zIndex:9999},hasArrow:!0,openDelay:250,closeDelay:100,closeOnScroll:!0,borderRadius:"12px",px:"12px",py:"8px",label:r.jsx(Ne,{spacing:"8px",alignItems:"center",children:r.jsx(Ar,{children:"Скопировать прямую ссылку на инструкцию"})}),"aria-label":"A tooltip with icon and text",children:r.jsx(Dr,{onClick:Hi,cursor:"pointer",as:"IconButton",py:"5px",bgColor:"#EBEDF0",icon:r.
21jsx(He,{fontSize:"1.125rem"}),variant:"outline",color:"#007AFF",borderRadius:"99px",h:"40px",border:"1px solid",borderColor:"#007AFF35",boxShadow:"sm"})}),"reader"!==g&&r.jsx(Mr,{PortalProps:{zIndex:9999},hasArrow:!0,openDelay:250,closeDelay:100,closeOnScroll:!0,borderRadius:"12px",px:"12px",py:"8px",isDisabled:gr,label:Qe?"Идёт обновление инструкции":uo,children:b?r.jsx(Dr,{opacity:hi||!(null==(N=null==x?void 0:x.steps)?void 0:N.length)||"PRO"!==(null==zi?void 0:zi.type)||Mi?.4:1,isLoading:hi,isDisabled:Mi||Qe,onClick:"PRO"!==(null==zi?void 0:zi.type)||Mi?Mi?void 0:Fi:br,py:"5px",fontSize:".875rem",fontWeight:"400",bgColor:"gray.100",icon:r.jsx(Ze,{fontSize:"1.125rem",color:"orange"}),variant:"outline",borderRadius:"99px",h:"40px",border:"1px solid",boxShadow:"base",_hover:{boxShadow:"sm"},borderColor:"gray.300",color:"gray.600","aria-label":"Подробные описания от ИИ",overflow:"hidden",position:"relative",sx:!(hi||!(null==(V=null==x?void 0:x.steps)?void 0:V.length)||"PRO"!==(null==zi?void 0:zi.type)||Mi)&&{"&::after":{content:'""',position:"absolute",top:0,left:"-100%",width:"100%",height:"100%",background:"linear-gradient(75deg, transparent, rgba(255,255,255,0.6), transparent)",pointerEvents:"none",zIndex:10,animation:`${$t} 1.5s ease-in-out 2 alternate`}}}):r.jsx(Ir,{opacity:hi||!(null==(H=null==x?void 0:x.steps)?void 0:H.length)||"PRO"!==(null==zi?void 0:zi.type)||Mi?.4:1,isLoading:hi,isDisabled:Mi||Qe,onClick:"PRO"!==(null==zi?void 0:zi.type)||Mi?Mi?void 0:Fi:br,py:"5px",fontSize:".875rem",fontWeight:"400",bgColor:"gray.100",leftIcon:r.jsx(Ze,{fontSize:"1.125rem",color:"orange"}),variant:"outline",borderRadius:"99px",h:"40px",border:"1px solid",boxShadow:"base",_hover:{boxShadow:"sm"},borderColor:"gray.300",color:"gray.600","aria-label":"Подробные описания от ИИ",overflow:"hidden",position:"relative",sx:!(hi||!(null==(U=null==x?void 0:x.steps)?void 0:U.length)||"PRO"!==(null==zi?void 0:zi.type)||Mi)&&{"&::after":{content:'""',position:"absolute",top:0,left:"-100%",width:"100%",height:"100%",background:"linear-gradient(75deg, transparent, rgba(255,255,255,0.6), transparent)",pointerEvents:"none",zIndex:10,animation:`${$t} 1.5s ease-in-out 2 alternate`}},children:"Улучшить"})}),"reader"!==g&&r.jsx(Mr,{hasArrow:!0,openDelay:250,closeDelay:100,closeOnScroll:!0,borderRadius:"12px",px:"12px",py:"8px",label:"История изменений",isDisabled:Se,children:r.jsxs(Er,{position:"relative",display:"inline-block",children:[r.jsx(Dr,{onClick:we,py:"5px",bgColor:"#EBEDF0",icon:r.jsx(vi,{fontSize:"1.125rem"}),variant:"outline",borderRadius:"99px",h:"40px",border:"1px solid",borderColor:"rgba(0,0,0,.1)","aria-label":"История версий"}),ke>0&&r.jsx(Ie,{position:"absolute",top:"-4px",right:"-4px",minW:"18px",h:"18px",px:"5px",borderRadius:"full",bg:"red.500",color:"white",borderWidth:"2px",borderColor:"white",_dark:{borderColor:"gray.800"},fontSize:"0.7rem",fontWeight:"700",display:"flex",alignItems:"center",justifyContent:"center","aria-label":ke>9?"Непросмотренных изменений: 9+":`Непросмотренных изменений: ${ke}`,children:ke>9?"9+":ke})]})}),hr&&r.jsx(Mr,{hasArrow:!0,openDelay:250,closeDelay:100,closeOnScroll:!0,borderRadius:"12px",px:"12px",py:"8px",label:Le?"Правки уже открыты":Qe?"Инструкция сейчас обновляется":Pe?"Есть предложенные изменения":"Обновить инструкцию перезаписью",children:r.jsxs(Er,{position:"relative",display:"inline-block",children:[r.jsx(Dr,{onClick:rr,isDisabled:Le||Qe,py:"5px",bgColor:"#EBEDF0",icon:r.jsx(Vi,{size:"1.125rem"}),variant:"outline",borderRadius:"99px",h:"40px",border:"1px solid",borderColor:"rgba(0,0,0,.1)","aria-label":"Обновить инструкцию"}),Pe&&r.jsx(Ie,{position:"absolute",top:"-4px",right:"-4px",minW:"18px",h:"18px",px:"5px",borderRadius:"full",bg:"orange.500",color:"white",borderWidth:"2px",borderColor:"white",_dark:{borderColor:"gray.800"},fontSize:"0.7rem",fontWeight:"700",display:"flex",alignItems:"center",justifyContent:"center","aria-label":"Есть предложенные изменения",children:"!"})]})}),b?r.jsx(Ir,{as:Dr,display:"reader"===g?"none":"flex",color:"#4F378A",onClick:()=>{io(!0)},icon:r.jsx(Yi,{}),_hover:{bg:"#D8C3E3"},_active:{bg:"#BCAAC6"},bg:"#EBD4F7",h:"40px",borderRadius:"40px",border:"1px solid",borderColor:"#4F378A35"}):r.jsx(Ir,{display:"reader"===g?"none":"flex",color:"#4F378A",onClick:()=>{io(!0)},leftIcon:r.jsx(Yi,{}),_hover:{bg:"#D8C3E3"},_active:{bg:"#BCAAC6"},bg:"#EBD4F7",h:"40px",borderRadius:"40px",border:"1px solid",borderColor:"#4F378A35",boxShadow:"sm",children:r.jsx(Ar,{fontSize:"0.825rem",fontWeight:"400",children:"Поделиться"})}),!v&&(Xe?r.jsxs(t,{cursor:"none",children:[r.jsx(s,{as:Ir,rightIcon:r.jsx(l,{}),variant:"outline",bgColor:"#EBEDF0",borderRadius:"24px",py:"12px",px:"20px",pl:"4px",children:r.jsxs(Ne,{children:[r.jsx(Re,{size:"sm",src:null==Xe?void 0:Xe.avatarUrl,name:(null==Xe?void 0:Xe.username)||(null==Xe?void 0:Xe.email)}),r.jsxs(Ve,{spacing:"2px",align:"start",children:[r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",display:b?"n
21one":"flex",children:(null==Xe?void 0:Xe.username)||(null==Xe?void 0:Xe.email)}),r.jsx(Ar,{fontSize:"0.65rem",fontWeight:"300",color:"gray.600",display:b?"none":"flex",children:null==Xe?void 0:Xe.email})]})]})}),r.jsxs(u,{children:[r.jsx(h,{cursor:"pointer",onClick:e=>{e.preventDefault(),e.stopPropagation(),Fi()},children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Управление подпиской"})}),r.jsx(h,{onClick:se,children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Настройки профиля"})}),r.jsx(h,{onClick:po,children:r.jsx(Ar,{fontSize:"0.875rem",fontWeight:"400",children:"Выйти"})})]})]}):r.jsx(Ye,{href:"/login",display:"none",cursor:"none",children:r.jsx(Ir,{colorScheme:"purple",variant:"outline",cursor:"none",children:"Войти"})}))]})}),mo=r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{isOpen:gr,onClose:mr,isCentered:!b,scrollBehavior:b?"inside":void 0,returnFocusOnClose:!1,children:[r.jsx(Xr,{backdropBlur:4,backdropFilter:"blur(4px)"}),r.jsx(Gr,{boxShadow:"4px 4px 15px rgba(0, 0, 0, 0.15)",borderRadius:b?0:"20px",px:b?"16px":"30px",pt:b?"calc(env(safe-area-inset-top, 0px) + 16px)":"20px",pb:b?"calc(env(safe-area-inset-bottom, 0px) + 12px)":"20px",m:b?0:void 0,w:b?"100vw":void 0,maxW:b?"100vw":"450px",h:b?"var(--app-height, 100vh)":void 0,minH:b?"var(--app-height, 100vh)":void 0,maxH:b?"var(--app-height, 100vh)":void 0,display:"flex",flexDirection:"column",overflow:"hidden",children:r.jsxs(Ve,{align:"start",w:"100%",h:b?"100%":"auto",minH:0,spacing:b?0:"20px",children:[r.jsx(Qr,{p:"0",pb:b?4:0,pr:b?"44px":0,w:"100%",flexShrink:0,children:r.jsx(Ar,{fontSize:"1.125rem",fontWeight:"700",children:"Подробные описания от ИИ"})}),r.jsx(Kr,{borderRadius:"99px",mt:b?0:"5px",top:b?"calc(env(safe-area-inset-top, 0px) + 8px)":void 0,right:b?"12px":void 0}),r.jsxs(Jr,{p:"0",pr:b?1:0,pb:b?4:0,w:"100%",flex:b?1:void 0,minH:b?0:void 0,overflowX:"hidden",overflowY:b?"auto":void 0,scrollPaddingBottom:b?"calc(var(--keyboard-inset, 0px) + 16px)":void 0,sx:b?{overscrollBehavior:"contain",WebkitOverflowScrolling:"touch"}:void 0,children:[Di&&null!=_i&&r.jsxs(Ar,{fontSize:".875rem",fontWeight:"500",mb:3,color:"orange.600",children:["На тестовом периоде PRO: осталось попыток улучшения — ",_i," из 3."]}),r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",mb:4,children:"Позволяет сгенерировать текстовые описания для шагов инструкции на основании скриншотов и текущего текста шагов."}),r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",mb:4,color:"gray.500",children:"Для обеспечения наиболее точных описаний, ответьте пожалуйста на несколько вопросов. (необязательно)"}),r.jsxs(Ve,{align:"stretch",spacing:4,children:[r.jsxs(Er,{children:[r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Для кого эта инструкция?"}),r.jsx(O,{value:fr,onChange:e=>vr(e.target.value),placeholder:"Например: новый сотрудник, менеджер, пользователь с доступом в систему",fontSize:".875rem",borderRadius:"8px",focusBorderColor:"#4F378A",mb:4,isDisabled:hi})]}),r.jsxs(Er,{children:[r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Какова цель процесса? Что получит пользователь в итоге?"}),r.jsx(O,{value:jr,onChange:e=>yr(e.target.value),placeholder:"Например: смена пароля, создание проекта, настройка команды",fontSize:".875rem",borderRadius:"8px",focusBorderColor:"#4F378A",mb:4,isDisabled:hi})]}),r.jsxs(Er,{children:[r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Что нужно иметь или сделать до начала? (предварительные условия)"}),r.jsx(O,{value:Sr,onChange:e=>wr(e.target.value),placeholder:"Например: быть залогиненным, иметь права доступа",fontSize:".875rem",borderRadius:"8px",focusBorderColor:"#4F378A",mb:4,isDisabled:hi})]}),r.jsxs(Er,{children:[r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Особые требования или нюансы (необязательно)"}),r.jsx(Oe,{value:Cr,onChange:e=>kr(e.target.value),placeholder:"Тон, термины, что подчеркнуть или избегать…",rows:2,resize:"vertical",fontSize:".875rem",borderRadius:"8px",focusBorderColor:"#4F378A",isDisabled:hi})]}),r.jsxs(Er,{children:[r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Укажите точность генерации"}),r.jsxs(t,{matchWidth:!0,children:[r.jsx(s,{as:Ir,rightIcon:r.jsx(l,{}),variant:"outline",fontWeight:"400",fontSize:".875rem",borderRadius:"8px",borderColor:"gray.300",w:"100%",justifyContent:"space-between",textAlign:"left",isDisabled:hi,_hover:{borderColor:"gray.400"},children:"fast"===zr?"Нормальный режим – быстрее":"Детальный режим – медленнее"}),r.jsxs(a,{minW:"100%",children:[r.jsxs(d,{onClick:()=>Wr("fast"),justifyContent:"space-between",children:[r.jsx(Ar,{as:"span",children:"Нормальный режим – быстрее"}),"fast"===zr&&r.jsx(c,{boxSize:4})]}),r.jsxs(d,{onClick:()=>Wr("detailed"),justifyContent:"space-between",children:[r.jsx(Ar,{as:"span",children:"Детальный режим – медленнее"}),"detailed"===zr&&r.jsx(c,{boxSize:4})]})]})]})]}),(()=>{var e;const i=(null==(e=null==x?void 0:x.steps)?void 0:e.length)??0,o=9*i,n=Math.floor(o/60),t=o%60,s=n>0?`${n} ${1===n?"минута":n<5?"минуты":"минут"}${t>0?` ${t} ${1===t?"секунда":t<5?"секунды":"секунд"}`:""}`:`${o} ${1===o?"секунда":o<5?"секунды":"секунд"}`,l="detailed"===zr&&i>0;return r.jsx(Er,{overflow:"hidden",minH:0,w:"100%",children:r.jsx(qr,{in:l,offsetY:-8,unmountOnExit:!0,transition:{enter:{duration:.25},exit:{duration:.2}},style:{width:"100%",display:"block"},children:r.jsx(Er,{p:3,borderRadius:"8px",bg:"orange.50",borderWidth:"1px",borderColor:"orange.200",width:"100%",children:r.jsxs(Ar,{fontSize:".875rem",color:"gray.800",children:["Внимание, на обработку всех шагов инструкции потребуется примерно ",r.jsx("strong",{children:s}),", пожалуйста дождитесь завершения. Вы можете продолжить работу над другими инструкциями в"," ",r.jsx(Ye,{href:"/mainscreen",color:"purple.600",textDecoration:"underline",_hover:{color:"purple.700"},children:"другой вкладке"}),"."]})})})})})()]}),hi&&Rr&&r.jsxs(Ve,{align:"stretch",spacing:2,mt:4,children:[r.jsx(Zi,{size:"sm",colorScheme:"purple",value:Math.min(95,_r),borderRadius:"full",hasStripe:!0,isAnimated:!0,transition:"width 0.15s ease-out"}),r.jsxs(Ar,{fontSize:".875rem",color:"gray.600",children:["Блок ",Rr.chunk," из ",Rr.totalChunks,null!=Rr.totalSteps&&` · Обновлено шаÐ
21³Ð¾Ð²: ${Rr.updated??0}`]})]})]}),r.jsx(Ci,{p:"0",pt:b?3:0,w:"100%",flexShrink:0,borderTopWidth:b?"1px":0,borderColor:"gray.100",children:r.jsxs(Ne,{w:"100%",spacing:"auto",p:"0",children:[r.jsx(Ir,{variant:"ghost",onClick:mr,borderRadius:"40px",h:"40px",children:r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",children:"Отмена"})}),r.jsx(ki,{}),r.jsx(Ir,{bgColor:"#4F378A",color:"white",borderRadius:"40px",_hover:{opacity:"0.75"},_active:{opacity:"1"},h:"40px",isLoading:hi,loadingText:r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",color:"#FFFFFF",children:"Анализирую..."}),isDisabled:hi,onClick:async()=>{var e,r,i,o,n,t,s,l;if(!(null==x?void 0:x.id))return;gi(!0),Pr(0),Fr({chunk:0,totalChunks:1,updated:0,totalSteps:null});$r.current=setInterval(()=>{Pr(e=>Math.min(95,e+.08))},150);try{const s=[];fr.trim()&&s.push(`Для кого: ${fr.trim()}`),jr.trim()&&s.push(`Цель процесса: ${jr.trim()}`),Sr.trim()&&s.push(`Предварительные условия: ${Sr.trim()}`),Cr.trim()&&s.push(`Дополнительно: ${Cr.trim()}`);const l=s.length?s.join("\n"):void 0,a=await xe(x.id,{processContext:l||void 0,fastMode:"fast"===zr,onProgress:e=>{if("start"===e.type){$r.current&&(clearInterval($r.current),$r.current=null),Fr({chunk:0,totalChunks:e.totalChunks,updated:0,totalSteps:e.totalSteps});const r=100/Math.max(1,e.totalChunks||1)/(("fast"===zr?1e4:25e3)/150);$r.current=setInterval(()=>{Pr(e=>Math.min(95,e+r))},150)}else Fr({chunk:e.chunk,totalChunks:e.totalChunks,updated:e.updated,totalSteps:e.totalSteps})}});mr(),vr(""),yr(""),wr(""),kr(""),Wr("fast"),Fr(null),Pr(100);const d=await(null==Z?void 0:Z());Ue&&(null==d?void 0:d.id)&&Ue.emit("instruction:update",d);const c=null!=a.totalSteps?a.totalSteps:a.updated;let p=null!=a.updated&&null!=c?`Обновлено ${a.updated} из ${c} шагов`:null!=a.updated?`Обновлено шагов: ${a.updated}`:"Описания добавлены";(null==(e=a.skippedStepOrders)?void 0:e.length)&&(p+=`. Не обновлены шаги: ${a.skippedStepOrders.join(", ")}`),(null==(r=a.chunkErrors)?void 0:r.length)&&(p+=`. Ошибки в блоках: ${a.chunkErrors.map(e=>e.chunk).join(", ")}`),ne({title:(null==(i=a.chunkErrors)?void 0:i.length)||(null==(o=a.skippedStepOrders)?void 0:o.length)?"Готово с предупреждениями":"Готово",description:p,status:(null==(n=a.chunkErrors)?void 0:n.length)||(null==(t=a.skippedStepOrders)?void 0:t.length)?"warning":"success",duration:5e3}),Ri()}catch(a){const e=(null==(l=null==(s=null==a?void 0:a.response)?void 0:s.data)?void 0:l.error)??a.message??"Не удалось обогатить шаги";ne({title:"Ошибка",description:e,status:"error",duration:5e3})}finally{$r.current&&(clearInterval($r.current),$r.current=null),gi(!1),Fr(null),Pr(0)}},children:r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",color:"#FFFFFF",children:"Сгенерировать"})})]})})]})})]}),r.jsxs(Yr,{isOpen:te,onClose:ye,isCentered:!0,cursor:"none",returnFocusOnClose:!1,children:[r.jsx(Xr,{backdropBlur:4,backdropFilter:"blur(4px)"}),r.jsx(Gr,{boxShadow:"4px 4px 15px rgba(0, 0, 0, 0.15)",borderRadius:"20px",px:"30px",py:"20px",maxW:b?"calc(100vw - 20px)":"450px",children:r.jsx("form",{onSubmit:async e=>{var r,i;if(e.preventDefault(),qi===Gi)return void ye();let o=!1;if(qi!==Gi)try{await me(Ii,{name:qi}),ne({title:"Имя пользователя обновлено",status:"success",duration:3e3,isClosable:!0}),Xi(qi),Ki(qi),o=!0,Ge()}catch(n){ne({title:"Ошибка обновления имени",description:(null==(i=null==(r=n.response)?void 0:r.data)?void 0:i.error)||n.message,status:"error",duration:3e3,isClosable:!0})}o&&ye()},children:r.jsxs(Ve,{align:"start",w:"100%",spacing:"20px",children:[r.jsx(Qr,{p:"0",w:"100%",children:r.jsxs(Ne,{children:[r.jsx(W,{}),r.jsx(Ar,{fontSize:"1.125rem",fontWeight:"700",children:"Настройки профиля"})]})}),r.jsx(Kr,{borderRadius:"99px",mt:b?"20px":"5px"}),r.jsxs(Jr,{p:"0",w:"100%",children:[r.jsxs(Er,{mb:4,children:[r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Фото профиля"}),r.jsxs(Ne,{justify:"space-between",children:[r.jsx(Re,{userSelect:"none",pointerEvents:"none",size:"sm",src:null==Xe?void 0:Xe.avatarUrl,name:qi||(null==Xe?void 0:Xe.username)||(null==Xe?void 0:Xe.email)}),r.jsx(Ir,{borderRadius:"8px",fontSize:".85rem",onClick:()=>Li.current.click(),fontWeight:"400",bgColor:"#EBEDF0",h:"36px",_hover:{bg:"#F5F5F5"},_active:{bg:"#F5F5F5"},children:r.jsx(Ar,{children:"Загрузить новое фото"})}),r.jsx(O,{ref:Li,type:"file",accept:"image/png,image/jpeg",display:"none",onChange:async e=>{const r=e.target.files[0];if(r)try{const{avatarUrl:e}=await ue(Ii,r);Bi(e),ne({title:"Аватар обновлён",status:"success",duration:2e3,isClosable:!0}),Ge()}catch(i){ne({title:"Ошибка загрузки",description:i.message,status:"error",duration:2e3,isClosable:!0})}}})]})]}),r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Имя пользователя"}),r.jsx(O,{placeholder:"Введите имя пользователя",mb:4,fontSize:".875rem",borderRadius:"8px",focusBorderColor:"#4F378A",value:qi,onChange:e=>Ji(e.target.value)}),r.jsx(Ar,{fontWeight:"400",fontSize:".875rem",mb:"8px",children:"Email пользователя"}),r.jsx(O,{placeholder:"Введите имя пользователя",mb:4,fontSize:".875rem",borderRadius:"8px",focusBorderColor:"#4F378A",value:null==Xe?void 0:Xe.email,isDisabled:!0})]}),r.jsx(Ci,{p:"0",w:"100%",children:r.jsxs(Ne,{w:"100%",spacing:"auto",p:"0",children:[r.jsx(Ir,{variant:"ghost",borderRadius:"40px",h:"40px",onClick:ye,children:r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",children:"Отмена"})}),r.jsx(ki,{}),r.jsx(Ir,{type:"submit",bgColor:"#4F378A",borderRadius:"40px",_hover:{opacity:"0.75"},_active:{opacity:"1"},h:"40px",children:r.jsx(Ar,{fontSize:".875rem",fontWeight:"400",color:"#FFFFFF",children:"Сохранить изменения"})})]})})]})})})]}),r.jsx(Io,{isOpen:ro,onClose:()=>io(!1),instruction:x,currentUser:Xe,companyData:Si,license:zi,isMobile:b,handlePublishModalAccessChange:async e=>{if(x)try{await ve(x.id,e);
21if(ne({title:"Уровень доступа обновлён",status:"success"}),eo(e),null==Q||Q(r=>r?{...r,isPublic:e}:r),sessionStorage.setItem("instructionAccessUpdated","1"),("public"===e||"none"===e)&&x.seo)try{await fe(x.id,!1),lo(!1)}catch(r){}co(!1)}catch(i){ne({title:"Ошибка обновления доступа",description:i.message,status:"error"})}},handlePublishClick:Hi,handlePublishClickInteractive:async()=>{if(x)try{const e=`https://steppo.ru/sequence/${x.uuid}`,r=await or(e);"none"===x.isPublic&&(await be(x.id),eo("public")),ne(r?{title:"Публичная ссылка скопирована в буфер обмена",status:"success"}:{title:"Не удалось скопировать",description:e,status:"warning"}),io(!1)}catch(e){ne({title:"Ошибка публикации",description:e.message,status:"error"})}},handlePublishFrameClick:async()=>{if(x)try{const e=`<div style="display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f7f7f7;" >\n    <div style="border-radius: 1rem; width: 850px; height: 650px; display: flex; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);">\n        <div style="border-radius: 1rem; overflow: hidden; width: 850px; height: 650px; border: 1.125px solid rgba(0, 0, 0, 0.25);">\n            <iframe src='https://steppo.ru/public/${x.uuid}?header=0' style="height: 650px; width: 850px; border: 0;"></iframe>\n        </div>\n    </div>\n</div>`,r=await or(e);"none"===x.isPublic&&(await be(x.id),eo("public")),ne(r?{title:"Iframe скопирован в буфер обмена",status:"success"}:{title:"Не удалось скопировать",description:e,status:"warning"})}catch(e){ne({title:"Ошибка копирования",description:e.message,status:"error"})}},handlePublishVideoClick:async()=>{if(x)try{const e=`<div style="display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f7f7f7;" >\n    <div style="border-radius: 1rem; width: 850px; height: 650px; display: flex; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);">\n        <div style="border-radius: 1rem; overflow: hidden; width: 850px; height: 650px; border: 1.125px solid rgba(0, 0, 0, 0.25);">\n            <iframe src='https://steppo.ru/embed/${x.uuid}?withAudio=1&showControls=1&frameHeight=700' style="height: 650px; width: 850px; border: 0;"></iframe>\n        </div>\n    </div>\n</div>`,r=await or(e);"none"===x.isPublic&&(await be(x.id),eo("public")),ne(r?{title:"Iframe скопирован в буфер обмена",status:"success"}:{title:"Не удалось скопировать",description:e,status:"warning"})}catch(e){ne({title:"Ошибка копирования",description:e.message,status:"error"})}},handlePublishSlideshowClick:async()=>{if(x)try{const e=`<div style="display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f7f7f7;" >\n    <div style="border-radius: 1rem; width: 850px; height: 650px; display: flex; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);">\n        <div style="border-radius: 1rem; overflow: hidden; width: 850px; height: 650px; border: 1.125px solid rgba(0, 0, 0, 0.25);">\n            <iframe src='https://steppo.ru/embed/${x.uuid}?withAudio=0&showControls=0&frameHeight=800' style="height: 650px; width: 850px; border: 0;"></iframe>\n        </div>\n    </div>\n</div>`,r=await or(e);"none"===x.isPublic&&(await be(x.id),eo("public")),ne(r?{title:"Iframe скопирован в буфер обмена",status:"success"}:{title:"Не удалось скопировать",description:e,status:"warning"})}catch(e){ne({title:"Ошибка копирования",description:e.message,status:"error"})}},handleSeoChange:async e=>{const r=e.target.checked;lo(r),co(!0);try{await fe(x.id,r),ne({title:r?"SEO включено":"SEO выключено",status:"success",duration:2e3})}catch(i){lo(!r),ne({title:"Ошибка обновления SEO",description:i.message,status:"error",duration:2e3})}finally{co(!1)}},commentsForReaders:Boolean(null==x?void 0:x.discussionsForReaders),onCommentsForReadersChange:xr,handleStartTest:xo,generatePdf:ge,generateDocx:he,toast:ne,onInstructionRefresh:K,PublicSequencePageNew:er}),r.jsx(Ot,{currentCompanyRole:g,companyData:Si,instructionUuid:null==x?void 0:x.uuid,isOpen:tr,onClose:()=>sr(!1),isMobile:b}),r.jsx(dn,{isOpen:Se,onClose:Ce,instructionId:null==x?void 0:x.id,documentType:"instruction",onRestored:()=>{const e=null==Z?void 0:Z();return e&&"function"==typeof e.then?e:Promise.resolve()},onMarkAsRead:pr,socket:Ue,currentUserId:null==Xe?void 0:Xe.id,authorLicenseType:oo,openLicenseModal:Fi,onTryPro:(null==Xe?void 0:Xe.id)?()=>xo(Xe.id):void 0,isProTested:null==zi?void 0:zi.isProTested,updateLocked:Qe}),r.jsx(Zn,{entity:{...x,kind:"document"},isOpen:fi,onClose:()=>ji(!1)}),r.jsx(gt,{isOpen:Fe&&!Le,onClose:Me,instruction:x,currentUser:Xe,onOpenLicenseModal:Fi})]});return v?r.jsxs(r.Fragment,{children:[Pi,go,mo]}):r.jsxs(Er,{w:"100%",zIndex:"5",h:"60px",boxShadow:"base",borderBottom:"1px",borderColor:"#d9d9d9",bgColor:"rgba(255,255,255,.55)",backdropFilter:"blur(8px)",children:[Pi,r.jsxs(We,{justify:"space-between",align:"center",px:"20px",h:"60px",children:[r.jsx(Ne,{spacing:"25px",children:!f&&r.jsx(Ye,{onClick:()=>{var e;const r=(null==(e=null==x?void 0:x.folder)?void 0:e.companyId)||(null==x?void 0:x.companyId)||localStorage.getItem("selectedCompanyId"),i=[];for(let n=0;n<localStorage.length;n++){const e=localStorage.key(n);e&&e.startsWith("choosenFolder_")&&i.push(e)}
21i.forEach(e=>localStorage.removeItem(e));const o=(null==x?void 0:x.folderId)||"0";r&&localStorage.setItem(`choosenFolder_${r}`,o),X(`/mainscreen?cid=${r}&lastFolder=${o}`)},_hover:{opacity:"0.75"},_active:{opacity:"1"},children:r.jsxs(Ne,{spacing:"10px",bg:"#EBEDF0",py:"4px",px:"10px",border:"1px solid #D9DADD",borderRadius:"8px",children:[r.jsx(Ee,{size:"16px"}),!b&&r.jsxs(Ar,{fontWeight:"400",fontSize:"0.825rem",textDecoration:"none",children:["Перейти в папку ",r.jsx("b",{children:(null==(Y=null==x?void 0:x.folder)?void 0:Y.name)||"Накопитель"})]})]})})}),r.jsxs(Ne,{spacing:"8px",children:[i.isValidElement(_)?i.cloneElement(_,{onInvite:cr}):_,bo]})]}),mo]})}export{no as C,En as D,Zn as E,Bt as H,so as I,ao as M,Nn as P,Io as S,dn as V,uo as a,bn as b,hn as c,gn as d,un as e,Dn as f,_n as g,mn as h,Ot as i,Go as j,Fn as k,cn as l,On as m,pn 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.