PageSourceSearch

https://touchfish.ltd/assets/CustomPageView-ChZZQOVi.js

js touchfish.ltd collected 2026-10-02 02:01:21 UTC 9,610 bytes, 1 lines download raw bytes

1import{d as pe,r as c,c as w,X as he,w as ve,o as _e,a as ge,D as we,K as ye,B as s,z as d,k as H,G as f,u as v,Q as W,R as Q,F as xe,V as ke,E as be,U as q,S as Ee,H as Ce,C as u,A as De,n as X}from"./vendor-vue-Dzwqm9Y9.js";import{b as Pe}from"./vendor-ui-KYGBtk6l.js";import{a as Se,u as Ie,b as Me,_ as O,q as G,D as Be}from"./index-Dg7iAOYr.js";import{_ as Re}from"./AppLayout.vue_vue_type_script_setup_true_lang-CDGJUeC2.js";import{d as $e,p as Te}from"./vendor-misc-B-nM3tYW.js";import{u as Ue}from"./vendor-i18n-BuoWFzps.js";import"./AppHeader.vue_vue_type_style_index_0_scoped_25b0c839_lang-B0lsvCqV.js";import"./useClipboard-DI2IZ1WO.js";import"./LocaleSwitcher-BZZz6YQD.js";/* empty css                                                                       */const Ae="user_id",Ye="token",Le="theme",ze="lang",He="ui_mode",Oe="embedded",Ve="src_host",je="src_url";function Fe(y,a,M,$="light",_){if(!y)return y;try{const r=new URL(y);return a&&r.searchParams.set(Ae,String(a)),M&&r.searchParams.set(Ye,M),r.searchParams.set(Le,$),_&&r.searchParams.set(ze,_),r.searchParams.set(He,Oe),typeof window<"u"&&(r.searchParams.set(Ve,window.location.origin),r.searchParams.set(je,window.location.href)),r.toString()}catch{return y}}function J(){return typeof document>"u"?"light":document.documentElement.classList.contains("dark")?"dark":"light"}const Ke={class:"custom-page-layout"},Ne={class:"card flex-1 min-h-0 overflow-hidden"},We={key:0,class:"flex h-full items-center justify-center py-12"},Qe={key:1,class:"flex h-full items-center justify-center p-10 text-center"},qe={class:"max-w-md"},Xe={class:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 dark:bg-dark-700"},Ge={class:"text-lg font-semibold text-gray-900 dark:text-white"},Je={class:"mt-2 text-sm text-gray-500 dark:text-dark-400"},Ze={key:2,class:"flex h-full overflow-hidden"},et={class:"toc-sidebar"},tt={class:"toc-header"},nt={class:"toc-title"},ot={class:"toc-nav"},st=["href","onClick"],at={class:"ml-1 text-xs"},rt=["innerHTML"],it={key:3,class:"flex h-full items-center justify-center p-10 text-center"},lt={class:"max-w-md"},ct={class:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 dark:bg-dark-700"},ut={class:"text-lg font-semibold text-gray-900 dark:text-white"},dt={class:"mt-2 text-sm text-gray-500 dark:text-dark-400"},ft=["href"],mt=["src"],pt=pe({__name:"CustomPageView",setup(y){const{t:a,locale:M}=Ue(),$=he(),_=Se(),r=Ie(),Z=Me(),x=c(!1),T=c("light"),k=c(""),B=c(null),m=c([]),b=c(typeof window<"u"?window.innerWidth>768:!0),R=c("");let E=null;const U=c(null),p=c(null),h=c(null);let l=null,C=!1;function V(e,t){const n=U.value,o=p.value;!n||!o||(h.value={x:Math.max(0,Math.min(e,n.clientWidth-o.offsetWidth)),y:Math.max(0,Math.min(t,n.clientHeight-o.offsetHeight))})}function ee(e){if(e.button!==0||!e.isPrimary||!p.value)return;const t=p.value;C=!1,l={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:t.offsetLeft,y:t.offsetTop},t.setPointerCapture(e.pointerId)}function te(e){if(!l||e.pointerId!==l.pointerId)return;const t=e.clientX-l.startX,n=e.clientY-l.startY;!C&&Math.hypot(t,n)<4||(C=!0,V(l.x+t,l.y+n),e.preventDefault())}function A(e){var t;!l||e.pointerId!==l.pointerId||(l=null,(t=p.value)!=null&&t.hasPointerCapture(e.pointerId)&&p.value.releasePointerCapture(e.pointerId))}function ne(e){C&&e.detail!==0&&e.preventDefault(),C=!1}Pe([U,p],()=>{h.value&&V(h.value.x,h.value.y)});const oe=w(()=>$.params.id),D=w(()=>{var o;const e=oe.value,n=(((o=_.cachedPublicSettings)==null?void 0:o.custom_menu_items)??[]).find(i=>i.id===e)??null;return n||(r.isAdmin?Z.customMenuItems.find(i=>i.id===e)??null:null)}),j=w(()=>{var t;const e=D.value;return e?e.page_slug?e.page_slug:(t=e.url)!=null&&t.startsWith("md:")?e.url.slice(3):"":""}),Y=w(()=>!!j.value),L=w(()=>{var e;return!D.value||Y.value?"":Fe(D.value.url,(e=r.user)==null?void 0:e.id,r.token,T.value,M.value)}),se=w(()=>{if(Y.value)return!1;const e=L.value;return e.startsWith("http://")||e.startsWith("https://")});function ae(e,t){const n=e.toLowerCase().replace(/[^\w一-鿿]+/g,"-").replace(/^-+|-+$/g,"");return n?`${n}-${t}`:`heading-${t}`}function re(e){const t=e.trim();if(!t||/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith("//")||t.startsWith("/"))return!1;const[n]=t.split(/([?#].*)/,2);return n.split("/").filter(o=>o&&o!==".").every(o=>o!==".."&&!o.includes("\\"))}function ie(e,t){const n=t.trim(),[o,i=""]=n.split(/([?#].*)/,2),P=o.split("/").filter(g=>g&&g!==".").map(g=>encodeURIComponent(g)).join("/");return G(`/pages/${encodeURIComponent(e)}/images/${P}${i}`)}async function le(e){x.value=!0,m.value=[],R.value="";try{const t=await fetch(G(`/pages/${encodeURIComponent(e)}`),{headers:r.token?{Authorization:`Bearer ${r.token}`}:{}});if(!t.ok){k.value=`<p class="text-red-500">${a("common.pageNotFound")}</p>`;return}let n=await t.text();n=n.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(F,S,I)=>re(I)?`![${S}](${ie(e,I)})`:F);const o=$e.parse(n),i=Te.sanitize(o,{ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","src"]}),P=[];let g=0;const fe=i.replace(/<(h[1-4])[^>]*>(.*?)<\/h[1-4]>/gi,(F,S,I)=>{const me=parseInt(S[1]),K=I.replace(/<[^>]+>/g,"").trim(),N=ae(K,g++);return P.push({id:N,text:K,level:me}),`<${S} id="${N}">${I}</${S}>`});k.value=fe,m.value=P}catch{k.value='<p class="text-red-500">Failed to load page</p>'}finally{x.value=!1,await X(),await X(),de()}}function ce(e){const t=B.value;if(!t)return;const n=t.querySelector(`#${CSS.escape(e)}`);n&&(n.scrollIntoView({behavior:"smooth",block:"start"}),R.value=e,window.innerWidth<=640&&(b.value=!1))}let z=0;function ue(){z||(z=requestAnimationFrame(()=>{z=0;const e=B.value;if(!e||m.value.length===0)return;const t=e.getBoundingClientRect();let n="";for(const o of m.value){const i=e.querySelector(`#${CSS.escape(o.id)}`);i&&i.getBoundingClientRect().top-t.top<=100&&(n=o.id)}R.value=n}))}function de(){const e=B.value;e&&e.querySelectorAll("pre").forEach(t=>{if(t.querySelector(".copy-btn"))return;const n=document.createElement("button");
1n.className="copy-btn",n.textContent=a("customPage.copyCode"),n.addEventListener("click",async()=>{var i;const o=((i=t.querySelector("code"))==null?void 0:i.textContent)??t.textContent??"";try{await navigator.clipboard.writeText(o),n.textContent=a("customPage.copiedCode"),setTimeout(()=>{n.textContent=a("customPage.copyCode")},2e3)}catch{n.textContent=a("customPage.copyCodeFailed"),setTimeout(()=>{n.textContent=a("customPage.copyCode")},2e3)}}),t.style.position="relative",t.appendChild(n)})}return ve(j,e=>{e?le(e):(k.value="",m.value=[])},{immediate:!0}),_e(async()=>{if(T.value=J(),typeof document<"u"&&(E=new MutationObserver(()=>{T.value=J()}),E.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})),!_.publicSettingsLoaded){x.value=!0;try{await _.fetchPublicSettings()}finally{x.value=!1}}}),ge(()=>{E&&(E.disconnect(),E=null)}),(e,t)=>(u(),we(Re,null,{default:ye(()=>{var n;return[s("div",Ke,[s("div",Ne,[x.value?(u(),d("div",We,[...t[3]||(t[3]=[s("div",{class:"h-8 w-8 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"},null,-1)])])):D.value?Y.value?(u(),d("div",Ze,[W(s("aside",et,[s("div",tt,[s("span",nt,f(v(a)("customPage.tableOfContents")),1),s("button",{class:"toc-close-btn",onClick:t[0]||(t[0]=o=>b.value=!1)},[...t[4]||(t[4]=[s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("path",{d:"M15 18l-6-6 6-6"})],-1)])])]),s("nav",ot,[(u(!0),d(xe,null,ke(m.value,o=>(u(),d("a",{key:o.id,href:"#"+o.id,class:De(["toc-item",[`toc-level-${o.level}`,{"toc-active":R.value===o.id}]]),onClick:q(i=>ce(o.id),["prevent"])},f(o.text),11,st))),128))])],512),[[Q,b.value]]),W(s("button",{class:"toc-toggle-btn",onClick:t[1]||(t[1]=o=>b.value=!0)},[t[5]||(t[5]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("path",{d:"M3 12h18M3 6h18M3 18h18"})],-1)),s("span",at,f(v(a)("customPage.tableOfContents")),1)],512),[[Q,!b.value&&m.value.length>0]]),s("div",{ref_key:"markdownContainer",ref:B,class:"markdown-page-content flex-1 h-full overflow-auto p-6 md:p-10",innerHTML:k.value,onScroll:ue},null,40,rt)])):se.value?(u(),d("div",{key:4,ref_key:"embedShell",ref:U,class:"custom-embed-shell"},[(n=D.value)!=null&&n.hide_open_button?be("",!0):(u(),d("a",{key:0,ref_key:"openButton",ref:p,href:L.value,target:"_blank",rel:"noopener noreferrer",class:"btn btn-secondary btn-sm custom-open-fab",style:Ee(h.value?{left:`${h.value.x}px`,top:`${h.value.y}px`,right:"auto"}:void 0),onPointerdown:ee,onPointermove:te,onPointerup:A,onPointercancel:A,onLostpointercapture:A,onDragstart:t[2]||(t[2]=q(()=>{},["prevent"])),onClick:ne},[H(O,{name:"externalLink",size:"sm",class:"mr-1.5","stroke-width":2}),Ce(" "+f(v(a)("customPage.openInNewTab")),1)],44,ft)),s("iframe",{src:L.value,class:"custom-embed-frame",allowfullscreen:""},null,8,mt)],512)):(u(),d("div",it,[s("div",lt,[s("div",ct,[H(O,{name:"link",size:"lg",class:"text-gray-400"})]),s("h3",ut,f(v(a)("customPage.notConfiguredTitle")),1),s("p",dt,f(v(a)("customPage.notConfiguredDesc")),1)])])):(u(),d("div",Qe,[s("div",qe,[s("div",Xe,[H(O,{name:"link",size:"lg",class:"text-gray-400"})]),s("h3",Ge,f(v(a)("customPage.notFoundTitle")),1),s("p",Je,f(v(a)("customPage.notFoundDesc")),1)])]))])])]}),_:1}))}}),Ct=Be(pt,[["__scopeId","data-v-00aca232"]]);export{Ct 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.