1import{config}from"@theme/global-config";import{getBeaconContext}from"@theme/global-searchspring-cookies";const BEACON_ORIGIN="https://analytics.searchspring.net/beacon/v2";export function sendSearchspringBeacon(t,e,n){const r=config.searchspring?.siteId;if(!r||!t||!e)return;const i={context:getBeaconContext()};void 0!==n&&(i.data=n),fetch(`${BEACON_ORIGIN}/${r}/${t}/${e}`,{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})}export function isSearchspringProductResult(t){if(!t||"banner"===t.type)return!1;const e=String(t.url||"");if(!e)return!1;const n=e.replace(/^https?:\/\/[^/]+/i,"");return!(n.includes("/pages/")||n.includes("/blogs/")||n.includes("/articles/"))&&(n.includes("/products/")&&Boolean(t.handle||t.uid||t.id))}export function toBeaconProduct(t,e={}){const n=String(t?.uid||t?.id||e.uid||"");if(!n)return null;const r={type:"product",parentId:String(e.parentId||n),uid:n},i=t?.sku||e.sku;return i&&(r.sku=String(i)),r}export function toBeaconCartItem(t,e){const n=String(t?.product_id||t?.parentId||""),r=String(t?.variant_id||t?.id||t?.uid||"");if(!n||!r)return null;const i={parentId:n,uid:r,qty:Number(e??t.quantity??1),price:toBeaconPrice(t)};return t.sku&&(i.sku=String(t.sku)),i}function toBeaconPrice(t){const e=t?.final_price??t?.price??0;return"number"==typeof e&&Number.isInteger(e)&&t.key?Number((e/100).toFixed(2)):Number(Number(e).toFixed(2))}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.