- Add serve.py to resolve clean Quartz URLs to .html files - Regenerate Quartz site with correct baseUrl http://100.118.5.51:9120 - 196 HTML files emitted; all internal links now resolve
2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
var H=Math.min,O=Math.max,G=Math.round;var T=t=>({x:t,y:t}),ne={left:"right",right:"left",bottom:"top",top:"bottom"};function Rt(t,e,n){return O(t,H(e,n))}function Q(t,e){return typeof t=="function"?t(e):t}function $(t){return t.split("-")[0]}function it(t){return t.split("-")[1]}function dt(t){return t==="x"?"y":"x"}function mt(t){return t==="y"?"height":"width"}function P(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function ht(t){return dt(P(t))}function Et(t,e,n){n===void 0&&(n=!1);let o=it(t),i=ht(t),r=mt(i),s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=K(s)),[s,K(s)]}function Ot(t){let e=K(t);return[ot(t),e,ot(e)]}function ot(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var bt=["left","right"],At=["right","left"],oe=["top","bottom"],ie=["bottom","top"];function re(t,e,n){switch(t){case"top":case"bottom":return n?e?At:bt:e?bt:At;case"left":case"right":return e?oe:ie;default:return[]}}function Lt(t,e,n,o){let i=it(t),r=re($(t),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(ot)))),r}function K(t){let e=$(t);return ne[e]+t.slice(e.length)}function se(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function gt(t){return typeof t!="number"?se(t):{top:t,right:t,bottom:t,left:t}}function L(t){let{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Ct(t,e,n){let{reference:o,floating:i}=t,r=P(e),s=ht(e),c=mt(s),f=$(e),a=r==="y",u=o.x+o.width/2-i.width/2,l=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2,h;switch(f){case"top":h={x:u,y:o.y-i.height};break;case"bottom":h={x:u,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:l};break;case"left":h={x:o.x-i.width,y:l};break;default:h={x:o.x,y:o.y}}let p=it(e);return p&&(h[s]+=m*(p==="end"?1:-1)*(n&&a?-1:1)),h}async function St(t,e){var n;e===void 0&&(e={});let{x:o,y:i,platform:r,rects:s,elements:c,strategy:f}=t,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:l="floating",altBoundary:m=!1,padding:h=0}=Q(e,t),p=gt(h),d=c[m?l==="floating"?"reference":"floating":l],w=L(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(d)))==null||n?d:d.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:f})),x=l==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),y=await(r.isElement==null?void 0:r.isElement(v))&&await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1},R=L(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:f}):x);return{top:(w.top-R.top+p.top)/y.y,bottom:(R.bottom-w.bottom+p.bottom)/y.y,left:(w.left-R.left+p.left)/y.x,right:(R.right-w.right+p.right)/y.x}}var ce=50,Tt=async(t,e,n)=>{let{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:St},f=await(s.isRTL==null?void 0:s.isRTL(e)),a=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:l}=Ct(a,o,f),m=o,h=0,p={};for(let g=0;g<r.length;g++){let d=r[g];if(!d)continue;let{name:w,fn:x}=d,{x:v,y,data:R,reset:b}=await x({x:u,y:l,initialPlacement:o,placement:m,strategy:i,middlewareData:p,rects:a,platform:c,elements:{reference:t,floating:e}});u=v??u,l=y??l,p[w]={...p[w],...R},b&&h<ce&&(h++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(a=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:u,y:l}=Ct(a,m,f)),g=-1)}return{x:u,y:l,placement:m,strategy:i,middlewareData:p}};var Pt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;let{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:f,elements:a}=e,{mainAxis:u=!0,crossAxis:l=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...d}=Q(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};let w=$(i),x=P(c),v=$(c)===c,y=await(f.isRTL==null?void 0:f.isRTL(a.floating)),R=m||(v||!g?[K(c)]:Ot(c)),b=p!=="none";!m&&b&&R.push(...Lt(c,g,p,y));let X=[c,...R],I=await f.detectOverflow(e,d),B=[],k=((o=r.flip)==null?void 0:o.overflows)||[];if(u&&B.push(I[w]),l){let N=Et(i,s,y);B.push(I[N[0]],I[N[1]])}if(k=[...k,{placement:i,overflows:B}],!B.every(N=>N<=0)){var j,nt;let N=(((j=r.flip)==null?void 0:j.index)||0)+1,ut=X[N];if(ut&&(!(l==="alignment"?x!==P(ut):!1)||k.every(E=>P(E.placement)===x?E.overflows[0]>0:!0)))return{data:{index:N,overflows:k},reset:{placement:ut}};let Y=(nt=k.filter(_=>_.overflows[0]<=0).sort((_,E)=>_.overflows[1]-E.overflows[1])[0])==null?void 0:nt.placement;if(!Y)switch(h){case"bestFit":{var yt;let _=(yt=k.filter(E=>{if(b){let F=P(E.placement);return F===x||F==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(F=>F>0).reduce((F,ee)=>F+ee,0)]).sort((E,F)=>E[1]-F[1])[0])==null?void 0:yt[0];_&&(Y=_);break}case"initialPlacement":Y=c;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};function Mt(t){let e=H(...t.map(r=>r.left)),n=H(...t.map(r=>r.top)),o=O(...t.map(r=>r.right)),i=O(...t.map(r=>r.bottom));return{x:e,y:n,width:o-e,height:i-n}}function le(t){let e=t.slice().sort((i,r)=>i.y-r.y),n=[],o=null;for(let i=0;i<e.length;i++){let r=e[i];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(i=>L(Mt(i)))}var Dt=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){let{placement:n,elements:o,rects:i,platform:r,strategy:s}=e,{padding:c=2,x:f,y:a}=Q(t,e),u=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(o.reference))||[]);if(!u.length)return{};let l=le(u),m=L(Mt(u)),h=gt(c);function p(){if(l.length===2&&(l[0].left>l[1].right||l[1].left>l[0].right)&&f!=null&&a!=null)return l.find(d=>f>d.left-h.left&&f<d.right+h.right&&a>d.top-h.top&&a<d.bottom+h.bottom)||m;if(l.length>=2){if(P(n)==="y"){let b=l[0],X=l[l.length-1],I=$(n)==="top",B=b.top,k=X.bottom,j=I?b.left:X.left,nt=I?b.right:X.right;return L({x:j,y:B,width:nt-j,height:k-B})}let d=$(n)==="left",w=O(...l.map(b=>b.right)),x=H(...l.map(b=>b.left)),v=l.filter(b=>d?b.left===x:b.right===w),y=v[0].top,R=v[v.length-1].bottom;return L({x,y,width:w-x,height:R-y})}return m}let g=await r.getElementRects({reference:{getBoundingClientRect:p},floating:o.floating,strategy:s});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}};var kt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:o,placement:i,platform:r}=e,{mainAxis:s=!0,crossAxis:c=!1,limiter:f={fn:x=>{let{x:v,y}=x;return{x:v,y}}},...a}=Q(t,e),u={x:n,y:o},l=await r.detectOverflow(e,a),m=P(i),h=dt(m),p=u[h],g=u[m],d=(x,v)=>Rt(v+l[x==="y"?"top":"left"],v,v-l[x==="y"?"bottom":"right"]);s&&(p=d(h,p)),c&&(g=d(m,g));let w=f.fn({...e,[h]:p,[m]:g});return{...w,data:{x:w.x-n,y:w.y-o,enabled:{[h]:s,[m]:c}}}}}};function st(){return typeof window<"u"}function V(t){return Ht(t)?(t.nodeName||"").toLowerCase():"#document"}function A(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function M(t){var e;return(e=(Ht(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ht(t){return st()?t instanceof Node||t instanceof A(t).Node:!1}function C(t){return st()?t instanceof Element||t instanceof A(t).Element:!1}function D(t){return st()?t instanceof HTMLElement||t instanceof A(t).HTMLElement:!1}function Ft(t){return!st()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof A(t).ShadowRoot}function Z(t){let{overflow:e,overflowX:n,overflowY:o,display:i}=S(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function $t(t){return/^(table|td|th)$/.test(V(t))}function J(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var ae=/transform|translate|scale|rotate|perspective|filter/,fe=/paint|layout|strict|content/,z=t=>!!t&&t!=="none",pt;function ct(t){let e=C(t)?S(t):t;return z(e.transform)||z(e.translate)||z(e.scale)||z(e.rotate)||z(e.perspective)||!lt()&&(z(e.backdropFilter)||z(e.filter))||ae.test(e.willChange||"")||fe.test(e.contain||"")}function Wt(t){let e=W(t);for(;D(e)&&!U(e);){if(ct(e))return e;if(J(e))return null;e=W(e)}return null}function lt(){return pt==null&&(pt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pt}function U(t){return/^(html|body|#document)$/.test(V(t))}function S(t){return A(t).getComputedStyle(t)}function tt(t){return C(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(V(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Ft(t)&&t.host||M(t);return Ft(e)?e.host:e}function Bt(t){let e=W(t);return U(e)?(t.ownerDocument||t).body:D(e)&&Z(e)?e:Bt(e)}function rt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=Bt(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),s=A(i);if(r){let c=at(s);return e.concat(s,s.visualViewport||[],Z(i)?i:[],c&&n?rt(c):[])}else return e.concat(i,rt(i,[],n))}function at(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function zt(t){let e=S(t),n=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=D(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,c=G(n)!==r||G(o)!==s;return c&&(n=r,o=s),{width:n,height:o,$:c}}function Vt(t){return C(t)?t:t.contextElement}function q(t){let e=Vt(t);if(!D(e))return T(1);let n=e.getBoundingClientRect(),{width:o,height:i,$:r}=zt(e),s=(r?G(n.width):n.width)/o,c=(r?G(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var ue=T(0);function It(t){let e=A(t);return!lt()||!e.visualViewport?ue:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function de(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===A(t)}function et(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),r=Vt(t),s=T(1);e&&(o?C(o)&&(s=q(o)):s=q(t));let c=de(r,n,o)?It(r):T(0),f=(i.left+c.x)/s.x,a=(i.top+c.y)/s.y,u=i.width/s.x,l=i.height/s.y;if(r&&o){let m=A(r),h=C(o)?A(o):o,p=m,g=at(p);for(;g&&h!==p;){let d=q(g),w=g.getBoundingClientRect(),x=S(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*d.x,y=w.top+(g.clientTop+parseFloat(x.paddingTop))*d.y;f*=d.x,a*=d.y,u*=d.x,l*=d.y,f+=v,a+=y,p=A(g),g=at(p)}}return L({width:u,height:l,x:f,y:a})}function ft(t,e){let n=tt(t).scrollLeft;return e?e.left+n:et(M(t)).left+n}function Ut(t,e){let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-ft(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function me(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t,r=i==="fixed",s=M(o),c=e?J(e.floating):!1;if(o===s||c&&r)return n;let f={scrollLeft:0,scrollTop:0},a=T(1),u=T(0),l=D(o);if((l||!r)&&((V(o)!=="body"||Z(s))&&(f=tt(o)),l)){let h=et(o);a=q(o),u.x=h.x+o.clientLeft,u.y=h.y+o.clientTop}let m=s&&!l&&!r?Ut(s,f):T(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-f.scrollLeft*a.x+u.x+m.x,y:n.y*a.y-f.scrollTop*a.y+u.y+m.y}}function he(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function ge(t){let e=tt(t),n=t.ownerDocument.body,o=O(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=O(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),r=-e.scrollLeft+ft(t),s=-e.scrollTop;return S(n).direction==="rtl"&&(r+=O(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:r,y:s}}var pe=25;function we(t,e,n){n===void 0&&(n="viewport");let o=n==="layoutViewport",i=A(t),r=M(t),s=i.visualViewport,c=r.clientWidth,f=r.clientHeight,a=0,u=0;if(s){let m=!lt()||e==="fixed";o?m||(a=-s.offsetLeft,u=-s.offsetTop):(c=s.width,f=s.height,m&&(a=s.offsetLeft,u=s.offsetTop))}if(ft(r)<=0){let m=r.ownerDocument,h=m.body,p=getComputedStyle(h),g=m.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,d=Math.abs(r.clientWidth-h.clientWidth-g),w=getComputedStyle(r).scrollbarGutter==="stable both-edges"?d/2:d;w<=pe&&(c-=w)}return{width:c,height:f,x:a,y:u}}function xe(t,e){let n=et(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=q(t),s=t.clientWidth*r.x,c=t.clientHeight*r.y,f=i*r.x,a=o*r.y;return{width:s,height:c,x:f,y:a}}function Nt(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=we(t,n,e);else if(e==="document")o=ge(M(t));else if(C(e))o=xe(e,n);else{let i=It(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return L(o)}function ve(t,e){let n=e.get(t);if(n)return n;let o=rt(t,[],!1).filter(c=>C(c)&&V(c)!=="body"),i=null,r=S(t).position==="fixed",s=r?W(t):t;for(;C(s)&&!U(s);){let c=S(s),f=ct(s),a=i?i.position:r?"fixed":"";!f&&(a==="fixed"||a==="absolute"&&c.position==="static")?o=o.filter(l=>l!==s):i=c,s=W(s)}return e.set(t,o),o}function ye(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t,s=[...n==="clippingAncestors"?J(e)?[]:ve(e,this._c):[].concat(n),o],c=Nt(e,s[0],i),f=c.top,a=c.right,u=c.bottom,l=c.left;for(let m=1;m<s.length;m++){let h=Nt(e,s[m],i);f=O(h.top,f),a=H(h.right,a),u=H(h.bottom,u),l=O(h.left,l)}return{width:a-l,height:u-f,x:l,y:f}}function be(t){let{width:e,height:n}=zt(t);return{width:e,height:n}}function Ae(t,e,n){let o=D(e),i=M(e),r=n==="fixed",s=et(t,!0,r,e),c={scrollLeft:0,scrollTop:0},f=T(0);if((o||!r)&&((V(e)!=="body"||Z(i))&&(c=tt(e)),o)){let m=et(e,!0,r,e);f.x=m.x+e.clientLeft,f.y=m.y+e.clientTop}!o&&i&&(f.x=ft(i));let a=i&&!o&&!r?Ut(i,c):T(0),u=s.left+c.scrollLeft-f.x-a.x,l=s.top+c.scrollTop-f.y-a.y;return{x:u,y:l,width:s.width,height:s.height}}function wt(t){return S(t).position==="static"}function _t(t,e){if(!D(t)||S(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return M(t)===n&&(n=n.ownerDocument.body),n}function qt(t,e){let n=A(t);if(J(t))return n;if(!D(t)){let i=W(t);for(;i&&!U(i);){if(C(i)&&!wt(i))return i;i=W(i)}return n}let o=_t(t,e);for(;o&&$t(o)&&wt(o);)o=_t(o,e);return o&&U(o)&&wt(o)&&!ct(o)?n:o||Wt(t)||n}var Re=async function(t){let e=this.getOffsetParent||qt,n=this.getDimensions,o=await n(t.floating);return{reference:Ae(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ee(t){return S(t).direction==="rtl"}var Oe={convertOffsetParentRelativeRectToViewportRelativeRect:me,getDocumentElement:M,getClippingRect:ye,getOffsetParent:qt,getElementRects:Re,getClientRects:he,getDimensions:be,getScale:q,isElement:C,isRTL:Ee};var Xt=kt,jt=Pt;var Yt=Dt;var Kt=(t,e,n)=>{let o=new Map,i=n??{},r={...Oe,...i.platform,_c:o};return Tt(t,e,{...i,platform:r})};var Gt=(t,e,n)=>{let o=new URL(t.getAttribute(e),n);t.setAttribute(e,o.pathname+o.hash)};function Qt(t,e){t.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(n=>{Gt(n,"href",e)}),t.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(n=>{Gt(n,"src",e)})}var Le=/<link rel="canonical" href="([^"]*)">/;async function Zt(t){let e=await fetch(`${t}`);if(!e.headers.get("content-type")?.startsWith("text/html"))return e;let n=await e.clone().text(),[o,i]=n.match(Le)??[];return i?fetch(`${new URL(i,t)}`):e}var Ce=new DOMParser,xt=null;async function Jt({clientX:t,clientY:e}){let n=xt=this;if(n.dataset.noPopover==="true")return;async function o(d){let{x:w,y:x}=await Kt(n,d,{strategy:"fixed",middleware:[Yt({x:t,y:e}),Xt(),jt()]});Object.assign(d.style,{transform:`translate(${w.toFixed()}px, ${x.toFixed()}px)`})}function i(d){if(vt(),d.classList.add("active-popover"),o(d),s!==""){let w=d.querySelector(".popover-inner");if(w){let x=`#popover-internal-${s.slice(1)}`,v=w.querySelector(x);v&&w.scroll({top:v.offsetTop-12,behavior:"instant"})}}}let r=new URL(n.href),s=decodeURIComponent(r.hash);r.hash="",r.search="";let c=`popover-${n.pathname}`,f=document.getElementById(c);if(document.getElementById(c)){i(f);return}let a=await Zt(r).catch(d=>{console.error(d)});if(!a)return;let u=a.headers.get("Content-Type");if(!u)return;let[l]=u.split(";"),[m,h]=l.split("/"),p=document.createElement("div");p.id=c,p.classList.add("popover");let g=document.createElement("div");switch(g.classList.add("popover-inner"),g.dataset.contentType=l??void 0,p.appendChild(g),m){case"image":let d=document.createElement("img");d.src=r.toString(),d.alt=r.pathname,g.appendChild(d);break;case"application":if(h==="pdf"){let y=document.createElement("iframe");y.src=r.toString(),g.appendChild(y)}break;default:let w=await a.text(),x=Ce.parseFromString(w,"text/html");Qt(x,r),x.querySelectorAll("[id]").forEach(y=>{let R=`popover-internal-${y.id}`;y.id=R});let v=[...x.getElementsByClassName("popover-hint")];if(v.length===0)return;v.forEach(y=>g.appendChild(y))}document.getElementById(c)||(document.body.appendChild(p),xt===this&&i(p))}function vt(){xt=null,document.querySelectorAll(".popover").forEach(e=>e.classList.remove("active-popover"))}function te(){let t=[...document.querySelectorAll("a.internal")];for(let e of t)e.addEventListener("mouseenter",Jt),e.addEventListener("mouseleave",vt),window.addCleanup(()=>{e.removeEventListener("mouseenter",Jt),e.removeEventListener("mouseleave",vt)})}document.addEventListener("nav",te);document.addEventListener("render",te);
|