1import{p as c}from"./pageData-B3nQg5j2.js";const h=c("ai-chat-history-data","historyNotFoundMessage","No history found for this tool");window.ChatHistory={getKey(t){t||(t=window.location.pathname),t=window.location.pathname;const e=t.split("/").filter(Boolean);return e.length===0?"chat_history_home":e.length===1&&/^[a-zA-Z]{2}$/.test(e[0])?`chat_history_${e[0]}/home`:`chat_history_${e.join("/")}`},get(t){return JSON.parse(localStorage.getItem(this.getKey(t)))||[]},save(t,e){localStorage.setItem(this.getKey(t),JSON.stringify(e))},addChat(t,e){let o=this.get(t);const a=new Date,i=new Date(e.full_date);let s="";i.toDateString()===a.toDateString()?s="Today":s=i.toLocaleDateString();let r=o.find(l=>l.date_group===s);r?r.chats.unshift(e):o.unshift({date_group:s,chats:[e]}),this.save(t,o)}};function n(t){const e=window.location.pathname.split("/").pop();let o="";t.forEach(a=>{o+=` 2 <li class="sidebar-header text-primary my-2 fw-bold"> 3 ${a.date_group} 4 </li> 5 <div class="links">`,a.chats.forEach(i=>{const s=e===i.unique_id?"active":"";o+=` 6 <a href="/${i.page_url}/history/${i.unique_id}" class="chat-message d-block align-items-center my-1 text-decoration-none"> 7 <li class="d-flex justify-content-between align-items-center border ${s} p-1 radius-5"> 8 <span class="ps-3 fs-14 chat-text"> 9 ${i.message} 10 </span> 11 <span class="font-s-12"> 12 ${i.diff_for_humans} 13 </span> 14 </li> 15 </a>`}),o+="</div>"}),$("#historyCollapse").html(o)}document.querySelector(".openhistory")&&document.querySelector(".openhistory").addEventListener("click",function(){const t=window.location.pathname.split("/")[1],e=ChatHistory.get(t);e.length?n(e):($("#historyCollapse").html(` 16 <div class="d-flex justify-content-center align-items-center p-4"> 17 <div class="history_loader" role="status"></div> 18 </div> 19 `),fetch("/load-history").then(o=>o.json()).then(o=>{const a=document.querySelector("#historyCollapse");o.success&&o.data.length?(ChatHistory.save(t,o.data),n(o.data)):a&&(a.innerHTML=`<p style="padding: 10px; color: #555; font-style: italic;"> 20 ${h}. 21 </p>`)}).catch(o=>{const a=document.querySelector("#historyCollapse");a&&(a.innerHTML=`<p style="padding: 10px; color: red; font-style: italic;"> 22 Error loading history. 23 </p>`)}))});document.querySelector(".logout-btn")?.addEventListener("click",function(){Object.keys(localStorage).forEach(t=>{t.startsWith("chat_history_")&&localStorage.removeItem(t)})});window.renderHistory=n;export{n as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.