diff --git a/web/dist/assets/index-D0tS7qA0.js b/web/dist/assets/index-D0tS7qA0.js new file mode 100644 index 0000000..6846cfb --- /dev/null +++ b/web/dist/assets/index-D0tS7qA0.js @@ -0,0 +1,5 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();class C{constructor(){this.allSkins=[]}async loadData(){try{const e=await fetch("/data/skins_all.json");if(!e.ok)throw new Error(`Failed to fetch data: ${e.status} ${e.statusText}`);return this.allSkins=await e.json(),console.log(`[DataManager] Loaded ${this.allSkins.length} skins from JSON.`),this.allSkins}catch(e){throw console.error("[DataManager] Error loading data:",e),e}}}class B{constructor(e){this.allSkins=e.map(t=>({...t,_searchStr:`${t.champion} ${t.skin_name}`.toLowerCase()}))}applyFilters(e,t,n,i,s){let a=this.allSkins.filter(l=>!(e&&!l._searchStr.includes(e)||t&&l.champion!==t||n==="chromas"&&!l.isChroma||n==="prestige"&&!l.isPrestige||n==="esports"&&!l.isEsports||n==="favorites"&&!s.has(l.skin_id)));return i!=="default"&&a.sort((l,c)=>{switch(i){case"date-newest":return(c.release_date||"").localeCompare(l.release_date||"");case"date-oldest":return(l.release_date||"").localeCompare(c.release_date||"");case"price-high":return(c.price||0)-(l.price||0);case"price-low":return(l.price||0)-(c.price||0);case"name-az":return l.skin_name.localeCompare(c.skin_name);default:return 0}}),a}}const y={ULTIMATE:"ultimate",LEGENDARY:"legendary",EPIC:"epic",MYTHIC:"mythic",PRESTIGE:"prestige",HEXTECH:"hextech",CHROMA:"chroma",COLLECTION:"collection"};class E{static getBadges(e){const t=[];e.price>=3250?t.push({type:y.ULTIMATE,label:"Ultimate"}):e.price>=1820?t.push({type:y.LEGENDARY,label:"Legendary"}):e.price>=1350?t.push({type:y.EPIC,label:"Epic"}):e.isPrestige&&t.push({type:y.MYTHIC,label:"Mythic"}),e.isPrestige&&t.push({type:y.PRESTIGE,label:"Prestige"}),e.skin_name.includes("Hextech")&&t.push({type:y.HEXTECH,label:"Hextech"}),e.isChroma&&t.push({type:y.CHROMA,label:"Chromas"});const n=["K/DA","PROJECT","Star Guardian","Coven","Spirit Blossom","Blood Moon","High Noon","Pool Party","Bewitching","Snow Moon","Arcana"];for(const i of n)if(e.skin_name.includes(i)){t.push({type:y.COLLECTION,label:i});break}return t}static createBadgeElement(e){const t=document.createElement("span");return t.className=`badge badge-${e.type}`,t.textContent=e.label,t}}class L{constructor(e){this.favorites=e}createCardElement(e,t,n){const i=this.favorites.has(e.skin_id),s=document.createElement("div");s.className="skin-card",s.dataset.skinId=e.skin_id,s.setAttribute("tabindex","0"),s.setAttribute("role","button"),s.setAttribute("aria-label",`View details for ${e.skin_name}`);const a=document.createElement("button");a.className=`skin-card-favorite ${i?"active":""}`,a.dataset.skinId=e.skin_id,a.title=i?"Remove from Favorites":"Add to Favorites",a.setAttribute("aria-label",i?"Remove from Favorites":"Add to Favorites"),a.innerHTML=` + + `;const l=document.createElement("div");l.className="skin-card-image-wrapper";const c=document.createElement("img");c.className="skin-card-image",c.src=e.imagePath,c.alt="",c.loading="lazy",l.appendChild(c);const p=E.getBadges(e);if(p.length>0){const r=document.createElement("div");r.className="skin-card-badges",p.forEach(m=>{r.appendChild(E.createBadgeElement(m))}),l.appendChild(r)}const h=document.createElement("div");h.className="skin-card-info";const u=document.createElement("div");u.className="skin-card-title",u.textContent=e.skin_name;const d=document.createElement("div");if(d.className="skin-card-champion",d.textContent=e.champion,h.appendChild(u),h.appendChild(d),e.price){const r=document.createElement("div");r.className="skin-card-price",r.textContent=`${e.price} RP`,h.appendChild(r)}return s.appendChild(a),s.appendChild(l),s.appendChild(h),s}}class w{constructor(e,t){this.favorites=e,this.toggleFavoriteCallback=t,this.modal=document.getElementById("skinModal"),this.adminModal=document.getElementById("adminModal"),this.init()}init(){const e=document.getElementById("closeModal");e&&e.addEventListener("click",()=>this.close()),this.modal&&this.modal.addEventListener("click",i=>{i.target.classList.contains("modal-overlay")&&this.close()});const t=document.getElementById("modalFavorite");t&&t.addEventListener("click",()=>{const i=document.getElementById("modalSkinId").textContent;i&&this.toggleFavoriteCallback&&(this.toggleFavoriteCallback(i),this.favorites.has(i)?t.classList.add("active"):t.classList.remove("active"))});const n=document.getElementById("closeAdmin");n&&n.addEventListener("click",()=>{this.adminModal&&(this.adminModal.style.display="none")}),this.adminModal&&this.adminModal.addEventListener("click",i=>{i.target===this.adminModal&&(this.adminModal.style.display="none")})}open(e){if(!this.modal)return;const t=e;document.getElementById("modalImage").src=t.imagePath,document.getElementById("modalTitle").textContent=t.skin_name,document.getElementById("modalChampion").textContent=t.champion,document.getElementById("modalSkinId").textContent=t.skin_id,document.getElementById("modalSkinNum").textContent=t.skin_num;const n=document.getElementById("modalPriceRow");n&&(t.price>0&&t.price<99999?(n.style.display="flex",document.getElementById("modalPrice").textContent=`${t.price} RP`):n.style.display="none"),this.updateReleaseDate(t);const i=document.getElementById("modalBadges");i.innerHTML="",E.getBadges(t).forEach(c=>{i.appendChild(E.createBadgeElement(c))}),this.updateYouTubeLink(t);const a=document.getElementById("modalFavorite");a&&(this.favorites.has(t.skin_id)?(a.classList.add("active"),a.setAttribute("aria-pressed","true")):(a.classList.remove("active"),a.setAttribute("aria-pressed","false"))),this.modal.classList.add("active"),this.modal.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden";const l=document.getElementById("closeModal");l&&l.focus()}close(){this.modal&&(this.modal.classList.remove("active"),this.modal.setAttribute("aria-hidden","true")),this.adminModal&&(this.adminModal.style.display="none"),document.body.style.overflow=""}updateYouTubeLink(e){const t=document.getElementById("modalYouTubeLink");if(!t)return;t.style.display="inline-flex";let n="";e.skin_name.toLowerCase().includes("default")||e.skin_name.toLowerCase().includes("original")?n=`League of Legends ${e.champion} Base Skin Spotlight`:e.skin_name.toLowerCase().includes(e.champion.toLowerCase())?n=`League of Legends ${e.skin_name} Skin Spotlight`:n=`League of Legends ${e.skin_name} ${e.champion} Skin Spotlight`,t.href=`https://www.youtube.com/results?search_query=${encodeURIComponent(n)}`}async updateReleaseDate(e){const t=document.getElementById("modalReleaseDateRow");if(t){document.getElementById("modalReleaseDate").textContent="Loading date...",t.style.display="flex";try{const n=await fetch(`https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/skins/${e.skin_id}/${e.skin_id}.json`);if(n.ok){const i=await n.json();if(i.releaseDate){const a=new Date(i.releaseDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});document.getElementById("modalReleaseDate").textContent=a}else document.getElementById("modalReleaseDate").textContent="Unknown"}else throw new Error("API 404")}catch(n){console.log("Could not fetch date",n),document.getElementById("modalReleaseDate").textContent="N/A"}}}}class b{constructor(){this.dataManager=new C,this.filterEngine=null,this.skinCardV=null,this.modal=null,this.allSkins=[],this.filteredSkins=[],this.currentFilter="all",this.currentChampion="",this.searchQuery="",this.currentSort="default",this.isBrowseLoaded=!1,this.favorites=new Set(JSON.parse(localStorage.getItem("skinFavorites")||"[]")),this.skinCardV=new L(this.favorites),this.modal=new w(this.favorites,e=>this.toggleFavorite(e)),this.initialize()}async initialize(){try{this.allSkins=await this.dataManager.loadData(),this.filterEngine=new B(this.allSkins),this.filteredSkins=[...this.allSkins],this.populateChampionFilter(),this.setupEventListeners(),this.setupEventDelegation(),this.updateStats()}catch(e){console.error("Initialization failed",e);const t=document.getElementById("skinsGrid");t&&(t.innerHTML='
Failed to load skins. Please ensure the data server is running.
')}}populateChampionFilter(){const e=[...new Set(this.allSkins.map(n=>n.champion))].sort(),t=document.getElementById("championFilter");t&&e.forEach(n=>{const i=document.createElement("option");i.value=n,i.textContent=n,t.appendChild(i)})}setupEventListeners(){const e=document.getElementById("themeToggle");e&&e.addEventListener("click",()=>{document.body.dataset.theme,document.body.classList.toggle("light-theme");const d=document.body.classList.contains("light-theme");e.querySelector(".sun-icon").style.display=d?"none":"block",e.querySelector(".moon-icon").style.display=d?"block":"none"});const t=document.getElementById("homeBtn");t&&t.addEventListener("click",()=>this.showSection("heroSection"));const n=document.getElementById("browseBtn");n&&n.addEventListener("click",()=>this.loadAndShowBrowse());const i=document.getElementById("heroBrowseBtn");i&&i.addEventListener("click",()=>this.loadAndShowBrowse());const s=document.getElementById("searchInput"),a=document.getElementById("clearSearch");s.addEventListener("input",d=>{this.searchQuery=d.target.value.toLowerCase(),a.style.display=this.searchQuery?"block":"none",this.applyFilters()}),a.addEventListener("click",()=>{s.value="",this.searchQuery="",a.style.display="none",this.applyFilters()}),document.querySelectorAll(".filter-chip").forEach(d=>{d.addEventListener("click",r=>{const m=r.target.closest(".filter-chip");m&&(document.querySelectorAll(".filter-chip").forEach(f=>f.classList.remove("active")),m.classList.add("active"),this.currentFilter=m.dataset.filter,this.applyFilters())})});const l=document.getElementById("favoritesBtn");l&&l.addEventListener("click",()=>{this.showSection("browseSection"),this.isBrowseLoaded||(this.isBrowseLoaded=!0),document.querySelectorAll(".filter-chip").forEach(r=>r.classList.remove("active"));const d=document.querySelector('.filter-chip[data-filter="favorites"]');d&&d.classList.add("active"),this.currentFilter="favorites",this.applyFilters()}),document.getElementById("championFilter").addEventListener("change",d=>{this.currentChampion=d.target.value,this.applyFilters()});const c=document.getElementById("sortControl");c&&c.addEventListener("change",d=>{this.currentSort=d.target.value,this.applyFilters()}),document.addEventListener("keydown",d=>{d.key==="Escape"&&this.modal.close()});const p=document.getElementById("adminTrigger"),h=document.getElementById("adminModal");p&&h&&p.addEventListener("click",()=>{h.style.display="flex",this.updateAdminStats()});const u=document.getElementById("closeAdmin");u&&u.addEventListener("click",()=>{h.style.display="none"})}showSection(e){document.getElementById("heroSection").style.display="none",document.getElementById("browseSection").style.display="none",document.querySelectorAll(".nav-btn").forEach(t=>t.classList.remove("active")),e==="heroSection"?(document.getElementById("heroSection").style.display="block",document.getElementById("homeBtn").classList.add("active")):e==="browseSection"&&(document.getElementById("browseSection").style.display="block",document.getElementById("browseBtn").classList.add("active")),window.scrollTo(0,0)}loadAndShowBrowse(){this.isBrowseLoaded||(this.applyFilters(),this.isBrowseLoaded=!0),this.showSection("browseSection")}toggleFavorite(e){this.favorites.has(e)?this.favorites.delete(e):this.favorites.add(e),localStorage.setItem("skinFavorites",JSON.stringify([...this.favorites])),this.updateStats()}applyFilters(){this.filterEngine&&(this.filteredSkins=this.filterEngine.applyFilters(this.searchQuery,this.currentChampion,this.currentFilter,this.currentSort,this.favorites),this.renderSkins())}renderSkins(){const e=document.getElementById("skinsGrid"),t=document.getElementById("loadingState"),n=document.getElementById("emptyState");if(t&&(t.style.display="none"),this.filteredSkins.length===0){e.innerHTML="",n&&(n.style.display="flex");return}n&&(n.style.display="none"),e.innerHTML="",this.currentRenderCount=0,this.CHUNK_SIZE=50,this.observerSentinel=document.createElement("div"),this.observerSentinel.className="scroll-sentinel",this.observerSentinel.style.height="20px",this.observerSentinel.style.width="100%",this.renderNextChunk(),this.scrollObserver&&this.scrollObserver.disconnect(),this.scrollObserver=new IntersectionObserver(i=>{i[0].isIntersecting&&this.renderNextChunk()},{rootMargin:"200px"}),e.appendChild(this.observerSentinel),this.scrollObserver.observe(this.observerSentinel)}renderNextChunk(){const e=document.getElementById("skinsGrid");if(this.currentRenderCount>=this.filteredSkins.length){this.scrollObserver&&this.scrollObserver.disconnect(),this.observerSentinel&&(this.observerSentinel.style.display="none");return}const t=this.filteredSkins.slice(this.currentRenderCount,this.currentRenderCount+this.CHUNK_SIZE),n=document.createDocumentFragment();t.forEach(i=>{const s=this.skinCardV.createCardElement(i);n.appendChild(s)}),this.observerSentinel&&this.observerSentinel.parentNode===e?e.insertBefore(n,this.observerSentinel):e.appendChild(n),this.currentRenderCount+=t.length}setupEventDelegation(){const e=document.getElementById("skinsGrid");e&&(e.addEventListener("click",t=>{const n=t.target.closest(".skin-card-favorite");if(n){t.stopPropagation();const s=n.dataset.skinId;if(s){this.toggleFavorite(s),n.classList.toggle("active");const a=n.querySelector("svg path");a&&(n.classList.contains("active")?(a.setAttribute("fill","currentColor"),n.setAttribute("aria-label","Remove from Favorites"),n.title="Remove from Favorites"):(a.setAttribute("fill","none"),n.setAttribute("aria-label","Add to Favorites"),n.title="Add to Favorites"))}return}const i=t.target.closest(".skin-card");if(i){const s=i.dataset.skinId;if(s){const a=this.getSkinById(s);a&&this.modal&&this.modal.open(a)}}}),e.addEventListener("keydown",t=>{if(t.key==="Enter"||t.key===" "){const n=t.target.closest(".skin-card-favorite");if(n){t.preventDefault(),t.stopPropagation(),n.click();return}const i=t.target.closest(".skin-card");if(i&&document.activeElement===i){t.preventDefault();const s=i.dataset.skinId;if(s){const a=this.getSkinById(s);a&&this.modal&&this.modal.open(a)}}}}))}getSkinById(e){return this.allSkins.find(t=>t.skin_id==e)}updateStats(){try{const e=this.allSkins.length,t=new Set(this.allSkins.map(r=>r.champion)).size,n=this.favorites.size,i=this.allSkins.filter(r=>r.isChroma).length,s=e-i,a=document.getElementById("favoritesCount");a&&(a.textContent=n);const l=document.getElementById("heroTotalSkins"),c=document.getElementById("heroTotalChamps");l&&(l.textContent=s.toLocaleString()),c&&(c.textContent=t.toLocaleString());const p=document.getElementById("footerStats");p&&(p.textContent=`${s.toLocaleString()} Skins • ${t} Champions • ${i} Chromas`);const h=this.allSkins.filter(r=>r.price>0&&r.price<99999),u=(r,m,f)=>{const g=document.getElementById(r);if(g&&m){const v=g.querySelector(".stat-icon");v&&m.imagePath&&(v.style.backgroundImage=`url('${m.imagePath}')`);const S=g.querySelector(".stat-value");S&&(S.textContent=f||m.skin_name)}else if(g){const v=g.querySelector(".stat-value");v&&(v.textContent="N/A")}};if(h.length>0){const r=h.reduce((f,g)=>(f.price||0)>(g.price||0)?f:g);u("statMostExpensive",r,`${r.price} RP`);const m=h.reduce((f,g)=>(f.price||99999)<(g.price||99999)?f:g);u("statCheapest",m,`${m.price} RP`)}else u("statMostExpensive",null,"N/A"),u("statCheapest",null,"N/A");const d=this.allSkins.filter(r=>r.release_date);if(d.length>0){const r=d.reduce((m,f)=>(m.release_date||"")>(f.release_date||"")?m:f);u("statLatest",r,r.release_date)}else u("statLatest",null,"N/A")}catch(e){console.warn("Stats update warning:",e)}}updateAdminStats(){if(performance&&performance.memory){const t=Math.round(performance.memory.usedJSHeapSize/1024/1024),n=Math.round(performance.memory.jsHeapSizeLimit/1024/1024);document.getElementById("admin_memory").textContent=`${t} / ${n} MB`}else document.getElementById("admin_memory").textContent="Restricted";document.getElementById("admin_dom").textContent=document.getElementsByTagName("*").length,document.getElementById("admin_assets").textContent=document.images.length;const e=Math.round(performance.now());document.getElementById("admin_tti").textContent=`${e}ms`}}var I="@vercel/speed-insights",x="1.3.1",M=()=>{window.si||(window.si=function(...e){(window.siq=window.siq||[]).push(e)})};function _(){return typeof window<"u"}function A(){try{const o="production"}catch{}return"production"}function k(){return A()==="development"}function F(o){return o.scriptSrc?o.scriptSrc:k()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":o.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":o.basePath?`${o.basePath}/speed-insights/script.js`:"/_vercel/speed-insights/script.js"}function R(o={}){var e;if(!_()||o.route===null)return null;M();const t=F(o);if(document.head.querySelector(`script[src*="${t}"]`))return null;o.beforeSend&&((e=window.si)==null||e.call(window,"beforeSend",o.beforeSend));const n=document.createElement("script");return n.src=t,n.defer=!0,n.dataset.sdkn=I+(o.framework?`/${o.framework}`:""),n.dataset.sdkv=x,o.sampleRate&&(n.dataset.sampleRate=o.sampleRate.toString()),o.route&&(n.dataset.route=o.route),o.endpoint?n.dataset.endpoint=o.endpoint:o.basePath&&(n.dataset.endpoint=`${o.basePath}/speed-insights/vitals`),o.dsn&&(n.dataset.dsn=o.dsn),k()&&o.debug===!1&&(n.dataset.debug="false"),n.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${t}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(n),{setRoute:i=>{n.dataset.route=i??void 0}}}R();document.addEventListener("DOMContentLoaded",()=>{new b}); diff --git a/web/dist/assets/index-DUgFVd0j.js b/web/dist/assets/index-DUgFVd0j.js deleted file mode 100644 index 70a614b..0000000 --- a/web/dist/assets/index-DUgFVd0j.js +++ /dev/null @@ -1,5 +0,0 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();class C{constructor(){this.allSkins=[]}async loadData(){try{const e=await fetch("/data/skins_all.json");if(!e.ok)throw new Error(`Failed to fetch data: ${e.status} ${e.statusText}`);return this.allSkins=await e.json(),console.log(`[DataManager] Loaded ${this.allSkins.length} skins from JSON.`),this.allSkins}catch(e){throw console.error("[DataManager] Error loading data:",e),e}}}class k{constructor(e){this.allSkins=e.map(t=>({...t,_searchStr:`${t.champion} ${t.skin_name}`.toLowerCase()}))}applyFilters(e,t,n,s,i){let a=this.allSkins.filter(r=>!(e&&!r._searchStr.includes(e)||t&&r.champion!==t||n==="chromas"&&!r.isChroma||n==="prestige"&&!r.isPrestige||n==="esports"&&!r.isEsports||n==="favorites"&&!i.has(r.skin_id)));return s!=="default"&&a.sort((r,d)=>{switch(s){case"date-newest":return(d.release_date||"").localeCompare(r.release_date||"");case"date-oldest":return(r.release_date||"").localeCompare(d.release_date||"");case"price-high":return(d.price||0)-(r.price||0);case"price-low":return(r.price||0)-(d.price||0);case"name-az":return r.skin_name.localeCompare(d.skin_name);default:return 0}}),a}}const g={ULTIMATE:"ultimate",LEGENDARY:"legendary",EPIC:"epic",MYTHIC:"mythic",PRESTIGE:"prestige",HEXTECH:"hextech",CHROMA:"chroma",COLLECTION:"collection"};class E{static getBadges(e){const t=[];e.price>=3250?t.push({type:g.ULTIMATE,label:"Ultimate"}):e.price>=1820?t.push({type:g.LEGENDARY,label:"Legendary"}):e.price>=1350?t.push({type:g.EPIC,label:"Epic"}):e.isPrestige&&t.push({type:g.MYTHIC,label:"Mythic"}),e.isPrestige&&t.push({type:g.PRESTIGE,label:"Prestige"}),e.skin_name.includes("Hextech")&&t.push({type:g.HEXTECH,label:"Hextech"}),e.isChroma&&t.push({type:g.CHROMA,label:"Chromas"});const n=["K/DA","PROJECT","Star Guardian","Coven","Spirit Blossom","Blood Moon","High Noon","Pool Party","Bewitching","Snow Moon","Arcana"];for(const s of n)if(e.skin_name.includes(s)){t.push({type:g.COLLECTION,label:s});break}return t}static createBadgeElement(e){const t=document.createElement("span");return t.className=`badge badge-${e.type}`,t.textContent=e.label,t}}class B{constructor(e){this.favorites=e}createCardElement(e,t,n){const s=this.favorites.has(e.skin_id),i=document.createElement("div");i.className="skin-card",i.dataset.skinId=e.skin_id,i.setAttribute("tabindex","0"),i.setAttribute("role","button"),i.setAttribute("aria-label",`View details for ${e.skin_name}`);const a=document.createElement("button");a.className=`skin-card-favorite ${s?"active":""}`,a.dataset.skinId=e.skin_id,a.title=s?"Remove from Favorites":"Add to Favorites",a.setAttribute("aria-label",s?"Remove from Favorites":"Add to Favorites"),a.innerHTML=` - - `;const r=document.createElement("div");r.className="skin-card-image-wrapper";const d=document.createElement("img");d.className="skin-card-image",d.src=e.imagePath,d.alt="",d.loading="lazy",r.appendChild(d);const f=E.getBadges(e);if(f.length>0){const o=document.createElement("div");o.className="skin-card-badges",f.forEach(c=>{o.appendChild(E.createBadgeElement(c))}),r.appendChild(o)}const m=document.createElement("div");m.className="skin-card-info";const h=document.createElement("div");h.className="skin-card-title",h.textContent=e.skin_name;const l=document.createElement("div");if(l.className="skin-card-champion",l.textContent=e.champion,m.appendChild(h),m.appendChild(l),e.price){const o=document.createElement("div");o.className="skin-card-price",o.textContent=`${e.price} RP`,m.appendChild(o)}return i.appendChild(a),i.appendChild(r),i.appendChild(m),i}}class L{constructor(e,t){this.favorites=e,this.toggleFavoriteCallback=t,this.modal=document.getElementById("skinModal"),this.adminModal=document.getElementById("adminModal"),this.init()}init(){const e=document.getElementById("closeModal");e&&e.addEventListener("click",()=>this.close()),this.modal&&this.modal.addEventListener("click",s=>{s.target.classList.contains("modal-overlay")&&this.close()});const t=document.getElementById("modalFavorite");t&&t.addEventListener("click",()=>{const s=document.getElementById("modalSkinId").textContent;s&&this.toggleFavoriteCallback&&(this.toggleFavoriteCallback(s),this.favorites.has(s)?t.classList.add("active"):t.classList.remove("active"))});const n=document.getElementById("closeAdmin");n&&n.addEventListener("click",()=>{this.adminModal&&(this.adminModal.style.display="none")}),this.adminModal&&this.adminModal.addEventListener("click",s=>{s.target===this.adminModal&&(this.adminModal.style.display="none")})}open(e){if(!this.modal)return;const t=e;document.getElementById("modalImage").src=t.imagePath,document.getElementById("modalTitle").textContent=t.skin_name,document.getElementById("modalChampion").textContent=t.champion,document.getElementById("modalSkinId").textContent=t.skin_id,document.getElementById("modalSkinNum").textContent=t.skin_num;const n=document.getElementById("modalPriceRow");n&&(t.price>0&&t.price<99999?(n.style.display="flex",document.getElementById("modalPrice").textContent=`${t.price} RP`):n.style.display="none"),this.updateReleaseDate(t);const s=document.getElementById("modalBadges");s.innerHTML="",E.getBadges(t).forEach(d=>{s.appendChild(E.createBadgeElement(d))}),this.updateYouTubeLink(t);const a=document.getElementById("modalFavorite");a&&(this.favorites.has(t.skin_id)?(a.classList.add("active"),a.setAttribute("aria-pressed","true")):(a.classList.remove("active"),a.setAttribute("aria-pressed","false"))),this.modal.classList.add("active"),this.modal.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden";const r=document.getElementById("closeModal");r&&r.focus()}close(){this.modal&&(this.modal.classList.remove("active"),this.modal.setAttribute("aria-hidden","true")),this.adminModal&&(this.adminModal.style.display="none"),document.body.style.overflow=""}updateYouTubeLink(e){const t=document.getElementById("modalYouTubeLink");if(!t)return;t.style.display="inline-flex";let n="";e.skin_name.toLowerCase().includes("default")||e.skin_name.toLowerCase().includes("original")?n=`League of Legends ${e.champion} Base Skin Spotlight`:e.skin_name.toLowerCase().includes(e.champion.toLowerCase())?n=`League of Legends ${e.skin_name} Skin Spotlight`:n=`League of Legends ${e.skin_name} ${e.champion} Skin Spotlight`,t.href=`https://www.youtube.com/results?search_query=${encodeURIComponent(n)}`}async updateReleaseDate(e){const t=document.getElementById("modalReleaseDateRow");if(t){document.getElementById("modalReleaseDate").textContent="Loading date...",t.style.display="flex";try{const n=await fetch(`https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/skins/${e.skin_id}/${e.skin_id}.json`);if(n.ok){const s=await n.json();if(s.releaseDate){const a=new Date(s.releaseDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});document.getElementById("modalReleaseDate").textContent=a}else document.getElementById("modalReleaseDate").textContent="Unknown"}else throw new Error("API 404")}catch(n){console.log("Could not fetch date",n),document.getElementById("modalReleaseDate").textContent="N/A"}}}}class I{constructor(){this.dataManager=new C,this.filterEngine=null,this.skinCardV=null,this.modal=null,this.allSkins=[],this.filteredSkins=[],this.currentFilter="all",this.currentChampion="",this.searchQuery="",this.currentSort="default",this.isBrowseLoaded=!1,this.favorites=new Set(JSON.parse(localStorage.getItem("skinFavorites")||"[]")),this.skinCardV=new B(this.favorites),this.modal=new L(this.favorites,e=>this.toggleFavorite(e)),this.initialize()}async initialize(){try{this.allSkins=await this.dataManager.loadData(),this.filterEngine=new k(this.allSkins),this.filteredSkins=[...this.allSkins],this.populateChampionFilter(),this.setupEventListeners(),this.setupEventDelegation(),this.updateStats()}catch(e){console.error("Initialization failed",e);const t=document.getElementById("skinsGrid");t&&(t.innerHTML='
Failed to load skins. Please ensure the data server is running.
')}}populateChampionFilter(){const e=[...new Set(this.allSkins.map(n=>n.champion))].sort(),t=document.getElementById("championFilter");t&&e.forEach(n=>{const s=document.createElement("option");s.value=n,s.textContent=n,t.appendChild(s)})}setupEventListeners(){const e=document.getElementById("themeToggle");e&&e.addEventListener("click",()=>{document.body.dataset.theme,document.body.classList.toggle("light-theme");const l=document.body.classList.contains("light-theme");e.querySelector(".sun-icon").style.display=l?"none":"block",e.querySelector(".moon-icon").style.display=l?"block":"none"});const t=document.getElementById("homeBtn");t&&t.addEventListener("click",()=>this.showSection("heroSection"));const n=document.getElementById("browseBtn");n&&n.addEventListener("click",()=>this.loadAndShowBrowse());const s=document.getElementById("heroBrowseBtn");s&&s.addEventListener("click",()=>this.loadAndShowBrowse());const i=document.getElementById("searchInput"),a=document.getElementById("clearSearch");i.addEventListener("input",l=>{this.searchQuery=l.target.value.toLowerCase(),a.style.display=this.searchQuery?"block":"none",this.applyFilters()}),a.addEventListener("click",()=>{i.value="",this.searchQuery="",a.style.display="none",this.applyFilters()}),document.querySelectorAll(".filter-chip").forEach(l=>{l.addEventListener("click",o=>{const c=o.target.closest(".filter-chip");c&&(document.querySelectorAll(".filter-chip").forEach(u=>u.classList.remove("active")),c.classList.add("active"),this.currentFilter=c.dataset.filter,this.applyFilters())})});const r=document.getElementById("favoritesBtn");r&&r.addEventListener("click",()=>{this.showSection("browseSection"),this.isBrowseLoaded||(this.isBrowseLoaded=!0),document.querySelectorAll(".filter-chip").forEach(o=>o.classList.remove("active"));const l=document.querySelector('.filter-chip[data-filter="favorites"]');l&&l.classList.add("active"),this.currentFilter="favorites",this.applyFilters()}),document.getElementById("championFilter").addEventListener("change",l=>{this.currentChampion=l.target.value,this.applyFilters()});const d=document.getElementById("sortControl");d&&d.addEventListener("change",l=>{this.currentSort=l.target.value,this.applyFilters()}),document.addEventListener("keydown",l=>{l.key==="Escape"&&this.modal.close()});const f=document.getElementById("adminTrigger"),m=document.getElementById("adminModal");f&&m&&f.addEventListener("click",()=>{m.style.display="flex",this.updateAdminStats()});const h=document.getElementById("closeAdmin");h&&h.addEventListener("click",()=>{m.style.display="none"})}showSection(e){document.getElementById("heroSection").style.display="none",document.getElementById("browseSection").style.display="none",document.querySelectorAll(".nav-btn").forEach(t=>t.classList.remove("active")),e==="heroSection"?(document.getElementById("heroSection").style.display="block",document.getElementById("homeBtn").classList.add("active")):e==="browseSection"&&(document.getElementById("browseSection").style.display="block",document.getElementById("browseBtn").classList.add("active")),window.scrollTo(0,0)}loadAndShowBrowse(){this.isBrowseLoaded||(this.applyFilters(),this.isBrowseLoaded=!0),this.showSection("browseSection")}toggleFavorite(e){this.favorites.has(e)?this.favorites.delete(e):this.favorites.add(e),localStorage.setItem("skinFavorites",JSON.stringify([...this.favorites])),this.updateStats()}applyFilters(){this.filterEngine&&(this.filteredSkins=this.filterEngine.applyFilters(this.searchQuery,this.currentChampion,this.currentFilter,this.currentSort,this.favorites),this.renderSkins())}renderSkins(){const e=document.getElementById("skinsGrid"),t=document.getElementById("loadingState"),n=document.getElementById("emptyState");if(t&&(t.style.display="none"),this.filteredSkins.length===0){e.innerHTML="",n&&(n.style.display="flex");return}n&&(n.style.display="none"),e.innerHTML="",this.currentRenderCount=0,this.CHUNK_SIZE=50,this.observerSentinel=document.createElement("div"),this.observerSentinel.className="scroll-sentinel",this.observerSentinel.style.height="20px",this.observerSentinel.style.width="100%",this.renderNextChunk(),this.scrollObserver&&this.scrollObserver.disconnect(),this.scrollObserver=new IntersectionObserver(s=>{s[0].isIntersecting&&this.renderNextChunk()},{rootMargin:"200px"}),e.appendChild(this.observerSentinel),this.scrollObserver.observe(this.observerSentinel)}renderNextChunk(){const e=document.getElementById("skinsGrid");if(this.currentRenderCount>=this.filteredSkins.length){this.scrollObserver&&this.scrollObserver.disconnect(),this.observerSentinel&&(this.observerSentinel.style.display="none");return}const t=this.filteredSkins.slice(this.currentRenderCount,this.currentRenderCount+this.CHUNK_SIZE),n=document.createDocumentFragment();t.forEach(s=>{const i=this.skinCardV.createCardElement(s);n.appendChild(i)}),this.observerSentinel&&this.observerSentinel.parentNode===e?e.insertBefore(n,this.observerSentinel):e.appendChild(n),this.currentRenderCount+=t.length}setupEventDelegation(){const e=document.getElementById("skinsGrid");e&&(e.addEventListener("click",t=>{const n=t.target.closest(".skin-card-favorite");if(n){t.stopPropagation();const i=n.dataset.skinId;if(i){this.toggleFavorite(i),n.classList.toggle("active");const a=n.querySelector("svg path");a&&(n.classList.contains("active")?(a.setAttribute("fill","currentColor"),n.setAttribute("aria-label","Remove from Favorites"),n.title="Remove from Favorites"):(a.setAttribute("fill","none"),n.setAttribute("aria-label","Add to Favorites"),n.title="Add to Favorites"))}return}const s=t.target.closest(".skin-card");if(s){const i=s.dataset.skinId;if(i){const a=this.getSkinById(i);a&&this.modal&&this.modal.open(a)}}}),e.addEventListener("keydown",t=>{if(t.key==="Enter"||t.key===" "){const n=t.target.closest(".skin-card-favorite");if(n){t.preventDefault(),t.stopPropagation(),n.click();return}const s=t.target.closest(".skin-card");if(s&&document.activeElement===s){t.preventDefault();const i=s.dataset.skinId;if(i){const a=this.getSkinById(i);a&&this.modal&&this.modal.open(a)}}}}))}getSkinById(e){return this.allSkins.find(t=>t.skin_id==e)}updateStats(){try{const e=this.allSkins.length,t=new Set(this.allSkins.map(o=>o.champion)).size,n=this.favorites.size,s=this.allSkins.filter(o=>o.isChroma).length,i=e-s,a=document.getElementById("favoritesCount");a&&(a.textContent=n);const r=document.getElementById("heroTotalSkins"),d=document.getElementById("heroTotalChamps");r&&(r.textContent=i.toLocaleString()),d&&(d.textContent=t.toLocaleString());const f=document.getElementById("footerStats");f&&(f.textContent=`${i.toLocaleString()} Skins • ${t} Champions • ${s} Chromas`);const m=this.allSkins.filter(o=>o.price>0&&o.price<99999),h=(o,c,u)=>{const p=document.getElementById(o);if(p&&c){const v=p.querySelector(".stat-icon");v&&c.imagePath&&(v.style.backgroundImage=`url('${c.imagePath}')`);const S=p.querySelector(".stat-value");S&&(S.textContent=u||c.skin_name)}else if(p){const v=p.querySelector(".stat-value");v&&(v.textContent="N/A")}};if(m.length>0){const o=m.reduce((u,p)=>(u.price||0)>(p.price||0)?u:p);h("statMostExpensive",o,`${o.price} RP`);const c=m.reduce((u,p)=>(u.price||99999)<(p.price||99999)?u:p);h("statCheapest",c,`${c.price} RP`)}else h("statMostExpensive",null,"N/A"),h("statCheapest",null,"N/A");const l=this.allSkins.filter(o=>o.release_date);if(l.length>0){const o=l.reduce((c,u)=>(c.release_date||"")>(u.release_date||"")?c:u);h("statLatest",o,o.release_date)}else h("statLatest",null,"N/A")}catch(e){console.warn("Stats update warning:",e)}}updateAdminStats(){if(performance&&performance.memory){const t=Math.round(performance.memory.usedJSHeapSize/1024/1024),n=Math.round(performance.memory.jsHeapSizeLimit/1024/1024);document.getElementById("admin_memory").textContent=`${t} / ${n} MB`}else document.getElementById("admin_memory").textContent="Restricted";document.getElementById("admin_dom").textContent=document.getElementsByTagName("*").length,document.getElementById("admin_assets").textContent=document.images.length;const e=Math.round(performance.now());document.getElementById("admin_tti").textContent=`${e}ms`}}document.addEventListener("DOMContentLoaded",()=>{new I}); diff --git a/web/dist/index.html b/web/dist/index.html index c58ef68..f842f87 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -1,584 +1,584 @@ - - - - - - Rareness - Ultimate League of Legends Skin Collection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + Rareness - Ultimate League of Legends Skin Collection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -
- - - - - -
-
- - - -
-
- - -
-
-
- Curated Collection -

- Experience Rareness -

-

- The ultimate visual catalog of League of Legends cosmetics. Browse, - filter, and discover over 1,600 skins in premium detail. -

-
- -
- -
-
- -
-
Loading...
-
Most Exclusive
-
-
-
-
-
-
Loading...
-
Best Value
-
-
-
-
-
-
Loading...
-
Latest Drop
-
-
-
-
-
- - - - - - -
- - - - - - - - - + + +
+ + + + + +
+
+ + + +
+
+ + +
+
+
+ Curated Collection +

+ Experience Rareness +

+

+ The ultimate visual catalog of League of Legends cosmetics. Browse, + filter, and discover over 1,600 skins in premium detail. +

+
+ +
+ +
+
+ +
+
Loading...
+
Most Exclusive
+
+
+
+
+
+
Loading...
+
Best Value
+
+
+
+
+
+
Loading...
+
Latest Drop
+
+
+
+
+
+ + + + + + +
+ + + + + + + + + diff --git a/web/node_modules/.bin/acorn b/web/node_modules/.bin/acorn old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/acorn.cmd b/web/node_modules/.bin/acorn.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/acorn.ps1 b/web/node_modules/.bin/acorn.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/esbuild b/web/node_modules/.bin/esbuild old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/esbuild.cmd b/web/node_modules/.bin/esbuild.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/esbuild.ps1 b/web/node_modules/.bin/esbuild.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/eslint b/web/node_modules/.bin/eslint old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/eslint-config-prettier b/web/node_modules/.bin/eslint-config-prettier old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/eslint-config-prettier.cmd b/web/node_modules/.bin/eslint-config-prettier.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/eslint-config-prettier.ps1 b/web/node_modules/.bin/eslint-config-prettier.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/eslint.cmd b/web/node_modules/.bin/eslint.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/eslint.ps1 b/web/node_modules/.bin/eslint.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/js-yaml b/web/node_modules/.bin/js-yaml old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/js-yaml.cmd b/web/node_modules/.bin/js-yaml.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/js-yaml.ps1 b/web/node_modules/.bin/js-yaml.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/lz-string b/web/node_modules/.bin/lz-string old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/lz-string.cmd b/web/node_modules/.bin/lz-string.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/lz-string.ps1 b/web/node_modules/.bin/lz-string.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/nanoid b/web/node_modules/.bin/nanoid old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/nanoid.cmd b/web/node_modules/.bin/nanoid.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/nanoid.ps1 b/web/node_modules/.bin/nanoid.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/node-which b/web/node_modules/.bin/node-which old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/node-which.cmd b/web/node_modules/.bin/node-which.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/node-which.ps1 b/web/node_modules/.bin/node-which.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/prettier b/web/node_modules/.bin/prettier old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/prettier.cmd b/web/node_modules/.bin/prettier.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/prettier.ps1 b/web/node_modules/.bin/prettier.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/rollup b/web/node_modules/.bin/rollup old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/rollup.cmd b/web/node_modules/.bin/rollup.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/rollup.ps1 b/web/node_modules/.bin/rollup.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/tldts b/web/node_modules/.bin/tldts old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/tldts.cmd b/web/node_modules/.bin/tldts.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/tldts.ps1 b/web/node_modules/.bin/tldts.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/vite b/web/node_modules/.bin/vite old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/vite.cmd b/web/node_modules/.bin/vite.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/vite.ps1 b/web/node_modules/.bin/vite.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/vitest b/web/node_modules/.bin/vitest old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/vitest.cmd b/web/node_modules/.bin/vitest.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/vitest.ps1 b/web/node_modules/.bin/vitest.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/why-is-node-running b/web/node_modules/.bin/why-is-node-running old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/why-is-node-running.cmd b/web/node_modules/.bin/why-is-node-running.cmd old mode 100644 new mode 100755 diff --git a/web/node_modules/.bin/why-is-node-running.ps1 b/web/node_modules/.bin/why-is-node-running.ps1 old mode 100644 new mode 100755 diff --git a/web/node_modules/.package-lock.json b/web/node_modules/.package-lock.json index aa1d534..b386514 100644 --- a/web/node_modules/.package-lock.json +++ b/web/node_modules/.package-lock.json @@ -1,6 +1,6 @@ { "name": "web", - "version": "1.0.0", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { @@ -216,6 +216,23 @@ "node": ">=18" } }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/win32-x64": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", @@ -454,6 +471,34 @@ "dev": true, "license": "MIT" }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.55.1.tgz", + "integrity": "sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.55.1.tgz", + "integrity": "sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-win32-x64-gnu": { "version": "4.55.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.55.1.tgz", @@ -548,6 +593,40 @@ "dev": true, "license": "MIT" }, + "node_modules/@vercel/speed-insights": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vercel/speed-insights/-/speed-insights-1.3.1.tgz", + "integrity": "sha512-PbEr7FrMkUrGYvlcLHGkXdCkxnylCWePx7lPxxq36DNdfo9mcUjLOmqOyPDHAOgnfqgGGdmE3XI9L/4+5fr+vQ==", + "license": "Apache-2.0", + "peerDependencies": { + "@sveltejs/kit": "^1 || ^2", + "next": ">= 13", + "react": "^18 || ^19 || ^19.0.0-rc", + "svelte": ">= 4", + "vue": "^3", + "vue-router": "^4" + }, + "peerDependenciesMeta": { + "@sveltejs/kit": { + "optional": true + }, + "next": { + "optional": true + }, + "react": { + "optional": true + }, + "svelte": { + "optional": true + }, + "vue": { + "optional": true + }, + "vue-router": { + "optional": true + } + } + }, "node_modules/@vitest/expect": { "version": "4.0.17", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.17.tgz", diff --git a/web/node_modules/@esbuild/linux-x64/README.md b/web/node_modules/@esbuild/linux-x64/README.md new file mode 100644 index 0000000..b2f1930 --- /dev/null +++ b/web/node_modules/@esbuild/linux-x64/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/web/node_modules/@esbuild/linux-x64/bin/esbuild b/web/node_modules/@esbuild/linux-x64/bin/esbuild new file mode 100755 index 0000000..2c11e32 Binary files /dev/null and b/web/node_modules/@esbuild/linux-x64/bin/esbuild differ diff --git a/web/node_modules/@esbuild/linux-x64/package.json b/web/node_modules/@esbuild/linux-x64/package.json new file mode 100644 index 0000000..91d4db9 --- /dev/null +++ b/web/node_modules/@esbuild/linux-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@esbuild/linux-x64", + "version": "0.27.2", + "description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.", + "repository": { + "type": "git", + "url": "git+https://github.com/evanw/esbuild.git" + }, + "license": "MIT", + "preferUnplugged": true, + "engines": { + "node": ">=18" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ] +} diff --git a/web/node_modules/@rollup/rollup-linux-x64-gnu/README.md b/web/node_modules/@rollup/rollup-linux-x64-gnu/README.md new file mode 100644 index 0000000..cabe280 --- /dev/null +++ b/web/node_modules/@rollup/rollup-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@rollup/rollup-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `rollup` diff --git a/web/node_modules/@rollup/rollup-linux-x64-gnu/package.json b/web/node_modules/@rollup/rollup-linux-x64-gnu/package.json new file mode 100644 index 0000000..9b3ab36 --- /dev/null +++ b/web/node_modules/@rollup/rollup-linux-x64-gnu/package.json @@ -0,0 +1,25 @@ +{ + "name": "@rollup/rollup-linux-x64-gnu", + "version": "4.55.1", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "files": [ + "rollup.linux-x64-gnu.node" + ], + "description": "Native bindings for Rollup", + "author": "Lukas Taegert-Atkinson", + "homepage": "https://rollupjs.org/", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/rollup/rollup.git" + }, + "libc": [ + "glibc" + ], + "main": "./rollup.linux-x64-gnu.node" +} \ No newline at end of file diff --git a/web/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node b/web/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node new file mode 100644 index 0000000..5c026e1 Binary files /dev/null and b/web/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node differ diff --git a/web/node_modules/@rollup/rollup-linux-x64-musl/README.md b/web/node_modules/@rollup/rollup-linux-x64-musl/README.md new file mode 100644 index 0000000..5848a6c --- /dev/null +++ b/web/node_modules/@rollup/rollup-linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@rollup/rollup-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `rollup` diff --git a/web/node_modules/@rollup/rollup-linux-x64-musl/package.json b/web/node_modules/@rollup/rollup-linux-x64-musl/package.json new file mode 100644 index 0000000..5dd25f0 --- /dev/null +++ b/web/node_modules/@rollup/rollup-linux-x64-musl/package.json @@ -0,0 +1,25 @@ +{ + "name": "@rollup/rollup-linux-x64-musl", + "version": "4.55.1", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "files": [ + "rollup.linux-x64-musl.node" + ], + "description": "Native bindings for Rollup", + "author": "Lukas Taegert-Atkinson", + "homepage": "https://rollupjs.org/", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/rollup/rollup.git" + }, + "libc": [ + "musl" + ], + "main": "./rollup.linux-x64-musl.node" +} \ No newline at end of file diff --git a/web/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node b/web/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node new file mode 100644 index 0000000..cab60b5 Binary files /dev/null and b/web/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node differ diff --git a/web/node_modules/@vercel/speed-insights/.eslintrc.cjs b/web/node_modules/@vercel/speed-insights/.eslintrc.cjs new file mode 100644 index 0000000..1cf9818 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/.eslintrc.cjs @@ -0,0 +1,7 @@ +module.exports = { + extends: '../../.eslintrc.cjs', + rules: { + 'tsdoc/syntax': 'off', + }, + ignorePatterns: ['jest.setup.ts'], +}; diff --git a/web/node_modules/@vercel/speed-insights/LICENSE b/web/node_modules/@vercel/speed-insights/LICENSE new file mode 100644 index 0000000..3eb9904 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/LICENSE @@ -0,0 +1,190 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +Copyright 2023 Vercel, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/web/node_modules/@vercel/speed-insights/README.md b/web/node_modules/@vercel/speed-insights/README.md new file mode 100644 index 0000000..7a3443e --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/README.md @@ -0,0 +1,49 @@ +![Speed Insights](https://github.com/vercel/speed-insights/blob/main/.github/banner.png) + +
Vercel Speed Insights
+
Performance insights for your website
+
+
+Website + · +Documentation + · +Twitter +
+ +## Overview + +`@vercel/speed-insights` automatically tracks web vitals and other performance metrics for your website. + +This package does **not** track data in development mode. + +It has 1st class integration with: + +| Framework | Package | +| --------- | ---------------------------------- | +| Next.js | `@vercel/speed-insights/next` | +| Nuxt | `@vercel/speed-insights/nuxt` | +| Sveltekit | `@vercel/speed-insights/sveltekit` | +| Remix | `@vercel/speed-insights/remix` | +| React | `@vercel/speed-insights/react` | +| Astro | `@vercel/speed-insights/astro` | +| Vue | `@vercel/speed-insights/vue` | + +It also supports other frameworks, vanilla JS and static websites. + +## Quickstart + +1. Enable Vercel Speed Insights for a project in the [Vercel Dashboard](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fspeed-insights&title=Open+Web+Analytics). +2. Add the `@vercel/speed-insights` package to your project +3. Inject Speed Insights to your app + + - If you are using **Next.js**, **React**, **Nuxt** or **Vue** you can use the framework-specific `` component to inject the script into your app. + - If you are using **Sveltekit**, you can use the `injectSpeedInsights()` function `@vercel/speed-insights/sveltekit` in your top-level `+layout.js/ts` file. + - For other frameworks, you can use the `inject` function add the tracking script to your app. + - If you want to use Vercel Speed Insights on a static site without npm, follow the instructions in the [documentation](https://vercel.com/docs/speed-insights/quickstart). + +4. Deploy your app to Vercel and see data flowing in. + +## Documentation + +Find more details about this package in our [documentation](https://vercel.com/docs/speed-insights/quickstart). diff --git a/web/node_modules/@vercel/speed-insights/dist/astro/component.ts b/web/node_modules/@vercel/speed-insights/dist/astro/component.ts new file mode 100644 index 0000000..e673447 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/astro/component.ts @@ -0,0 +1,3 @@ +// @ts-expect-error typescript doesn't handle ./index.astro properly, but it's needed to generate types +// eslint-disable-next-line import/no-default-export, no-useless-rename -- Exporting everything doesn't yield the desired outcome +export { default as default } from './index.astro'; diff --git a/web/node_modules/@vercel/speed-insights/dist/astro/index.astro b/web/node_modules/@vercel/speed-insights/dist/astro/index.astro new file mode 100644 index 0000000..4a6a895 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/astro/index.astro @@ -0,0 +1,53 @@ +--- +// Since this file will not be bundled by Tsup, it is referencing bundled files relative to dist/astro/ +import type { SpeedInsightsProps } from '../index.d.ts'; +type Props = Omit; + +const propsStr = JSON.stringify(Astro.props); +const paramsStr = JSON.stringify(Astro.params); +--- + + + + diff --git a/web/node_modules/@vercel/speed-insights/dist/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/index.d.mts new file mode 100644 index 0000000..020a9a0 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/index.d.mts @@ -0,0 +1,59 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function computeRoute(pathname: string | null, pathParams: Record | null): string | null; + +/** + * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights). + * @param [props] - Speed Insights options. + * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`. + * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event. + * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`. + * @param [props.route] - The dynamic route of the page. + * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting. + */ +declare function injectSpeedInsights(props?: SpeedInsightsProps & { + framework?: string; + basePath?: string; +}): { + setRoute: (route: string | null) => void; +} | null; + +declare const _default: { + injectSpeedInsights: typeof injectSpeedInsights; + computeRoute: typeof computeRoute; +}; + +export { type BeforeSendMiddleware, type SpeedInsightsProps, computeRoute, _default as default, injectSpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/index.d.ts new file mode 100644 index 0000000..020a9a0 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/index.d.ts @@ -0,0 +1,59 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function computeRoute(pathname: string | null, pathParams: Record | null): string | null; + +/** + * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights). + * @param [props] - Speed Insights options. + * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`. + * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event. + * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`. + * @param [props.route] - The dynamic route of the page. + * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting. + */ +declare function injectSpeedInsights(props?: SpeedInsightsProps & { + framework?: string; + basePath?: string; +}): { + setRoute: (route: string | null) => void; +} | null; + +declare const _default: { + injectSpeedInsights: typeof injectSpeedInsights; + computeRoute: typeof computeRoute; +}; + +export { type BeforeSendMiddleware, type SpeedInsightsProps, computeRoute, _default as default, injectSpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/index.js b/web/node_modules/@vercel/speed-insights/dist/index.js new file mode 100644 index 0000000..07fe70d --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/index.js @@ -0,0 +1,161 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/generic.ts +var generic_exports = {}; +__export(generic_exports, { + computeRoute: () => computeRoute, + default: () => generic_default, + injectSpeedInsights: () => injectSpeedInsights +}); +module.exports = __toCommonJS(generic_exports); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} +var generic_default = { + injectSpeedInsights, + computeRoute +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + computeRoute, + injectSpeedInsights +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/index.js.map b/web/node_modules/@vercel/speed-insights/dist/index.js.map new file mode 100644 index 0000000..18c5920 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/generic.ts","../package.json","../src/queue.ts","../src/utils.ts"],"sourcesContent":["import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCE,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,UAAM,UAAU,OAAO,QAAQ,UAAU;AAEzC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,UAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,cAAM,UAAU,kBAAkB,KAAK;AACvC,YAAI,QAAQ,KAAK,MAAM,GAAG;AACxB,mBAAS,OAAO,QAAQ,SAAS,KAAK,GAA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,YAAY;AACpB,WAAO,QAAQ,aAAa,MAAM,WAAW,SAAS;AAAA,EACxD;AACA,MAAI,MAAM,OAAO;AACf,WAAO,QAAQ,QAAQ,MAAM;AAAA,EAC/B;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,QAAQ,WAAW,MAAM;AAAA,EAClC,WAAW,MAAM,UAAU;AACzB,WAAO,QAAQ,WAAW,GAAG,MAAM,QAAQ;AAAA,EAC7C;AACA,MAAI,MAAM,KAAK;AACb,WAAO,QAAQ,MAAM,MAAM;AAAA,EAC7B;AACA,MAAI,cAAc,KAAK,MAAM,UAAU,OAAO;AAC5C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,SAAO,UAAU,MAAY;AAE3B,YAAQ;AAAA,MACN,sDAAsD,GAAG;AAAA,IAC3D;AAAA,EACF;AAEA,WAAS,KAAK,YAAY,MAAM;AAEhC,SAAO;AAAA,IACL,UAAU,CAAC,UAA+B;AACxC,aAAO,QAAQ,QAAQ,SAAS;AAAA,IAClC;AAAA,EACF;AACF;AAMA,IAAO,kBAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/index.mjs b/web/node_modules/@vercel/speed-insights/dist/index.mjs new file mode 100644 index 0000000..023c810 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/index.mjs @@ -0,0 +1,133 @@ +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} +var generic_default = { + injectSpeedInsights, + computeRoute +}; +export { + computeRoute, + generic_default as default, + injectSpeedInsights +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/index.mjs.map new file mode 100644 index 0000000..3fb961e --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../package.json","../src/queue.ts","../src/utils.ts","../src/generic.ts"],"sourcesContent":["{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n"],"mappings":";AACE,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,UAAM,UAAU,OAAO,QAAQ,UAAU;AAEzC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,UAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,cAAM,UAAU,kBAAkB,KAAK;AACvC,YAAI,QAAQ,KAAK,MAAM,GAAG;AACxB,mBAAS,OAAO,QAAQ,SAAS,KAAK,GAAG,GAAG;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAEA,eA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AAA,EACxD;AACA,MAAI,MAAM,OAAO;AACf,WAAO,QAAQ,QAAQ,MAAM;AAAA,EAC/B;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,QAAQ,WAAW,MAAM;AAAA,EAClC,WAAW,MAAM,UAAU;AACzB,WAAO,QAAQ,WAAW,GAAG,MAAM,QAAQ;AAAA,EAC7C;AACA,MAAI,MAAM,KAAK;AACb,WAAO,QAAQ,MAAM,MAAM;AAAA,EAC7B;AACA,MAAI,cAAc,KAAK,MAAM,UAAU,OAAO;AAC5C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,SAAO,UAAU,MAAY;AAE3B,YAAQ;AAAA,MACN,sDAAsD,GAAG;AAAA,IAC3D;AAAA,EACF;AAEA,WAAS,KAAK,YAAY,MAAM;AAEhC,SAAO;AAAA,IACL,UAAU,CAAC,UAA+B;AACxC,aAAO,QAAQ,QAAQ,SAAS;AAAA,IAClC;AAAA,EACF;AACF;AAMA,IAAO,kBAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/next/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/next/index.d.mts new file mode 100644 index 0000000..786644a --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/next/index.d.mts @@ -0,0 +1,39 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights$1 { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights$1['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights$1['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +type Props = Omit; +declare function SpeedInsights(props: Props): null; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/next/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/next/index.d.ts new file mode 100644 index 0000000..786644a --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/next/index.d.ts @@ -0,0 +1,39 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights$1 { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights$1['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights$1['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +type Props = Omit; +declare function SpeedInsights(props: Props): null; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/next/index.js b/web/node_modules/@vercel/speed-insights/dist/next/index.js new file mode 100644 index 0000000..6060a41 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/next/index.js @@ -0,0 +1,239 @@ +"use strict"; +"use client"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/nextjs/index.tsx +var nextjs_exports = {}; +__export(nextjs_exports, { + SpeedInsights: () => SpeedInsights2 +}); +module.exports = __toCommonJS(nextjs_exports); +var import_react2 = __toESM(require("react")); + +// src/react/index.tsx +var import_react = require("react"); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/react/utils.ts +function getBasePath() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/react/index.tsx +function SpeedInsights(props) { + (0, import_react.useEffect)(() => { + var _a; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + }, [props.beforeSend]); + const setScriptRoute = (0, import_react.useRef)(null); + (0, import_react.useEffect)(() => { + if (!setScriptRoute.current) { + const script = injectSpeedInsights({ + framework: props.framework ?? "react", + basePath: props.basePath ?? getBasePath(), + ...props + }); + if (script) { + setScriptRoute.current = script.setRoute; + } + } else if (props.route) { + setScriptRoute.current(props.route); + } + }, [props.route]); + return null; +} + +// src/nextjs/utils.ts +var import_navigation = require("next/navigation.js"); +var useRoute = () => { + const params = (0, import_navigation.useParams)(); + const searchParams = (0, import_navigation.useSearchParams)() || new URLSearchParams(); + const path = (0, import_navigation.usePathname)(); + if (!params) { + return null; + } + const finalParams = Object.keys(params).length ? params : Object.fromEntries(searchParams.entries()); + return computeRoute(path, finalParams); +}; +function getBasePath2() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/nextjs/index.tsx +function SpeedInsightsComponent(props) { + const route = useRoute(); + return /* @__PURE__ */ import_react2.default.createElement( + SpeedInsights, + { + route, + ...props, + framework: "next", + basePath: getBasePath2() + } + ); +} +function SpeedInsights2(props) { + return /* @__PURE__ */ import_react2.default.createElement(import_react2.Suspense, { fallback: null }, /* @__PURE__ */ import_react2.default.createElement(SpeedInsightsComponent, { ...props })); +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + SpeedInsights +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/next/index.js.map b/web/node_modules/@vercel/speed-insights/dist/next/index.js.map new file mode 100644 index 0000000..380662d --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/next/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/nextjs/index.tsx","../../src/react/index.tsx","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/react/utils.ts","../../src/nextjs/utils.ts"],"sourcesContent":["'use client';\n\nimport React, { Suspense } from 'react';\nimport { SpeedInsights as SpeedInsightsScript } from '../react';\nimport type { SpeedInsightsProps } from '../types';\nimport { getBasePath, useRoute } from './utils';\n\ntype Props = Omit;\n\nfunction SpeedInsightsComponent(props: Props): React.ReactElement {\n const route = useRoute();\n\n return (\n \n );\n}\n\nexport function SpeedInsights(props: Props): null {\n // Because of incompatible types between ReactNode in React 19 and React 18 we return null (which is also what we render)\n return (\n \n \n \n ) as never;\n}\n","'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { SpeedInsightsProps } from '../types';\nimport { computeRoute, injectSpeedInsights } from '../generic';\nimport { getBasePath } from './utils';\n\nexport function SpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n },\n): JSX.Element | null {\n useEffect(() => {\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n }, [props.beforeSend]);\n\n const setScriptRoute = useRef<((path: string) => void) | null>(null);\n useEffect(() => {\n if (!setScriptRoute.current) {\n const script = injectSpeedInsights({\n framework: props.framework ?? 'react',\n basePath: props.basePath ?? getBasePath(),\n ...props,\n });\n if (script) {\n setScriptRoute.current = script.setRoute;\n }\n } else if (props.route) {\n setScriptRoute.current(props.route);\n }\n }, [props.route]);\n\n return null;\n}\n\nexport { computeRoute };\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;\n}\n","'use client';\n/* eslint-disable @typescript-eslint/no-unnecessary-condition -- can be empty in pages router */\nimport { useParams, usePathname, useSearchParams } from 'next/navigation.js';\nimport { computeRoute } from '../utils';\n\nexport const useRoute = (): string | null => {\n const params = useParams();\n const searchParams = useSearchParams() || new URLSearchParams();\n const path = usePathname();\n // Until we have route parameters, we don't compute the route\n if (!params) {\n return null;\n }\n // in Next.js@13, useParams() could return an empty object for pages router, and we default to searchParams.\n const finalParams = Object.keys(params).length\n ? params\n : Object.fromEntries(searchParams.entries());\n return computeRoute(path, finalParams);\n};\n\nexport function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA;AAAA;AAEA,IAAAC,gBAAgC;;;ACAhC,mBAAkC;;;ACDhC,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,UAAM,UAAU,OAAO,QAAQ,UAAU;AAEzC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,UAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,cAAM,UAAU,kBAAkB,KAAK;AACvC,YAAI,QAAQ,KA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V,uBAAe,UAAU,OAAO;AAAA,MAClC;AAAA,IACF,WAAW,MAAM,OAAO;AACtB,qBAAe,QAAQ,MAAM,KAAK;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,MAAM,KAAK,CAAC;AAEhB,SAAO;AACT;;;AMlCA,wBAAwD;AAGjD,IAAM,WAAW,MAAqB;AAC3C,QAAM,aAAS,6BAAU;AACzB,QAAM,mBAAe,mCAAgB,KAAK,IAAI,gBAAgB;AAC9D,QAAM,WAAO,+BAAY;AAEzB,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,OAAO,KAAK,MAAM,EAAE,SACpC,SACA,OAAO,YAAY,aAAa,QAAQ,CAAC;AAC7C,SAAO,aAAa,MAAM,WAAW;AACvC;AAEO,SAASC,eAAkC;AAKhD,MAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,QAAQ,aAAa;AACxE,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,IAAI;AACrB;;;APpBA,SAAS,uBAAuB,OAAkC;AAChE,QAAM,QAAQ,SAAS;AAEvB,SACE,8BAAAC,QAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ,WAAU;AAAA,MACV,UAAUC,aAAY;AAAA;AAAA,EACxB;AAEJ;AAEO,SAASC,eAAc,OAAoB;AAEhD,SACE,8BAAAF,QAAA,cAAC,0BAAS,UAAU,QAClB,8BAAAA,QAAA,cAAC,0BAAwB,GAAG,OAAO,CACrC;AAEJ;","names":["SpeedInsights","import_react","getBasePath","React","getBasePath","SpeedInsights"]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/next/index.mjs b/web/node_modules/@vercel/speed-insights/dist/next/index.mjs new file mode 100644 index 0000000..e08e486 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/next/index.mjs @@ -0,0 +1,205 @@ +"use client"; + +// src/nextjs/index.tsx +import React, { Suspense } from "react"; + +// src/react/index.tsx +import { useEffect, useRef } from "react"; + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/react/utils.ts +function getBasePath() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/react/index.tsx +function SpeedInsights(props) { + useEffect(() => { + var _a; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + }, [props.beforeSend]); + const setScriptRoute = useRef(null); + useEffect(() => { + if (!setScriptRoute.current) { + const script = injectSpeedInsights({ + framework: props.framework ?? "react", + basePath: props.basePath ?? getBasePath(), + ...props + }); + if (script) { + setScriptRoute.current = script.setRoute; + } + } else if (props.route) { + setScriptRoute.current(props.route); + } + }, [props.route]); + return null; +} + +// src/nextjs/utils.ts +import { useParams, usePathname, useSearchParams } from "next/navigation.js"; +var useRoute = () => { + const params = useParams(); + const searchParams = useSearchParams() || new URLSearchParams(); + const path = usePathname(); + if (!params) { + return null; + } + const finalParams = Object.keys(params).length ? params : Object.fromEntries(searchParams.entries()); + return computeRoute(path, finalParams); +}; +function getBasePath2() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/nextjs/index.tsx +function SpeedInsightsComponent(props) { + const route = useRoute(); + return /* @__PURE__ */ React.createElement( + SpeedInsights, + { + route, + ...props, + framework: "next", + basePath: getBasePath2() + } + ); +} +function SpeedInsights2(props) { + return /* @__PURE__ */ React.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React.createElement(SpeedInsightsComponent, { ...props })); +} +export { + SpeedInsights2 as SpeedInsights +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/next/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/next/index.mjs.map new file mode 100644 index 0000000..78bf875 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/next/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/nextjs/index.tsx","../../src/react/index.tsx","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/react/utils.ts","../../src/nextjs/utils.ts"],"sourcesContent":["'use client';\n\nimport React, { Suspense } from 'react';\nimport { SpeedInsights as SpeedInsightsScript } from '../react';\nimport type { SpeedInsightsProps } from '../types';\nimport { getBasePath, useRoute } from './utils';\n\ntype Props = Omit;\n\nfunction SpeedInsightsComponent(props: Props): React.ReactElement {\n const route = useRoute();\n\n return (\n \n );\n}\n\nexport function SpeedInsights(props: Props): null {\n // Because of incompatible types between ReactNode in React 19 and React 18 we return null (which is also what we render)\n return (\n \n \n \n ) as never;\n}\n","'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { SpeedInsightsProps } from '../types';\nimport { computeRoute, injectSpeedInsights } from '../generic';\nimport { getBasePath } from './utils';\n\nexport function SpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n },\n): JSX.Element | null {\n useEffect(() => {\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n }, [props.beforeSend]);\n\n const setScriptRoute = useRef<((path: string) => void) | null>(null);\n useEffect(() => {\n if (!setScriptRoute.current) {\n const script = injectSpeedInsights({\n framework: props.framework ?? 'react',\n basePath: props.basePath ?? getBasePath(),\n ...props,\n });\n if (script) {\n setScriptRoute.current = script.setRoute;\n }\n } else if (props.route) {\n setScriptRoute.current(props.route);\n }\n }, [props.route]);\n\n return null;\n}\n\nexport { computeRoute };\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;\n}\n","'use client';\n/* eslint-disable @typescript-eslint/no-unnecessary-condition -- can be empty in pages router */\nimport { useParams, usePathname, useSearchParams } from 'next/navigation.js';\nimport { computeRoute } from '../utils';\n\nexport const useRoute = (): string | null => {\n const params = useParams();\n const searchParams = useSearchParams() || new URLSearchParams();\n const path = usePathname();\n // Until we have route parameters, we don't compute the route\n if (!params) {\n return null;\n }\n // in Next.js@13, useParams() could return an empty object for pages router, and we default to searchParams.\n const finalParams = Object.keys(params).length\n ? params\n : Object.fromEntries(searchParams.entries());\n return computeRoute(path, finalParams);\n};\n\nexport function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH;\n}\n"],"mappings":";;;AAEA,OAAO,SAAS,gBAAgB;;;ACAhC,SAAS,WAAW,cAAc;;;ACDhC,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,o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AA,MACC,GAAG;AAAA,MACJ,WAAU;AAAA,MACV,UAAUC,aAAY;AAAA;AAAA,EACxB;AAEJ;AAEO,SAASC,eAAc,OAAoB;AAEhD,SACE,oCAAC,YAAS,UAAU,QAClB,oCAAC,0BAAwB,GAAG,OAAO,CACrC;AAEJ;","names":["getBasePath","getBasePath","SpeedInsights"]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/nuxt/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.d.mts new file mode 100644 index 0000000..f2f121b --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.d.mts @@ -0,0 +1,3 @@ +declare const SpeedInsights: any; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/nuxt/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.d.ts new file mode 100644 index 0000000..f2f121b --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.d.ts @@ -0,0 +1,3 @@ +declare const SpeedInsights: any; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/nuxt/index.js b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.js new file mode 100644 index 0000000..610bea5 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.js @@ -0,0 +1,203 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/nuxt/index.ts +var nuxt_exports = {}; +__export(nuxt_exports, { + SpeedInsights: () => SpeedInsights +}); +module.exports = __toCommonJS(nuxt_exports); + +// src/vue/create-component.ts +var import_vue = require("vue"); +var import_vue_router = require("vue-router"); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/vue/utils.ts +var import_meta = {}; +function getBasePath() { + try { + return import_meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/vue/create-component.ts +function createComponent(framework = "vue") { + return (0, import_vue.defineComponent)({ + props: [ + "dsn", + "sampleRate", + "beforeSend", + "debug", + "scriptSrc", + "endpoint" + ], + setup(props) { + const route = (0, import_vue_router.useRoute)(); + const configure = injectSpeedInsights({ + ...props, + framework, + basePath: getBasePath() + }); + if (route && configure) { + const changeRoute = () => { + configure.setRoute(computeRoute(route.path, route.params)); + }; + changeRoute(); + (0, import_vue.watch)(route, changeRoute); + } + }, + // Vue component must have a render function, or a template. + render() { + return null; + } + }); +} + +// src/nuxt/index.ts +var SpeedInsights = createComponent("nuxt"); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + SpeedInsights +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/nuxt/index.js.map b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.js.map new file mode 100644 index 0000000..72e77e3 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/nuxt/index.ts","../../src/vue/create-component.ts","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/vue/utils.ts"],"sourcesContent":["import { createComponent } from '../vue/create-component';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- vue's defineComponent return type is any\nexport const SpeedInsights = createComponent('nuxt');\n","import { defineComponent, watch } from 'vue';\n// for barebone vue project, vite will issue a warning since 'vue-router' import can't be resolved,\nimport { useRoute } from 'vue-router';\nimport { injectSpeedInsights, type SpeedInsightsProps } from '../generic';\nimport { computeRoute } from '../utils';\nimport { getBasePath } from './utils';\n\nexport function createComponent(\n framework = 'vue',\n): ReturnType {\n return defineComponent({\n props: [\n 'dsn',\n 'sampleRate',\n 'beforeSend',\n 'debug',\n 'scriptSrc',\n 'endpoint',\n ],\n setup(props: Omit) {\n const route = useRoute();\n const configure = injectSpeedInsights({\n ...props,\n framework,\n basePath: getBasePath(),\n });\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project\n if (route && configure) {\n const changeRoute = (): void => {\n configure.setRoute(computeRoute(route.path, route.params));\n };\n\n changeRoute();\n watch(route, changeRoute);\n }\n },\n // Vue component must have a render function, or a template.\n render() {\n return null;\n },\n });\n}\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAuC;AAEvC,wBAAyB;;;ACDvB,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,O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AAM;AAEhC,SAAO;AAAA,IACL,UAAU,CAAC,UAA+B;AACxC,aAAO,QAAQ,QAAQ,SAAS;AAAA,IAClC;AAAA,EACF;AACF;;;AC1EA;AAAO,SAAS,cAAkC;AAIhD,MAAI;AACF,WAAO,YAAY,IAAI;AAAA,EAGzB,QAAQ;AAAA,EAER;AACF;;;ALJO,SAAS,gBACd,YAAY,OACwB;AACpC,aAAO,4BAAgB;AAAA,IACrB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,MAAM,OAA8C;AAClD,YAAM,YAAQ,4BAAS;AACvB,YAAM,YAAY,oBAAoB;AAAA,QACpC,GAAG;AAAA,QACH;AAAA,QACA,UAAU,YAAY;AAAA,MACxB,CAAC;AAED,UAAI,SAAS,WAAW;AACtB,cAAM,cAAc,MAAY;AAC9B,oBAAU,SAAS,aAAa,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA,QAC3D;AAEA,oBAAY;AACZ,8BAAM,OAAO,WAAW;AAAA,MAC1B;AAAA,IACF;AAAA;AAAA,IAEA,SAAS;AACP,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;;;ADtCO,IAAM,gBAAgB,gBAAgB,MAAM;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/nuxt/index.mjs b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.mjs new file mode 100644 index 0000000..4cf1a28 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.mjs @@ -0,0 +1,175 @@ +// src/vue/create-component.ts +import { defineComponent, watch } from "vue"; +import { useRoute } from "vue-router"; + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/vue/utils.ts +function getBasePath() { + try { + return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/vue/create-component.ts +function createComponent(framework = "vue") { + return defineComponent({ + props: [ + "dsn", + "sampleRate", + "beforeSend", + "debug", + "scriptSrc", + "endpoint" + ], + setup(props) { + const route = useRoute(); + const configure = injectSpeedInsights({ + ...props, + framework, + basePath: getBasePath() + }); + if (route && configure) { + const changeRoute = () => { + configure.setRoute(computeRoute(route.path, route.params)); + }; + changeRoute(); + watch(route, changeRoute); + } + }, + // Vue component must have a render function, or a template. + render() { + return null; + } + }); +} + +// src/nuxt/index.ts +var SpeedInsights = createComponent("nuxt"); +export { + SpeedInsights +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/nuxt/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.mjs.map new file mode 100644 index 0000000..159fe8b --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/nuxt/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/vue/create-component.ts","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/vue/utils.ts","../../src/nuxt/index.ts"],"sourcesContent":["import { defineComponent, watch } from 'vue';\n// for barebone vue project, vite will issue a warning since 'vue-router' import can't be resolved,\nimport { useRoute } from 'vue-router';\nimport { injectSpeedInsights, type SpeedInsightsProps } from '../generic';\nimport { computeRoute } from '../utils';\nimport { getBasePath } from './utils';\n\nexport function createComponent(\n framework = 'vue',\n): ReturnType {\n return defineComponent({\n props: [\n 'dsn',\n 'sampleRate',\n 'beforeSend',\n 'debug',\n 'scriptSrc',\n 'endpoint',\n ],\n setup(props: Omit) {\n const route = useRoute();\n const configure = injectSpeedInsights({\n ...props,\n framework,\n basePath: getBasePath(),\n });\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project\n if (route && configure) {\n const changeRoute = (): void => {\n configure.setRoute(computeRoute(route.path, route.params));\n };\n\n changeRoute();\n watch(route, changeRoute);\n }\n },\n // Vue component must have a render function, or a template.\n render() {\n return null;\n },\n });\n}\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n","import { createComponent } from '../vue/create-component';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- vue's defineComponent return type is any\nexport const SpeedInsights = createComponent('nuxt');\n"],"mappings":";AAAA,SAAS,iBAAiB,aAAa;AAEvC,SAAS,gBAAgB;;;ACDvB,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,U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YAAY;AAAA,MACxB,CAAC;AAED,UAAI,SAAS,WAAW;AACtB,cAAM,cAAc,MAAY;AAC9B,oBAAU,SAAS,aAAa,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA,QAC3D;AAEA,oBAAY;AACZ,cAAM,OAAO,WAAW;AAAA,MAC1B;AAAA,IACF;AAAA;AAAA,IAEA,SAAS;AACP,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;;;AMtCO,IAAM,gBAAgB,gBAAgB,MAAM;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/react/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/react/index.d.mts new file mode 100644 index 0000000..f3de2e9 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/react/index.d.mts @@ -0,0 +1,43 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights$1 { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights$1['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights$1['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function computeRoute(pathname: string | null, pathParams: Record | null): string | null; + +declare function SpeedInsights(props: SpeedInsightsProps & { + framework?: string; + basePath?: string; +}): JSX.Element | null; + +export { SpeedInsights, computeRoute }; diff --git a/web/node_modules/@vercel/speed-insights/dist/react/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/react/index.d.ts new file mode 100644 index 0000000..f3de2e9 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/react/index.d.ts @@ -0,0 +1,43 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights$1 { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights$1['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights$1['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function computeRoute(pathname: string | null, pathParams: Record | null): string | null; + +declare function SpeedInsights(props: SpeedInsightsProps & { + framework?: string; + basePath?: string; +}): JSX.Element | null; + +export { SpeedInsights, computeRoute }; diff --git a/web/node_modules/@vercel/speed-insights/dist/react/index.js b/web/node_modules/@vercel/speed-insights/dist/react/index.js new file mode 100644 index 0000000..348d8c5 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/react/index.js @@ -0,0 +1,192 @@ +"use strict"; +"use client"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/react/index.tsx +var react_exports = {}; +__export(react_exports, { + SpeedInsights: () => SpeedInsights, + computeRoute: () => computeRoute +}); +module.exports = __toCommonJS(react_exports); +var import_react = require("react"); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/react/utils.ts +function getBasePath() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/react/index.tsx +function SpeedInsights(props) { + (0, import_react.useEffect)(() => { + var _a; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + }, [props.beforeSend]); + const setScriptRoute = (0, import_react.useRef)(null); + (0, import_react.useEffect)(() => { + if (!setScriptRoute.current) { + const script = injectSpeedInsights({ + framework: props.framework ?? "react", + basePath: props.basePath ?? getBasePath(), + ...props + }); + if (script) { + setScriptRoute.current = script.setRoute; + } + } else if (props.route) { + setScriptRoute.current(props.route); + } + }, [props.route]); + return null; +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + SpeedInsights, + computeRoute +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/react/index.js.map b/web/node_modules/@vercel/speed-insights/dist/react/index.js.map new file mode 100644 index 0000000..98dd05c --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/react/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/react/index.tsx","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/react/utils.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { SpeedInsightsProps } from '../types';\nimport { computeRoute, injectSpeedInsights } from '../generic';\nimport { getBasePath } from './utils';\n\nexport function SpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n },\n): JSX.Element | null {\n useEffect(() => {\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n }, [props.beforeSend]);\n\n const setScriptRoute = useRef<((path: string) => void) | null>(null);\n useEffect(() => {\n if (!setScriptRoute.current) {\n const script = injectSpeedInsights({\n framework: props.framework ?? 'react',\n basePath: props.basePath ?? getBasePath(),\n ...props,\n });\n if (script) {\n setScriptRoute.current = script.setRoute;\n }\n } else if (props.route) {\n setScriptRoute.current(props.route);\n }\n }, [props.route]);\n\n return null;\n}\n\nexport { computeRoute };\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAkC;;;ACDhC,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAA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AAO;AAAA,EACT;AACA,SAAO,QAAQ,IAAI;AACrB;;;ALFO,SAAS,cACd,OAIoB;AACpB,8BAAU,MAAM;AAblB;AAcI,QAAI,MAAM,YAAY;AACpB,mBAAO,OAAP,gCAAY,cAAc,MAAM;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,MAAM,UAAU,CAAC;AAErB,QAAM,qBAAiB,qBAAwC,IAAI;AACnE,8BAAU,MAAM;AACd,QAAI,CAAC,eAAe,SAAS;AAC3B,YAAM,SAAS,oBAAoB;AAAA,QACjC,WAAW,MAAM,aAAa;AAAA,QAC9B,UAAU,MAAM,YAAY,YAAY;AAAA,QACxC,GAAG;AAAA,MACL,CAAC;AACD,UAAI,QAAQ;AACV,uBAAe,UAAU,OAAO;AAAA,MAClC;AAAA,IACF,WAAW,MAAM,OAAO;AACtB,qBAAe,QAAQ,MAAM,KAAK;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,MAAM,KAAK,CAAC;AAEhB,SAAO;AACT;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/react/index.mjs b/web/node_modules/@vercel/speed-insights/dist/react/index.mjs new file mode 100644 index 0000000..4618371 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/react/index.mjs @@ -0,0 +1,167 @@ +"use client"; + +// src/react/index.tsx +import { useEffect, useRef } from "react"; + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/react/utils.ts +function getBasePath() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/react/index.tsx +function SpeedInsights(props) { + useEffect(() => { + var _a; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + }, [props.beforeSend]); + const setScriptRoute = useRef(null); + useEffect(() => { + if (!setScriptRoute.current) { + const script = injectSpeedInsights({ + framework: props.framework ?? "react", + basePath: props.basePath ?? getBasePath(), + ...props + }); + if (script) { + setScriptRoute.current = script.setRoute; + } + } else if (props.route) { + setScriptRoute.current(props.route); + } + }, [props.route]); + return null; +} +export { + SpeedInsights, + computeRoute +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/react/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/react/index.mjs.map new file mode 100644 index 0000000..20ff3da --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/react/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/react/index.tsx","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/react/utils.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { SpeedInsightsProps } from '../types';\nimport { computeRoute, injectSpeedInsights } from '../generic';\nimport { getBasePath } from './utils';\n\nexport function SpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n },\n): JSX.Element | null {\n useEffect(() => {\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n }, [props.beforeSend]);\n\n const setScriptRoute = useRef<((path: string) => void) | null>(null);\n useEffect(() => {\n if (!setScriptRoute.current) {\n const script = injectSpeedInsights({\n framework: props.framework ?? 'react',\n basePath: props.basePath ?? getBasePath(),\n ...props,\n });\n if (script) {\n setScriptRoute.current = script.setRoute;\n }\n } else if (props.route) {\n setScriptRoute.current(props.route);\n }\n }, [props.route]);\n\n return null;\n}\n\nexport { computeRoute };\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;\n}\n"],"mappings":";;;AAEA,SAAS,WAAW,cAAc;;;ACDhC,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,UAAM,UAAU,OAAO,QAAQ,UAAU;AAEzC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,UAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,cAAM,UAAU,kBAAkB,KAAK;AACvC,YAAI,QAAQ,KAAK,MAAM,GAAG;AACxB,mBAAS,OAAO,QAAQ,SAAS,KAAK,GAAG,GAAG;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAEA,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,UAA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AAO;AACT;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/remix/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/remix/index.d.mts new file mode 100644 index 0000000..3fba54f --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/remix/index.d.mts @@ -0,0 +1,38 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights$1 { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights$1['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights$1['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function SpeedInsights(props: Omit): JSX.Element; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/remix/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/remix/index.d.ts new file mode 100644 index 0000000..3fba54f --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/remix/index.d.ts @@ -0,0 +1,38 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights$1 { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights$1['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights$1['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function SpeedInsights(props: Omit): JSX.Element; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/remix/index.js b/web/node_modules/@vercel/speed-insights/dist/remix/index.js new file mode 100644 index 0000000..3eb8666 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/remix/index.js @@ -0,0 +1,231 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/remix/index.tsx +var remix_exports = {}; +__export(remix_exports, { + SpeedInsights: () => SpeedInsights2 +}); +module.exports = __toCommonJS(remix_exports); +var import_react3 = __toESM(require("react")); + +// src/react/index.tsx +var import_react = require("react"); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/react/utils.ts +function getBasePath() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/react/index.tsx +function SpeedInsights(props) { + (0, import_react.useEffect)(() => { + var _a; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + }, [props.beforeSend]); + const setScriptRoute = (0, import_react.useRef)(null); + (0, import_react.useEffect)(() => { + if (!setScriptRoute.current) { + const script = injectSpeedInsights({ + framework: props.framework ?? "react", + basePath: props.basePath ?? getBasePath(), + ...props + }); + if (script) { + setScriptRoute.current = script.setRoute; + } + } else if (props.route) { + setScriptRoute.current(props.route); + } + }, [props.route]); + return null; +} + +// src/remix/utils.ts +var import_react2 = require("@remix-run/react"); +var import_meta = {}; +var useRoute = () => { + const params = (0, import_react2.useParams)(); + const location = (0, import_react2.useLocation)(); + return computeRoute(location.pathname, params); +}; +function getBasePath2() { + try { + return import_meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/remix/index.tsx +function SpeedInsights2(props) { + const route = useRoute(); + return /* @__PURE__ */ import_react3.default.createElement( + SpeedInsights, + { + route, + ...props, + framework: "remix", + basePath: getBasePath2() + } + ); +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + SpeedInsights +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/remix/index.js.map b/web/node_modules/@vercel/speed-insights/dist/remix/index.js.map new file mode 100644 index 0000000..317bd76 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/remix/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/remix/index.tsx","../../src/react/index.tsx","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/react/utils.ts","../../src/remix/utils.ts"],"sourcesContent":["import React from 'react';\nimport { SpeedInsights as SpeedInsightsScript } from '../react';\nimport type { SpeedInsightsProps } from '../types';\nimport { getBasePath, useRoute } from './utils';\n\nexport function SpeedInsights(\n props: Omit,\n): JSX.Element {\n const route = useRoute();\n\n return (\n \n );\n}\n","'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { SpeedInsightsProps } from '../types';\nimport { computeRoute, injectSpeedInsights } from '../generic';\nimport { getBasePath } from './utils';\n\nexport function SpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n },\n): JSX.Element | null {\n useEffect(() => {\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n }, [props.beforeSend]);\n\n const setScriptRoute = useRef<((path: string) => void) | null>(null);\n useEffect(() => {\n if (!setScriptRoute.current) {\n const script = injectSpeedInsights({\n framework: props.framework ?? 'react',\n basePath: props.basePath ?? getBasePath(),\n ...props,\n });\n if (script) {\n setScriptRoute.current = script.setRoute;\n }\n } else if (props.route) {\n setScriptRoute.current(props.route);\n }\n }, [props.route]);\n\n return null;\n}\n\nexport { computeRoute };\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;\n}\n","import { useLocation, useParams } from '@remix-run/react';\nimport { computeRoute } from '../utils';\n\nexport const useRoute = (): string | null => {\n const params = useParams();\n const location = useLocation();\n\n return computeRoute(location.pathname, params as never);\n};\n\nexport function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA;AAAA;AAAA,IAAAC,gBAAkB;;;ACElB,mBAAkC;;;ACDhC,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,UAAM,UAAU,OAAO,QAAQ,UAAU;AAEzC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,UAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,cAAM,UAAU,kBAAkB,KAAK;AACvC,YAAI,QAAQ,KAAK,MAAM,GAAG;AACxB,mBAAS,OAAO,QAAQ,SAAS,KAAK,GAAG,GAAG;AAAA,QAC9C;AAAA,MACF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KAAK;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,MAAM,KAAK,CAAC;AAEhB,SAAO;AACT;;;AMpCA,IAAAC,gBAAuC;AAAvC;AAGO,IAAM,WAAW,MAAqB;AAC3C,QAAM,aAAS,yBAAU;AACzB,QAAM,eAAW,2BAAY;AAE7B,SAAO,aAAa,SAAS,UAAU,MAAe;AACxD;AAEO,SAASC,eAAkC;AAIhD,MAAI;AACF,WAAO,YAAY,IAAI;AAAA,EAGzB,QAAQ;AAAA,EAER;AACF;;;APhBO,SAASC,eACd,OACa;AACb,QAAM,QAAQ,SAAS;AAEvB,SACE,8BAAAC,QAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ,WAAU;AAAA,MACV,UAAUC,aAAY;AAAA;AAAA,EACxB;AAEJ;","names":["SpeedInsights","import_react","import_react","getBasePath","SpeedInsights","React","getBasePath"]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/remix/index.mjs b/web/node_modules/@vercel/speed-insights/dist/remix/index.mjs new file mode 100644 index 0000000..791e442 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/remix/index.mjs @@ -0,0 +1,195 @@ +// src/remix/index.tsx +import React from "react"; + +// src/react/index.tsx +import { useEffect, useRef } from "react"; + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/react/utils.ts +function getBasePath() { + if (typeof process === "undefined" || typeof process.env === "undefined") { + return void 0; + } + return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH; +} + +// src/react/index.tsx +function SpeedInsights(props) { + useEffect(() => { + var _a; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + }, [props.beforeSend]); + const setScriptRoute = useRef(null); + useEffect(() => { + if (!setScriptRoute.current) { + const script = injectSpeedInsights({ + framework: props.framework ?? "react", + basePath: props.basePath ?? getBasePath(), + ...props + }); + if (script) { + setScriptRoute.current = script.setRoute; + } + } else if (props.route) { + setScriptRoute.current(props.route); + } + }, [props.route]); + return null; +} + +// src/remix/utils.ts +import { useLocation, useParams } from "@remix-run/react"; +var useRoute = () => { + const params = useParams(); + const location = useLocation(); + return computeRoute(location.pathname, params); +}; +function getBasePath2() { + try { + return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/remix/index.tsx +function SpeedInsights2(props) { + const route = useRoute(); + return /* @__PURE__ */ React.createElement( + SpeedInsights, + { + route, + ...props, + framework: "remix", + basePath: getBasePath2() + } + ); +} +export { + SpeedInsights2 as SpeedInsights +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/remix/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/remix/index.mjs.map new file mode 100644 index 0000000..ba18291 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/remix/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/remix/index.tsx","../../src/react/index.tsx","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/react/utils.ts","../../src/remix/utils.ts"],"sourcesContent":["import React from 'react';\nimport { SpeedInsights as SpeedInsightsScript } from '../react';\nimport type { SpeedInsightsProps } from '../types';\nimport { getBasePath, useRoute } from './utils';\n\nexport function SpeedInsights(\n props: Omit,\n): JSX.Element {\n const route = useRoute();\n\n return (\n \n );\n}\n","'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { SpeedInsightsProps } from '../types';\nimport { computeRoute, injectSpeedInsights } from '../generic';\nimport { getBasePath } from './utils';\n\nexport function SpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n },\n): JSX.Element | null {\n useEffect(() => {\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n }, [props.beforeSend]);\n\n const setScriptRoute = useRef<((path: string) => void) | null>(null);\n useEffect(() => {\n if (!setScriptRoute.current) {\n const script = injectSpeedInsights({\n framework: props.framework ?? 'react',\n basePath: props.basePath ?? getBasePath(),\n ...props,\n });\n if (script) {\n setScriptRoute.current = script.setRoute;\n }\n } else if (props.route) {\n setScriptRoute.current(props.route);\n }\n }, [props.route]);\n\n return null;\n}\n\nexport { computeRoute };\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using process.env[varname]\n // some bundles won't replace the value at build time.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- we can't use optionnal here, it'll break if process does not exist.\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return undefined;\n }\n return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;\n}\n","import { useLocation, useParams } from '@remix-run/react';\nimport { computeRoute } from '../utils';\n\nexport const useRoute = (): string | null => {\n const params = useParams();\n const location = useLocation();\n\n return computeRoute(location.pathname, params as never);\n};\n\nexport function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n"],"mappings":";AAAA,OAAO,WAAW;;;ACElB,SAAS,WAAW,cAAc;;;ACDhC,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC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file diff --git a/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.d.mts new file mode 100644 index 0000000..d7345a7 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.d.mts @@ -0,0 +1,38 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function injectSpeedInsights(props?: Omit): void; + +export { injectSpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.d.ts new file mode 100644 index 0000000..d7345a7 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.d.ts @@ -0,0 +1,38 @@ +interface SpeedInsightsProps { + dsn?: string; + sampleRate?: number; + route?: string | null; + beforeSend?: BeforeSendMiddleware; + debug?: boolean; + scriptSrc?: string; + endpoint?: string; +} +type EventTypes = 'vital'; +interface Event { + type: EventTypes; + url: string; + route?: string; +} +type BeforeSendMiddleware = (data: Event) => Event | null | undefined | false; +interface Functions { + beforeSend?: BeforeSendMiddleware; +} +interface SpeedInsights { + queue: [T, Functions[T]][]; + addAction: (action: T, data: Functions[T]) => void; +} +declare global { + interface Window { + /** Base interface to track events */ + si?: SpeedInsights['addAction']; + /** Queue for speed insights datapoints, before the library is loaded */ + siq?: SpeedInsights['queue']; + sil?: boolean; + /** used by Astro component only */ + speedInsightsBeforeSend?: BeforeSendMiddleware; + } +} + +declare function injectSpeedInsights(props?: Omit): void; + +export { injectSpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.js b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.js new file mode 100644 index 0000000..3db9e18 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.js @@ -0,0 +1,154 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/sveltekit/index.ts +var sveltekit_exports = {}; +__export(sveltekit_exports, { + injectSpeedInsights: () => injectSpeedInsights2 +}); +module.exports = __toCommonJS(sveltekit_exports); +var import_store = require("svelte/store"); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/sveltekit/utils.ts +var import_meta = {}; +function getBasePath() { + try { + return import_meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/sveltekit/index.ts +var import_stores = require("$app/stores"); +var import_environment = require("$app/environment"); +function injectSpeedInsights2(props = {}) { + var _a; + if (import_environment.browser) { + const speedInsights = injectSpeedInsights({ + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route could be undefined in layout.js file + route: (_a = (0, import_store.get)(import_stores.page).route) == null ? void 0 : _a.id, + ...props, + framework: "sveltekit", + basePath: getBasePath() + }); + if (speedInsights) { + import_stores.page.subscribe((value) => { + var _a2; + if ((_a2 = value.route) == null ? void 0 : _a2.id) { + speedInsights.setRoute(value.route.id); + } + }); + } + } +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + injectSpeedInsights +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.js.map b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.js.map new file mode 100644 index 0000000..8ba10c2 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/sveltekit/index.ts","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/sveltekit/utils.ts"],"sourcesContent":["import { get } from 'svelte/store';\nimport {\n injectSpeedInsights as genericInject,\n type SpeedInsightsProps,\n} from '../generic';\nimport { getBasePath } from './utils';\nimport { page } from '$app/stores';\nimport { browser } from '$app/environment';\nimport type {} from '@sveltejs/kit'; // don't remove, ensures ambient types for $app/* are loaded\n\nexport function injectSpeedInsights(\n props: Omit = {},\n): void {\n if (browser) {\n const speedInsights = genericInject({\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route could be undefined in layout.js file\n route: get(page).route?.id,\n ...props,\n framework: 'sveltekit',\n basePath: getBasePath(),\n });\n\n if (speedInsights) {\n page.subscribe((value) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route could be undefined in layout.js file\n if (value.route?.id) {\n speedInsights.setRoute(value.route.id);\n }\n });\n }\n }\n}\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,6BAAAA;AAAA;AAAA;AAAA,mBAAoB;;;ACClB,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEn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O,QAAQ,QAAQ,MAAM;AAAA,EAC/B;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,QAAQ,WAAW,MAAM;AAAA,EAClC,WAAW,MAAM,UAAU;AACzB,WAAO,QAAQ,WAAW,GAAG,MAAM,QAAQ;AAAA,EAC7C;AACA,MAAI,MAAM,KAAK;AACb,WAAO,QAAQ,MAAM,MAAM;AAAA,EAC7B;AACA,MAAI,cAAc,KAAK,MAAM,UAAU,OAAO;AAC5C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,SAAO,UAAU,MAAY;AAE3B,YAAQ;AAAA,MACN,sDAAsD,GAAG;AAAA,IAC3D;AAAA,EACF;AAEA,WAAS,KAAK,YAAY,MAAM;AAEhC,SAAO;AAAA,IACL,UAAU,CAAC,UAA+B;AACxC,aAAO,QAAQ,QAAQ,SAAS;AAAA,IAClC;AAAA,EACF;AACF;;;AC1EA;AAAO,SAAS,cAAkC;AAIhD,MAAI;AACF,WAAO,YAAY,IAAI;AAAA,EAGzB,QAAQ;AAAA,EAER;AACF;;;ALLA,oBAAqB;AACrB,yBAAwB;AAGjB,SAASC,qBACd,QAA+C,CAAC,GAC1C;AAZR;AAaE,MAAI,4BAAS;AACX,UAAM,gBAAgB,oBAAc;AAAA;AAAA,MAElC,QAAO,2BAAI,kBAAI,EAAE,UAAV,mBAAiB;AAAA,MACxB,GAAG;AAAA,MACH,WAAW;AAAA,MACX,UAAU,YAAY;AAAA,IACxB,CAAC;AAED,QAAI,eAAe;AACjB,yBAAK,UAAU,CAAC,UAAU;AAvBhC,YAAAC;AAyBQ,aAAIA,MAAA,MAAM,UAAN,gBAAAA,IAAa,IAAI;AACnB,wBAAc,SAAS,MAAM,MAAM,EAAE;AAAA,QACvC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["injectSpeedInsights","injectSpeedInsights","_a"]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.mjs b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.mjs new file mode 100644 index 0000000..1f091e0 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.mjs @@ -0,0 +1,128 @@ +// src/sveltekit/index.ts +import { get } from "svelte/store"; + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/sveltekit/utils.ts +function getBasePath() { + try { + return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/sveltekit/index.ts +import { page } from "$app/stores"; +import { browser } from "$app/environment"; +function injectSpeedInsights2(props = {}) { + var _a; + if (browser) { + const speedInsights = injectSpeedInsights({ + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route could be undefined in layout.js file + route: (_a = get(page).route) == null ? void 0 : _a.id, + ...props, + framework: "sveltekit", + basePath: getBasePath() + }); + if (speedInsights) { + page.subscribe((value) => { + var _a2; + if ((_a2 = value.route) == null ? void 0 : _a2.id) { + speedInsights.setRoute(value.route.id); + } + }); + } + } +} +export { + injectSpeedInsights2 as injectSpeedInsights +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.mjs.map new file mode 100644 index 0000000..2c4524c --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/sveltekit/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/sveltekit/index.ts","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/sveltekit/utils.ts"],"sourcesContent":["import { get } from 'svelte/store';\nimport {\n injectSpeedInsights as genericInject,\n type SpeedInsightsProps,\n} from '../generic';\nimport { getBasePath } from './utils';\nimport { page } from '$app/stores';\nimport { browser } from '$app/environment';\nimport type {} from '@sveltejs/kit'; // don't remove, ensures ambient types for $app/* are loaded\n\nexport function injectSpeedInsights(\n props: Omit = {},\n): void {\n if (browser) {\n const speedInsights = genericInject({\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route could be undefined in layout.js file\n route: get(page).route?.id,\n ...props,\n framework: 'sveltekit',\n basePath: getBasePath(),\n });\n\n if (speedInsights) {\n page.subscribe((value) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route could be undefined in layout.js file\n if (value.route?.id) {\n speedInsights.setRoute(value.route.id);\n }\n });\n }\n }\n}\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n"],"mappings":";AAAA,SAAS,WAAW;;;ACClB,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AA6CO,SAAS,aACd,OACQ;AACR,MAAI,MAAM,WAAW;AACnB,WAAO,MAAM;AAAA,EACf;AACA,MAAI,cAAc,GAAG;AACnB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,KAAK;AACb,WAAO;AAAA,EACT;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,GAAG,MAAM,QAAQ;AAAA,EAC1B;AACA,SAAO;AACT;;;ACvEA,SAAS,oBACP,QAGI,CAAC,GAGE;AArBT;AAuBE,MAAI,CAAC,UAAU,KAAK,MAAM,UAAU,KAAM,QAAO;AAEjD,YAAU;AAEV,QAAM,MAAM,aAAa,KAAK;AAE9B,MAAI,SAAS,KAAK,cAAc,g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AA,MACH,WAAW;AAAA,MACX,UAAU,YAAY;AAAA,IACxB,CAAC;AAED,QAAI,eAAe;AACjB,WAAK,UAAU,CAAC,UAAU;AAvBhC,YAAAC;AAyBQ,aAAIA,MAAA,MAAM,UAAN,gBAAAA,IAAa,IAAI;AACnB,wBAAc,SAAS,MAAM,MAAM,EAAE;AAAA,QACvC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["injectSpeedInsights","_a"]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/vue/index.d.mts b/web/node_modules/@vercel/speed-insights/dist/vue/index.d.mts new file mode 100644 index 0000000..f2f121b --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/vue/index.d.mts @@ -0,0 +1,3 @@ +declare const SpeedInsights: any; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/vue/index.d.ts b/web/node_modules/@vercel/speed-insights/dist/vue/index.d.ts new file mode 100644 index 0000000..f2f121b --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/vue/index.d.ts @@ -0,0 +1,3 @@ +declare const SpeedInsights: any; + +export { SpeedInsights }; diff --git a/web/node_modules/@vercel/speed-insights/dist/vue/index.js b/web/node_modules/@vercel/speed-insights/dist/vue/index.js new file mode 100644 index 0000000..3bd7c17 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/vue/index.js @@ -0,0 +1,203 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/vue/index.ts +var vue_exports = {}; +__export(vue_exports, { + SpeedInsights: () => SpeedInsights +}); +module.exports = __toCommonJS(vue_exports); + +// src/vue/create-component.ts +var import_vue = require("vue"); +var import_vue_router = require("vue-router"); + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/vue/utils.ts +var import_meta = {}; +function getBasePath() { + try { + return import_meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/vue/create-component.ts +function createComponent(framework = "vue") { + return (0, import_vue.defineComponent)({ + props: [ + "dsn", + "sampleRate", + "beforeSend", + "debug", + "scriptSrc", + "endpoint" + ], + setup(props) { + const route = (0, import_vue_router.useRoute)(); + const configure = injectSpeedInsights({ + ...props, + framework, + basePath: getBasePath() + }); + if (route && configure) { + const changeRoute = () => { + configure.setRoute(computeRoute(route.path, route.params)); + }; + changeRoute(); + (0, import_vue.watch)(route, changeRoute); + } + }, + // Vue component must have a render function, or a template. + render() { + return null; + } + }); +} + +// src/vue/index.ts +var SpeedInsights = createComponent(); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + SpeedInsights +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/vue/index.js.map b/web/node_modules/@vercel/speed-insights/dist/vue/index.js.map new file mode 100644 index 0000000..29c5a7c --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/vue/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/vue/index.ts","../../src/vue/create-component.ts","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/vue/utils.ts"],"sourcesContent":["import { createComponent } from './create-component';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- vue's defineComponent return type is any\nexport const SpeedInsights = createComponent();\n","import { defineComponent, watch } from 'vue';\n// for barebone vue project, vite will issue a warning since 'vue-router' import can't be resolved,\nimport { useRoute } from 'vue-router';\nimport { injectSpeedInsights, type SpeedInsightsProps } from '../generic';\nimport { computeRoute } from '../utils';\nimport { getBasePath } from './utils';\n\nexport function createComponent(\n framework = 'vue',\n): ReturnType {\n return defineComponent({\n props: [\n 'dsn',\n 'sampleRate',\n 'beforeSend',\n 'debug',\n 'scriptSrc',\n 'endpoint',\n ],\n setup(props: Omit) {\n const route = useRoute();\n const configure = injectSpeedInsights({\n ...props,\n framework,\n basePath: getBasePath(),\n });\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project\n if (route && configure) {\n const changeRoute = (): void => {\n configure.setRoute(computeRoute(route.path, route.params));\n };\n\n changeRoute();\n watch(route, changeRoute);\n }\n },\n // Vue component must have a render function, or a template.\n render() {\n return null;\n },\n });\n}\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAuC;AAEvC,wBAAyB;;;ACDvB,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;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KAAK,YAAY,MAAM;AAEhC,SAAO;AAAA,IACL,UAAU,CAAC,UAA+B;AACxC,aAAO,QAAQ,QAAQ,SAAS;AAAA,IAClC;AAAA,EACF;AACF;;;AC1EA;AAAO,SAAS,cAAkC;AAIhD,MAAI;AACF,WAAO,YAAY,IAAI;AAAA,EAGzB,QAAQ;AAAA,EAER;AACF;;;ALJO,SAAS,gBACd,YAAY,OACwB;AACpC,aAAO,4BAAgB;AAAA,IACrB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,MAAM,OAA8C;AAClD,YAAM,YAAQ,4BAAS;AACvB,YAAM,YAAY,oBAAoB;AAAA,QACpC,GAAG;AAAA,QACH;AAAA,QACA,UAAU,YAAY;AAAA,MACxB,CAAC;AAED,UAAI,SAAS,WAAW;AACtB,cAAM,cAAc,MAAY;AAC9B,oBAAU,SAAS,aAAa,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA,QAC3D;AAEA,oBAAY;AACZ,8BAAM,OAAO,WAAW;AAAA,MAC1B;AAAA,IACF;AAAA;AAAA,IAEA,SAAS;AACP,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;;;ADtCO,IAAM,gBAAgB,gBAAgB;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/vue/index.mjs b/web/node_modules/@vercel/speed-insights/dist/vue/index.mjs new file mode 100644 index 0000000..e8a3fb2 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/vue/index.mjs @@ -0,0 +1,175 @@ +// src/vue/create-component.ts +import { defineComponent, watch } from "vue"; +import { useRoute } from "vue-router"; + +// package.json +var name = "@vercel/speed-insights"; +var version = "1.3.1"; + +// src/queue.ts +var initQueue = () => { + if (window.si) return; + window.si = function a(...params) { + (window.siq = window.siq || []).push(params); + }; +}; + +// src/utils.ts +function isBrowser() { + return typeof window !== "undefined"; +} +function detectEnvironment() { + try { + const env = process.env.NODE_ENV; + if (env === "development" || env === "test") { + return "development"; + } + } catch (e) { + } + return "production"; +} +function isDevelopment() { + return detectEnvironment() === "development"; +} +function computeRoute(pathname, pathParams) { + if (!pathname || !pathParams) { + return pathname; + } + let result = pathname; + try { + const entries = Object.entries(pathParams); + for (const [key, value] of entries) { + if (!Array.isArray(value)) { + const matcher = turnValueToRegExp(value); + if (matcher.test(result)) { + result = result.replace(matcher, `/[${key}]`); + } + } + } + for (const [key, value] of entries) { + if (Array.isArray(value)) { + const matcher = turnValueToRegExp(value.join("/")); + if (matcher.test(result)) { + result = result.replace(matcher, `/[...${key}]`); + } + } + } + return result; + } catch (e) { + return pathname; + } +} +function turnValueToRegExp(value) { + return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`); +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function getScriptSrc(props) { + if (props.scriptSrc) { + return props.scriptSrc; + } + if (isDevelopment()) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.debug.js"; + } + if (props.dsn) { + return "https://va.vercel-scripts.com/v1/speed-insights/script.js"; + } + if (props.basePath) { + return `${props.basePath}/speed-insights/script.js`; + } + return "/_vercel/speed-insights/script.js"; +} + +// src/generic.ts +function injectSpeedInsights(props = {}) { + var _a; + if (!isBrowser() || props.route === null) return null; + initQueue(); + const src = getScriptSrc(props); + if (document.head.querySelector(`script[src*="${src}"]`)) return null; + if (props.beforeSend) { + (_a = window.si) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend); + } + const script = document.createElement("script"); + script.src = src; + script.defer = true; + script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : ""); + script.dataset.sdkv = version; + if (props.sampleRate) { + script.dataset.sampleRate = props.sampleRate.toString(); + } + if (props.route) { + script.dataset.route = props.route; + } + if (props.endpoint) { + script.dataset.endpoint = props.endpoint; + } else if (props.basePath) { + script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`; + } + if (props.dsn) { + script.dataset.dsn = props.dsn; + } + if (isDevelopment() && props.debug === false) { + script.dataset.debug = "false"; + } + script.onerror = () => { + console.log( + `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.` + ); + }; + document.head.appendChild(script); + return { + setRoute: (route) => { + script.dataset.route = route ?? void 0; + } + }; +} + +// src/vue/utils.ts +function getBasePath() { + try { + return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH; + } catch { + } +} + +// src/vue/create-component.ts +function createComponent(framework = "vue") { + return defineComponent({ + props: [ + "dsn", + "sampleRate", + "beforeSend", + "debug", + "scriptSrc", + "endpoint" + ], + setup(props) { + const route = useRoute(); + const configure = injectSpeedInsights({ + ...props, + framework, + basePath: getBasePath() + }); + if (route && configure) { + const changeRoute = () => { + configure.setRoute(computeRoute(route.path, route.params)); + }; + changeRoute(); + watch(route, changeRoute); + } + }, + // Vue component must have a render function, or a template. + render() { + return null; + } + }); +} + +// src/vue/index.ts +var SpeedInsights = createComponent(); +export { + SpeedInsights +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/dist/vue/index.mjs.map b/web/node_modules/@vercel/speed-insights/dist/vue/index.mjs.map new file mode 100644 index 0000000..cf770c5 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/dist/vue/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/vue/create-component.ts","../../package.json","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts","../../src/vue/utils.ts","../../src/vue/index.ts"],"sourcesContent":["import { defineComponent, watch } from 'vue';\n// for barebone vue project, vite will issue a warning since 'vue-router' import can't be resolved,\nimport { useRoute } from 'vue-router';\nimport { injectSpeedInsights, type SpeedInsightsProps } from '../generic';\nimport { computeRoute } from '../utils';\nimport { getBasePath } from './utils';\n\nexport function createComponent(\n framework = 'vue',\n): ReturnType {\n return defineComponent({\n props: [\n 'dsn',\n 'sampleRate',\n 'beforeSend',\n 'debug',\n 'scriptSrc',\n 'endpoint',\n ],\n setup(props: Omit) {\n const route = useRoute();\n const configure = injectSpeedInsights({\n ...props,\n framework,\n basePath: getBasePath(),\n });\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project\n if (route && configure) {\n const changeRoute = (): void => {\n configure.setRoute(computeRoute(route.path, route.params));\n };\n\n changeRoute();\n watch(route, changeRoute);\n }\n },\n // Vue component must have a render function, or a template.\n render() {\n return null;\n },\n });\n}\n","{\n \"name\": \"@vercel/speed-insights\",\n \"version\": \"1.3.1\",\n \"description\": \"Speed Insights is a tool for measuring web performance and providing suggestions for improvement.\",\n \"keywords\": [\n \"speed-insights\",\n \"vercel\"\n ],\n \"repository\": {\n \"url\": \"github:vercel/speed-insights\",\n \"directory\": \"packages/web\"\n },\n \"license\": \"Apache-2.0\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"browser\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./astro\": {\n \"import\": \"./dist/astro/component.ts\"\n },\n \"./next\": {\n \"browser\": \"./dist/next/index.mjs\",\n \"import\": \"./dist/next/index.mjs\",\n \"require\": \"./dist/next/index.js\"\n },\n \"./nuxt\": {\n \"browser\": \"./dist/nuxt/index.mjs\",\n \"import\": \"./dist/nuxt/index.mjs\",\n \"require\": \"./dist/nuxt/index.js\"\n },\n \"./react\": {\n \"browser\": \"./dist/react/index.mjs\",\n \"import\": \"./dist/react/index.mjs\",\n \"require\": \"./dist/react/index.js\"\n },\n \"./remix\": {\n \"browser\": \"./dist/remix/index.mjs\",\n \"import\": \"./dist/remix/index.mjs\",\n \"require\": \"./dist/remix/index.js\"\n },\n \"./sveltekit\": {\n \"types\": \"./dist/sveltekit/index.d.ts\",\n \"svelte\": \"./dist/sveltekit/index.mjs\"\n },\n \"./vue\": {\n \"browser\": \"./dist/vue/index.mjs\",\n \"import\": \"./dist/vue/index.mjs\",\n \"require\": \"./dist/vue/index.js\"\n }\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"dist/index.d.ts\"\n ],\n \"react\": [\n \"dist/react/index.d.ts\"\n ],\n \"next\": [\n \"dist/next/index.d.ts\"\n ],\n \"nuxt\": [\n \"dist/nuxt/index.d.ts\"\n ],\n \"remix\": [\n \"dist/remix/index.d.ts\"\n ],\n \"sveltekit\": [\n \"dist/sveltekit/index.d.ts\"\n ],\n \"vue\": [\n \"dist/vue/index.d.ts\"\n ]\n }\n },\n \"scripts\": {\n \"build\": \"tsup && pnpm copy-astro\",\n \"copy-astro\": \"cp -R src/astro dist/\",\n \"dev\": \"pnpm copy-astro && tsup --watch\",\n \"lint\": \"eslint .\",\n \"lint-fix\": \"eslint . --fix\",\n \"test\": \"vitest\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"devDependencies\": {\n \"@remix-run/react\": \"^2.14.0\",\n \"@sveltejs/kit\": \"^2.8.1\",\n \"@swc/core\": \"^1.9.2\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@testing-library/react\": \"^16.0.1\",\n \"@types/node\": \"^22.9.1\",\n \"@types/react\": \"^18.3.12\",\n \"copyfiles\": \"^2.4.1\",\n \"jsdom\": \"^25.0.1\",\n \"next\": \"^14.0.4\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"svelte\": \"^5.2.7\",\n \"tsup\": \"8.3.5\",\n \"vitest\": \"^2.1.5\",\n \"vue\": \"^3.5.13\",\n \"vue-router\": \"^4.4.5\"\n },\n \"peerDependencies\": {\n \"@sveltejs/kit\": \"^1 || ^2\",\n \"next\": \">= 13\",\n \"react\": \"^18 || ^19 || ^19.0.0-rc\",\n \"svelte\": \">= 4\",\n \"vue\": \"^3\",\n \"vue-router\": \"^4\"\n },\n \"peerDependenciesMeta\": {\n \"@sveltejs/kit\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n },\n \"vue-router\": {\n \"optional\": true\n }\n }\n}\n","export const initQueue = (): void => {\n // initialize va until script is loaded\n if (window.si) return;\n\n window.si = function a(...params): void {\n (window.siq = window.siq || []).push(params);\n };\n};\n","import type { SpeedInsightsProps } from './types';\n\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nfunction detectEnvironment(): 'development' | 'production' {\n try {\n const env = process.env.NODE_ENV;\n if (env === 'development' || env === 'test') {\n return 'development';\n }\n } catch (e) {\n // do nothing, this is okay\n }\n return 'production';\n}\n\nexport function isProduction(): boolean {\n return detectEnvironment() === 'production';\n}\n\nexport function isDevelopment(): boolean {\n return detectEnvironment() === 'development';\n}\n\nexport function computeRoute(\n pathname: string | null,\n pathParams: Record | null,\n): string | null {\n if (!pathname || !pathParams) {\n return pathname;\n }\n\n let result = pathname;\n try {\n const entries = Object.entries(pathParams);\n // simple keys must be handled first\n for (const [key, value] of entries) {\n if (!Array.isArray(value)) {\n const matcher = turnValueToRegExp(value);\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[${key}]`);\n }\n }\n }\n // array values next\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n const matcher = turnValueToRegExp(value.join('/'));\n if (matcher.test(result)) {\n result = result.replace(matcher, `/[...${key}]`);\n }\n }\n }\n return result;\n } catch (e) {\n return pathname;\n }\n}\n\nfunction turnValueToRegExp(value: string): RegExp {\n return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);\n}\n\nfunction escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getScriptSrc(\n props: SpeedInsightsProps & { basePath?: string },\n): string {\n if (props.scriptSrc) {\n return props.scriptSrc;\n }\n if (isDevelopment()) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.debug.js';\n }\n if (props.dsn) {\n return 'https://va.vercel-scripts.com/v1/speed-insights/script.js';\n }\n if (props.basePath) {\n return `${props.basePath}/speed-insights/script.js`;\n }\n return '/_vercel/speed-insights/script.js';\n}\n","import { name as packageName, version } from '../package.json';\nimport { initQueue } from './queue';\nimport type { SpeedInsightsProps, BeforeSendMiddleware } from './types';\nimport { computeRoute, getScriptSrc, isBrowser, isDevelopment } from './utils';\n\n/**\n * Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).\n * @param [props] - Speed Insights options.\n * @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.\n * @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.\n * @param [props.sampleRate] - When setting to 0.5, 50% of the events will be sent to Vercel Speed Insights. Defaults to `1`.\n * @param [props.route] - The dynamic route of the page.\n * @param [props.dsn] - The DSN of the project to send events to. Only required when self-hosting.\n */\nfunction injectSpeedInsights(\n props: SpeedInsightsProps & {\n framework?: string;\n basePath?: string;\n } = {},\n): {\n setRoute: (route: string | null) => void;\n} | null {\n // When route is null, it means that pages router is not ready yet. Will resolve soon\n if (!isBrowser() || props.route === null) return null;\n\n initQueue();\n\n const src = getScriptSrc(props);\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return null;\n\n if (props.beforeSend) {\n window.si?.('beforeSend', props.beforeSend);\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n script.dataset.sdkn =\n packageName + (props.framework ? `/${props.framework}` : '');\n script.dataset.sdkv = version;\n\n if (props.sampleRate) {\n script.dataset.sampleRate = props.sampleRate.toString();\n }\n if (props.route) {\n script.dataset.route = props.route;\n }\n if (props.endpoint) {\n script.dataset.endpoint = props.endpoint;\n } else if (props.basePath) {\n script.dataset.endpoint = `${props.basePath}/speed-insights/vitals`;\n }\n if (props.dsn) {\n script.dataset.dsn = props.dsn;\n }\n if (isDevelopment() && props.debug === false) {\n script.dataset.debug = 'false';\n }\n\n script.onerror = (): void => {\n // eslint-disable-next-line no-console -- Logging is okay here\n console.log(\n `[Vercel Speed Insights] Failed to load script from ${src}. Please check if any content blockers are enabled and try again.`,\n );\n };\n\n document.head.appendChild(script);\n\n return {\n setRoute: (route: string | null): void => {\n script.dataset.route = route ?? undefined;\n },\n };\n}\n\nexport { injectSpeedInsights, computeRoute };\nexport type { SpeedInsightsProps, BeforeSendMiddleware };\n\n// eslint-disable-next-line import/no-default-export -- Allow default export\nexport default {\n injectSpeedInsights,\n computeRoute,\n};\n","export function getBasePath(): string | undefined {\n // !! important !!\n // do not access env variables using import.meta.env[varname]\n // some bundles won't replace the value at build time.\n try {\n return import.meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH as\n | string\n | undefined;\n } catch {\n // do nothing\n }\n}\n","import { createComponent } from './create-component';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- vue's defineComponent return type is any\nexport const SpeedInsights = createComponent();\n"],"mappings":";AAAA,SAAS,iBAAiB,aAAa;AAEvC,SAAS,gBAAgB;;;ACDvB,WAAQ;AACR,cAAW;;;ACFN,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO,GAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACLO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEA,SAAS,oBAAkD;AACzD,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF,SAAS,GAAG;AAAA,EAEZ;AACA,SAAO;AACT;AAMO,SAAS,gBAAyB;AACvC,SAAO,kBAAkB,MAAM;AACjC;AAEO,SAAS,aACd,UACA,YACe;AACf,MAAI,CAAC,YAAY,CAAC,YAAY;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI;AACF,UAAM,UAAU,OAAO,QAAQ,UA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ED,UAAI,SAAS,WAAW;AACtB,cAAM,cAAc,MAAY;AAC9B,oBAAU,SAAS,aAAa,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA,QAC3D;AAEA,oBAAY;AACZ,cAAM,OAAO,WAAW;AAAA,MAC1B;AAAA,IACF;AAAA;AAAA,IAEA,SAAS;AACP,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;;;AMtCO,IAAM,gBAAgB,gBAAgB;","names":[]} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/package.json b/web/node_modules/@vercel/speed-insights/package.json new file mode 100644 index 0000000..648e115 --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/package.json @@ -0,0 +1,137 @@ +{ + "name": "@vercel/speed-insights", + "version": "1.3.1", + "description": "Speed Insights is a tool for measuring web performance and providing suggestions for improvement.", + "keywords": [ + "speed-insights", + "vercel" + ], + "repository": { + "url": "github:vercel/speed-insights", + "directory": "packages/web" + }, + "license": "Apache-2.0", + "exports": { + "./package.json": "./package.json", + ".": { + "browser": "./dist/index.mjs", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./astro": { + "import": "./dist/astro/component.ts" + }, + "./next": { + "browser": "./dist/next/index.mjs", + "import": "./dist/next/index.mjs", + "require": "./dist/next/index.js" + }, + "./nuxt": { + "browser": "./dist/nuxt/index.mjs", + "import": "./dist/nuxt/index.mjs", + "require": "./dist/nuxt/index.js" + }, + "./react": { + "browser": "./dist/react/index.mjs", + "import": "./dist/react/index.mjs", + "require": "./dist/react/index.js" + }, + "./remix": { + "browser": "./dist/remix/index.mjs", + "import": "./dist/remix/index.mjs", + "require": "./dist/remix/index.js" + }, + "./sveltekit": { + "types": "./dist/sveltekit/index.d.ts", + "svelte": "./dist/sveltekit/index.mjs" + }, + "./vue": { + "browser": "./dist/vue/index.mjs", + "import": "./dist/vue/index.mjs", + "require": "./dist/vue/index.js" + } + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "dist/index.d.ts" + ], + "react": [ + "dist/react/index.d.ts" + ], + "next": [ + "dist/next/index.d.ts" + ], + "nuxt": [ + "dist/nuxt/index.d.ts" + ], + "remix": [ + "dist/remix/index.d.ts" + ], + "sveltekit": [ + "dist/sveltekit/index.d.ts" + ], + "vue": [ + "dist/vue/index.d.ts" + ] + } + }, + "devDependencies": { + "@remix-run/react": "^2.14.0", + "@sveltejs/kit": "^2.8.1", + "@swc/core": "^1.9.2", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.0.1", + "@types/node": "^22.9.1", + "@types/react": "^18.3.12", + "copyfiles": "^2.4.1", + "jsdom": "^25.0.1", + "next": "^14.0.4", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "svelte": "^5.2.7", + "tsup": "8.3.5", + "vitest": "^2.1.5", + "vue": "^3.5.13", + "vue-router": "^4.4.5" + }, + "peerDependencies": { + "@sveltejs/kit": "^1 || ^2", + "next": ">= 13", + "react": "^18 || ^19 || ^19.0.0-rc", + "svelte": ">= 4", + "vue": "^3", + "vue-router": "^4" + }, + "peerDependenciesMeta": { + "@sveltejs/kit": { + "optional": true + }, + "next": { + "optional": true + }, + "react": { + "optional": true + }, + "svelte": { + "optional": true + }, + "vue": { + "optional": true + }, + "vue-router": { + "optional": true + } + }, + "scripts": { + "build": "tsup && pnpm copy-astro", + "copy-astro": "cp -R src/astro dist/", + "dev": "pnpm copy-astro && tsup --watch", + "lint": "eslint .", + "lint-fix": "eslint . --fix", + "test": "vitest", + "type-check": "tsc --noEmit" + } +} \ No newline at end of file diff --git a/web/node_modules/@vercel/speed-insights/test.setup.ts b/web/node_modules/@vercel/speed-insights/test.setup.ts new file mode 100644 index 0000000..073144d --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/test.setup.ts @@ -0,0 +1,11 @@ +import { beforeEach } from 'vitest'; +import '@testing-library/jest-dom/vitest'; + +beforeEach(() => { + if (typeof window === 'undefined') return; + // reset dom before each test + const html = document.querySelector('html'); + if (html) { + html.innerHTML = ''; + } +}); diff --git a/web/node_modules/@vercel/speed-insights/tsconfig.json b/web/node_modules/@vercel/speed-insights/tsconfig.json new file mode 100644 index 0000000..435362c --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "module": "esnext" + }, + "include": ["src", "./test.setup.ts"] +} diff --git a/web/node_modules/@vercel/speed-insights/tsup.config.js b/web/node_modules/@vercel/speed-insights/tsup.config.js new file mode 100644 index 0000000..00cb8cc --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/tsup.config.js @@ -0,0 +1,68 @@ +import { defineConfig } from 'tsup'; + +const cfg = { + splitting: false, + sourcemap: true, + clean: true, + treeshake: false, + dts: true, + format: ['esm', 'cjs'], +}; + +export default defineConfig([ + { + ...cfg, + entry: { + index: 'src/generic.ts', + }, + outDir: 'dist', + }, + { + ...cfg, + entry: { + index: 'src/nextjs/index.tsx', + }, + external: ['react', 'next'], + outDir: 'dist/next', + }, + { + ...cfg, + entry: { + index: 'src/nuxt/index.ts', + }, + external: ['vue', 'vue-router'], + outDir: 'dist/nuxt', + }, + { + ...cfg, + entry: { + index: 'src/react/index.tsx', + }, + external: ['react'], + outDir: 'dist/react', + }, + { + ...cfg, + entry: { + index: 'src/remix/index.tsx', + }, + external: ['react', '@remix-run/react'], + outDir: 'dist/remix', + }, + { + ...cfg, + entry: { + index: 'src/sveltekit/index.ts', + }, + external: ['svelte', '@sveltejs/kit', '$app'], + outDir: 'dist/sveltekit', + }, + { + ...cfg, + entry: { + index: 'src/vue/index.ts', + }, + external: ['vue', 'vue-router'], + outDir: 'dist/vue', + }, +]); diff --git a/web/node_modules/@vercel/speed-insights/vitest.config.mts b/web/node_modules/@vercel/speed-insights/vitest.config.mts new file mode 100644 index 0000000..316dbef --- /dev/null +++ b/web/node_modules/@vercel/speed-insights/vitest.config.mts @@ -0,0 +1,10 @@ +/// +import { defineConfig } from 'vitest/config'; + +// eslint-disable-next-line import/no-default-export -- vitest needs a default export. +export default defineConfig({ + test: { + environment: 'jsdom', + setupFiles: './test.setup.ts', + }, +}); diff --git a/web/package-lock.json b/web/package-lock.json index c200991..e276900 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,13 +1,16 @@ { "name": "web", - "version": "1.0.0", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "web", - "version": "1.0.0", + "version": "0.2.0", "license": "ISC", + "dependencies": { + "@vercel/speed-insights": "^1.3.1" + }, "devDependencies": { "@testing-library/dom": "^10.4.1", "eslint": "^9.39.2", @@ -1309,6 +1312,40 @@ "dev": true, "license": "MIT" }, + "node_modules/@vercel/speed-insights": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@vercel/speed-insights/-/speed-insights-1.3.1.tgz", + "integrity": "sha512-PbEr7FrMkUrGYvlcLHGkXdCkxnylCWePx7lPxxq36DNdfo9mcUjLOmqOyPDHAOgnfqgGGdmE3XI9L/4+5fr+vQ==", + "license": "Apache-2.0", + "peerDependencies": { + "@sveltejs/kit": "^1 || ^2", + "next": ">= 13", + "react": "^18 || ^19 || ^19.0.0-rc", + "svelte": ">= 4", + "vue": "^3", + "vue-router": "^4" + }, + "peerDependenciesMeta": { + "@sveltejs/kit": { + "optional": true + }, + "next": { + "optional": true + }, + "react": { + "optional": true + }, + "svelte": { + "optional": true + }, + "vue": { + "optional": true + }, + "vue-router": { + "optional": true + } + } + }, "node_modules/@vitest/expect": { "version": "4.0.17", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.17.tgz", diff --git a/web/package.json b/web/package.json index 2fe9be0..131f478 100644 --- a/web/package.json +++ b/web/package.json @@ -22,5 +22,8 @@ "prettier": "^3.7.4", "vite": "^7.3.1", "vitest": "^4.0.17" + }, + "dependencies": { + "@vercel/speed-insights": "^1.3.1" } } diff --git a/web/src/main.js b/web/src/main.js index e849e44..e182c1b 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -1,6 +1,10 @@ import './styles/main.css'; import { SkinCollection } from './core/SkinCollection.js'; +import { injectSpeedInsights } from '@vercel/speed-insights'; + +// Initialize Vercel Speed Insights +injectSpeedInsights(); document.addEventListener("DOMContentLoaded", () => { new SkinCollection();