This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.cjs
21 lines (21 loc) · 24.2 KB
/
index.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var le=Object.defineProperty;var Xe=e=>le(e,"__esModule",{value:!0});var y=(e,t)=>{Xe(e);for(var n in t)le(e,n,{get:t[n],enumerable:!0})};y(exports,{components:()=>R,electron:()=>V,env:()=>j,fmt:()=>h,fs:()=>u,notion:()=>X,registry:()=>g,storage:()=>_,web:()=>o});var j={};y(j,{focusMenu:()=>Ye,focusNotion:()=>De,name:()=>Ge,reload:()=>et,version:()=>Qe});"use strict";var de=globalThis.__enhancerElectronApi.platform,pe=globalThis.__enhancerElectronApi.version,ue=globalThis.__enhancerElectronApi.focusMenu,he=globalThis.__enhancerElectronApi.focusNotion,fe=globalThis.__enhancerElectronApi.reload;"use strict";var Ge=de,Qe=pe,Ye=ue,De=he,et=fe;var u={};y(u,{getJSON:()=>rt,getText:()=>st,isFile:()=>ot,localPath:()=>nt,notionPath:()=>tt});"use strict";var M=globalThis.__enhancerElectronApi.notionPath,L=e=>`notion://www.notion.so/__notion-enhancer/${e}`,me=(e,t={})=>{if(e=e.replace(/^https:\/\/www\.notion\.so\//,"notion://www.notion.so/"),e.startsWith("http")||e.startsWith("notion://"))return fetch(e,t).then(r=>r.json());try{return globalThis.__enhancerElectronApi.nodeRequire(`notion-enhancer/${e}`)}catch{return fetch(L(e),t).then(s=>s.json())}},ge=(e,t={})=>{if(e=e.replace(/^https:\/\/www\.notion\.so\//,"notion://www.notion.so/"),e.startsWith("http")||e.startsWith("notion://"))return fetch(e,t).then(r=>r.text());try{return globalThis.__enhancerElectronApi.nodeRequire("fs").readFileSync(M(`notion-enhancer/${e}`))}catch{return fetch(L(e),t).then(s=>s.text())}},ye=async e=>{try{let t=globalThis.__enhancerElectronApi.nodeRequire("fs");if(e.startsWith("http"))await fetch(e);else try{t.existsSync(M(`notion-enhancer/${e}`))}catch{await fetch(L(e))}return!0}catch{return!1}};"use strict";var tt=M,nt=L,rt=me,st=ge,ot=ye;var _={};y(_,{addChangeListener:()=>lt,db:()=>ct,get:()=>it,removeChangeListener:()=>dt,set:()=>at});"use strict";var H=(e,t=void 0)=>globalThis.__enhancerElectronApi.db.get(e,t),I=(e,t)=>globalThis.__enhancerElectronApi.db.set(e,t),we=(e,t=H,n=I)=>(typeof e=="string"&&(e=[e]),{get:(r=[],s=void 0)=>t([...e,...r],s),set:(r,s)=>n([...e,...r],s)}),ve=e=>globalThis.__enhancerElectronApi.db.addChangeListener(e),be=e=>globalThis.__enhancerElectronApi.db.removeChangeListener(e);"use strict";var it=H,at=I,ct=we,lt=ve,dt=be;var V={};y(V,{browser:()=>pt,getFocusedNotionWindow:()=>wt,getNotionWindows:()=>yt,notionRequire:()=>gt,onMessage:()=>mt,sendMessage:()=>ht,sendMessageToHost:()=>ft,webFrame:()=>ut});"use strict";var pt=globalThis.__enhancerElectronApi?.browser,ut=globalThis.__enhancerElectronApi?.webFrame,ht=(e,t,n="notion-enhancer")=>{globalThis.__enhancerElectronApi&&globalThis.__enhancerElectronApi.ipcRenderer.sendMessage(e,t,n)},ft=(e,t,n="notion-enhancer")=>{globalThis.__enhancerElectronApi&&globalThis.__enhancerElectronApi.ipcRenderer.sendMessageToHost(e,t,n)},mt=(e,t,n="notion-enhancer")=>{globalThis.__enhancerElectronApi&&globalThis.__enhancerElectronApi.ipcRenderer.onMessage(e,t,n)},gt=e=>globalThis.__enhancerElectronApi?globalThis.__enhancerElectronApi.notionRequire(e):null,yt=()=>globalThis.__enhancerElectronApi?globalThis.__enhancerElectronApi.getNotionWindows():null,wt=()=>globalThis.__enhancerElectronApi?globalThis.__enhancerElectronApi.getFocusedNotionWindow():null;var X={};y(X,{create:()=>xt,get:()=>xe,getPageID:()=>J,getSpaceID:()=>T,getUserID:()=>_e,search:()=>vt,set:()=>bt,sign:()=>$t,upload:()=>_t});"use strict";var m=e=>(e?.length===32&&!e.includes("-")&&(e=e.replace(/([\d\w]{8})([\d\w]{4})([\d\w]{4})([\d\w]{4})([\d\w]{12})/,"$1-$2-$3-$4-$5")),e),xe=async(e,t="block")=>{e=m(e);let n=await u.getJSON("https://www.notion.so/api/v3/getRecordValues",{headers:{"Content-Type":"application/json"},body:JSON.stringify({requests:[{table:t,id:e}]}),method:"POST"});return n?.results?.[0]?.value||n},_e=()=>JSON.parse(localStorage["LRU:KeyValueStore2:current-user-id"]||{}).value,J=()=>m(o.queryParams().get("p")||location.pathname.split(/(-|\/)/g).reverse()[0]),K,T=async()=>(K||(K=(await xe(J())).space_id),K),vt=async(e="",t=20,n=T())=>(n=m(await n),await u.getJSON("https://www.notion.so/api/v3/search",{headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"BlocksInSpace",query:e,spaceId:n,limit:t,filters:{isDeletedOnly:!1,excludeTemplates:!1,isNavigableOnly:!1,requireEditPermissions:!1,ancestors:[],createdBy:[],editedBy:[],lastEditedTime:{},createdTime:{}},sort:"Relevance",source:"quick_find"}),method:"POST"})),bt=async({recordID:e,recordTable:t="block",spaceID:n=T(),path:r=[]},s={})=>{n=m(await n),e=m(e);let c=await u.getJSON("https://www.notion.so/api/v3/saveTransactions",{headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:h.uuidv4(),transactions:[{id:h.uuidv4(),spaceId:n,operations:[{pointer:{table:t,id:e,spaceId:n},path:r,command:r.length?"set":"update",args:s}]}]}),method:"POST"});return c.errorId?c:!0},xt=async({recordValue:e={},recordTable:t="block"}={},{prepend:n=!1,siblingID:r=void 0,parentID:s=J(),parentTable:c="block",spaceID:a=T(),userID:i=_e()}={})=>{a=m(await a),s=m(s),r=m(r);let d=m(e?.id??h.uuidv4()),x=[],A={type:"text",id:d,version:0,created_time:new Date().getTime(),last_edited_time:new Date().getTime(),parent_id:s,parent_table:c,alive:!0,created_by_table:"notion_user",created_by_id:i,last_edited_by_table:"notion_user",last_edited_by_id:i,space_id:a,permissions:[{type:"user_permission",role:"editor",user_id:i}]};c==="space"?(s=a,A.parent_id=a,x.push("pages"),A.type="page"):c==="collection_view"?(x.push("page_sort"),A.type="page"):x.push("content");let ce=await u.getJSON("https://www.notion.so/api/v3/saveTransactions",{headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:h.uuidv4(),transactions:[{id:h.uuidv4(),spaceId:a,operations:[{pointer:{table:c,id:s,spaceId:a},path:x,command:n?"listBefore":"listAfter",args:{...r?{after:r}:{},id:d}},{pointer:{table:t,id:d,spaceId:a},path:[],command:"set",args:{...A,...e}}]}]}),method:"POST"});return ce.errorId?ce:d},_t=async(e,{pageID:t=J(),spaceID:n=T()}={})=>{n=m(await n),t=m(t);let r=await u.getJSON("https://www.notion.so/api/v3/getUploadFileUrl",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({bucket:"secure",name:e.name,contentType:e.type,record:{table:"block",id:t,spaceId:n}})});return r.errorId?r:(fetch(r.signedPutUrl,{method:"PUT",headers:{"content-type":e.type},body:e}),r.url)},$t=(e,t,n="block")=>(e.startsWith("/")&&(e=`https://notion.so${e}`),e.includes("secure.notion-static.com")&&(e=new URL(e),e=`https://www.notion.so/signed/${encodeURIComponent(e.origin+e.pathname)}?table=${n}&id=${t}`),e);var h={};y(h,{is:()=>kt,rgbContrast:()=>Lt,rgbLogShade:()=>jt,slugger:()=>At,uuidv4:()=>Et});"use strict";var At=(e,t=new Set)=>{e=e.replace(/\s/g,"-").replace(/[^A-Za-z0-9-_]/g,"").toLowerCase();let n=0,r=e;for(;t.has(r);)n++,r=`${e}-${n}`;return r},Et=()=>crypto?.randomUUID?crypto.randomUUID():([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),jt=(e,t)=>{var n=parseInt,r=Math.round,[s,c,t,a]=t.split(","),i=e<0,d=i?0:e*255**2,i=i?1+e:1-e;return"rgb"+(a?"a(":"(")+r((i*n(s[3]=="a"?s.slice(5):s.slice(4))**2+d)**.5)+","+r((i*n(c)**2+d)**.5)+","+r((i*n(t)**2+d)**.5)+(a?","+a:")")},Lt=(e,t,n)=>Math.sqrt(.299*(e*e)+.587*(t*t)+.114*(n*n))>165.75?"rgb(0,0,0)":"rgb(255,255,255)",Tt={alphanumeric:/^[\w\.-]+$/,uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,semver:/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/i,email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i,url:/^[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,64}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/i,color:/^(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{6})\b|(?:rgb|hsl)a?\([^\)]*\)$/i};function St(e,t){let n=e.match(t);return!!(n&&n.length)}var kt=async(e,t,{extension:n=""}={})=>{if(n=!e||!e.endsWith||e.endsWith(n),Array.isArray(t))return t.includes(e);switch(t){case"array":return Array.isArray(e);case"object":return e&&typeof e=="object"&&!Array.isArray(e);case"undefined":case"boolean":case"number":return typeof e===t&&n;case"string":return typeof e===t&&n;case"alphanumeric":case"uuid":case"semver":case"email":case"url":case"color":return typeof e=="string"&&St(e,Tt[t])&&n;case"file":return typeof e=="string"&&e&&await u.isFile(e)&&n}return!1};var g={};y(g,{core:()=>Ae,db:()=>Ut,enabled:()=>zt,errors:()=>Wt,get:()=>ee,list:()=>D,optionDefault:()=>je,optionTypes:()=>Jt,profileDB:()=>G,profileName:()=>Ee,supportedEnvs:()=>Mt});"use strict";var l=async(e,t,n,r,{extension:s="",error:c=`invalid ${t} (${s?`${s} `:""}${r}): ${JSON.stringify(n)}`,optional:a=!1}={})=>{let i;for(let d of Array.isArray(r)?[r]:r.split("|"))if(d==="file"?i=n&&!n.startsWith("http")?await h.is(`repo/${e._dir}/${n}`,d,{extension:s}):!1:i=await h.is(n,d,{extension:s}),i)break;return i||a&&await h.is(n,"undefined")?!0:(c&&e._err(c),!1)},Pt=async e=>(e.environments=e.environments??g.supportedEnvs,await l(e,"environments",e.environments,"array")?e.environments.map(n=>l(e,"environments.env",n,g.supportedEnvs)):!1),Ct=async e=>{if(!await l(e,"tags",e.tags,"array"))return!1;let n=["core","extension","theme","integration"];if(!e.tags.filter(i=>n.includes(i)).length)return e._err(`invalid tags (must contain at least one of 'core', 'extension', 'theme' or 'integration'):
${JSON.stringify(e.tags)}`),!1;let s=e.tags.includes("theme"),c=e.tags.includes("light")||e.tags.includes("dark"),a=e.tags.includes("light")&&e.tags.includes("dark");return s&&(!c||a)?(e._err(`invalid tags (themes must be either 'light' or 'dark', not neither or both):
${JSON.stringify(e.tags)}`),!1):e.tags.map(i=>l(e,"tags.tag",i,"string"))},Ot=async e=>await l(e,"authors",e.authors,"array")?e.authors.map(n=>[l(e,"authors.author.name",n.name,"string"),l(e,"authors.author.email",n.email,"email",{optional:!0}),l(e,"authors.author.homepage",n.homepage,"url"),l(e,"authors.author.avatar",n.avatar,"url")]):!1,Nt=async e=>{if(!await l(e,"css",e.css,"object"))return!1;let n=[];for(let r of["frame","client","menu"]){if(!e.css[r])continue;let s=await l(e,`css.${r}`,e.css[r],"array");s&&(s=e.css[r].map(c=>l(e,`css.${r}.file`,c,"file",{extension:".css"}))),n.push(s)}return n},Rt=async e=>{if(!await l(e,"js",e.js,"object"))return!1;let n=[];for(let r of["frame","client","menu"]){if(!e.js[r])continue;let s=await l(e,`js.${r}`,e.js[r],"array");s&&(s=e.js[r].map(c=>l(e,`js.${r}.file`,c,"file",{extension:".mjs"}))),n.push(s)}if(e.js.electron)if(await l(e,"js.electron",e.js.electron,"array"))for(let s of e.js.electron){if(!await l(e,"js.electron.file",s,"object")){n.push(!1);continue}n.push([l(e,"js.electron.file.source",s.source,"file",{extension:".cjs"}),l(e,"js.electron.file.target",s.target,"string",{extension:".js"})])}else n.push(!1);return n},qt=async e=>{if(!await l(e,"options",e.options,"array"))return!1;let n=[];for(let r of e.options){let s="options.option";if(!await l(e,`${s}.type`,r.type,g.optionTypes)){n.push(!1);continue}switch(r.environments=r.environments??g.supportedEnvs,n.push([l(e,`${s}.key`,r.key,"alphanumeric"),l(e,`${s}.label`,r.label,"string"),l(e,`${s}.tooltip`,r.tooltip,"string",{optional:!0}),l(e,`${s}.environments`,r.environments,"array").then(a=>a?r.environments.map(i=>l(e,`${s}.environments.env`,i,g.supportedEnvs)):!1)]),r.type){case"toggle":n.push(l(e,`${s}.value`,r.value,"boolean"));break;case"select":{let a=await l(e,`${s}.values`,r.values,"array");a&&(a=r.values.map(i=>l(e,`${s}.values.value`,i,"string"))),n.push(a);break}case"text":case"hotkey":n.push(l(e,`${s}.value`,r.value,"string"));break;case"number":case"color":n.push(l(e,`${s}.value`,r.value,r.type));break;case"file":{let a=await l(e,`${s}.extensions`,r.extensions,"array");a&&(a=r.extensions.map(i=>l(e,`${s}.extensions.extension`,i,"string"))),n.push(a);break}}}return n};async function $e(e){let t=[l(e,"name",e.name,"string"),l(e,"id",e.id,"uuid"),l(e,"version",e.version,"semver"),Pt(e),l(e,"description",e.description,"string"),l(e,"preview",e.preview,"file|url",{optional:!0}),Ct(e),Ot(e),Nt(e),Rt(e),qt(e)];do t=await Promise.all(t.flat(1/0));while(t.some(n=>Array.isArray(n)));return t.every(n=>n)}"use strict";var Ae=["a6621988-551d-495a-97d8-3c568bca2e9e","0f0bf8b6-eae6-4273-b307-8fc43f2ee082","36a2ffc9-27ff-480e-84a7-c7700a7d232d"],Mt=["linux","win32","darwin","extension"],Jt=["toggle","select","text","number","color","file","hotkey"],Ee=async()=>_.get(["currentprofile"],"default"),G=async()=>_.db(["profiles",await Ee()]),Q,Y=[],D=async(e=t=>!0)=>{Q||(Q=new Promise(async(n,r)=>{let s=[];for(let c of await u.getJSON("repo/registry.json"))try{let a={...await u.getJSON(`repo/${c}/mod.json`),_dir:c,_err:i=>Y.push({source:c,message:i})};await $e(a)&&s.push(a)}catch{Y.push({source:c,message:"invalid mod.json"})}n(s)}));let t=[];for(let n of await Q)await e(n)&&t.push(n);return t},Wt=async()=>(await D(),Y),ee=async e=>(await D(t=>t.id===e))[0],zt=async e=>(await ee(e)).environments.includes(j.name)?Ae.includes(e)?!0:(await G()).get(["_mods",e],!1):!1,je=async(e,t)=>{let n=await ee(e),r=n.options.find(s=>s.key===t);if(!!r)switch(r.type){case"toggle":case"text":case"number":case"color":case"hotkey":return r.value;case"select":return r.values[0];case"file":return}},Ut=async e=>{let t=await G();return _.db([e],async(n,r=void 0)=>(typeof n=="string"&&(n=[n]),n.length===2&&(r=await je(e,n[1])??r),t.get(n,r)),t.set)};var o={};y(o,{addDocumentObserver:()=>Gt,addHotkeyListener:()=>Kt,copyToClipboard:()=>It,empty:()=>Ft,escape:()=>Te,html:()=>ke,loadStylesheet:()=>Ht,queryParams:()=>Bt,raw:()=>Se,readFromClipboard:()=>Vt,removeDocumentObserver:()=>Qt,removeHotkeyListener:()=>Xt,render:()=>Pe,whenReady:()=>Zt});"use strict";var Le=!1,S=[],te,W=[],ne=[],Zt=(e=[])=>new Promise((t,n)=>{let r=()=>{let s=setInterval(c,100);function c(){!e.every(i=>document.querySelector(i))||(clearInterval(s),t(!0))}c()};document.readyState!=="complete"?document.addEventListener("readystatechange",s=>{document.readyState==="complete"&&r()}):r()}),Bt=()=>new URLSearchParams(window.location.search),Te=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\\/g,"\"),Se=(e,...t)=>{let n=e.map(r=>r+(["string","number"].includes(typeof t[0])?t.shift():Te(JSON.stringify(t.shift(),null,2)??""))).join("");return n.includes("<pre")?n.trim():n.split(/\n/).map(r=>r.trim()).filter(r=>r.length).join(" ")},ke=(e,...t)=>{let n=document.createRange().createContextualFragment(Se(e,...t));return n.children.length===1?n.children[0]:n.children},Pe=(e,...t)=>(t=t.map(n=>n instanceof HTMLCollection?[...n]:n).flat(1/0).filter(n=>n),e.append(...t),e),Ft=e=>{for(;e.firstChild&&e.removeChild(e.firstChild););return e},Ht=e=>{let t=ke`<link
rel="stylesheet"
href="${e.startsWith("https://")?e:u.localPath(e)}"
/>`;return Pe(document.head,t),t},It=async e=>{try{await navigator.clipboard.writeText(e)}catch{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},Vt=()=>navigator.clipboard.readText(),Ce=(e,t)=>{if(document.activeElement.nodeName==="INPUT"&&!t.listenInInput)return;let r={metaKey:["meta","os","win","cmd","command"],ctrlKey:["ctrl","control"],shiftKey:["shift"],altKey:["alt"]};if(!!t.keys.every(c=>{c=c.toLowerCase();for(let a in r)if(r[a].includes(c)&&e[a])return r[a]=[],!0;if(c==="space"&&(c=" "),c==="plus"&&(c="+"),c===e.key.toLowerCase())return!0})){for(let c in r){let a=e[c],i=r[c].length>0;if(a&&i)return}t.callback(e)}},Kt=(e,t,{listenInInput:n=!1,keydown:r=!1}={})=>{typeof e=="string"&&(e=e.split("+")),S.push({keys:e,callback:t,listenInInput:n,keydown:r}),Le||(Le=!0,document.addEventListener("keyup",s=>{for(let c of S.filter(({keydown:a})=>!a))Ce(s,c)}),document.addEventListener("keydown",s=>{for(let c of S.filter(({keydown:a})=>a))Ce(s,c)}))},Xt=e=>{S=S.filter(t=>t.callback!==e)},Gt=(e,t=[])=>{if(!te){let n=r=>{for(;r.length;){let s=r.shift(),c=(i,d)=>i instanceof Element&&(i.matches(d)||i.matches(`${d} *`)||i.querySelector(d)),a=i=>s.target.matches(i)||s.target.matches(`${i} *`)||[...s.addedNodes].some(d=>c(d,i));for(let i of W)(!i.selectors.length||i.selectors.some(a))&&i.callback(s)}};te=new MutationObserver((r,s)=>{ne.length||requestIdleCallback(()=>n(ne)),ne.push(...r)}),te.observe(document.body,{childList:!0,subtree:!0,attributes:!0})}W.push({callback:e,selectors:t})},Qt=e=>{W=W.filter(t=>t.callback!==e)};var R={};y(R,{addCornerAction:()=>Ke,addPanelView:()=>Ie,addTooltip:()=>Ne,feather:()=>Re});"use strict";var Oe,p,Yt=e=>[...e.getClientRects()].reduce((t,n)=>t.some(r=>r.y===n.y)?t:[...t,n],[]).length,Dt=async(e,t,n)=>{p.style.top="0px",p.style.left="0px";let r=e.getBoundingClientRect(),{offsetWidth:s,offsetHeight:c}=p,a=6,i=r.x,d=Math.floor(r.y);if(["top","bottom"].includes(t)){t==="top"&&(d-=c+a),t==="bottom"&&(d+=r.height+a),i-=s/2-r.width/2,p.style.left=`${i}px`,p.style.top=`${d}px`;let x=()=>Yt(p.firstElementChild)>n,A=x();for(;x();)p.style.left=`${window.innerWidth-i>i?i++:i--}px`;A&&(i+=window.innerWidth-i>i?a:-a,p.style.left=`${i}px`),p.style.textAlign="center"}return["left","right"].includes(t)&&(d-=c/2-r.height/2,t==="left"&&(i-=s+a),t==="right"&&(i+=r.width+a),p.style.left=`${i}px`,p.style.top=`${d}px`,p.style.textAlign="start"),!0},Ne=async(e,t,{delay:n=100,offsetDirection:r="bottom",maxLines:s=1}={})=>{Oe||(Oe=o.loadStylesheet("api/components/tooltip.css"),p=o.html`<div id="enhancer--tooltip"></div>`,o.render(document.body,p)),globalThis.markdownit||await import(u.localPath("dep/markdown-it.min.js"));let c=markdownit({linkify:!0});t instanceof Element||(t=o.html`<div style="display:inline">
${t.split(`
`).map(i=>c.renderInline(i)).join("<br>")}
</div>`);let a;e.addEventListener("mouseover",async i=>{a||(a=setTimeout(async()=>{e.matches(":hover")&&p.style.display!=="block"&&(p.style.display="block",o.render(o.empty(p),t),Dt(e,r,s),await p.animate([{opacity:0},{opacity:1}],{duration:65}).finished),a=void 0},n))}),e.addEventListener("mouseout",async i=>{a=void 0,p.style.display==="block"&&!e.matches(":hover")&&(await p.animate([{opacity:1},{opacity:0}],{duration:65}).finished,p.style.display="")})};"use strict";var re,Re=async(e,t={})=>(re||(re=o.html`${await u.getText("dep/feather-sprite.svg")}`),t.style=((t.style?t.style+";":"")+"stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;fill:none;").trim(),t.viewBox="0 0 24 24",`<svg ${Object.entries(t).map(([n,r])=>`${o.escape(n)}="${o.escape(r)}"`).join(" ")}>${re.getElementById(e)?.innerHTML}</svg>`);"use strict";var k=[],en=o.raw`<svg viewBox="-1 -1 9 11">
<path d="M 3.5 0L 3.98809 -0.569442L 3.5 -0.987808L 3.01191 -0.569442L 3.5 0ZM 3.5 9L 3.01191
9.56944L 3.5 9.98781L 3.98809 9.56944L 3.5 9ZM 0.488094 3.56944L 3.98809 0.569442L 3.01191
-0.569442L -0.488094 2.43056L 0.488094 3.56944ZM 3.01191 0.569442L 6.51191 3.56944L 7.48809
2.43056L 3.98809 -0.569442L 3.01191 0.569442ZM -0.488094 6.56944L 3.01191 9.56944L 3.98809
8.43056L 0.488094 5.43056L -0.488094 6.56944ZM 3.98809 9.56944L 7.48809 6.56944L 6.51191
5.43056L 3.01191 8.43056L 3.98809 9.56944Z"></path>
</svg>`,qe,v,z,w,$,P,E,Me,Je,se,f,We,U,C,Z,oe,b,ie,O,B="data-enhancer-panel-pinned",F=()=>$.hasAttribute(B),N=()=>{let e=[z,w,P,$].filter(t=>t);if(F()){ae();for(let t of e)t.removeAttribute(B)}else for(let t of e)t.setAttribute(B,"true");v.set(["panel.pinned"],F())},ze=async()=>{document.documentElement.style.setProperty("--component--panel-width",f+"px"),v.set(["panel.width"],f)},Ue=e=>{e.preventDefault(),se=!0,f=Je+(Me-e.clientX),f<190&&(f=190),f>480&&(f=480),$.style.width=f+"px",P.style.width=f+"px",z.style.paddingRight=f+"px",w&&(w.style.right=f+"px")},Ze=e=>{$.style.width="",P.style.width="",z.style.paddingRight="",w&&(w.style.right=""),ze(),E.style.cursor="",document.body.removeEventListener("mousemove",Ue),document.body.removeEventListener("mouseup",Ze)},tn=e=>{Me=e.clientX,Je=f,E.style.cursor="auto",document.body.addEventListener("mousemove",Ue),document.body.addEventListener("mouseup",Ze)},nn=()=>document.body.contains(b),Be=()=>{if(!F())return N();o.render(We,O),o.empty(b);for(let t of k){let n=C.contains(t.$title),r=o.render(o.html`<div class="enhancer--panel-switcher-item" tabindex="0" ${n?"data-open":""}></div>`,o.render(o.html`<span class="enhancer--panel-view-title"></span>`,t.$icon.cloneNode(!0),t.$title.cloneNode(!0)));r.addEventListener("click",()=>{He(t),v.set(["panel.open"],t.id)}),o.render(b,r)}let e=Z.getBoundingClientRect();o.render(o.empty(O),o.render(o.html`<div style="position: fixed; top: ${e.top}px; left: ${e.left}px;
width: ${e.width}px; height: ${e.height}px;"></div>`,o.render(o.html`<div style="position: relative; top: 100%; pointer-events: auto;"></div>`,b))),b.querySelector("[data-open]").focus(),b.animate([{opacity:0},{opacity:1}],{duration:200}),document.addEventListener("keydown",Fe)},ae=()=>{document.removeEventListener("keydown",Fe),b.animate([{opacity:1},{opacity:0}],{duration:200}).onfinish=()=>O.remove()},Fe=e=>{if(nn())switch(e.key){case"Escape":ae(),e.stopPropagation();break;case"Enter":document.activeElement.click(),e.stopPropagation();break;case"ArrowUp":(e.target.previousElementSibling||e.target.parentElement.lastElementChild).focus(),e.stopPropagation();break;case"ArrowDown":(e.target.nextElementSibling||e.target.parentElement.firstElementChild).focus(),e.stopPropagation();break}},He=e=>{let t=k.find(({$content:n})=>document.contains(n));o.render(o.empty(C),o.render(o.html`<span class="enhancer--panel-view-title"></span>`,e.$icon,e.$title)),e.onFocus(),o.render(o.empty(oe),e.$content),t&&t.onBlur()};async function rn(){await o.whenReady([".notion-frame"]),z=document.querySelector(".notion-frame"),$=o.html`<div id="enhancer--panel"></div>`,P=o.html`<div id="enhancer--panel-hover-trigger"></div>`,E=o.html`<div id="enhancer--panel-resize"><div></div></div>`,C=o.html`<div id="enhancer--panel-header-title"></div>`,Z=o.render(o.html`<div id="enhancer--panel-header"></div>`,C),oe=o.html`<div id="enhancer--panel-content"></div>`,b=o.html`<div id="enhancer--panel-switcher"></div>`,ie=o.html`<div id="enhancer--panel-header-switcher" tabindex="0">
${en}
</div>`,O=o.html`<div id="enhancer--panel-switcher-overlay-container"></div>`;let e='.notion-cursor-listener > div[style*="flex-end"]',t=()=>{document.contains(w)||(w=document.querySelector(e),F()&&w&&w.setAttribute(B,"true"))};w=document.querySelector(e),o.addDocumentObserver(t,[e]),await v.get(["panel.pinned"])&&N(),o.addHotkeyListener(await v.get(["panel.hotkey"]),N),U.addEventListener("click",r=>{r.stopPropagation(),N()}),o.render($,o.render(Z,C,ie,U),oe,E),await sn(),await on();let n='.notion-cursor-listener > .notion-sidebar-container ~ [style^="position: absolute"]';await o.whenReady([n]),document.querySelector(n).before(P,$)}async function sn(){f=await v.get(["panel.width"],240),ze(),E.addEventListener("mousedown",tn),E.addEventListener("click",()=>{se?se=!1:N()})}async function on(){We=document.querySelector(".notion-app-inner"),Z.addEventListener("click",Be),ie.addEventListener("click",Be),O.addEventListener("click",ae)}var Ie=async({id:e,icon:t,title:n,$content:r,onFocus:s=()=>{},onBlur:c=()=>{}})=>{qe||(qe=o.loadStylesheet("api/components/panel.css")),v||(v=await g.db("36a2ffc9-27ff-480e-84a7-c7700a7d232d")),U||(U=o.html`<div id="enhancer--panel-header-toggle" tabindex="0"><div>
${await R.feather("chevrons-right")}
</div></div>`);let a={id:e,$icon:o.render(o.html`<span class="enhancer--panel-view-title-icon"></span>`,t instanceof Element?t:o.html`${t}`),$title:o.render(o.html`<span class="enhancer--panel-view-title-text"></span>`,n),$content:r,onFocus:s,onBlur:c};k.push(a),k.length===1&&await rn(),(k.length===1||await v.get(["panel.open"])===e)&&He(a)};"use strict";var Ve,q,Ke=async(e,t)=>{Ve||(Ve=o.loadStylesheet("api/components/corner-action.css"),q=o.html`<div id="enhancer--corner-actions"></div>`),await o.whenReady([".notion-help-button"]);let n=document.querySelector(".notion-help-button"),r=document.querySelector(".onboarding-checklist-button");r&&q.prepend(r),q.prepend(n),o.render(document.querySelector(".notion-app-inner > .notion-cursor-listener"),q);let s=o.html`<div class="enhancer--corner-action-button">${e}</div>`;return s.addEventListener("click",t),o.render(q,s),s};"use strict";"use strict";