ScrapBubble-min
code:app.js
var Z,h,ye,wt,K,ve,ke,Tt,ee={},we=[],Pt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|inech|zoo|^ord|itera/i;function z(e,t){for(var r in t)er=tr;return e}function Te(e){var t=e.parentNode;t&&t.removeChild(e)}function a(e,t,r){var o,s,n,l={};for(n in t)n=="key"?o=tn:n=="ref"?s=tn:ln=tn;if(arguments.length>2&&(l.children=arguments.length>3?Z.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(n in e.defaultProps)ln===void 0&&(ln=e.defaultPropsn);return te(e,l,o,s,null)}function te(e,t,r,o,s){var n={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:s??++ye};return s==null&&h.vnode!=null&&h.vnode(n),n}function w(e){return e.children}function re(e,t){this.props=e,this.context=t}function W(e,t){if(t==null)return e.__?W(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if((r=e.__kt)!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?W(e):null}function Pe(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__kt)!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Pe(e)}}function Le(e){(!e.__d&&(e.__d=!0)&&K.push(e)&&!oe.__r++||ke!==h.debounceRendering)&&((ke=h.debounceRendering)||ve)(oe)}function oe(){for(var e;oe.__r=K.length;)e=K.sort(function(t,r){return t.__v.__b-r.__v.__b}),K=[],e.some(function(t){var r,o,s,n,l,m;t.__d&&(l=(n=(r=t).__v).__e,(m=r.__P)&&(o=[],(s=z({},n)).__v=n.__v+1,de(m,n,s,r.__n,m.ownerSVGElement!==void 0,n.__h!=null?l:null,o,l??W(n),n.__h),je(o,n),n.__e!=l&&Pe(n)))})}function Ne(e,t,r,o,s,n,l,m,u,g){var i,p,d,c,f,k,b,_=o&&o.__k||we,x=_.length;for(r.__k=[],i=0;i<t.length;i++)if((c=r.__ki=(c=ti)==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?te(null,c,null,null,c):Array.isArray(c)?te(w,{children:c},null,null,null):c.__b>0?te(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=r,c.__b=r.__b+1,(d=_i)===null||d&&c.key==d.key&&c.type===d.type)_i=void 0;else for(p=0;p<x;p++){if((d=_p)&&c.key==d.key&&c.type===d.type){_p=void 0;break}d=null}de(e,c,d=d||ee,s,n,l,m,u,g),f=c.__e,(p=c.ref)&&d.ref!=p&&(b||(b=[]),d.ref&&b.push(d.ref,null,c),b.push(p,c.__c||f,c)),f!=null?(k==null&&(k=f),typeof c.type=="function"&&c.__k===d.__k?c.__d=u=Ee(c,u,e):u=Se(e,c,d,_,f,u),typeof r.type=="function"&&(r.__d=u)):u&&d.__e==u&&u.parentNode!=e&&(u=W(d))}for(r.__e=k,i=x;i--;)_i!=null&&(typeof r.type=="function"&&_i.__e!=null&&_i.__e==r.__d&&(r.__d=W(o,i+1)),He(_i,_i));if(b)for(i=0;i<b.length;i++)Ie(bi,b++i,b++i)}function Ee(e,t,r){for(var o,s=e.__k,n=0;s&&n<s.length;n++)(o=sn)&&(o.__=e,t=typeof o.type=="function"?Ee(o,t,r):Se(r,o,o,s,o.__e,t));return t}function Se(e,t,r,o,s,n){var l,m,u;if(t.__d!==void 0)l=t.__d,t.__d=void 0;else if(r==null||s!=n||s.parentNode==null)e:if(n==null||n.parentNode!==e)e.appendChild(s),l=null;else{for(m=n,u=0;(m=m.nextSibling)&&u<o.length;u+=2)if(m==s)break e;e.insertBefore(s,n),l=n}return l!==void 0?l:s.nextSibling}function Lt(e,t,r,o,s){var n;for(n in r)n==="children"||n==="key"||n in t||ne(e,n,null,rn,o);for(n in t)s&&typeof tn!="function"||n==="children"||n==="key"||n==="value"||n==="checked"||rn===tn||ne(e,n,tn,rn,o)}function Ce(e,t,r){t0==="-"?e.setProperty(t,r):et=r==null?"":typeof r!="number"||Pt.test(t)?r:r+"px"}function ne(e,t,r,o,s){var n;e:if(t==="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||Ce(e.style,t,"");if(r)for(t in r)o&&rt===ot||Ce(e.style,t,rt)}else if(t0==="o"&&t1==="n")n=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.lt+n=r,r?o||e.addEventListener(t,n?Me:$e,n):e.removeEventListener(t,n?Me:$e,n);else if(t!=="dangerouslySetInnerHTML"){if(s)t=t.replace(/xlinkH:h/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{et=r??"";break e}catch{}typeof r=="function"||(r!=null&&(r!==!1||t0==="a"&&t1==="r")?e.setAttribute(t,r):e.removeAttribute(t))}}function $e(e){this.le.type+!1(h.event?h.event(e):e)}function Me(e){this.le.type+!0(h.event?h.event(e):e)}function de(e,t,r,o,s,n,l,m,u){var g,i,p,d,c,f,k,b,_,x,v,y=t.type;if(t.constructor!==void 0)return null;r.__h!=null&&(u=r.__h,m=t.__e=r.__e,t.__h=null,n=m),(g=h.__b)&&g(t);try{e:if(typeof y=="function"){if(b=t.props,_=(g=y.contextType)&&og.__c,x=g?_?_.props.value:g.__:o,r.__c?k=(i=t.__c=r.__c).__=i.__E:("prototype"in y&&y.prototype.render?t.__c=i=new y(b,x):(t.__c=i=new re(b,x),i.constructor=y,i.render=Et),_&&_.sub(i),i.props=b,i.state||(i.state={}),i.context=x,i.__n=o,p=i.__d=!0,i.__h=[]),i.__s==null&&(i.__s=i.state),y.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=z({},i.__s)),z(i.__s,y.getDerivedStateFromProps(b,i.__s))),d=i.props,c=i.state,p)y.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(y.getDerivedStateFromProps==null&&b!==d&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(b,x),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(b,i.__s,x)===!1||t.__v===r.__v){i.props=b,i.state=i.__s,t.__v!==r.__v&&(i.__d=!1),i.__v=t,t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(N){N&&(N.__=t)}),i.__h.length&&l.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(b,i.__s,x),i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(d,c,f)})}i.context=x,i.props=b,i.state=i.__s,(g=h.__r)&&g(t),i.__d=!1,i.__v=t,i.__P=e,g=i.render(i.props,i.state,i.context),i.state=i.__s,i.getChildContext!=null&&(o=z(z({},o),i.getChildContext())),p||i.getSnapshotBeforeUpdate==null||(f=i.getSnapshotBeforeUpdate(d,c)),v=g!=null&&g.type===w&&g.key==null?g.props.children:g,Ne(e,Array.isArray(v)?v:v,t,r,o,s,n,l,m,u),i.base=t.__e,t.__h=null,i.__h.length&&l.push(i),k&&(i.__E=i.__=null),i.__e=!1}else n==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=Nt(r.__e,t,r,o,s,n,l,u);(g=h.diffed)&&g(t)}catch(N){t.__v=null,(u||n!=null)&&(t.__e=m,t.__h=!!u,nn.indexOf(m)=null),h.__e(N,t,r)}}function je(e,t){h.__c&&h.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){h.__e(o,r.__v)}})}function Nt(e,t,r,o,s,n,l,m){var u,g,i,p=r.props,d=t.props,c=t.type,f=0;if(c==="svg"&&(s=!0),n!=null){for(;f<n.length;f++)if((u=nf)&&"setAttribute"in u==!!c&&(c?u.localName===c:u.nodeType===3)){e=u,nf=null;break}}if(e==null){if(c===null)return document.createTextNode(d);e=s?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,d.is&&d),n=null,m=!1}if(c===null)p===d||m&&e.data===d||(e.data=d);else{if(n=n&&Z.call(e.childNodes),g=(p=r.props||ee).dangerouslySetInnerHTML,i=d.dangerouslySetInnerHTML,!m){if(n!=null)for(p={},f=0;f<e.attributes.length;f++)p[e.attributes[f].name]=e.attributes[f].value;(i||g)&&(i&&(g&&i.__html==g.__html||i.__html===e.innerHTML)||(e.innerHTML=i&&i.__html||""))}if(Lt(e,d,p,s,m),i)t.__k=[];else if(f=t.props.children,Ne(e,Array.isArray(f)?f:f,t,r,o,s&&c!=="foreignObject",n,l,n?n0:r.__k&&W(r,0),m),n!=null)for(f=n.length;f--;)nf!=null&&Te(nf);m||("value"in d&&(f=d.value)!==void 0&&(f!==p.value||f!==e.value||c==="progress"&&!f)&&ne(e,"value",f,p.value,!1),"checked"in d&&(f=d.checked)!==void 0&&f!==e.checked&&ne(e,"checked",f,p.checked,!1))}return e}function Ie(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(o){h.__e(o,r)}}function He(e,t,r){var o,s;if(h.unmount&&h.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||Ie(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(n){h.__e(n,t)}o.base=o.__P=null}if(o=e.__k)for(s=0;s<o.length;s++)os&&He(os,t,typeof e.type!="function");r||e.__e==null||Te(e.__e),e.__e=e.__d=void 0}function Et(e,t,r){return this.constructor(e,r)}function se(e,t,r){var o,s,n;h.__&&h.__(e,t),s=(o=typeof r=="function")?null:r&&r.__k||t.__k,n=[],de(t,e=(!o&&r||t).__k=a(w,null,e),s||ee,ee,t.ownerSVGElement!==void 0,!o&&r?r:s?null:t.firstChild?Z.call(t.childNodes):null,n,!o&&r?r:s?s.__e:t.firstChild,o),je(n,e)}Z=we.slice,h={__e:function(e,t){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e),s=r.__d),s)return r.__E=r}catch(n){e=n}throw e}},ye=0,wt=function(e){return e!=null&&e.constructor===void 0},re.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=z({},this.state),typeof e=="function"&&(e=e(z({},r),this.props)),e&&z(r,e),e!=null&&this.__v&&(t&&this.__h.push(t),Le(this))},re.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Le(this))},re.prototype.render=w,K=[],ve=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,oe.__r=0,Tt=0;var ae,j,Oe,q=0,ue=[],Re=h.__b,Fe=h.__r,Be=h.diffed,ze=h.__c,Ae=h.unmount;function me(e,t){h.__h&&h.__h(j,e,q||t),q=0;var r=j.__H||(j.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__e}function I(e){return q=1,St(We,e)}function St(e,t,r){var o=me(ae++,2);return o.t=e,o.__c||(o.__=[r?r(t):We(void 0,t),function(s){var n=o.t(o.__0,s);o.__0!==n&&(o.__=[n,o.__1],o.__c.setState({}))}],o.__c=j),o.__}function F(e,t){var r=me(ae++,3);!h.__s&&Ue(r.__H,t)&&(r.__=e,r.__H=t,j.__H.__h.push(r))}function A(e){return q=5,H(function(){return{current:e}},[])}function H(e,t){var r=me(ae++,7);return Ue(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function C(e,t){return q=8,H(function(){return e},t)}function Ct(){var e;for(ue.sort(function(t,r){return t.__v.__b-r.__v.__b});e=ue.pop();)if(e.__P)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],h.__e(t,e.__v)}}h.__b=function(e){j=null,Re&&Re(e)},h.__r=function(e){Fe&&Fe(e),ae=0;var t=(j=e.__c).__H;t&&(t.__h.forEach(ie),t.__h.forEach(fe),t.__h=[])},h.diffed=function(e){Be&&Be(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(ue.push(t)!==1&&Oe===h.requestAnimationFrame||((Oe=h.requestAnimationFrame)||function(r){var o,s=function(){clearTimeout(n),De&&cancelAnimationFrame(o),setTimeout(r)},n=setTimeout(s,100);De&&(o=requestAnimationFrame(s))})(Ct)),j=null},h.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ie),r.__h=r.__h.filter(function(o){return!o.__||fe(o)})}catch(o){t.some(function(s){s.__h&&(s.__h=[])}),t=[],h.__e(o,r.__v)}}),ze&&ze(e,t)},h.unmount=function(e){Ae&&Ae(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(o){try{ie(o)}catch(s){t=s}}),t&&h.__e(t,r.__v))};var De=typeof requestAnimationFrame=="function";function ie(e){var t=j,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),j=t}function fe(e){var t=j;e.__c=e.__(),j=t}function Ue(e,t){return!e||e.length!==t.length||t.some(function(r,o){return r!==eo})}function We(e,t){return typeof t=="function"?t(e):t}var Qe;(function(e){})(Qe||(Qe={}));var Mt="0.13.3",Ke;function qe(e=Mt){let t=https://cdnjs.cloudflare.com/ajax/libs/KaTeX/${e}/katex.min.js,r=document.createElement("script");return r.src=t,Ke??=new Promise((o,s)=>{r.onload=()=>o(window.katex),r.onerror=n=>s(n),document.head.append(r)}),Ke}function V(e,t={}){let r=A(null),o,s=I(e),n,l=I("");return F(()=>{(async()=>{let{render:m}=await qe();if(!!r.current)try{m(o,r.current,t),l("")}catch(u){if(u instanceof Error&&u.name==="ParseError")l(u.message.slice("KaTeX parse error: ".length));else throw u}})()},o),{ref:r,error:n,setFormula:s}}var P=e=>e.toLowerCase().replaceAll(" ","_"),$=e=>e.replaceAll(" ","_").replace(//?#\{}^|<>/g,t=>encodeURIComponent(t));function Ve(e,...t){return e!==void 0&&t.includes(e)}function R(e,t){return/${e}/${P(t)}}function X(e){if(e.pathType==="root"){let,t="",r=""=e.href.match(/\/(\w\-+)(?:\/?|\/(.*))$/)??"","","";if(t==="")throw SyntaxError(Failed to get a project name from "${e.href}");let,o=r?.match?.(/#(a-f\d{24,32})$/)??"","";return r===""?{project:t}:o===""?{project:t,title:r}:{project:t,title:r.slice(0,-1-o.length),hash:o}}else{let,t=e.href.match(/#(a-f\d{24,32})$/)??"","";return t===""?{title:e.href}:{title:e.href.slice(0,-1-t.length),hash:t}}}var le=e=>{let t=()=>{},r=new Promise((o,s)=>{let n=setTimeout(()=>o(),e);t=()=>{clearTimeout(n),s("cancelled")}});return r.cancel=t,r};var jt=e=>({type:"title",text:e.rows0.text}),It=e=>{let{rows:t,...r}=e,{indent:o=0,text:s=""}=t??{},n=s.replace(/^\s*code:/,"");return{indent:o,type:"codeBlock",fileName:n,content:r.map(l=>l.text.substring(o+1)).join(` )}},L=(e,{parseOnNested:t,parseOnQuoted:r,patterns:o})=>(s,n,l)=>{var m,u,g,i,p,d;if(!t&&n.nested)return(m=l==null?void 0:l())!==null&&m!==void 0?m:[];if(!r&&n.quoted)return(u=l==null?void 0:l())!==null&&u!==void 0?u:[];for(let c of o){let f=c.exec(s);if(f===null)continue;let k=s.substring(0,f.index),b=s.substring(f.index+((i=(g=f[0])===null||g===void 0?void 0:g.length)!==null&&i!==void 0?i:0)),_=e((p=f[0])!==null&&p!==void 0?p:"",n);return[...U(k,n),..._,...U(b,n)]}return(d=l==null?void 0:l())!==null&&d!==void 0?d:[]},E=e=>[{type:"plain",raw:e,text:e}],Ht=L(E,{parseOnNested:!0,parseOnQuoted:!0,patterns:[/^()(.*)()$/]}),Ot=/^>.*$/,Rt=(e,t)=>t.context==="table"?E(e,t):[{type:"quote",raw:e,nodes:U(e.substring(1),{...t,quoted:!0})}],Ft=L(Rt,{parseOnNested:!1,parseOnQuoted:!1,patterns:[Ot]}),Bt=/^\? .+$/,zt=(e,t)=>t.context==="table"?E(e,t):[{type:"helpfeel",raw:e,text:e.substring(2)}],At=L(zt,{parseOnNested:!1,parseOnQuoted:!1,patterns:[Bt]}),Dt=/\[\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)\]\]/i,Ut=/\[\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}\]\]/,Wt=(e,t)=>{if(t.context==="table")return E(e,t);let r=e.substring(2,e.length-2),o=/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(r);return[{type:"strongImage",raw:e,src:o?${r}/thumb/1000:r}]},Qt=L(Wt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Dt,Ut]}),Kt=/\[[^[\]]*\.icon(?:\*[1-9]\d*)?\]/;function Xe(e){return(t,r)=>{if(e==="strongIcon"&&r.context==="table")return E(t,r);let o=e==="icon"?t.substring(1,t.length-1):t.substring(2,t.length-2),s=o.lastIndexOf(".icon"),n=o.substring(0,s),l=n.startsWith("/")?"root":"relative",m=o.substring(s+5,o.length),u=m.startsWith("*")?parseInt(m.substring(1),10):1;return new Array(u).fill({}).map(()=>({path:n,pathType:l,type:e,raw:t}))}}var qt=Xe("icon"),Vt=L(qt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Kt]}),Xt=/\[\[[^[\]]*\.icon(?:\*\d+)?\]\]/,Gt=Xe("strongIcon"),Jt=L(Gt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Xt]}),Yt=/\[\[(?:[^[]|\[[^[]).*?\]*\]\]/,Zt=(e,t)=>t.context==="table"?E(e,t):[{type:"strong",raw:e,nodes:U(e.substring(2,e.length-2),{...t,nested:!0})}],er=L(Zt,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Yt]}),tr=/\[\$ .+? \]/,rr=/\[\$ [^\]]+\]/,or=(e,t)=>t.context==="table"?E(e,t):[{type:"formula",raw:e,formula:e.substring(3,e.length-(e.endsWith(" ]")?2:1))}],nr=L(or,{parseOnNested:!1,parseOnQuoted:!0,patterns:[tr,rr]}),sr=/\[[!"#%&'()*+,\-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/,ar=(e,t)=>{if(t.context==="table")return E(e,t);let r=e.indexOf(" "),o=e.substring(1,r),s=e.substring(r+1,e.length-1),n=new Set(o);if(n.has("*")){let l=o.split("*").length-1;n.delete("*"),n.add(*-${Math.min(l,10)})}return[{type:"decoration",raw:e,rawDecos:o,decos:Array.from(n),nodes:U(s,{...t,nested:!0})}]},ir=L(ar,{parseOnNested:!1,parseOnQuoted:!0,patterns:[sr]}),lr=/.*?/,cr=(e,t)=>t.context==="table"?E(e,t):[{type:"code",raw:e,text:e.substring(1,e.length-1)}],pr=L(cr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[lr]}),dr=/^[$%] .+$/,ur=(e,t)=>{var r;if(t.context==="table")return E(e,t);let o=(r=e[0])!==null&&r!==void 0?r:"",s=e.substring(2);return[{type:"commandLine",raw:e,symbol:o,text:s}]},mr=L(ur,{parseOnNested:!1,parseOnQuoted:!1,patterns:[dr]}),fr=/\[\s+\]/,gr=(e,t)=>t.context==="table"?E(e,t):[{type:"blank",raw:e,text:e.substring(1,e.length-1)}],br=L(gr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[fr]}),hr=/\[https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?(?:\s+https?:\/\/[^\s\]]+)?\]/i,_r=/\[https?:\/\/[^\s\]]+\s+https?:\/\/[^\s\]]+\.(?:png|jpe?g|gif|svg)(?:\?[^\]\s]+)?\]/i,xr=/\[https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?(?:\s+https?:\/\/[^\s\]]+)?\]/,yr=/\[https?:\/\/[^\s\]]+\s+https?:\/\/(?:[0-9a-z-]+\.)?gyazo\.com\/[0-9a-f]{32}(?:\/raw)?\]/,vr=e=>/^https?:\/\/[^\s\]]+\.(png|jpe?g|gif|svg)(\?[^\]\s]+)?$/i.test(e)||kr(e),kr=e=>/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}(\/raw)?$/.test(e),wr=(e,t)=>{if(t.context==="table")return E(e,t);let r=e.search(/\s/),o=r!==-1?e.substring(1,r):e.substring(1,e.length-1),s=r!==-1?e.substring(r,e.length-1).trimLeft():"",[n,l]=vr(s)?[s,o]:[o,s];return[{type:"image",raw:e,src:/^https?:\/\/([0-9a-z-]\.)?gyazo\.com\/[0-9a-f]{32}$/.test(n)?${n}/thumb/1000:n,link:l}]},Tr=L(wr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[hr,_r,xr,yr]}),Pr=/\[https?:\/\/[^\s\]]+\s+[^\]]*[^\s]\]/,Lr=/\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/,Nr=/\[https?:\/\/[^\s\]]+\]/,Er=/https?:\/\/[^\s]+/,Sr=(e,t)=>{if(t.context==="table")return E(e,t);let r=e.startsWith("[")&&e.endsWith("]")?e.substring(1,e.length-1):e,o=/^https?:\/\/[^\s\]]/.test(r),s=(o?/^https?:\/\/[^\s\]]+/:/https?:\/\/[^\s\]]+$/).exec(r);if((s==null?void 0:s[0])===void 0)return[];let n=o?r.substring(s[0].length):r.substring(0,s.index-1);return[{type:"link",raw:e,pathType:"absolute",href:s[0],content:n.trim()}]},Cr=L(Sr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[Pr,Lr,Nr,Er]}),Ge=/\[([^\]]*[^\s])\s+([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)\]/,Je=/\[([NS]\d+(?:\.\d+)?,[EW]\d+(?:\.\d+)?(?:,Z\d+)?)(?:\s+([^\]]*[^\s]))?\]/,$r=e=>{let[t="",r="",o=""]=e.split(","),s=parseFloat(t.replace(/^N/,"").replace(/^S/,"-")),n=parseFloat(r.replace(/^E/,"").replace(/^W/,"-")),l=/^Z\d+$/.test(o)?parseInt(o.replace(/^Z/,""),10):14;return{latitude:s,longitude:n,zoom:l}},Mr=(e,t)=>{var r;if(t.context==="table")return E(e,t);let o=(r=e.match(Ge))!==null&&r!==void 0?r:e.match(Je);if(o===null)return[];let s=e.startsWith("[N")||e.startsWith("[S"),[,n="",l=""]=s?o:[o[0],o[2],o[1]],{latitude:m,longitude:u,zoom:g}=$r(n),i=l!==""?https://www.google.com/maps/place/${encodeURIComponent(l)}/@${m},${u},${g}z:https://www.google.com/maps/@${m},${u},${g}z;return[{type:"googleMap",raw:e,latitude:m,longitude:u,zoom:g,place:l,url:i}]},jr=L(Mr,{parseOnNested:!1,parseOnQuoted:!0,patterns:[Ge,Je]}),Ir=/\[\/?[^[\]]+\]/,Hr=e=>{let t=e.substring(1,e.length-1);return[{type:"link",raw:e,pathType:t.startsWith("/")?"root":"relative",href:t,content:""}]},Or=L(Hr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[Ir]}),Rr=/(?:^|\s)#\S+/,Fr=(e,t)=>{if(t.context==="table")return E(e,t);if(e.startsWith("#"))return[{type:"hashTag",raw:e,href:e.substring(1)}];let r=e.substring(0,1),o=e.substring(1);return[...E(r,t),{type:"hashTag",raw:o,href:o.substring(1)}]},Br=L(Fr,{parseOnNested:!0,parseOnQuoted:!0,patterns:[Rr]}),zr=(e,t,r)=>{var o;return e===""?[]:(o=r==null?void 0:r())!==null&&o!==void 0?o:[]},Ar=(...e)=>(t,r)=>e.reduceRight((o,s)=>()=>s(t,r,o),()=>Ht(t,r))(),U=Ar(zr,Ft,At,pr,mr,nr,br,ir,Qt,Jt,er,Tr,Cr,Vt,jr,Or,Br),Dr=e=>{let{rows:[t,...r]}=e,{indent:o=0,text:s=""}=t??{},n=s.replace(/^\s*table:/,"");return{indent:o,type:"table",fileName:n,cells:r.map(l=>l.text.substring(o+1)).map(l=>l.split(" ").map(m=>U(m,{nested:!1,quoted:!1,context:"table"})))}},Ur=e=>{let{indent:t,text:r}=e.rows[0];return{indent:t,type:"line",nodes:U(r.substring(t),{nested:!1,quoted:!1,context:"line"})}},Wr=e=>{switch(e.type){case"title":return jt(e);case"codeBlock":return It(e);case"table":return Dr(e);case"line":return Ur(e)}},Qr=e=>e.split( ).map(t=>{var r,o,s;return{indent:(s=(o=(r=/^\s+/.exec(t))===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0,text:t}}),Kr=(e,t)=>{var r,o;return(e.type==="codeBlock"||e.type==="table")&&t.indent>((o=(r=e.rows[0])===null||r===void 0?void 0:r.indent)!==null&&o!==void 0?o:0)},Ye=(e,t)=>{let r=e[e.length-1];return r!==void 0&&Kr(r,t)?(r.rows.push(t),e):(e.push({type:/^\s*code:/.test(t.text)?"codeBlock":/^\s*table:/.test(t.text)?"table":"line",rows:[t]}),e)},qr=(e,t)=>{var r;if((r=t.hasTitle)!==null&&r!==void 0?r:!0){let[o,...s]=e;return o===void 0?[]:[{type:"title",rows:[o]},...s.reduce(Ye,[])]}return e.reduce(Ye,[])},ge=(e,t)=>{var r;let o=Qr(e);return qr(o,{hasTitle:(r=t==null?void 0:t.hasTitle)!==null&&r!==void 0?r:!0}).map(Wr)};function ce(e,t,r){return H(()=>{let o=e.map(s=>typeof s=="string"?s:s.text).join(
);return ge(o,t)},[e,t,...r??[]])}function Ze(e,t){return t.some(r=>{switch(r.type){case"hashTag":return P(r.href)===P(e);case"link":{if(r.pathType!=="relative")return!1;let{title:o=""}=X({pathType:"relative",href:r.href});return P(o)===P(e)}case"quote":case"strong":case"decoration":return Ze(e,r.nodes)}})}function et({lines:e,project:t,title:r,emptyLinks:o,noIndent:s,scrollTo:n}){let l=ce(e,{hasTitle:!1}),m=H(()=>e.flatMap(p=>typeof p=="string"?[]:[p.id]),[e]),u=H(()=>{let p=0;return l.map(d=>{switch(d.type){case"title":case"line":return{...d,id:m[p++]};case"codeBlock":{let c=p;return p+=d.content.split(
).length+1,{...d,ids:m.slice(c,p)}}case"table":{let c=p;return p+=d.cells.length+1,{...d,ids:m.slice(c,p)}}}})},[l,m]),g=H(()=>{if(!n)return;let p=n.type==="id"?n.value:u.find(d=>d.type!=="line"?!1:Ze(n.value,d.nodes))?.id??"";if(!!m.includes(p))return p},[n,u,m]),i=A(null);return F(()=>{if(!g)return;let p=i.current?.querySelector(data-id="${g}"),d=window.scrollY;p?.scrollIntoView?.({block:"center"}),window.scroll(0,d)},[g]),a("div",{className:"lines",ref:i},u.map(p=>{switch(p.type){case"title":return a("div",null);case"codeBlock":return a(Vr,{key:p.ids[0],block:p,project:t,title:r,noIndent:s,ids:p.ids,scrollId:g});case"table":return a(Xr,{key:p.ids[0],block:p,project:t,title:r,emptyLinks:o,noIndent:s,ids:p.ids,scrollId:g});case"line":return a(G,{key:p.id,index:p.id,indent:p.indent,noIndent:s,permalink:p.id===g},p.nodes.length>0?p.nodes.map(d=>a(J,{node:d,project:t,emptyLinks:o})):a("br",null))}}))}var G=({index:e,indent:t,noIndent:r,children:o,permalink:s})=>a("div",{className:line${s?" permalink":""},"data-id":e,"data-indent":t,style:{"margin-left":r?"":${1*t}em}},o),Vr=({block:{fileName:e,content:t,indent:r},project:o,title:s,ids:n,scrollId:l})=>{let[m,u]=I(""),g=C(async i=>{i.preventDefault(),i.stopPropagation();try{await navigator.clipboard.writeText(t),u("Copied"),await le(1e3),u("")}catch(p){alert(Failed to copy the code block Error:${p.message})}},[t]);return a(w,null,a(G,{index:n[0],indent:r,permalink:n[0]===l},a("span",{className:"code-block"},a("span",{className:"code-block-start"},e.includes(".")?a("a",{href:/api/code/${o}/${$(s)}/${e},target:"_blank"},e):e),a("span",{className:"copy",title:"Copy",onClick:g},m))),a(w,null,t.split(
).map((i,p)=>a(G,{index:n[p+1],indent:r,permalink:n[p+1]===l},a("code",{className:"code-block"},i)))))},Xr=({block:{fileName:e,cells:t,indent:r},project:o,title:s,emptyLinks:n,ids:l,scrollId:m})=>a(w,null,a(G,{index:l[0],indent:r,permalink:l[0]===m},a("span",{className:"table-block"},a("span",{className:"table-block-start"},a("a",{href:/api/table/${o}/${$(s)}/${e}.csv,target:"_blank"},e)))),a(w,null,t.map((u,g)=>a(G,{index:l[g+1],indent:r,permalink:l[g+1]===m},a("span",{className:"table-block table-block-row"},u.map((i,p)=>a("span",{className:cell col-${p}},i.map(d=>a(J,{node:d,project:o,emptyLinks:n}))))))))),J=({node:e,project:t,emptyLinks:r})=>{switch(e.type){case"code":return a(Gr,{node:e});case"formula":return a(Jr,{node:e});case"commandLine":return a(Yr,{node:e});case"helpfeel":return a(Zr,{node:e});case"quote":return a(eo,{node:e,project:t,emptyLinks:r});case"strong":return a(to,{node:e,project:t,emptyLinks:r});case"decoration":return a(ro,{node:e,project:t,emptyLinks:r});case"plain":case"blank":return a(no,{node:e});case"hashTag":return a(io,{node:e,project:t,emptyLinks:r});case"link":return a(lo,{node:e,project:t,emptyLinks:r});case"googleMap":return a(oo,{node:e});case"icon":return a(tt,{node:e,project:t,strong:!1});case"strongIcon":return a(tt,{node:e,project:t,strong:!0});case"image":return a(so,{node:e});case"strongImage":return a(ao,{node:e})}},Gr=({node:{text:e}})=>a("code",{className:"code"},e),Jr=({node:{formula:e}})=>{let{ref:t,error:r,setFormula:o}=V("");return o(e),a("span",{className:formula ${r?" error":""}},r?a("code",null,e):a("span",{className:"katex-display",ref:t}))},Yr=({node:{text:e,symbol:t}})=>a("code",{className:"cli"},a("span",{className:"prefix"},t)," ",a("span",{className:"command"},e)),Zr=({node:{text:e}})=>a("code",{className:"helpfeel"},a("span",{className:"prefix"},"?")," ",a("span",{className:"entry"},e)),eo=({node:{nodes:e},project:t,emptyLinks:r})=>a("blockquote",{className:"quote"},e.map(o=>a(J,{node:o,project:t,emptyLinks:r}))),to=({node:{nodes:e},project:t,emptyLinks:r})=>a("strong",null,e.map(o=>a(J,{node:o,project:t,emptyLinks:r}))),ro=({node:{decos:e,nodes:t},project:r,emptyLinks:o})=>a("span",{className:e.map(s=>deco-${s}).join(" ")},t.map(s=>a(J,{node:s,project:r,emptyLinks:o}))),oo=({node:{place:e,latitude:t,longitude:r,zoom:o}})=>a("span",{className:"pointing-device-map"},a("a",{href:https://www.google.com/maps/search/${e}/@${t},${r},${o}z,rel:"noopner noreferrer",target:"_blank"},a("img",{className:"google-map",src:/api/google-map/static-map?center=${t}%2C${r}&markers=${e}&zoom=${o}&_csrf=${window._csrf}}))),no=({node:{text:e}})=>a(w,null,e),tt=({node:{pathType:e,path:t},strong:r,project:o})=>{let[s,n]=e==="relative"?[o,t]:t.match(/\/([\w\-]+)\/(.+)$/)?.slice?.(1)??[o,t],l=$(n);return a("a",{href:/${s}/${l},rel:s===scrapbox.Project.name?"route":"noopener noreferrer",target:s===scrapbox.Project.name?"":"_blank"},a("img",{className:r?"icon strong-icon":"icon",alt:n,src:/api/pages/${s}/${l}/icon},n))},so=({node:{link:e,src:t}})=>{let r=e||(/https:\/\/gyazo\.com\/[^\/]+\/thumb\/1000/.test(t)?t.slice(0,-"/thumb/1000".length):t);return a("a",{className:e?"link":"",href:r,rel:"noopner noreferrer",target:"_blank"},a("img",{className:"image",src:t}))},ao=({node:{src:e}})=>a("img",{className:"image strong-image",src:e}),io=({node:{href:e},project:t,emptyLinks:r})=>a("a",{href:/${t}/${$(e)},className:page-link${r.includes(P(e))?" empty-page-link":""},type:"hashTag",rel:t===scrapbox.Project.name?"route":"noopener noreferrer",target:t===scrapbox.Project.name?"":"_blank"},"#",e),lo=({node:{pathType:e,href:t,content:r},project:o,emptyLinks:s})=>{switch(e){case"relative":case"root":{let{project:n=o,title:l,hash:m=""}=X({pathType:e,href:t});return a("a",{className:page-link${l!==void 0&&s.includes(P(l))?" empty-page-link":""},type:"link",href:/${n}${l===void 0?"":/${$(l)}${m===""?"":#${m}}},rel:n===scrapbox.Project.name?"route":"noopener noreferrer",target:n===scrapbox.Project.name?"":"_blank"},t)}case"absolute":{let n=mo(t);if(n)return a(fo,{...n});let l=bo(t);return l?a(ho,{...l}):_o(t)?a(xo,{href:t,content:r}):vo(t)?a(ko,{href:t}):a("a",{className:"link",href:t,rel:"noopener noreferrer",target:"_blank"},r||t)}}},co=/https?:\/\/(?:www\.|)youtube\.com\/watch\?((?:[^\s]+&|)v=([a-zA-Z\d_-]+)(?:&[^\s]+|))/,po=/https?:\/\/youtu\.be\/([a-zA-Z\d_-]+)(?:\?([^\s]{0,100})|)/,uo=/https?:\/\/(?:www\.|)youtube\.com\/playlist\?((?:[^\s]+&|)list=([a-zA-Z\d_-]+)(?:&[^\s]+|))/;function mo(e){{let t=e.match(co);if(t){let[,r,o]=t,s=new URLSearchParams(r);return s.delete("v"),s.append("autoplay","0"),{videoId:o,params:s}}}{let t=e.match(po);if(t){let[,r]=t;return{videoId:r,params:new URLSearchParams("autoplay=0")}}}{let t=e.match(uo);if(t){let[,r,o]=t,s=new URLSearchParams(r),n=s.get("v");return n?(s.delete("v"),s.append("autoplay","0"),s.append("list",o),{videoId:n,params:s}):void 0}}}var fo=({videoId:e,params:t})=>a("div",{className:"iframe-video-player"},a("iframe",{src:https://www.youtube.com/embed/${e}?${t.toString()},allowFullScreen:!0,type:"text/html"})),go=/https?:\/\/vimeo\.com\/([0-9]+)/i;function bo(e){let t=e.match(go);if(!!t)return{vimeoId:t[1]}}var ho=({vimeoId:e})=>a("div",{className:"iframe-video-player"},a("iframe",{src:https://player.vimeo.com/video/${e},allowFullScreen:!0,type:"text/html"}));function _o(e){return/\.(?:mp3|ogg|wav|aac)$/.test(e)}var xo=({href:e,content:t})=>t===""?a("audio",{className:"audio-player",preload:"none",controls:!0,src:e}):a(yo,{href:e,content:t}),yo=({href:e,content:t})=>{let r=A(null),o=C(()=>{r.current?.paused?(r.current.currentTime=0,r.current.play()):r.current?.pause?.()},[]);return a("span",{className:"audio-link"},a("a",{href:e,rel:"noopener noreferrer",target:"_blank"},t),a("span",{className:"play",onClick:o},"♬"),a("audio",{preload:"none",src:e,ref:r}))};function vo(e){return/\.(?:mp4|webm)$/.test(e)}var ko=({href:e})=>a("div",{className:"video-player"},a("video",{class:"video",style:{display:"inline-block"},controls:!0,loop:!0,src:e}));var rt=({project:e,title:t,lines:r,emptyLinks:o,hasChildCards:s,position:n,theme:l,index:m,onPointerEnterCapture:u,scrollTo:g,onClick:i})=>a(w,null,r.length>0&&a("div",{className:text-bubble${s?" no-scroll":""},"data-theme":l,"data-index":m,onPointerEnterCapture:u,onClick:i,style:{top:${n.top}px,maxWidth:${n.maxWidth}px,..."left"in n?{left:${n.left}px}:{right:${n.right}px}}},a(wo,null,e!==scrapbox.Project.name&&a(To,{project:e,title:t})),a(et,{lines:r,emptyLinks:o,project:e,title:t,scrollTo:g}))),wo=({children:e})=>a("div",{className:"status-bar top-right"},e);function To({project:e,title:t}){return a("a",{href:/${e}/${$(t)},target:"_blank",rel:"noopener noreferrer"},e)}var ot=({project:e,title:t,descriptions:r,thumbnail:o,linkedTo:s,linkedType:n,theme:l,...m})=>{let u=ce(o?[]:r,{hasTitle:!1},[o,r]);return a("a",{className:"related-page-card page-link",type:"link","data-theme":l,"data-linked-to":s,"data-linked-type":n,href:/${e}/${$(t)},rel:e===scrapbox.Project.name?"route":"noopner noreferrer",target:e!==scrapbox.Project.name?"_blank":"",...m},a("div",{class:"hover"}),a("div",{class:"content"},a("div",{class:"header"},a("div",{class:"title"},t)),o?a("div",{class:"thumbnail"},a("img",{src:o})):a("div",{class:"description"},u.flatMap((g,i)=>g.type==="line"?[a("p",{key:i},g.nodes.map(p=>a(nt,{node:p,project:e})))]:[]))))},nt=({node:e,project:t})=>{switch(e.type){case"code":return a("code",null,e.text);case"formula":return a(Po,{node:e});case"commandLine":return a("code",null,e.symbol," $",e.text);case"helpfeel":return a("code",null,"? ",e.text);case"quote":case"strong":case"decoration":return a(w,null,e.nodes.map(r=>a(nt,{node:r,project:t})));case"icon":case"strongIcon":return a(Lo,{node:e,project:t});case"hashTag":return a(No,{node:e});case"link":return a(Eo,{node:e});case"plain":case"blank":return a(w,null,e.text);default:return a(w,null)}},Po=({node:{formula:e}})=>{let{ref:t,error:r,setFormula:o}=V("");return o(e),a("span",{className:formula ${r?" error":""}},r?a("code",null,e):a("span",{className:"katex-display",ref:t}))},Lo=({node:{pathType:e,path:t},project:r})=>{let[o,s]=e==="relative"?[r,t]:t.match(/\/([\w\-]+)\/(.+)$/)?.slice?.(1)??[r,t];return a("img",{class:"icon",src:/api/pages/${o}/${$(s)}/icon})},No=({node:{href:e}})=>a("span",{class:"page-link"},"#",e),Eo=({node:{pathType:e,href:t,content:r}})=>e!=="absolute"?a("span",{class:"page-link"},t):a("span",{class:"link"},r||t);var st=({cards:e,index:t,position:r,...o})=>a("div",{className:"card-bubble","data-index":t,style:{bottom:${r.bottom}px,maxWidth:${r.maxWidth}px,..."left"in r?{left:${r.left}px}:{right:${r.right}px}},...o},a("ul",null,e.map(({project:s,title:n,theme:l,descriptions:m,image:u,linkedTo:g,linkedType:i})=>a("li",null,a(ot,{key:/${s}/${n},project:s,title:n,theme:l,linkedTo:g,linkedType:i,descriptions:m,thumbnail:u??""})))));var at=*{box-sizing:border-box}a{background-color:transparent;text-decoration:none;cursor:pointer}img{display:inline-block;max-width:100%;max-height:100px}code{font-family:var(--code-text-font, Menlo, Monaco, Consolas, "Courier New", monospace);font-size:90%;color:var(--code-color, #342d9c);background-color:var(--code-bg, rgba(0,0,0,.04));padding:0;white-space:pre-wrap;word-wrap:break-word}blockquote{background-color:var(--quote-bg-color, rgba(0,0,0,.05));display:block;border-left:solid 4px #a0a0a0;padding-left:4px;margin:0}strong{font-weight:700}iframe{display:inline-block;margin:3px 0;vertical-align:middle;max-width:100%;width:640px;height:360px;border:0}audio{display:inline-block;vertical-align:middle;white-space:initial;max-width:100%}.formula{margin:auto 6px}.formula.error code{color:#fd7373}.katex-display{display:inline-block!important;margin:0!important;text-align:inherit!important}.error .katex-display{display:none}.cli{border-radius:4px}.cli .prefix{color:#9c6248}.helpfeel{background-color:#fbebdd;border-radius:4px;padding:3px!important}.helpfeel .prefix{color:#f17c00}.helpfeel .entry{color:#cc5020}.code-block{display:block;line-height:1.7em;background-color:var(--code-bg, rgba(0,0,0,.04))}.code-block-start{font-family:Menlo,Monaco,Consolas,Courier New,monospace;color:#342d9c;background-color:#ffcfc6;font-size:.9em;padding:1px 2px}.code-block-start a{color:#342d9c;text-decoration:underline}code.code-block,.table-block.table-block-row{padding-left:1em}.copy{font-family:"Font Awesome 5 Free";cursor:pointer}.table-block{white-space:nowrap}.table-block-start{padding:1px 2px;font-size:.9em;background-color:#ffcfc6}.table-block-start a{color:#342d9c;text-decoration:underline}.cell{margin:0;padding:0 2px 0 8px;box-sizing:content-box;display:inline-block;white-space:pre}.cell:nth-child(2n+1){background-color:#0000000a}.cell:nth-child(2n){background-color:#0000000f}.strong-image{max-height:100%}.icon{height:11px;vertical-align:middle}.strong-icon{height:13.2px}.deco-/{font-style:italic}.deco-*-1{font-weight:700}.deco-*-2{font-weight:700;font-size:1.2em}.deco-*-3{font-weight:700;font-size:1.44em}.deco-*-4{font-weight:700;font-size:1.73em}.deco-*-5{font-weight:700;font-size:2.07em}.deco-*-6{font-weight:700;font-size:2.49em}.deco-*-7{font-weight:700;font-size:3em}.deco-*-8{font-weight:700;font-size:3.58em}.deco-*-9{font-weight:700;font-size:4.3em}.deco-*-10{font-weight:700;font-size:5.16em}.deco--{text-decoration:line-through}.deco-_{text-decoration:underline}.page-link{color:var(--page-link-color, #5e8af7)}.page-link:hover{color:var(--page-link-hover-color, #2d67f5)}.empty-page-link{color:var(--empty-page-link-color, #fd7373)}.empty-page-link:hover{color:var(--empty-page-link-hover-color, #fd7373)}.link{color:var(--page-link-color, #5e8af7);text-decoration:underline}.link:hover{color:var(--page-link-color-hover-color, #2d67f5)}.link img{padding-bottom:3px;border-style:none none solid;border-width:1.5px;border-color:#8fadf9}.permalink{background-color:var(--line-permalink-color, rgba(234,218,74,.75))}.status-bar{display:inline-block;position:absolute;background-color:var(--page-bg, #fefefe);cursor:default}.status-bar>*{border:1px solid var(--status-bar-border-color, #a9aaaf)}.status-bar.top-left{top:0;left:0}.status-bar.top-left>*{border-top:none;border-left:none}.status-bar.top-left :last-of-type{border-bottom-right-radius:3px}.status-bar.top-right{top:0;right:0}.status-bar.top-right>*{border-top:none;border-right:none}.status-bar.top-right :last-of-type{border-bottom-left-radius:3px}.status-bar.bottom-right{bottom:0;right:0}.status-bar.bottom-right>*{border-bottom:none;border-right:none}.status-bar.bottom-right :last-of-type{border-top-left-radius:3px}.status-bar.bottom-left{bottom:0;left:0}.status-bar.bottom-left>*{border-bottom:none;border-left:none}.status-bar.bottom-left :last-of-type{border-top-right-radius:3px}.text-bubble{padding:5px 0 5px 5px;font-size:11px;line-height:1.42857;user-select:text;position:absolute;max-height:80vh;overflow-y:auto;background-color:var(--page-bg, #fefefe);color:var(--page-text-color, #4a4a4a);border-radius:4px;--text-bubble-border-color: hsl(221, 15%, 25%);border:1px solid var(--text-bubble-border-color, #f2f2f3);--status-bar-border-color: var(--text-bubble-border-color, #f2f2f3);box-shadow:0 6px 12px #0000002d;z-index:9000}.text-bubble.no-scroll{overflow-y:hidden}.text-bubbledata-theme=default-dark{--text-bubble-border-color: hsl(0, 0%, 39%)}.text-bubbledata-theme=default-minimal{--text-bubble-border-color: hsl(0, 0%, 89%)}.text-bubbledata-theme=paper-light{--text-bubble-border-color: hsl(53, 8%, 58%)}.text-bubbledata-theme=paper-dark-dark{--text-bubble-border-color: hsl(203, 42%, 17%)}.text-bubbledata-theme=blue{--text-bubble-border-color: hsl(227, 68%, 62%)}.text-bubbledata-theme=purple{--text-bubble-border-color: hsl(267, 39%, 60%)}.text-bubbledata-theme=green{--text-bubble-border-color: hsl(136, 29%, 50%)}.text-bubbledata-theme=orange{--text-bubble-border-color: hsl(43, 71%, 51%)}.text-bubbledata-theme=red{--text-bubble-border-color: hsl(4, 58%, 56%)}.text-bubbledata-theme=spring{--text-bubble-border-color: hsl(72, 64%, 57%)}.text-bubbledata-theme=kyoto{--text-bubble-border-color: hsl(331, 21%, 26%)}.text-bubbledata-theme=newyork{--text-bubble-border-color: hsl(176, 29%, 67%)}.project-badge{text-decoration:none;color:var(--tool-text-color, #363c49)}.related-page-carddata-theme=default-dark{--card-title-bg: hsl(0, 0%, 39%)}.related-page-carddata-theme=default-minimal{--card-title-bg: hsl(0, 0%, 89%)}.related-page-carddata-theme=paper-light{--card-title-bg: hsl(53, 8%, 58%)}.related-page-carddata-theme=paper-dark-dark{--card-title-bg: hsl(203, 42%, 17%)}.related-page-carddata-theme=blue{--card-title-bg: hsl(227, 68%, 62%)}.related-page-carddata-theme=purple{--card-title-bg: hsl(267, 39%, 60%)}.text-bubbledata-theme=green{--card-title-bg: hsl(136, 29%, 50%)}.related-page-carddata-theme=orange{--card-title-bg: hsl(43, 71%, 51%)}.related-page-carddata-theme=red{--card-title-bg: hsl(4, 58%, 56%)}.related-page-carddata-theme=spring{--card-title-bg: hsl(72, 64%, 57%)}.related-page-carddata-theme=kyoto{--card-title-bg: hsl(331, 21%, 26%)}.related-page-carddata-theme=newyork{--card-title-bg: hsl(176, 29%, 67%)}.related-page-card{display:block;position:relative;height:inherit;width:inherit;overflow:hidden;text-overflow:ellipsis;font-family:Roboto,Helvetica,Arial,Hiragino Sans,sans-serif;background-color:var(--card-bg, #fff);color:var(--card-title-color, #555);word-break:break-word;text-decoration:none}.related-page-card:hover{box-shadow:var(--card-box-hover-shadow, 0 2px 0 rgba(0,0,0,.23))}.related-page-card:focus{outline:0;box-shadow:0 0 0 3px #66afe999;border-color:#66afe9;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.related-page-card.hover{opacity:0;position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--card-hover-bg, rgba(0,0,0,.05));mix-blend-mode:multiply;z-index:1;transition:background-color .1s}.related-page-card:hover .hover{opacity:1}.related-page-card:active .hover{opacity:1;background-color:var(--card-active-bg, rgba(0,0,0,.1))}.related-page-card .content{height:calc(100% - 5px);width:inherit;display:flex;flex-direction:column;overflow:hidden}.related-page-card .content .header{width:100%;color:#396bdd;text-overflow:ellipsis;border-top:var(--card-title-bg, #f2f2f3) solid 10px;padding:8px 10px}.related-page-card .content .header .title{font-size:11px;line-height:16px;font-weight:700;max-height:48px;color:var(--card-title-color, #363c49);margin:0;overflow:hidden;display:block;-webkit-line-clamp:3;-webkit-box-orient:vertical;text-overflow:ellipsis}.related-page-card .content .description{line-height:16px;padding:8px 10px 0;font-size:10px;white-space:pre-line;column-count:1;column-gap:2em;column-width:10em;height:inherit;color:var(--card-description-color, gray);flex-shrink:16;overflow:hidden}.related-page-card .content .thumbnail{display:block;width:100%;margin:0 auto;padding:0 5px}.related-page-card .content .description p{margin:0;display:block}.related-page-card .content .description code{font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:90%;color:var(--code-color, #342d9c);background-color:var(--code-bg, rgba(0,0,0,.04));padding:0;white-space:pre-wrap;word-wrap:break-word}.related-page-card .content .description .icon{height:9px;vertical-align:middle}.related-page-card .content .description .page-link{background-color:transparent;text-decoration:none;cursor:pointer;color:var(--page-link-color, #5e8af7)}.card-bubble{background-color:var(--page-bg, #FFF);box-shadow:0 2px 2px #00000024,0 3px 1px -2px #0003,0 1px 5px #0000001f;position:absolute;max-width:80vw;box-sizing:content-box;z-index:9000;font-size:11px;line-height:1.42857}.card-bubble>ul{display:flex;padding:0;margin:0;list-style:none;overflow-x:auto;overflow-y:visible}.card-bubble>ul>li{display:block;position:relative;float:none;margin:5px;box-sizing:border-box;box-shadow:var(--card-box-shadow, 0 2px 0 rgba(0,0,0,.12));border-radius:2px;width:120px;height:120px} ;function So(e){return e!=null}function be(e){try{let t=typeof e=="string"?JSON.parse(e):e;return So(t)?typeof t.name=="string"&&typeof t.message=="string":!1}catch(t){if(t instanceof SyntaxError)return!1;throw t}}var Co=["default-light","default-dark","default-minimal"],$o=["paper-light","paper-dark-dark","paper-dark"],it=["blue","purple","green","orange","red"],Mo=["hacker1","hacker2"],lt=["winter","spring","summer","automn"],ct=["tropical"],pt=["kyoto","newyork","paris"],dt=["mred","lgreen"],zn=["default-light","default-minimal","paper-light",...it,...lt,...ct,...pt,...dt];var jo=[...Co,...$o,...it,...Mo,...lt,...ct,...pt,...dt];function he(e){return jo.includes(e)}var ut,Io="0.2.1",Ho=ScrapBubble-${Io};async function mt(e,t,r){let o=https://scrapbox.io/api/pages/${e}/${$(P(t))}?followRename=${r?.followRename??!0},s=await gt(o,r??{});if(!s.ok){let n=await s.text();if(!be(n)){let l=new Error;throw l.name="UnexpectedError",l.message=Unexpected error has occuerd when fetching "${o}",l}return JSON.parse(n)}return await s.json()}async function ft(e,t){let r=https://scrapbox.io/api/projects/${e},o=await gt(r,t??{});if(!o.ok){let s=await o.text();if(!be(s)){let n=new Error;throw n.name="UnexpectedError",n.message=Unexpected error has occuerd when fetching "${r}",n}return JSON.parse(s)}return await o.json()}async function gt(e,t){let{expired:r=60}=t,o=await globalThis.caches.match(e),s=new Date(o?.headers?.get?.("Date")??0).getTime()/1e3;if(!o||s+r<new Date().getTime()/1e3){let n=await globalThis.fetch(e);return ut??=await globalThis.caches.open(Ho),await ut.put(e,n.clone()),n}else return o}function bt({expired:e=60,whiteList:t=[]}){let[r,o]=I(new Map),[s,n]=I([]),[l,m]=I(new Set),u=H(()=>[...new Set([scrapbox.Project.name,...t])],[t]),g=C(async(c,f)=>{if(!u.includes(c))return;let k=new Set;o(x=>{for(let v of u){let y=R(v,f),{lines:N=[],linked:O=[],linksLc:T=[],loading:M=!1}=x.get(y)??{};M&&k.add(y),x.set(y,{project:v,title:f,loading:!0,lines:N,linksLc:T,linked:O})}return new Map(x)});let b=[];for(let x of u){let v=(async()=>{let y=R(x,f);if(k.has(y))return[!0,0];let N=await mt(x,f,{expired:e});if("name"in N)return[!0,0];let{lines:O,persistent:T,links:M,relatedPages:{links1hop:D}}=N,B=M.map(S=>P(S)),Q=D.flatMap(({title:S,descriptions:vt,image:kt})=>B.includes(P(S))?[]:[{title:S,descriptions:vt,image:kt}]);return o(S=>(S.set(y,{project:x,title:f,loading:!1,lines:O.slice(1),linked:Q,linksLc:B}),new Map(S))),[!T,Q.length]})();b.push(v)}let _=await Promise.all(b);m(x=>(_.some(([v])=>!v)?x.delete(P(f)):_.reduce((v,[,y])=>v+y,0)>1?x.delete(P(f)):x.add(P(f)),new Set(x)))},[u,e]),i=C((c,f,k,b)=>{!u.includes(f)||l.has(P(k))||n(_=>{let x=[R(f,k),...u.flatMap(v=>v===f?[]:[R(v,k)])];return[..._.slice(0,c),{ids:x,...b}]})},[u,l]),p=C(c=>n(f=>[...f.slice(0,c)]),[]);return{bubbles:H(()=>{let c=[R(scrapbox.Project.name,scrapbox.Page.title??"")];return s.flatMap(({ids:f,...k})=>{let b=f.flatMap(T=>r.has(T)?[r.get(T)]:[]),{project:_,title:x,lines:v,linksLc:y}=b.find(T=>T.lines.length>0)??b[0],N=b.flatMap(({project:T,linked:M})=>M.map(D=>({...D,project:T}))),O={project:_,title:x,lines:R(_,x)===c[0]?[]:v,linked:N.flatMap(({project:T,title:M,...D})=>c.includes(R(T,M))?[]:[{project:T,title:M,...D}]),emptyLinks:y.filter(T=>l.has(P(T))),loading:b.every(({loading:T})=>T),...k};return c.push(R(_,x)),O.lines.length>0||O.linked.length>0?[O]:[]})},[r,s,l]),cache:g,show:i,hide:p}}function _e(e,t,r,o){F(()=>(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o)),[e,t,o])}var Y="default-light";function ht(){let[e,t]=I(new Map);return C(o=>{if(o===scrapbox.Project.name){let s=document.documentElement.dataset.projectTheme??Y;return he(s)?s:Y}return e.has(o)||(t(s=>(s.set(o,Y),s)),(async()=>{try{let s=await ft(o);if(!("theme"in s))return;t(n=>(n.set(o,he(s.theme)?s.theme:Y),n))}catch(s){console.error(s)}})()),e.get(o)??Y},[e])}function _t(){let e=A(),t=C((...o)=>{e.current?.(...o)},[]),r=C(o=>e.current=o,[]);return[t,r]}function xt(){let[e,t]=_t(),[r,o]=_t();return[C(()=>new Promise((n,l)=>{t(n),o(l)}),[]),e,r]}function pe(){let e=document.getElementById("editor");if(!e)throw Error("#editor is not found");return e}var yt="scrap-bubble",Oo=({delay:e,expired:t,whiteList:r,scrollTargets:o})=>{let{bubbles:s,cache:n,show:l,hide:m}=bt({expired:t,whiteList:r}),u=ht(),[g,i]=xt();F(()=>{let d=!1;return(async()=>{for(;!d;){let c=await g();if(!(c.currentTarget instanceof HTMLDivElement))throw TypeError("event.currentTarget must be HTMLDivElement");let f=c.currentTarget,k=parseInt(f.dataset.index??"0"),b=c.target;if(!xe(b)&&!Ro(b))continue;let{project:_=scrapbox.Project.name,title:x,hash:v=""}=xe(b)?X({pathType:"root",href:${new URL(b.href).pathname}${new URL(b.href).hash}`}):{project:scrapbox.Project.name,title:scrapbox.Page.title};if(_==="")return;let y=decodeURIComponent(x??"");n(_,y);try{let S=le(e);b.addEventListener("pointerleave",()=>S.cancel(),{once:!0}),b.addEventListener("click",()=>S.cancel(),{once:!0}),await S}catch(S){if(S==="cancelled")continue;throw S}let N=v!==""&&o.includes("lineId")?{type:"id",value:v}:b.dataset.linkedTo&&Ve(b.dataset.linkedType,"link","hashtag","title")&&o.includes(b.dataset.linkedType)?{type:"link",value:b.dataset.linkedTo}:void 0,{top:O,right:T,left:M,bottom:D}=b.getBoundingClientRect(),B=pe().getBoundingClientRect(),Q=(M-B.left)/B.width>.5;l(k,_,y,{scrollTo:N,position:{top:Math.round(D-B.top),bottom:Math.round(B.bottom-O),...Q?{right:Math.round(B.right-T)}:{left:Math.round(M-B.left)},maxWidth:Q?T-10:document.documentElement.clientWidth-M-10},type:Fo(b)})}})(),()=>d=!0},e,n,l);let p=pe();return _e(p,"pointerenter",i,{capture:!0}),_e(document,"click",d=>{d.target.dataset.userscriptName!==yt&&m(0)},{capture:!0}),F(()=>{let d=()=>m(0);return scrapbox.addListener("page:changed",d),()=>scrapbox.removeListener("page:changed",d)},[]),a(w,null,a("link",{rel:"stylesheet",href:"https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.12.0/katex.min.css"}),a("style",null,at),s.map(({project:d,title:c,lines:f,emptyLinks:k,position:b,scrollTo:_,type:x,linked:v},y)=>a(w,{key:R(d,c)},a(rt,{project:d,title:c,theme:u(d),index:y+1,position:b,scrollTo:_,lines:f,emptyLinks:k,onPointerEnterCapture:i,onClick:()=>m(y+1),hasChildCards:s.length>y+1}),a(st,{position:b,cards:v.map(({project:N,...O})=>({project:N,linkedTo:c,linkedType:x,theme:u(N),...O})),index:y+1,onPointerEnterCapture:i,onClick:()=>m(y+1)}))))};function bs({delay:e=500,expired:t=60,whiteList:r=[],scrollTargets:o="link","hashtag","lineId","title"}={}){let s=document.createElement("div");s.dataset.userscriptName=yt,pe().append(s);let n=s.attachShadow({mode:"open"});se(a(Oo,{delay:e,expired:t,whiteList:r,scrollTargets:o}),n)}function Ro(e){return e instanceof HTMLSpanElement&&e.matches(".line-title .text")}function xe(e){return e instanceof HTMLAnchorElement&&e.classList.contains("page-link")}function Fo(e){return xe(e)?e.type==="link"?"link":"hashtag":"title"}export{bs as mount}; ---
This page is auto-translated from /nishio/ScrapBubble-min. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.