import{d as e,f as t,l as n,t as r}from"./hooks.module-BrXTvcfS.js";import{t as i}from"./jsxRuntime.module-Cao1NCKs.js";import{G as a,X as o,Z as s}from"./hooks-ClTXKdUl.js";e();var c=[{name:`Inter`,url:``+new URL(`Inter-VariableFont_opsz_wght-c8O0ljhh.ttf`,import.meta.url).href}];function l({iframeRef:e,pdfUrl:t,onLoad:n,editable:r,toolbar:c=!0,disableSelection:l,minPixelRatio:d}){let f=a(e,null),[p]=o(`locale`),[m]=s(`newLayout`),h=u(f,l);return i(`iframe`,{ref:f,class:`pdf-preview`,style:{width:`100%`,height:`100%`},src:`pdfjs/web/viewer.html?v=${glob.triliumVersion}&file=${t}&locale=${p}&sidebar=${m?`0`:`1`}&editable=${r?`1`:`0`}&toolbar=${c?`1`:`0`}${d?`&minPixelRatio=${d}`:``}`,onLoad:()=>{h(),n?.()}})}function u(e,i){let a=r(null),o=t(()=>{let t=e.current?.contentDocument;if(!t)return;let n=t.createElement(`style`);n.id=`client-root-vars`,n.textContent=f(d()),a.current=n,t.head.appendChild(n);let r=t.createElement(`style`);if(r.textContent=c.map(p).join(`
`),t.head.appendChild(r),i){let e=t.createElement(`style`);e.textContent=`.textLayer, .textLayer * { user-select: none !important; cursor: default !important; }`,t.head.appendChild(e)}},[e,i]);return n(()=>{let e=()=>{a.current.textContent=f(d())},t=window.matchMedia(`(prefers-color-scheme: dark)`);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},[e]),o}function d(){let e=getComputedStyle(document.documentElement),t={};for(let n=0;n<e.length;n++){let r=e[n];r.startsWith(`--`)&&(t[`--tn-${r.substring(2)}`]=e.getPropertyValue(r).trim())}return t}function f(e){return`:root {\n${Object.entries(e).map(([e,t])=>`  ${e}: ${t};`).join(`
`)}\n}`}function p(e){return`
        @font-face {
            font-family: '${e.name}';
            src: url('${e.url}');
        }
    `}export{l as t};