UNPKG

@diplodoc/transform

Version:

A simple transformer of text in YFM (Yandex Flavored Markdown) to HTML

3 lines (2 loc) 26.5 kB
"use strict";(()=>{(()=>{var wt=Object.create,z=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,tt=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty,_t=(t,e,o)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,St=(t,e)=>function(){return e||(0,t[tt(t)[0]])((e={exports:{}}).exports,e),e.exports},Ct=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!At.call(t,n)&&n!==o&&z(t,n,{get:()=>e[n],enumerable:!(i=Lt(e,n))||i.enumerable});return t},Ot=(t,e,o)=>(o=t!=null?wt(Et(t)):{},Ct(e||!t||!t.__esModule?z(o,"default",{value:t,enumerable:!0}):o,t)),Nt=(t,e,o)=>_t(t,typeof e!="symbol"?e+"":e,o),It=St({"node_modules/get-root-node-polyfill/index.js"(t,e){"use strict";function o(c){var u=typeof c=="object"&&!!c.composed;return u?i(this):n(this)}function i(c){var u=n(c);return l(u)?i(u.host):u}function n(c){return c.parentNode!=null?n(c.parentNode):c}function l(c){return c.nodeName==="#document-fragment"&&c.constructor.name==="ShadowRoot"}typeof e=="object"&&e.exports&&(e.exports=o)}});(()=>{var t="yfm_cut",e={Cut:"yfm-cut",Title:"yfm-cut-title",Content:"yfm-cut-content",Highlight:"yfm-cut-highlight"},o=class{constructor(){Nt(this,"disposers",[]),this.disposers.push(this.init())}init(){let l=!1,c=()=>{l=!0},u=()=>{l=!1},v=g=>{n(g.target)&&!l&&this.focusActiveCut(g.target)};return document.addEventListener("mousedown",c),document.addEventListener("mouseup",u),document.addEventListener("focus",v,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("mouseup",u),document.removeEventListener("focus",v,!0)}}dispose(){for(let l of this.disposers)l()}focusActiveCut(l){let c=l.parentNode;if(!i(c))return;let u=c;for(;u;)i(u)&&(u.open=!0),u=u.parentElement;setTimeout(()=>{c.classList.add(e.Highlight)},70),setTimeout(()=>{c.classList.remove(e.Highlight)},1e3)}};function i(l){var c;return((c=l==null?void 0:l.tagName)==null?void 0:c.toLowerCase())==="details"&&(l==null?void 0:l.classList.contains(e.Cut))}function n(l){var c;return((c=l==null?void 0:l.tagName)==null?void 0:c.toLowerCase())==="summary"&&(l==null?void 0:l.classList.contains(e.Title))}typeof window<"u"&&!window[t]&&(window[t]=new o)})(),(()=>{var t="yfm-tabs",e="yfm-tab",o="yfm-tab-panel",i="yfm-tab-list",n="active",l="data-diplodoc-group",c="data-diplodoc-key",u="data-diplodoc-variant",v="data-diplodoc-id",g="defaultTabsGroup-",_="data-diplodoc-forced",S="yfm-tabs-dropdown-select",y="yfm-tabs-vertical",b=(r=>(r.Regular="regular",r.Radio="radio",r.Dropdown="dropdown",r.Accordion="accordion",r))(b||{}),w=Symbol.for("diplodocTabs"),C=r=>{let s=r.composedPath();return Array.isArray(s)&&s.length>0?s[0]:r.target},x=r=>{let s=C(r);return!s||!s.matches},$=r=>Math.abs(r.scrollHeight-r.clientHeight)>1?r:r.parentElement?$(r.parentElement):void 0,M=(r,s)=>{let a=r.getBoundingClientRect(),d=s.getBoundingClientRect();return{top:a.top-d.top,left:a.left-d.left,scrollTop:s.scrollTop,scrollLeft:s.scrollLeft}},A={TABS:`.${t}`,TAB_LIST:`.${i}`,TAB:`.${e}`,TAB_PANEL:`.${o}`,VERTICAL_TABS:`.${y}`},U=class{constructor(r,s={}){this._onSelectTabHandlers=new Set,this._currentPageTabGroups=[],this._isRestoringTabs=!1,this._document=r,this._options=Object.assign({saveTabsToLocalStorage:!1,saveTabsToQueryStateMode:"none"},s),this._document.addEventListener("click",a=>{let d=C(a);if(a.target&&this.hideAllDropdown(a.target),x(a))return;if(this.isElementDropdownSelect(d)){d.classList.toggle(n);return}if(!this.isValidTabElement(d))return;let f=this.getTabDataFromHTMLElement(d);f&&this._selectTab(f,d)}),this._document.addEventListener("keydown",a=>{let d=null;switch(a.key){case"ArrowLeft":{d="left";break}case"ArrowRight":{d="right";break}case"ArrowUp":{d="left";break}case"ArrowDown":{d="right";break}}if(!d)return;let f=C(a);if(x(a)||!this.isValidTabElement(f))return;let{tabs:p,nodes:m}=this.getTabs(f),h=this.getTabDataFromHTMLElement(f),T=p.findIndex(({key:E})=>(h==null?void 0:h.key)&&E===h.key);if(!h||p.length<=1||T===-1)return;let L=(T+(d==="left"?-1:1)+p.length)%p.length;this.selectTab(p[L]),m[L].focus()})}configure(r){this._options=Object.assign(this._options,r)}onSelectTab(r){return this._onSelectTabHandlers.add(r),()=>{this._onSelectTabHandlers.delete(r)}}selectTabById(r,s){let a=this._document.querySelector(`${A.TAB}[${v}="${r}"]`);if(!a||!this.isValidTabElement(a))return;let d=this.getTabDataFromHTMLElement(a);d&&this._selectTab(d,a),s!=null&&s.scrollToElement&&a.scrollIntoView()}selectTab(r){this._selectTab(r)}restoreTabs(r){this._isRestoringTabs=!0;try{for(let[s,a]of Object.entries(r))if(s){let d={group:s,...a};this.selectTab(d)}}finally{this._isRestoringTabs=!1}}getTabsFromLocalStorage(){return JSON.parse(localStorage.getItem("tabsHistory")||"{}")}getTabsFromSearchQuery(){let r={},s=new URLSearchParams(window.location.search);return s.has("tabs")&&(s.get("tabs")||"").split(",").forEach(a=>{let d=a.split("_"),[f,p]=d,m="regular";if(d.length===3&&(m=d[2]),f&&p&&Object.values(b).includes(m)){let h=p;r[f]={key:h,variant:m}}}),r}updateLocalStorageWithTabs(r){this._options.saveTabsToLocalStorage&&(this._isRestoringTabs||localStorage.setItem("tabsHistory",JSON.stringify(r)))}updateQueryParamWithTabs(r){if(this._isRestoringTabs)return;let s=new URLSearchParams(window.location.search),a=Object.entries(r).map(([p,{key:m,variant:h}])=>h==="regular"?`${p}_${m}`:`${p}_${m}_${h}`);a.length>0?s.set("tabs",a.join(",")):s.delete("tabs");let d=history.state||{},f=new URL(window.location.href);f.search=s.toString(),window.history.replaceState({...d},document.title,f.href)}getCurrentPageTabHistory(r){return Object.fromEntries(Object.entries(r).filter(([s])=>this._currentPageTabGroups.includes(s)))}onPageChanged(){this._currentPageTabGroups=this.getCurrentPageTabGroups()}getCurrentPageTabGroups(){let r=this._document.getElementsByClassName(t),s=new Set;return Array.from(r).forEach(a=>{let d=a.getAttribute(l);d&&s.add(d)}),Array.from(s)}clearTabsPreferred(){localStorage.removeItem("tabsHistory"),this.updateQueryParamWithTabs({})}_selectTab(r,s){let{group:a,key:d,variant:f}=r;if(!a)return;this.saveTabPreferred({group:a,key:d,variant:f});let p=s&&$(s),m=p&&M(s,p);this.updateHTML({group:a,key:d,variant:f},s,f)>0&&(this.fireSelectTabEvent({group:a,key:d,variant:f},s==null?void 0:s.dataset.diplodocId),m&&this.resetScroll(s,p,m))}updateHTML(r,s,a){switch(a){case"radio":return this.updateHTMLRadio(r,s);case"accordion":return this.updateHTMLAccordion(r,s);case"regular":return this.updateHTMLRegular(r);case"dropdown":return this.updateHTMLDropdown(r);default:return 0}}saveTabPreferred(r){let s={};switch(this._options.saveTabsToLocalStorage&&(s=JSON.parse(localStorage.getItem("tabsHistory")||"{}")),s[r.group]={key:r.key,variant:r.variant},this._options.saveTabsToLocalStorage&&this.updateLocalStorageWithTabs(s),this._options.saveTabsToQueryStateMode){case"all":{this.updateQueryParamWithTabs(s);break}case"page":{this.updateQueryParamWithTabs(this.getCurrentPageTabHistory(s));break}}}updateHTMLRadio(r,s){let{group:a,key:d}=r,{isForced:f,root:p}=this.didTabOpenForce(s),m=f?`.yfm-vertical-tab[${_}="true"]`:"",h=this._document.querySelectorAll(`${A.TABS}[${l}="${a}"] ${A.TAB}[${c}="${d}"]${m}`);f&&(p==null||p.removeAttribute(_));let T=0;return h.forEach(L=>{let E=L.parentNode.children;for(let N=0;N<E.length;N+=2){let[I,O]=[E.item(N),E.item(N+1)],R=I.children.item(0);if(I===L){R.checked?(I.classList.remove("active"),O==null||O.classList.remove("active"),R.removeAttribute("checked")):(I.classList.add("active"),O==null||O.classList.add("active"),R.setAttribute("checked","true"));continue}R.hasAttribute("checked")&&(I.classList.remove("active"),O==null||O.classList.remove("active"),R.removeAttribute("checked")),T++}}),T}updateHTMLRegular(r){let{group:s,key:a}=r,d=this._document.querySelectorAll(`${A.TABS}[${l}="${s}"] ${A.TAB}[${c}="${a}"]`),f=0;return d.forEach(p=>{let m=p;if(!this.isValidTabElement(m)||m.dataset.diplodocIsActive==="true")return;f++;let h=p,T=h.parentNode,L=T==null?void 0:T.parentNode,E=Array.from((T==null?void 0:T.querySelectorAll(A.TAB))||[]),N=Array.from((L==null?void 0:L.children)||[]).filter(O=>O.classList.contains(o)),I=E.indexOf(h);E.forEach((O,R)=>{let be=N[R],H=R===I,Te=O;Te.dataset.diplodocIsActive=H?"true":"false",O.classList.toggle(n,H),O.setAttribute("aria-selected",H.toString()),O.setAttribute("tabindex",H?"0":"-1"),be.classList.toggle(n,H)})}),f}updateHTMLDropdown(r){let{group:s,key:a}=r,d=this._document.querySelectorAll(`${A.TABS}[${l}="${s}"] ${A.TAB}[${c}="${a}"]`),f=0;return d.forEach(p=>{let m=p.closest(`[${u}=dropdown]`);if(!(m!=null&&m.children))return;let h=m.children.item(0),T=m.children.item(1);h==null||h.classList.remove(n);let L=Array.from((T==null?void 0:T.children)||[]).indexOf(p)+2;for(let E=2;E<m.children.length;E++){let N=m.children.item(E),I=T==null?void 0:T.children.item(E-2);if(f++,L===E){N==null||N.classList.add(n),I.classList.add(n),h.innerHTML=p.innerHTML,h.classList.add("filled");continue}I.classList.remove(n),N.classList.remove(n)}}),f}updateHTMLAccordion(r,s){let{group:a,key:d}=r,f=this._document.querySelectorAll(`${A.TABS}[${l}="${a}"] ${A.TAB}[${c}="${d}"]`),p=0;return f.forEach(m=>{let h=m.closest(`[${u}=accordion]`);if(h!=null&&h.children)for(let T=0;T<h.children.length;T+=2){let L=h.children.item(T),E=h.children.item(T+1);if(p++,m===L){L==null||L.classList.toggle(n),E==null||E.classList.toggle(n);continue}L==null||L.classList.remove(n),E==null||E.classList.remove(n)}}),s&&!this.checkVisible(s)&&setTimeout(()=>{s.scrollIntoView({block:"nearest"})}),p}checkVisible(r){let s=r.getBoundingClientRect(),a=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(s.bottom<0||s.top-a>=0)}hideAllDropdown(r){this._document.querySelectorAll(".yfm-tabs-dropdown-select.active").forEach(s=>{s.contains(r)||s.classList.remove(n)})}resetScroll(r,s,a){let d=M(r,s),f=d.top-a.top,p=d.left-a.left,m=d.scrollTop-a.scrollTop,h=d.scrollLeft-a.scrollLeft;s.scrollTo(s.scrollLeft+p-h,s.scrollTop+f-m)}didTabOpenForce(r){if(!r)return{};if(r.dataset.diplodocForced)return{root:r,isForced:!0};let s=r.dataset.diplodocVerticalTab?r:r.parentElement,a=typeof(s==null?void 0:s.dataset.diplodocForced)!="undefined";return{root:s,isForced:a}}fireSelectTabEvent(r,s){let{group:a,key:d,variant:f}=r,p=a.startsWith(g)?{key:d,variant:f}:r;this._onSelectTabHandlers.forEach(m=>{m({tab:p,currentTabId:s})})}getTabsType(r){let s=r.closest(`[${u}]`);if(s)return s.dataset.diplodocVariant}isValidTabElement(r){return!!this.getTabsType(r)}isElementDropdownSelect(r){return r.classList.contains(S)}getTabDataFromHTMLElement(r){var s,a,d;let f=this.getTabsType(r);if(f==="radio"){let h=r.dataset.diplodocVerticalTab?r:r.parentElement,T=h.dataset.diplodocKey,L=(s=h.closest(A.TABS))==null?void 0:s.dataset.diplodocGroup;return T&&L?{group:L,key:T,variant:"radio"}:null}if(f==="dropdown"||f==="accordion"){let h=r.dataset.diplodocKey,T=(a=r.closest(A.TABS))==null?void 0:a.dataset.diplodocGroup;return h&&T?{group:T,key:h,variant:f}:null}let p=r.dataset.diplodocKey,m=(d=r.closest(A.TABS))==null?void 0:d.dataset.diplodocGroup;return p&&m?{group:m,key:p,variant:"regular"}:null}getTabs(r){var s,a;let d=(s=r.closest(A.TABS))==null?void 0:s.dataset.diplodocGroup,f=(a=r.closest(A.TAB_LIST))==null?void 0:a.querySelectorAll(A.TAB),p=[];return f.forEach(m=>{let h=m==null?void 0:m.dataset.diplodocKey;h&&p.push({group:d,key:h,variant:"regular"})}),{tabs:p,nodes:f}}};typeof window!="undefined"&&typeof document!="undefined"&&!window[w]&&(window[w]=new U(document))})();var Rt=Ot(It());typeof document!="undefined"&&(function(t){let e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;e?t.matches=t.matchesSelector=e:t.matches=t.matchesSelector=function(i){let l=(t.getRootNode?t.getRootNode():Rt.default.call(t)).querySelectorAll(i),c=this;return Array.prototype.some.call(l,u=>u===c)}})(Element.prototype);var k=t=>{let e=t.composedPath();return Array.isArray(e)&&e.length>0?e[0]:t.target},F=t=>{let e=k(t);return!e||!e.matches},K=async t=>{if(!t)return;if(navigator.clipboard&&typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(t);let e=document.createElement("textarea");e.setAttribute("style","position: absolute; left: 1000%"),e.textContent=t,document.body.append(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},kt=".yfm-clipboard-button",xt=".yfm-wrapping-button";function Pt(t){if(!t)return;let e=t.getAttribute("data-animation"),o=t.getRootNode().getElementById(`visibileAnimation-${e}`);o&&o.beginElement()}function Bt(t){var e;let o=(e=t.parentNode)==null?void 0:e.parentNode,i=o==null?void 0:o.querySelector("pre code");if(!o||!i)return;let n=Array.from(i.childNodes).filter(l=>!(l instanceof HTMLElement&&l.classList.contains("yfm-line-number"))).map(l=>l.textContent).join("");K(n.trim()).then(()=>{Pt(o.querySelector(".yfm-clipboard-icon")),setTimeout(()=>t.blur(),1500)})}function Dt(t){var e;let o=(e=t.parentNode)==null?void 0:e.parentNode,i=o==null?void 0:o.querySelector("pre code");!o||!i||(i.classList.toggle("wrap"),setTimeout(()=>t.blur(),500))}typeof document!="undefined"&&document.addEventListener("click",t=>{if(F(t))return;let e=k(t);e.matches(kt)?Bt(e):e.matches(xt)&&Dt(e)});var $t=".dc-doc-page__content",et="yfm yfm-tooltip",ot="open",Y="data-tooltip-id",Mt={mainAxis:5},Ht={top:"bottom",bottom:"top",left:"right",right:"left"},Ft={top:0,bottom:0,left:0,right:0};function nt(t){return t==="top"||t==="bottom"}function qt(t=0){return typeof t=="number"?{top:t,bottom:t,left:t,right:t}:{...Ft,...t}}function Q(t){let[e,o]=t.split("-");return{side:e,alignment:o}}function rt(t){return Ht[t]}function Wt(t){let{side:e,alignment:o}=Q(t),i=rt(e);return o?`${i}-${o}`:i}function it(t,e,o){let i=st(t,{top:e.y,left:e.x});return Kt(o,i,5)}function Vt(t,e,o){let i=rt(o);return t[o]>0&&e[i]<t[o]}function jt(t,e,o,i,n,l,c=!0){let u=at(t,e,n,i,l);if(!c)return{coords:u,placement:i};let v=it(e,u,o),{side:g}=Q(i);if(v[g]<=0)return{coords:u,placement:i};let _=Wt(i),S=at(t,e,n,_,l),y=it(e,S,o);return Vt(v,y,g)?{coords:S,placement:_}:{coords:u,placement:i}}function Gt(){let t=Math.random().toString(36).substring(2,6),e=Date.now().toString(36);return`${t}${e}`}function P(t){return{...t,right:t.left+t.width,bottom:t.top+t.height}}function st(t,e){var o,i,n,l;return P({top:(o=e.top)!=null?o:t.top,left:(i=e.left)!=null?i:t.left,width:(n=e.width)!=null?n:t.width,height:(l=e.height)!=null?l:t.height})}function lt(){let{documentElement:t,body:e}=document,o=window.scrollY||t.scrollTop||e.scrollTop,i=window.scrollX||t.scrollLeft||e.scrollLeft,n=t.clientTop||e.clientTop||0,l=t.clientLeft||e.clientLeft||0;return P({top:Math.round(o-n),left:Math.round(i-l),width:document.body.clientWidth,height:document.body.clientHeight})}function ct(t){let e=lt(),o=t.getBoundingClientRect();return P({top:Math.round(o.top+e.top),left:Math.round(o.left+e.left),width:o.width,height:o.height})}function Ut(t,e,o){let{mainAxis:i=0,crossAxis:n=0}=t,l=nt(e),c=e==="top"||e==="left"?-1:1,u=o&&l?-1:1,v=i*c,g=n*u;return l?{x:g,y:v}:{x:v,y:g}}function at(t,e,o,i,n){let{side:l,alignment:c}=Q(i),u=nt(l),v=u?"x":"y",g=v==="y"?"height":"width",_=t.left+t.width/2-e.width/2,S=t.top+t.height/2-e.height/2,y=t[g]/2-e[g]/2,b={x:t.left,y:t.top};switch(l){case"top":{b.x=_,b.y=t.top-e.height;break}case"bottom":{b.x=_,b.y=t.top+t.height;break}case"right":{b.x=t.left+t.width,b.y=S;break}case"left":{b.x=t.left-e.width,b.y=S;break}}switch(c){case"start":{b[v]-=y*(n&&u?-1:1);break}case"end":{b[v]+=y*(n&&u?-1:1);break}}let w=Ut(o,l,n);return b.x+=w.x,b.y+=w.y,b}function zt(t,e){let o=ct(e);return P({top:t.top-o.top+e.offsetTop,left:t.left-o.left+e.offsetLeft,width:t.width,height:t.height})}function Kt(t,e,o=0){let{top:i,bottom:n,left:l,right:c}=qt(o);return{top:t.top-e.top+i,bottom:e.bottom-t.bottom+n,left:t.left-e.left+l,right:e.right-t.right+c}}function dt(t={}){let{closeDelay:e=1e3,additionalClassName:o}=t,i=!1,n={currentId:null,timer:null,unsubscribe:null},l=()=>n.currentId?document.getElementById(n.currentId):null,c=()=>n.currentId?ut(n.currentId):null,u=()=>{let y=l();n.timer&&(clearTimeout(n.timer),n.timer=null),n.unsubscribe&&(n.unsubscribe(),n.unsubscribe=null),y&&(y.classList.remove(ot),Xt(y),n.currentId=null)},v=(y,b)=>{u();let w=Yt({text:b,className:o}),C=ft.bind(null,t,y,w);n.currentId=w.id,Qt(w,y),n.unsubscribe=Jt(y,C),w.classList.add(ot),C(),e>0&&(n.timer=setTimeout(u,e))},g=()=>{let y=l(),b=c();if(y&&!b){u();return}y&&b&&ft(t,b,y)};return{get visible(){return!!n.currentId},getActiveReference:c,show:v,hide:u,init:()=>{i||(i=!0,window.addEventListener("scroll",g),window.addEventListener("resize",g))},cleanup:()=>{i&&(i=!1,window.removeEventListener("scroll",g),window.removeEventListener("resize",g))}}}function Yt(t){let{text:e,className:o}=t,i=Gt(),n=document.createElement("div");return n.id=i,n.className=o?`${et} ${o}`:et,n.setAttribute("role","tooltip"),n.setAttribute("aria-live","polite"),n.textContent=e,n}function Qt(t,e){let o=document.querySelector($t)||document.body,i=e.getAttribute("aria-live");e.setAttribute(Y,t.id),i&&t.setAttribute("aria-live",i),o.appendChild(t)}function Xt(t){if(t.id){let e=ut(t.id);e==null||e.removeAttribute(Y)}t.remove()}function ut(t){return document.querySelector(`[${Y}="${t}"]`)}function Jt(t,e){let o=Zt(t);return o.addEventListener("scroll",e),()=>{o.removeEventListener("scroll",e)}}function Zt(t){return t.closest("table")||t.closest("code")||t.parentElement||document.body}function te(t,e){let o=e.parentElement;if(!o)return null;let i={reference:t,tooltip:e,offsetParent:o},n=lt(),l=ct(t),{width:c,height:u}=e.getBoundingClientRect();return{isRtl:document.dir==="rtl",viewport:n,reference:l,tooltip:P({top:0,left:0,width:c,height:u}),elements:i}}function ft(t,e,o){let i=te(e,o);if(!i)return;let n=ee(i,t);o.style.top=`${n.y}px`,o.style.left=`${n.x}px`}function ee(t,e){let{placement:o="bottom-start",offset:i=Mt,flip:n=!0}=e,{reference:l,tooltip:c,viewport:u,isRtl:v}=t,{coords:g}=jt(l,c,u,o,i,v,n),_=st(c,{top:g.y,left:g.x}),S=zt(_,t.elements.offsetParent);return{x:S.left,y:S.top}}var q={ru:"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E",en:"Copied",ar:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",cs:"Zkop\xEDrov\xE1no",fr:"Copi\xE9",es:"Copiado",he:"\u05D4\u05D5\u05E2\u05EA\u05E7",bg:"\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u043E",et:"Kopeeritud",el:"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03B7\u03BA\u03B5",pt:"Copiado",zh:"\u5DF2\u590D\u5236","zh-tw":"\u5DF2\u8907\u88FD",kk:"\u041A\u04E9\u0448\u0456\u0440\u0456\u043B\u0434\u0456",tr:"Kopyaland\u0131",uz:"Nusxalandi"},oe=/^(?:https?|file):$/,ne=".yfm-clipboard-anchor",pt=dt();function re(t){let e=t.nodeName==="A"?t.href:t.dataset.href,o=new URL(e||"",window.location.href);return oe.test(o.protocol)?o.href:window.location.href}typeof document!="undefined"&&(pt.init(),document.addEventListener("click",t=>{let e=k(t);if(F(t)||!e.matches(ne))return;let o=re(e);K(o).then(()=>{var i;let n=document.documentElement.lang||"en",l=(i=q[n])!=null?i:q.en;pt.show(e,l)})}));var mt="yfm-clipboard-inline-code",ie=`.${mt}`,B=dt({additionalClassName:"inline_code_tooltip"});function ht(t){let e=t.innerText;e&&K(e).then(()=>{var o;let i=document.documentElement.lang||"en",n=(o=q[i])!=null?o:q.en;B.show(t,n)})}typeof document!="undefined"&&(B.init(),document.addEventListener("click",t=>{let e=k(t),o=e.matches(ie);F(t)||!o||ht(e)}),document.addEventListener("keydown",t=>{if(t.key==="Enter"&&document.activeElement){let e=document.activeElement;if(!e.classList.contains(mt))return;ht(e)}if(t.key==="Escape"&&B.visible){let e=B.getActiveReference();B.hide(),e==null||e.focus()}}));var X={TITLE:".yfm .yfm-term_title",CONTENT:".yfm .yfm-term_dfn"},D="open",W=X.CONTENT.replace(/\./g,"")+" "+D,V=!0;function se(t,e){let o=e.getAttribute("id")||Math.random().toString(36).substr(2,8);t==null||t.setAttribute("term-id",o)}function le(t,e){let o=e.getAttribute("aria-live")||"polite";t==null||t.setAttribute("aria-live",o),t==null||t.setAttribute("aria-modal","true")}function J(t,e){let{x:o,y:i,right:n,left:l,width:c,height:u}=e.getBoundingClientRect(),v=vt(e);if(!v)return;let{right:g,left:_}=v.getBoundingClientRect();if((g<l||_>n)&&!V){j(t);return}V&&v&&(v.addEventListener("scroll",gt),V=!1);let S=Number(t.getAttribute("relativeX")),y=Number(t.getAttribute("relativeY"));if(S===o&&y===i)return;t.setAttribute("relativeX",String(o)),t.setAttribute("relativeY",String(i));let b=u+5,w=t.parentElement;if(!w)return;let{width:C}=t.getBoundingClientRect(),{left:x}=w.getBoundingClientRect(),$=Number(G(e).left),M=C+$,A=$-C<0,U=M>document.body.clientWidth,s=(U||document.dir==="rtl")&&!A?C-c:0,a=G(w).top-w.offsetTop,f=U?M-document.body.clientWidth+5:0,p=G(e).left-x+w.offsetLeft-s,m=p+C>=document.body.clientWidth;t.style.top=Number(G(e).top+b-a)+"px",t.style.left=Number(p-(m?f:0))+"px"}function gt(){let t=document.getElementsByClassName(W)[0];if(!t)return;let e=t.getAttribute("term-id")||"",o=document.getElementById(e);o&&J(t,o)}function vt(t){return t?t.closest("table")||t.closest("code")||t.parentElement:null}function bt(t){let e=document.getElementsByClassName(W)[0],o=t.getAttribute("id"),n=`${t.getAttribute("term-key")}_element`,l=t.closest(".wide-container"),c;if(l){let g=t.closest(".wide-content");if(!g)return;c=g.querySelector(`[id="${n}"]`)}else c=document.getElementById(n);if(e&&o===e.getAttribute("term-id")){j(e);return}let v=t.closest([X.CONTENT.replace(" ",""),D].join("."));e&&!v&&j(e),!(!t.matches(X.TITLE)||!c)&&(se(c,t),le(c,t),J(c,t),c.classList.toggle(D),ce(c))}function j(t){t.classList.remove(D);let e=Tt(t),o=vt(e);o&&(o.removeEventListener("scroll",gt),V=!0)}function G(t){let e=t.getBoundingClientRect(),o=document.body,i=document.documentElement,n=window.pageYOffset||i.scrollTop||o.scrollTop,l=window.pageXOffset||i.scrollLeft||o.scrollLeft,c=i.clientTop||o.clientTop||0,u=i.clientLeft||o.clientLeft||0,v=e.top+n-c,g=e.left+l-u;return{top:Math.round(v),left:Math.round(g)}}function ce(t){let e=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=e[0],i=e[e.length-1];o&&o.focus(),t.addEventListener("keydown",function(n){(n.key==="Tab"||n.keyCode===9)&&(n.shiftKey?document.activeElement===o&&(i.focus(),n.preventDefault()):document.activeElement===i&&(o.focus(),n.preventDefault()))})}function Tt(t){let e=t.getAttribute("term-id");if(!e)return null;if(t.closest(".wide-container")){let i=t.closest(".wide-content");return i?i.querySelector(`[id="${e}"]`):null}return document.getElementById(e)}typeof document!="undefined"&&(document.addEventListener("click",t=>{(k(t)||!F(t))&&bt(k(t))}),document.addEventListener("keydown",t=>{var e;let o=document.getElementsByClassName(W)[0];t.key==="Enter"&&document.activeElement&&bt(document.activeElement),t.key==="Escape"&&o&&(j(o),(e=Tt(o))==null||e.focus())}),window.addEventListener("resize",()=>{let t=document.getElementsByClassName(W)[0];if(!t)return;let e=t.getAttribute("term-id")||"",o=document.getElementById(e);if(!o){t.classList.toggle(D);return}J(t,o)}));var ae="[wide-content]",de='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M7.754 2.004a.75.75 0 0 0 0 1.5h4.75v4.742a.75.75 0 0 0 1.5 0V2.754a.75.75 0 0 0-.75-.75zm.492 11.992a.75.75 0 0 0 0-1.5h-4.75V7.754a.75.75 0 0 0-1.5 0v5.492a.75.75 0 0 0 .75.75z" clip-rule="evenodd"/></svg>',ue='<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" class="close-action"><path fillRule="evenodd" clipRule="evenodd" d="M9.46967 9.46967C9.76256 9.17678 10.2374 9.17678 10.5303 9.46967L14 12.9393L17.4697 9.46967C17.7626 9.17678 18.2374 9.17678 18.5303 9.46967C18.8232 9.76256 18.8232 10.2374 18.5303 10.5303L15.0607 14L18.5303 17.4697C18.8232 17.7626 18.8232 18.2374 18.5303 18.5303C18.2374 18.8232 17.7626 18.8232 17.4697 18.5303L14 15.0607L10.5303 18.5303C10.2374 18.8232 9.76256 18.8232 9.46967 18.5303C9.17678 18.2374 9.17678 17.7626 9.46967 17.4697L12.9393 14L9.46967 10.5303C9.17678 10.2374 9.17678 9.76256 9.46967 9.46967Z" fill="var(--g-color-text-primary)" fillOpacity="0.85"/></svg>',Z=()=>{window.wideTemplate&&(window.wideTemplate.style.display="none",window.wideTemplate.content(void 0))},fe=t=>{if(t.tagName!=="TABLE")return;let e=Array.from(t.children);return e.find(n=>n.tagName==="THEAD")?void 0:e.find(n=>n.tagName==="TBODY")},pe=()=>{if(window.wideTemplate)return window.wideTemplate;let t=document.createElement("div");t.classList.add("dc-doc-page","wide-container");let e=document.createElement("div");e.classList.add("wide-content-overlay"),e.addEventListener("click",Z);let o=document.createElement("div");o.classList.add("yfm","wide-content-wrapper");let i=document.createElement("div");i.classList.add("wide-toolbar");let n=document.createElement("div");n.classList.add("wide-actions"),n.addEventListener("click",Z),n.innerHTML=ue;let l=document.createElement("p");l.classList.add("wide-entity-name"),t.label=u=>{l.innerHTML=u||""};let c=document.createElement("div");return c.classList.add("wide-content"),t.content=u=>{var v;if(typeof u=="undefined"){c.innerHTML="";return}let g=u.cloneNode(!0),_=fe(g);(v=_==null?void 0:_.classList)==null||v.add("wide-thead-content");let S=g.querySelectorAll(".yfm-term_title"),y=[];S.forEach(b=>{let w=b.getAttribute("term-key");if(w){let C=document.getElementById(w+"_element");if(C){let x=C.cloneNode(!0);y.push(x)}}}),c.replaceChildren(g,...y)},i.append(l,n),o.append(i,c),t.append(e,o),t.style.display="none",document.body.appendChild(t),window.wideTemplate=t,t},me=t=>{let e=pe();e.label(t.title),e.content(t),e.style.display="flex"},he={render:me,remove:Z},ge=t=>{var e;if((e=t.parentElement)!=null&&e.classList.contains("wide-element-wrapper"))return;t.classList.add("wide-inner-element");let o=document.createElement("div");o.innerHTML=de,o.classList.add("wide-content-viewer"),o.addEventListener("click",()=>he.render(t));let i=document.createElement("div");i.classList.add("wide-element-wrapper"),t.before(i),i.appendChild(t),i.appendChild(o)},yt=()=>{Array.from(document.querySelectorAll(ae)).forEach(ge)};typeof window!="undefined"&&typeof document!="undefined"&&window.addEventListener("load",yt);var ve=()=>{yt()};typeof window!="undefined"&&(window.patchAfterRender=ve)})();})(); //# sourceMappingURL=yfm.min.js.map