PageSourceSearch

https://itick.org/_nuxt/C2akoU2s.js

js itick.org collected 2026-10-02 06:59:36 UTC 12,453 bytes, 1 lines download raw bytes

1import{$ as qe,d as ze,W as Xe,k as p,I as Ye,E as I,q,c as u,V as we,J as Ge,K as Ke,o as s,e as D,a5 as Je,b as l,S as te,g as c,t as T,U as oe,a6 as We,a8 as be,a2 as Qe,ah as Ze}from"./DkdofgM8.js";var et=Object.defineProperty,ke=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,xe=(m,n,r)=>n in m?et(m,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):m[n]=r,ne=(m,n)=>{for(var r in n||(n={}))tt.call(n,r)&&xe(m,r,n[r]);if(ke)for(var r of ke(n))ot.call(n,r)&&xe(m,r,n[r]);return m},re=(m,n,r)=>new Promise((C,g)=>{var y=f=>{try{i(r.next(f))}catch(d){g(d)}},M=f=>{try{i(r.throw(f))}catch(d){g(d)}},i=f=>f.done?C(f.value):Promise.resolve(f.value).then(y,M);i((r=r.apply(m,n)).next())});const nt=["data-markstream-mode"],rt={key:0,class:"d2-block-header flex justify-between items-center border-b"},at={class:"d2-header-actions flex items-center"},lt={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},it=["aria-label"],ut={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},st={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ct=["aria-label"],dt=["aria-pressed"],vt={key:0,class:"d2-source"},mt={class:"d2-code"},pt={key:0,class:"d2-error mt-2 text-xs"},ft={key:1},gt={key:0,class:"d2-source"},yt={class:"d2-code"},ht={key:0,class:"d2-error mt-2 text-xs"},wt=["innerHTML"],bt={key:0,class:"d2-error px-4 pb-3 text-xs"},ae=qe(ze({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(m){const n=m,{t:r}=Xe(),C=p(!1),g=p(!1),y=p(!1),M=p(!1),i=p(null),f=p(!1),d=p(""),S=p(0),z=p(null),K=p(null),le=p(null),Be=Ye(),N=p(null),L=p(typeof window>"u"),A=I(()=>{var o;return(o=n.node.code)!=null?o:""}),De=I(()=>`${n.isDark?"dark":"light"}:${A.value}`),X=I(()=>y.value||!M.value||!d.value),Ce=I(()=>!!d.value),Me=I(()=>{if(X.value&&K.value)return{minHeight:`${K.value}px`}}),Ee=I(()=>n.maxHeight==="none"?{maxHeight:"none"}:n.maxHeight!=null?{maxHeight:typeof n.maxHeight=="number"?`${n.maxHeight}px`:String(n.maxHeight)}:void 0),ie=typeof window<"u";let b=null,J=!1,W=!1,ue=0,O=null,j=!1,P=null,R="";typeof window<"u"&&q(()=>le.value,o=>{var e;if((e=N.value)==null||e.destroy(),N.value=null,!o)return void(L.value=!1);const t=Be(o,{rootMargin:"160px"});N.value=t,L.value=t.isVisible.value,t.whenVisible.then(()=>{L.value=!0})},{immediate:!0});const Te={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function se(o){return!o||o.disabled}function x(o,e,t="top"){if(se(o.currentTarget))return;const v=o,Y=(v==null?void 0:v.clientX)!=null&&(v==null?void 0:v.clientY)!=null?{x:v.clientX,y:v.clientY}:void 0;be(o.currentTarget,e,t,!1,Y,n.isDark)}function h(){Qe()}function ce(o){if(se(o.currentTarget))return;const e=C.value?r("common.copied")||"Copied":r("common.copy")||"Copy",t=o,v=(t==null?void 0:t.clientX)!=null&&(t==null?void 0:t.clientY)!=null?{x:t.clientX,y:t.clientY}:void 0;be(o.currentTarget,e,"top",!1,v,n.isDark)}function Ae(){return re(this,null,function*(){try{const o=A.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(o)),C.value=!0,setTimeout(()=>{C.value=!1},1e3)}catch(o){console.error("Copy failed:",o)}})}function Oe(){g.value=!g.value}function de(o){y.value=o==="source"}const je=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Fe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function He(o){if(!o)return"";const e=o.trim();return Fe.test(e)?e:""}function ve(){d.value=""}function Ie(){return re(this,null,function*(){var o,e,t,v,Y;
1if(!ie||W||!L.value||n.loading&&!n.progressiveRender)return;const me=De.value;if(me===R&&!i.value&&d.value)return M.value=!0,void(n.loading&&(y.value=!1));const pe=A.value;if(!pe)return ve(),i.value=null,void(R="");const G=++S.value;f.value=!0,i.value=null;try{const k=yield function(){return re(this,null,function*(){if(b)return b;const a=yield Ze();if(!a)return null;if(typeof a=="function"){const U=new a;return U&&typeof U.compile=="function"?b=U:typeof a.compile=="function"&&(b=a),b}return a!=null&&a.D2&&typeof a.D2=="function"?(b=new a.D2,b):(typeof a.compile=="function"&&(b=a),b)})}();if(!k)return M.value=!1,y.value=!0,ve(),void(i.value="D2 is not available.");if(typeof k.compile!="function"||typeof k.render!="function")throw new TypeError("D2 instance is missing compile/render methods.");M.value=!0;const w=yield k.compile(pe);if(G!==S.value)return;const Ne=(o=w==null?void 0:w.diagram)!=null?o:w,F=(t=(e=w==null?void 0:w.renderOptions)!=null?e:w==null?void 0:w.options)!=null?t:{},Le=(v=n.themeId)!=null?v:F.themeID,fe=(Y=n.darkThemeId)!=null?Y:F.darkThemeID,_=ne({},F);if(_.themeID=n.isDark&&fe!=null?fe:Le,_.darkThemeID=null,_.darkThemeOverrides=null,n.isDark){const a=F.themeOverrides&&typeof F.themeOverrides=="object"?F.themeOverrides:null;_.themeOverrides=ne(ne({},Te),a||{})}const Pe=yield k.render(Ne,_);if(G!==S.value)return;const ge=function(a){return a?typeof a=="string"?a:typeof a.svg=="string"?a.svg:typeof a.data=="string"?a.data:"":""}(Pe);if(!ge)throw new Error("D2 render returned empty output.");(function(a){const U=function(ye){if(typeof window>"u"||typeof DOMParser>"u"||!ye)return"";const Re=ye.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),Z=new DOMParser().parseFromString(Re,"image/svg+xml").documentElement;if(!Z||Z.nodeName.toLowerCase()!=="svg")return"";const ee=Z;return function(he){const Ve=new Set(["script"]),_e=[he,...Array.from(he.querySelectorAll("*"))];for(const E of _e){if(Ve.has(E.tagName.toLowerCase())){E.remove();continue}const Ue=Array.from(E.attributes);for(const H of Ue){const B=H.name;if(/^on/i.test(B))E.removeAttribute(B);else{if(B==="style"&&H.value){const $=H.value;if(je.some($e=>$e.test($))){E.removeAttribute(B);continue}}if((B==="href"||B==="xlink:href")&&H.value){const $=He(H.value);if(!$){E.removeAttribute(B);continue}$!==H.value&&E.setAttribute(B,$)}}}}}(ee),ee.classList.add("markstream-d2-root-svg"),ee.outerHTML}(a);d.value=U||""})(ge),R=me,n.loading&&(y.value=!1),i.value=null}catch(k){if(G!==S.value)return;const w=k!=null&&k.message?String(k.message):"D2 render failed.";n.loading||(i.value=w),R="",w.includes("@terrastruct/d2")&&(M.value=!1,y.value=!0)}finally{G===S.value&&(f.value=!1,j&&(j=!1,V()))}})}function V(o=!1){if(J||!ie||W)return;if(f.value)return void(j=!0);const e=Math.max(120,Number(n.progressiveIntervalMs)||0),t=Date.now()-ue;if(!o&&t<e)return j=!0,void(O==null&&(O=window.setTimeout(()=>{O=null,j&&(j=!1,V(!0))},Math.max(0,e-t))));J=!0;const v=()=>{J=!1,ue=Date.now(),Ie()};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(v):setTimeout(v,0)}function Se(){if(d.value)try{const o=new Blob([d.value],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(o);if(typeof document<"u"){const t=document.createElement("a");t.href=e,t.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(t),t.click(),document.body.removeChild(t)}URL.revokeObjectURL(e)}catch(o){console.error("Failed to export SVG:",o)}}function Q(){const o=z.value;if(!o)return;const e=o.getBoundingClientRect().height;e>0&&(K.value=e)}return q(()=>[n.node.code,n.loading,n.isDark],()=>{V()},{immediate:!0}),q(()=>n.loading,(o,e)=>{e&&!o&&V(!0)}),q(()=>L.value,o=>{o&&V(!0)}),q(()=>[X.value,d.value,A.value],()=>{we(()=>{Q()})}),Ge(()=>{we(()=>{Q()}),typeof ResizeObserver<"u"&&(P=new ResizeObserver(()=>{Q()}),z.value&&P.observe(z.value))}),Ke(()=>{var o;W=!0,R="",(o=N.value)==null||o.destroy(),N.value=null,O!=null&&(clearTimeout(O),O=null),P==null||P.disconnect(),P=null}),(o,e)=>(s(),u("div",{ref_key:"viewportTarget",ref:le,class:te(["d2-block-container rounded-lg border overflow-hidden",{dark:n.isDark}]),"data-markstream-d2":"1","data-markstream-mode":X.value?"fallback":"preview"},[n.showHeader?(s(),u("div",rt,[e[16]||(e[16]=l("div",{class:"flex items-center gap-x-2"},[l("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),l("div",at,[n.showModeToggle?(s(),u("div",lt,[l("button",{type:"button",class:te(["mode-btn px-2 py-0.5 rounded",y.value?"":"is-active"]),onClick:e[0]||(e[0]=t=>de("preview")),onMouseenter:e[1]||(e[1]=t=>x(t,c(r)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=t=>x(t,c(r)("common.preview")||"Preview")),onMouseleave:h,onBlur:h},T(c(r)("common.preview")||"Preview"),35),l("button",{type:"button",class:te(["mode-btn px-2 py-0.5 rounded",y.value?"is-active":""]),onClick:e[3]||(e[3]=t=>de("source")),onMouseenter:e[4]||(e[4]=t=>x(t,c(r)("common.source")||"Source")),onFocus:e[5]||(e[5]=t=>
1x(t,c(r)("common.source")||"Source")),onMouseleave:h,onBlur:h},T(c(r)("common.source")||"Source"),35)])):D("",!0),n.showCopyButton?(s(),u("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":C.value?c(r)("common.copied")||"Copied":c(r)("common.copy")||"Copy",onClick:Ae,onMouseenter:e[6]||(e[6]=t=>ce(t)),onFocus:e[7]||(e[7]=t=>ce(t)),onMouseleave:h,onBlur:h},[C.value?(s(),u("svg",st,[...e[13]||(e[13]=[l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(s(),u("svg",ut,[...e[12]||(e[12]=[l("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[l("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),l("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,it)):D("",!0),n.showExportButton&&d.value?(s(),u("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":c(r)("common.export")||"Export",onClick:Se,onMouseenter:e[8]||(e[8]=t=>x(t,c(r)("common.export")||"Export")),onFocus:e[9]||(e[9]=t=>x(t,c(r)("common.export")||"Export")),onMouseleave:h,onBlur:h},[...e[14]||(e[14]=[l("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,ct)):D("",!0),n.showCollapseButton?(s(),u("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":g.value,onClick:Oe,onMouseenter:e[10]||(e[10]=t=>x(t,g.value?c(r)("common.expand")||"Expand":c(r)("common.collapse")||"Collapse")),onFocus:e[11]||(e[11]=t=>x(t,g.value?c(r)("common.expand")||"Expand":c(r)("common.collapse")||"Collapse")),onMouseleave:h,onBlur:h},[(s(),u("svg",{style:oe({rotate:g.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[15]||(e[15]=[l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,dt)):D("",!0)])])):D("",!0),Je(l("div",{ref_key:"bodyRef",ref:z,class:"d2-block-body",style:oe(Me.value)},[n.loading&&!Ce.value?(s(),u("div",vt,[l("pre",mt,[l("code",null,T(A.value),1)]),i.value?(s(),u("p",pt,T(i.value),1)):D("",!0)])):(s(),u("div",ft,[X.value?(s(),u("div",gt,[l("pre",yt,[l("code",null,T(A.value),1)]),i.value?(s(),u("p",ht,T(i.value),1)):D("",!0)])):(s(),u("div",{key:1,class:"d2-render",style:oe(Ee.value)},[l("div",{class:"d2-svg",innerHTML:d.value},null,8,wt),i.value?(s(),u("p",bt,T(i.value),1)):D("",!0)],4))]))],4),[[We,!g.value]])],10,nt))}}),[["__scopeId","data-v-9be36d9c"]]);ae.install=m=>{m.component(ae.__name,ae)};export{ae as default};

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.