- build:www maps / to spec and /folders to stack-folder - Umami tracking via stats.levkin.ca - nginx deploy config for site LXC Co-authored-by: Cursor <cursoragent@cursor.com>
2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
import"./modulepreload-polyfill-B5Qt9EMX.js";function U(i={}){const{sectionSelector:a=".layer[data-layer], .folder[data-layer]",depthEl:s=document.getElementById("depth"),depthPrefix:u="L",tabSelector:r="[data-goto], .jump, .layer-id",mountSelector:o=".mount",foldTabs:c=!1,interactionMode:f="pin"}=i,d=document.querySelectorAll(a);if(!d.length)return;const l=document.querySelector(o),p=d.length-1,I=56;let k=null,b=[],v=1/0,y=!1;const q=()=>l?[...l.querySelectorAll(".folder .tab")]:[];function N(t){return t.querySelector(".tab")||t.querySelector(".body")||t}function D(){const t=q(),e=T(),n=t.map(g=>g.getBoundingClientRect().top),m=n.length?Math.max(...n)-Math.min(...n):0,h=n.length?n.every(g=>Math.abs(g-e)<=6):!1;return{tabs:t,stick:e,spread:m,onStick:h}}function T(){const t=document.documentElement,e=getComputedStyle(t).getPropertyValue("--stack-stick").trim(),n=parseFloat(e);return Number.isFinite(n)?e.endsWith("rem")?n*parseFloat(getComputedStyle(t).fontSize):(e.endsWith("px"),n):I}function E(t=!1){if(!t&&window.scrollY>8&&b.length)return;const e=T();b=[...d].map(n=>Math.max(0,N(n).offsetTop-e))}function V(){var t;return((t=d[p])==null?void 0:t.querySelector(".tab"))??null}function j(){if(l){y=!0;try{E(!0),l.style.setProperty("--stack-runway","0px"),l.offsetHeight;const t=T(),e=V();if(!e)return;for(let n=0;n<12;n++){const m=Math.max(0,document.documentElement.scrollHeight-window.innerHeight);window.scrollTo({top:m,behavior:"auto"}),l.offsetHeight;const h=Math.ceil(e.getBoundingClientRect().top-t);if(h<=1)break;const g=parseFloat(getComputedStyle(l).getPropertyValue("--stack-runway"))||0;l.style.setProperty("--stack-runway",`${g+h+2}px`),l.offsetHeight,E(!0)}}finally{y=!1,window.scrollTo({top:0,behavior:"auto"})}}}function R(){const{tabs:t,stick:e,spread:n}=D();if(!t.length)return!1;const m=t.map(h=>h.getBoundingClientRect().top);return n<=1&&m.every(h=>Math.abs(h-e)<=2)}function z(){const t=Math.max(0,document.documentElement.scrollHeight-window.innerHeight);if(!q().length)return 0;y=!0;try{for(let e=t;e>=0;e-=1)if(window.scrollTo({top:e,behavior:"auto"}),l==null||l.offsetHeight,R())return e;return 0}finally{y=!1,window.scrollTo({top:0,behavior:"auto"})}}function L(){window.scrollY<=8&&(E(!0),j(),E(!0)),v=z()}function S(){return!c||!l||q().length<d.length?!1:window.scrollY>120&&R()}function P(){l&&l.classList.toggle("is-folded",S())}function K(){y||window.scrollY>v&&window.scrollTo({top:v,behavior:"auto"})}function W(t){var g,Y,O,_;const e=d[t],n=e==null?void 0:e.querySelector(".tab");if(!n)return`${u}${t}`;const m=((Y=(g=n.querySelector(".tab-code"))==null?void 0:g.textContent)==null?void 0:Y.trim())??`${u}${t}`,h=((_=(O=n.querySelector(".tab-label"))==null?void 0:O.textContent)==null?void 0:_.trim())??"";return`${m}${h}`}function B(t){s&&(s.textContent=t===p&&S()?W(t):`${u}${t}`),document.querySelectorAll(".stack-ruler button, .stack-ruler [data-goto], .tab-rail button, .tab[data-goto], .layer-id").forEach(e=>{const n=e.dataset.layer??e.dataset.goto;n!==void 0&&e.classList.toggle("active",Number(n)===t)})}function H(t){k=t,d.forEach(e=>{e.classList.toggle("is-front",t!==null&&Number(e.dataset.layer)===t)}),t!==null&&B(t)}function M(){H(null)}function C(t){if(S()&&b[t]!==void 0){window.scrollTo({top:b[t],behavior:"smooth"});return}const e=document.getElementById(`layer-${t}`)||document.querySelector(`${a}[data-layer="${t}"]`);if(!e)return;let n;if(t===p)L(),n=v;else{const h=N(e);n=Math.min(h.getBoundingClientRect().top+window.scrollY-I,v)}const m=t===p?"auto":"smooth";window.scrollTo({top:Math.max(0,n),behavior:m}),t===p&&requestAnimationFrame(w)}function G(t){M(),C(t),requestAnimationFrame(()=>{P(),w()})}function A(t){if(f==="navigate"||S()){G(t);return}if(k===t){M(),w(),C(t);return}if(k!==null){M(),C(t),requestAnimationFrame(w);return}H(t),C(t)}function J(){if(S())return p;const t=window.scrollY;let e=0;for(let n=d.length-1;n>=0;n--){const m=b[n];if(m!==void 0&&t>=m-4){e=n;break}}return e}function Q(){d.forEach(t=>{t.classList.remove("is-covered"),t.style.removeProperty("--stack-blur")})}function w(){if(y||(K(),P(),k!==null))return;const t=J();Q(),B(t),window.dispatchEvent(new CustomEvent("stack-depth",{detail:{active:t}}))}window.addEventListener("stack-goto-layer",t=>{var n;const e=Number((n=t.detail)==null?void 0:n.layer);Number.isFinite(e)&&A(e)}),d.forEach(t=>{t.addEventListener("click",e=>{e.target.closest("a[href], button[data-goto], .layer-id, .rail-tab, .tab[data-goto], .site-preview, .cta-block, .cal-slot, [data-cal-embed]")||A(Number(t.dataset.layer))})}),document.querySelectorAll(r).forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),A(Number(t.dataset.goto??t.dataset.layer))})}),L(),w(),window.addEventListener("load",()=>{window.scrollY>8&&window.scrollTo(0,0),requestAnimationFrame(()=>{L(),w()})}),window.addEventListener("resize",()=>{L(),w()},{passive:!0}),window.addEventListener("scroll",w,{passive:!0})}function X(i=document.querySelector(".tab-rail")){const a=i?[...i.querySelectorAll(".rail-tab")]:[];if(!i||!a.length)return;function s(r){const o=Math.max(0,Math.min(a.length-1,r));a.forEach((c,f)=>c.classList.toggle("active",f===o))}function u(r){s(r),window.dispatchEvent(new CustomEvent("stack-goto-layer",{detail:{layer:r}}))}a.forEach(r=>{r.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),u(Number(r.dataset.layer??r.dataset.goto))})}),window.addEventListener("stack-depth",r=>{var c;const o=Number((c=r.detail)==null?void 0:c.active);Number.isFinite(o)&&s(o)}),s(0)}const $="https://cal.levkin.ca",Z="ilia/consult",F=`${$}/embed/embed.js`,tt={dark:{ns:"consult-l0",inlineConfig:{layout:"week_view",useSlotsViewOnSmallScreen:"true",theme:"dark"},ui:{theme:"dark",hideEventTypeDetails:!0,layout:"week_view"}},light:{ns:"consult-l7",inlineConfig:{layout:"week_view",useSlotsViewOnSmallScreen:"true",theme:"light"},ui:{theme:"light",hideEventTypeDetails:!0,layout:"week_view"}}};let x;function et(){var i;(i=window.Cal)!=null&&i.loaded||(function(a,s,u){const r=(c,f)=>{c.q.push(f)},o=a.document;a.Cal=a.Cal||function(){const c=a.Cal,f=arguments;if(c.loaded||(c.ns={},c.q=c.q||[],o.head.appendChild(o.createElement("script")).src=s,c.loaded=!0),f[0]===u){const d=function(){r(d,arguments)},l=f[1];d.q=d.q||[],typeof l=="string"?(c.ns[l]=c.ns[l]||d,r(c.ns[l],f),r(c,["initNamespace",l])):r(c,f);return}r(c,f)}})(window,F,"init")}function nt(){return new Promise(i=>{const a=()=>i(window.Cal),s=o=>{if(o.dataset.calReady){a();return}o.addEventListener("load",()=>{o.dataset.calReady="1",a()},{once:!0}),o.addEventListener("error",()=>i(null),{once:!0})},u=document.querySelector(`script[src="${F}"]`);if(u){s(u);return}const r=new MutationObserver(()=>{const o=document.querySelector(`script[src="${F}"]`);o&&(r.disconnect(),s(o))});r.observe(document.head,{childList:!0}),window.setTimeout(()=>{r.disconnect(),a()},12e3)})}function ot(){return x||(et(),window.Cal("init","consult",{origin:$}),x=nt()),x}function rt(i){var o;const a=i.dataset.calTarget,s=i.dataset.calTheme==="light"?"light":"dark",u=tt[s];!document.getElementById(a)||!u||!((o=window.Cal)!=null&&o.ns)||(window.Cal("init",u.ns,{origin:$}),window.Cal.ns[u.ns]("inline",{elementOrSelector:`#${a}`,config:u.inlineConfig,calLink:Z}),window.Cal.ns[u.ns]("ui",u.ui))}function it(i){const a=i.dataset.calTarget,s=document.getElementById(a);if(!s)return;const u=()=>{i.classList.add("is-blocked"),i.classList.remove("is-embedded")},r=()=>{i.classList.remove("is-blocked"),i.classList.add("is-embedded")};u();const o=()=>{const f=s.querySelector("iframe");return!!(f&&f.offsetHeight>60)},c=new MutationObserver(()=>{o()&&r()});c.observe(s,{childList:!0,subtree:!0}),window.setTimeout(()=>{c.disconnect(),o()||u()},8e3)}function at(){const i=[...document.querySelectorAll("[data-cal-embed]")];i.length&&ot().then(a=>{a&&i.forEach(s=>{rt(s),it(s)})}).catch(()=>{})}U({sectionSelector:".folder[data-layer]",mountSelector:".mount",foldTabs:!0,interactionMode:"navigate"});X();at();
|