diff --git a/src/popup/js/handlers.js b/src/popup/js/handlers.js index d0d07a7e..a5069db2 100644 --- a/src/popup/js/handlers.js +++ b/src/popup/js/handlers.js @@ -484,7 +484,6 @@ const hideTitleTooltip = (id, isPopup) => { }; const getHandleTitleTooltip = (func, delay, isPopup) => { - console.log("delay: ", delay); return (e) => { const id = isPopup ? global.state.currentId : eventId(e); let timerId = global.state.timerIdMap.get(e.target) ?? 0; diff --git a/src/popup/min/popup.min.js b/src/popup/min/popup.min.js index be307213..ca51fc7d 100644 --- a/src/popup/min/popup.min.js +++ b/src/popup/min/popup.min.js @@ -1,4 +1,4 @@ -const handleBackToFocus=e=>{const t=eventId(e);setTimeout(()=>{dispatch("memory-container--"+t,"focus")},250)},handleDeleteItem=e=>{e=eventId(e);showConfirmDeleteModal(e)},handleOpenItemLink=e=>{e=eventId(e);focusExistingOrCreateNewPaperTab(global.state.papers[e],!0)},handleOpenItemScirate=e=>{var e=eventId(e),t="https://scirate.com/arxiv/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemVanity=e=>{var e=eventId(e),t="https://www.arxiv-vanity.com/papers/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemAr5iv=e=>{var e=eventId(e),t="https://ar5iv.labs.arxiv.org/html/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemHuggingface=e=>{var e=eventId(e),t="https://huggingface.co/papers/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemCodeLink=async e=>{e=eventId(e),e=global.state.papers[e].codeLink;await focusExistingOrCreateNewCodeTab(e)},handleOpenItemWebsiteURL=async e=>{var e=eventId(e),t=global.state.papers[e].pdfLink;global.state.papers[e]=updatePaperVisits(global.state.papers[e]),await setStorage("papers",global.state.papers),await focusExistingOrCreateNewCodeTab(t)},handleCopyMarkdownLink=async e=>{var e=eventId(e),t=global.state.prefs,a=t.checkPreferPdf?"PDF":"Abstract",o=global.state.papers[e],o=makeMdLink(o,t);await copyAndConfirmMemoryItem(e,o,`Markdown ${a} link copied!`)},handleCopyBibtex=async e=>{var e=eventId(e),t=global.state.papers[e].bibtex;let a=bibtexToObject(t);a.hasOwnProperty("url")||(a.url=paperToAbs(global.state.papers[e])),a.hasOwnProperty("pdf")||"website"===global.state.papers[e].source||(a.pdf=paperToPDF(global.state.papers[e])),await copyAndConfirmMemoryItem(e,bibtexToString(a),"Bibtex copied!")},handleCopyPDFLink=async e=>{var e=eventId(e),t=global.state.prefs,a=global.state.papers[e],a=(t.checkPreferPdf?paperToPDF:paperToAbs)(a),t=t.checkPreferPdf?"PDF":"Abstract";await copyAndConfirmMemoryItem(e,a,t+" link copied!")},handleCopyHyperLink=async e=>{var e=eventId(e),t=global.state.prefs,a=global.state.papers[e],t=(t.checkPreferPdf?paperToPDF:paperToAbs)(a);await copyAndConfirmMemoryItem(e,t,"Hyperlink copied!",!1,a.title)},handleAddItemToFavorites=e=>{var e=eventId(e),t=hasClass("memory-container--"+e,"favorite");saveFavoriteItem(e,!t)},handleMemoryOpenLocal=e=>{var e=eventId(e),t=global.state.files[e],a=global.state.papers[e];global.state.papers[e]=updatePaperVisits(a),setStorage("papers",global.state.papers),t&&(t.id||0===t.id)&&chrome.downloads.open(t.id),window?.close&&window.close()},handleTextareaFocus=()=>{textareaFocusEnd(this)},handleMemorySaveEdits=e=>{var{note:t,codeLink:a}=getPaperEdits(e);saveNote(e,t),saveCodeLink(e,a),updatePaperTags(e,"memory-item-tags")},handleCancelPaperEdit=e=>{e.preventDefault();var e=eventId(e),t=global.state.papers[e];val(findEl(e,"form-note-textarea"),t.note),setHTML(findEl(e,"memory-item-tags"),getTagsOptions(t)),dispatch(findEl(e,"memory-item-edit"),"click")},handleTogglePaperEdit=e=>{e.preventDefault();e=eventId(e);const t=findEl("memory-container--"+e);var a=findEl(e,"code-and-note"),o=findEl(e,"extended-item"),s=findEl(e,"tag-list"),r=findEl(e,"memory-authors"),i=findEl(e,"edit-tags"),l=findEl(e,"memory-item-actions");const n=$(findEl(e,"memory-item-tags"));hasClass(t,"expand-open")?(removeClass(t,"expand-open"),slideDown(a,150),slideDown(s,150),slideDown(l,150),slideDown(r,150),slideUp(o,150),slideUp(i,150),setTimeout(()=>{n.select2("destroy")},500)):(addClass(t,"expand-open"),n.select2({...global.select2Options,width:"86%"}),hasClass(t,"has-monitoring")||n.on("change",monitorPaperEdits(e,!1)),t.classList.add("has-monitoring"),slideUp(a,150),slideUp(s,150),slideUp(l,150),slideUp(r,150),slideDown(o,150),slideDown(i,150))},handleMemorySelectChange=e=>{e=e.target.value;global.state.sortKey=e,sortMemory(),displayMemoryTable(),setMemorySortArrow("down")},handleMemorySortArrow=e=>{"memory-sort-arrow-down"===document.querySelector("#memory-sort-arrow svg").id?setMemorySortArrow("up"):setMemorySortArrow("down"),reverseMemory(),displayMemoryTable()},handleFilterFavorites=()=>{var e=!global.state.showFavorites;(global.state.showFavorites=e)?(addClass(findEl("filter-favorites").querySelector("svg"),"favorite"),sortMemory(),global.state.papersList=global.state.papersList.filter(e=>e.favorite),displayMemoryTable(),setMemorySortArrow("down"),findEl("memory-select").innerHTML+='',e=global.state.papersList.length,setPlaceholder("memory-search",`Search ${e} entries...`)):(removeClass(findEl("filter-favorites").querySelector("svg"),"favorite"),"favoriteDate"===val("memory-select")&&(val("memory-select","lastOpenDate"),global.state.sortKey="lastOpenDate"),document.querySelector('#memory-select option[value="favoriteDate"]').remove(),sortMemory(),setMemorySortArrow("down"),val("memory-search").trim()?dispatch("memory-search","keypress"):(global.state.papersList=global.state.sortedPapers,displayMemoryTable()),e=global.state.sortedPapers.length,setPlaceholder("memory-search",`Search ${e} entries...`))},handleMemorySearchKeyPress=a=>e=>{const t=val("memory-search").trim();if(log(t),t||setTimeout(()=>{style("memory-search-clear-icon","visibility","hidden")},0),!t){if(global.state.papersList.length!==global.state.sortedPapers.length)return global.state.papersList=global.state.sortedPapers,void displayMemoryTable();if(!a&&"Backspace"!==e.key)return}style("memory-search-clear-icon","visibility","visible"),(t.startsWith("t:")?searchMemoryByTags:t.startsWith("c:")?searchMemoryByCode:t.startsWith("y:")?searchMemoryByYear:searchMemory)(t),toggleTagsCollapse(t.startsWith("t:")),displayMemoryTable()},handleMemorySearchKeyUp=e=>{var t;"Backspace"==e.key&&((t=new Event("keypress")).key="Backspace",dispatch("memory-search",t)),"memory-search"===e.target.id&&dispatch("memory-search","keypress")},handleCancelModalClick=()=>{hideId("delete-paper-modal")},handleConfirmDeleteModalClick=async e=>{var t=findEl("delete-paper-modal-hidden-id").innerHTML,a=global.state.papers[t].title,o=global.state.papers[t].pdfLink;await deletePaperInStorage(t,global.state.papers),displayMemoryTable(),hideId("delete-paper-modal"),info(`Successfully deleted "${a}" (${t}) from PaperMemory`),global.state.currentId===t&&await updatePopupPaperNoMemory(o),setPlaceholder("memory-search",`Search ${global.state.papersList.length} entries ...`),addListener("memory-switch","click",handleMemorySwitchClick)},handleTagClick=e=>{e=e.target.textContent;val("memory-search","t: "+e),dispatch("memory-search","keypress")},handleClearSearch=e=>{val("memory-search",""),dispatch("memory-search","clear-search"),style("memory-search-clear-icon","visibility","hidden")},handleMemorySwitchClick=()=>{(global.state.memoryIsOpen?closeMemory:openMemory)()},handlePopupKeydown=t=>{var a,o=t.key;if(!(["Backspace","Enter","Escape","a","e"].indexOf(o)<0))if(global.state.prefsIsOpen)"Escape"===o?(t.preventDefault(),closeMenu()):"Enter"===o&&document.querySelector("#menu-switch:focus")&&closeMenu();else if(global.state.memoryIsOpen){if("Enter"===o){if(document.querySelector("#filter-favorites:focus"))return void dispatch("filter-favorites","click");if(document.querySelector("#memory-sort-arrow:focus")&&"Enter"===o)return void dispatch("memory-sort-arrow","click")}let e;const s=document.querySelector(".memory-container:focus");if("Escape"!==o){if(!s)return;e=s.id.split("--")[1]}"Backspace"===o?dispatch(findEl(e,"memory-delete"),"click"):"Enter"===o?(a="website"===global.state.papers[e].source?findEl(e,"memory-website-url"):global.state.prefs.checkEnterLocalPdf&&findEl(e,"memory-item-openLocal")||findEl(e,"memory-item-link"),dispatch(a,"click")):"Escape"===o?(t.preventDefault(),s&&hasClass(s,"expand-open")?handleTogglePaperEdit(t):closeMemory()):"e"===o&&dispatch(findEl(e,"memory-item-edit"),"click")}else if("a"===o){const e=queryAll(":focus");if(e.some(e=>["INPUT","TEXTAREA"].includes(e.tagName)))return;global.state.papers&&dispatch("memory-switch","click")}else"Enter"===o&&("memory-switch-open"===(a=document.querySelector(":focus")).id?dispatch("memory-switch","click"):"menu-switch"===a.id?(dispatch("menu-switch","click"),dispatch("menu-switch","blur")):hasClass(a,"memory-item-svg-div")&&dispatch(a,"click"))},handlePrefsCheckChange=async e=>{const t=e.target.id,a=findEl(t).checked;if(global.state&&global.state.prefs)global.state.prefs[t]=a,setStorage("prefs",global.state.prefs,function(){log(`Settings saved for ${t} (${a})`)});else{const o=await getStorage("prefs")??{};o[t]=a,setStorage("prefs",o,function(){log(`Settings saved for ${t} (${a})`)})}a&&"checkNoAuto"===t&&chrome.commands.getAll(e=>{e=e.find(e=>"manualParsing"===e.name).shortcut;console.log("shortcut: ",e),e||showPopupModal("manualParsing")})},handlePopupSaveEdits=e=>{var{note:t,codeLink:a,favorite:o}=getPaperEdits(e,!0);updatePaperTags(e,"#popup-item-tags--"+e),saveNote(e,t),saveCodeLink(e,a),saveFavoriteItem(e,o)},handlePopupDeletePaper=e=>()=>{showConfirmDeleteModal(e)},showTitleTooltip=(e,t)=>{t=t?findEl("popup-title-tooltip"):findEl(e,".title-tooltip");style(t,"display","block")},hideTitleTooltip=(e,t)=>{t=t?findEl("popup-title-tooltip"):findEl(e,".title-tooltip");style(t,"display","none")},getHandleTitleTooltip=(o,s,r)=>(console.log("delay: ",s),e=>{const t=r?global.state.currentId:eventId(e);var a=global.state.timerIdMap.get(e.target)??0;clearTimeout(a),a=setTimeout(()=>o(t,r),s),global.state.timerIdMap.set(e.target,a)}),handleExpandAuthors=e=>{var e=eventId(e),t=findEl(e,"memory-authors");setHTML(t,cutAuthors(global.state.papers[e].author,1e5))},getPaperinfoTitle=e=>{let t=`Added ${new Date(e.addDate).toLocaleString().replace(",","")} +const handleBackToFocus=e=>{const t=eventId(e);setTimeout(()=>{dispatch("memory-container--"+t,"focus")},250)},handleDeleteItem=e=>{e=eventId(e);showConfirmDeleteModal(e)},handleOpenItemLink=e=>{e=eventId(e);focusExistingOrCreateNewPaperTab(global.state.papers[e],!0)},handleOpenItemScirate=e=>{var e=eventId(e),t="https://scirate.com/arxiv/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemVanity=e=>{var e=eventId(e),t="https://www.arxiv-vanity.com/papers/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemAr5iv=e=>{var e=eventId(e),t="https://ar5iv.labs.arxiv.org/html/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemHuggingface=e=>{var e=eventId(e),t="https://huggingface.co/papers/"+arxivIdFromPaperID(global.state.papers[e].id);focusExistingOrCreateNewCodeTab(t),global.state.papers[e]=updatePaperVisits(global.state.papers[e]),setStorage("papers",global.state.papers)},handleOpenItemCodeLink=async e=>{e=eventId(e),e=global.state.papers[e].codeLink;await focusExistingOrCreateNewCodeTab(e)},handleOpenItemWebsiteURL=async e=>{var e=eventId(e),t=global.state.papers[e].pdfLink;global.state.papers[e]=updatePaperVisits(global.state.papers[e]),await setStorage("papers",global.state.papers),await focusExistingOrCreateNewCodeTab(t)},handleCopyMarkdownLink=async e=>{var e=eventId(e),t=global.state.prefs,a=t.checkPreferPdf?"PDF":"Abstract",o=global.state.papers[e],o=makeMdLink(o,t);await copyAndConfirmMemoryItem(e,o,`Markdown ${a} link copied!`)},handleCopyBibtex=async e=>{var e=eventId(e),t=global.state.papers[e].bibtex;let a=bibtexToObject(t);a.hasOwnProperty("url")||(a.url=paperToAbs(global.state.papers[e])),a.hasOwnProperty("pdf")||"website"===global.state.papers[e].source||(a.pdf=paperToPDF(global.state.papers[e])),await copyAndConfirmMemoryItem(e,bibtexToString(a),"Bibtex copied!")},handleCopyPDFLink=async e=>{var e=eventId(e),t=global.state.prefs,a=global.state.papers[e],a=(t.checkPreferPdf?paperToPDF:paperToAbs)(a),t=t.checkPreferPdf?"PDF":"Abstract";await copyAndConfirmMemoryItem(e,a,t+" link copied!")},handleCopyHyperLink=async e=>{var e=eventId(e),t=global.state.prefs,a=global.state.papers[e],t=(t.checkPreferPdf?paperToPDF:paperToAbs)(a);await copyAndConfirmMemoryItem(e,t,"Hyperlink copied!",!1,a.title)},handleAddItemToFavorites=e=>{var e=eventId(e),t=hasClass("memory-container--"+e,"favorite");saveFavoriteItem(e,!t)},handleMemoryOpenLocal=e=>{var e=eventId(e),t=global.state.files[e],a=global.state.papers[e];global.state.papers[e]=updatePaperVisits(a),setStorage("papers",global.state.papers),t&&(t.id||0===t.id)&&chrome.downloads.open(t.id),window?.close&&window.close()},handleTextareaFocus=()=>{textareaFocusEnd(this)},handleMemorySaveEdits=e=>{var{note:t,codeLink:a}=getPaperEdits(e);saveNote(e,t),saveCodeLink(e,a),updatePaperTags(e,"memory-item-tags")},handleCancelPaperEdit=e=>{e.preventDefault();var e=eventId(e),t=global.state.papers[e];val(findEl(e,"form-note-textarea"),t.note),setHTML(findEl(e,"memory-item-tags"),getTagsOptions(t)),dispatch(findEl(e,"memory-item-edit"),"click")},handleTogglePaperEdit=e=>{e.preventDefault();e=eventId(e);const t=findEl("memory-container--"+e);var a=findEl(e,"code-and-note"),o=findEl(e,"extended-item"),s=findEl(e,"tag-list"),r=findEl(e,"memory-authors"),i=findEl(e,"edit-tags"),l=findEl(e,"memory-item-actions");const n=$(findEl(e,"memory-item-tags"));hasClass(t,"expand-open")?(removeClass(t,"expand-open"),slideDown(a,150),slideDown(s,150),slideDown(l,150),slideDown(r,150),slideUp(o,150),slideUp(i,150),setTimeout(()=>{n.select2("destroy")},500)):(addClass(t,"expand-open"),n.select2({...global.select2Options,width:"86%"}),hasClass(t,"has-monitoring")||n.on("change",monitorPaperEdits(e,!1)),t.classList.add("has-monitoring"),slideUp(a,150),slideUp(s,150),slideUp(l,150),slideUp(r,150),slideDown(o,150),slideDown(i,150))},handleMemorySelectChange=e=>{e=e.target.value;global.state.sortKey=e,sortMemory(),displayMemoryTable(),setMemorySortArrow("down")},handleMemorySortArrow=e=>{"memory-sort-arrow-down"===document.querySelector("#memory-sort-arrow svg").id?setMemorySortArrow("up"):setMemorySortArrow("down"),reverseMemory(),displayMemoryTable()},handleFilterFavorites=()=>{var e=!global.state.showFavorites;(global.state.showFavorites=e)?(addClass(findEl("filter-favorites").querySelector("svg"),"favorite"),sortMemory(),global.state.papersList=global.state.papersList.filter(e=>e.favorite),displayMemoryTable(),setMemorySortArrow("down"),findEl("memory-select").innerHTML+='',e=global.state.papersList.length,setPlaceholder("memory-search",`Search ${e} entries...`)):(removeClass(findEl("filter-favorites").querySelector("svg"),"favorite"),"favoriteDate"===val("memory-select")&&(val("memory-select","lastOpenDate"),global.state.sortKey="lastOpenDate"),document.querySelector('#memory-select option[value="favoriteDate"]').remove(),sortMemory(),setMemorySortArrow("down"),val("memory-search").trim()?dispatch("memory-search","keypress"):(global.state.papersList=global.state.sortedPapers,displayMemoryTable()),e=global.state.sortedPapers.length,setPlaceholder("memory-search",`Search ${e} entries...`))},handleMemorySearchKeyPress=a=>e=>{const t=val("memory-search").trim();if(log(t),t||setTimeout(()=>{style("memory-search-clear-icon","visibility","hidden")},0),!t){if(global.state.papersList.length!==global.state.sortedPapers.length)return global.state.papersList=global.state.sortedPapers,void displayMemoryTable();if(!a&&"Backspace"!==e.key)return}style("memory-search-clear-icon","visibility","visible"),(t.startsWith("t:")?searchMemoryByTags:t.startsWith("c:")?searchMemoryByCode:t.startsWith("y:")?searchMemoryByYear:searchMemory)(t),toggleTagsCollapse(t.startsWith("t:")),displayMemoryTable()},handleMemorySearchKeyUp=e=>{var t;"Backspace"==e.key&&((t=new Event("keypress")).key="Backspace",dispatch("memory-search",t)),"memory-search"===e.target.id&&dispatch("memory-search","keypress")},handleCancelModalClick=()=>{hideId("delete-paper-modal")},handleConfirmDeleteModalClick=async e=>{var t=findEl("delete-paper-modal-hidden-id").innerHTML,a=global.state.papers[t].title,o=global.state.papers[t].pdfLink;await deletePaperInStorage(t,global.state.papers),displayMemoryTable(),hideId("delete-paper-modal"),info(`Successfully deleted "${a}" (${t}) from PaperMemory`),global.state.currentId===t&&await updatePopupPaperNoMemory(o),setPlaceholder("memory-search",`Search ${global.state.papersList.length} entries ...`),addListener("memory-switch","click",handleMemorySwitchClick)},handleTagClick=e=>{e=e.target.textContent;val("memory-search","t: "+e),dispatch("memory-search","keypress")},handleClearSearch=e=>{val("memory-search",""),dispatch("memory-search","clear-search"),style("memory-search-clear-icon","visibility","hidden")},handleMemorySwitchClick=()=>{(global.state.memoryIsOpen?closeMemory:openMemory)()},handlePopupKeydown=t=>{var a,o=t.key;if(!(["Backspace","Enter","Escape","a","e"].indexOf(o)<0))if(global.state.prefsIsOpen)"Escape"===o?(t.preventDefault(),closeMenu()):"Enter"===o&&document.querySelector("#menu-switch:focus")&&closeMenu();else if(global.state.memoryIsOpen){if("Enter"===o){if(document.querySelector("#filter-favorites:focus"))return void dispatch("filter-favorites","click");if(document.querySelector("#memory-sort-arrow:focus")&&"Enter"===o)return void dispatch("memory-sort-arrow","click")}let e;const s=document.querySelector(".memory-container:focus");if("Escape"!==o){if(!s)return;e=s.id.split("--")[1]}"Backspace"===o?dispatch(findEl(e,"memory-delete"),"click"):"Enter"===o?(a="website"===global.state.papers[e].source?findEl(e,"memory-website-url"):global.state.prefs.checkEnterLocalPdf&&findEl(e,"memory-item-openLocal")||findEl(e,"memory-item-link"),dispatch(a,"click")):"Escape"===o?(t.preventDefault(),s&&hasClass(s,"expand-open")?handleTogglePaperEdit(t):closeMemory()):"e"===o&&dispatch(findEl(e,"memory-item-edit"),"click")}else if("a"===o){const e=queryAll(":focus");if(e.some(e=>["INPUT","TEXTAREA"].includes(e.tagName)))return;global.state.papers&&dispatch("memory-switch","click")}else"Enter"===o&&("memory-switch-open"===(a=document.querySelector(":focus")).id?dispatch("memory-switch","click"):"menu-switch"===a.id?(dispatch("menu-switch","click"),dispatch("menu-switch","blur")):hasClass(a,"memory-item-svg-div")&&dispatch(a,"click"))},handlePrefsCheckChange=async e=>{const t=e.target.id,a=findEl(t).checked;if(global.state&&global.state.prefs)global.state.prefs[t]=a,setStorage("prefs",global.state.prefs,function(){log(`Settings saved for ${t} (${a})`)});else{const o=await getStorage("prefs")??{};o[t]=a,setStorage("prefs",o,function(){log(`Settings saved for ${t} (${a})`)})}a&&"checkNoAuto"===t&&chrome.commands.getAll(e=>{e=e.find(e=>"manualParsing"===e.name).shortcut;console.log("shortcut: ",e),e||showPopupModal("manualParsing")})},handlePopupSaveEdits=e=>{var{note:t,codeLink:a,favorite:o}=getPaperEdits(e,!0);updatePaperTags(e,"#popup-item-tags--"+e),saveNote(e,t),saveCodeLink(e,a),saveFavoriteItem(e,o)},handlePopupDeletePaper=e=>()=>{showConfirmDeleteModal(e)},showTitleTooltip=(e,t)=>{t=t?findEl("popup-title-tooltip"):findEl(e,".title-tooltip");style(t,"display","block")},hideTitleTooltip=(e,t)=>{t=t?findEl("popup-title-tooltip"):findEl(e,".title-tooltip");style(t,"display","none")},getHandleTitleTooltip=(o,s,r)=>e=>{const t=r?global.state.currentId:eventId(e);var a=global.state.timerIdMap.get(e.target)??0;clearTimeout(a),a=setTimeout(()=>o(t,r),s),global.state.timerIdMap.set(e.target,a)},handleExpandAuthors=e=>{var e=eventId(e),t=findEl(e,"memory-authors");setHTML(t,cutAuthors(global.state.papers[e].author,1e5))},getPaperinfoTitle=e=>{let t=`Added ${new Date(e.addDate).toLocaleString().replace(",","")} Last open ${new Date(e.lastOpenDate).toLocaleString().replace(",","")} Visits: `+e.count;return e.venue&&(t+=` ${e.venue} ${e.year}`),t=t.replaceAll("\n","
")},getMemoryItemHTML=(e,t)=>{var a=getDisplayId(e.id),o=e.note||"",s=e.id,r=new Set(e.tags),i=getTagsOptions(e),l=e.favorite?"favorite":"",n=(t.pdfLink="Open tab to "+e.title,t.copyLink="Copy URL to the paper's "+(global.state.prefs.checkPreferPdf?"PDF":"abstract"),`
${"website"==e.source&&e.pdfLink.replace(/^https?:\/\//,"")||""}
`);let d='
';e.note&&(d=`
Note: ${o}
`);var p=global.state.files.hasOwnProperty(e.id)?`
${tablerSvg("vocabulary","",["memory-icon-svg"])}
`:"",c="website"===e.source?"":``;let m="",y=(global.state.prefs.checkScirate&&"arxiv"===e.source&&(m=`
${tablerSvg("messages","",["memory-icon-svg"])}
`),""),g=(global.state.prefs.checkVanity&&"arxiv"===e.source&&(y=`
${tablerSvg("vanity","",["memory-icon-svg"])}
`),""),v=(global.state.prefs.checkAr5iv&&"arxiv"===e.source&&(g=`
${tablerSvg("ar5iv","",["memory-icon-svg"])}
`),"");global.state.prefs.checkHuggingface&&"arxiv"===e.source&&(v=`
${tablerSvg("huggingface","",["memory-icon-svg"])}
`);var u=getPaperinfoTitle(e);return`

${tablerSvg("star","",["memory-item-favorite-svg",l])} ${e.title}

${[...r].map(e=>`${e}`).join("")}
${cutAuthors(e.author)}
${n} ${d}
${tablerSvg("writing","",["memory-icon-svg"])}
${a}
${p} ${c} ${v} ${m} ${y} ${g}
${tablerSvg("markdown","",["memory-icon-svg"])}
${tablerSvg("math-function","",["memory-icon-svg"])}