PageSourceSearch

https://danhov.com/_next/static/chunks/4786-dccfd409dc6cdadf.js?dpl=dpl_FBwSHpJd7L4ZXBAXXbMFXyx96Q9S

js danhov.com collected 2026-10-06 19:37:12 UTC 8,162 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4786],{4947:(e,t,n)=>{n.d(t,{XQ:()=>C,HO:()=>R,bE:()=>J,Op:()=>h,vU:()=>v,$g:()=>w,Mt:()=>O,dV:()=>L,Wj:()=>D,zM:()=>r,dt:()=>M,DW:()=>U,B1:()=>z,Jb:()=>T});let i=new Map;function r(e){var t;let n=!1;for(let t of e||[]){if(!t||"string"!=typeof t.id||i.has(t.id))continue;let e={};for(let[n,i]of Object.entries(t.metal_images||{}))Array.isArray(i)&&i.length&&(e[n]=i[0]);i.set(t.id,{id:t.id,sku:t.sku,name:t.name,collection:t.collection||"",category:t.category,is_active:!!t.is_active,default_metal:t.default_metal,metals:t.metals||[],price_display:t.price_display,metal_prices:t.metal_prices||{},metal_image:e,first_image:t.images&&t.images[0]||null,diamond_types:t.diamond_types||[],default_diamonds:t.default_diamonds||"",diamond_prices:t.diamond_prices||{}}),n=!0}return n&&b&&(null==S||null==(t=S.pending)?void 0:t.length)&&queueMicrotask(a),n}function a(){var e;(null==S||null==(e=S.pending)?void 0:e.length)&&(S=k(),N())}let l="danhov-cart-v1";function o(e){let t=parseFloat(String(e||"").replace(/[^0-9.]/g,""));return Number.isFinite(t)?t:0}let s={lab:"Lab-grown side stones",natural:"Natural side stones"};function u(e){return String(e||"").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function d(e){var t,n,r,a;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||"string"!=typeof e.id||!l||"object"!=typeof l)return null;let d=i.get(e.id);if(!d||!d.is_active||l.diamond||l.selectedDiamond)return null;let c=l.metal||d.default_metal;if(!d.metals.includes(c))return null;let m=null==l.size||""===l.size?null:String(l.size);if(null!==m&&(!/^(?:[3-9]|1[0-3])(?:[.]5)?$/.test(m)||"fine"===d.category))return null;let f=void 0===l.quantity?1:l.quantity;if(!Number.isInteger(f)||f<1||f>99)return null;let g=d.diamond_types.length?d.diamond_types.includes(l.diamonds)?l.diamonds:d.default_diamonds:"",p=Number(g?null==(n=d.diamond_prices)||null==(t=n[g])?void 0:t[c]:null==(r=d.metal_prices)?void 0:r[c]),y=p>0?p:c===d.default_metal?o(d.price_display):0;return y>0?{key:JSON.stringify(g?[d.id,c,m,g]:[d.id,c,m]),productId:d.id,sku:d.sku,name:d.name,collection:d.collection||"",category:d.category,metal:c,metalLabel:g?"".concat(u(c)," \xb7 ").concat(s[g]):u(c),size:m,price:y,...g?{diamonds:g}:{},priceDisplay:w(y),image:(null==(a=d.metal_image)?void 0:a[c])||d.first_image||null,quantity:f}:null}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||"object"!=typeof e||!function(e){let t=/^tdp-(natural|lab)-([A-Za-z0-9_-]{1,40})$/.exec(String(e||""));return t?{origin:t[1],stockId:t[2]}:null}(e.id)||1!==(void 0===t.quantity?1:t.quantity))return null;let n=Number(e.price_num)||o(e.price);if(!(n>0))return null;let i=Number(e.carats)||0,r="string"==typeof t.forRing?t.forRing.slice(0,160):"string"==typeof e.forRing?e.forRing.slice(0,160):"";return{key:"diamond:".concat(e.id),productId:null,diamondId:e.id,sku:String(e.cert||e.id).slice(0,80),name:String(e.title||"".concat(i.toFixed(2)," Ct ").concat(e.shape||"Round"," Diamond")).slice(0,120),collection:"LAB GROWN"===e.type?"Lab-Grown Centre Diamond":"Natural Centre Diamond",category:"diamond",metal:"",metalLabel:[e.grade,e.cert].filter(Boolean).join(" \xb7 ").slice(0,160)||"Centre diamond",size:null,price:n,priceDisplay:w(n),image:"string"==typeof e.image?e.image:null,quantity:1,cert:String(e.cert||""),grade:String(e.grade||""),shape:String(e.shape||""),carats:i,type:e.type||"NATURAL",...r?{forRing:r}:{}}}function m(e,t){return t?e.items.find(e=>e.key===t.key)?{...e,items:e.items.map(e=>e.key===t.key?{...e,quantity:e.diamondId?1:Math.min(99,e.quantity+t.quantity)}:e)}:{...e,items:[...e.items,t]}:e}function f(e,t){return{...e,items:e.items.filter(e=>e.key!==t)}}function g(){return{items:[],version:1}}let p=["cert","grade","shape","carats","type","forRing"];function y(e){try{let t="string"==typeof e?JSON.parse(e):e;if(!t||1!==t.version||!Array.isArray(t.items))return g();return t.items.slice(0,200).reduce((e,t)=>{if(!t||"object"!=typeof t)return e;if(t.diamondId)return m(e,c({...t,id:t.diamondId},{}));let n=d({id:t.productId},t);return n?m(e,n):q||"string"!=typeof t.productId||i.has(t.productId)?e:{...e,pending:[...e.pending||[],t]}},g())}catch(e){return g()}}function v(e){return e.items.reduce((e,t)=>
1e+t.price*t.quantity,0)}function h(e){return e.items.reduce((e,t)=>e+t.quantity,0)}function w(e){return Number(e).toLocaleString("en-US",{style:"currency",currency:"USD"})}let _=new Set,S=null,b=!1;function k(){try{let e=window.localStorage.getItem(l);if(!e)return{items:[],version:1};return y(e)}catch(e){return{items:[],version:1}}}function I(e){try{window.localStorage.setItem(l,JSON.stringify({version:1,items:[...e.items.map(e=>e.diamondId?{diamondId:e.diamondId,quantity:1,title:e.name,price_num:e.price,image:e.image||void 0,...Object.fromEntries(p.map(t=>[t,e[t]||void 0]))}:{productId:e.productId,metal:e.metal,size:e.size,quantity:e.quantity,diamonds:e.diamonds||void 0}),...e.pending||[]]}))}catch(e){}}function N(){for(let e of _)e()}let E=!1,q=!1,A={items:[],version:1};function L(){return b||(S=k(),b=!0,!E&&window.location&&(E=!0,n.e(2985).then(n.bind(n,2985)).then(e=>{let{loadProducts:t}=e;return t()}).then(e=>{if(!e.length){E=!1;return}r(e),q=!0,I(S=k()),N()}).catch(()=>{E=!1}))),S}function O(){return A}function j(e){(e.key===l||null===e.key)&&(S=null===e.key?g():y(e.newValue),b=!0,N())}function z(e){return 0===_.size&&window.addEventListener("storage",j),_.add(e),()=>{_.delete(e),0===_.size&&window.removeEventListener("storage",j)}}function J(e,t){let n=d(e,t);return n?(b||(S=k(),b=!0),I(S=m(S,n)),N(),n):null}let C="danhov:open-cart";function D(){window.dispatchEvent(new Event(C))}function R(e,t){let n=c(e,t);return n?(b||(S=k(),b=!0),I(S=m(S,n)),N(),n):null}function U(e){b||(S=k(),b=!0);let t=function(e,t){let n=!1,i=e.items.map(e=>{let i=e.diamondId?Number(t[e.diamondId]):0;return i>0&&i!==e.price?(n=!0,{...e,price:i,priceDisplay:w(i)}):e});return n?{...e,items:i}:e}(S,e);t!==S&&(I(S=t),N())}function M(e){b||(S=k(),b=!0),I(S=f(S,e)),N()}function T(e,t){var n;b||(S=k(),b=!0),n=S,I(S=0===t?f(n,e):!Number.isInteger(t)||t<1||t>99||t>1&&n.items.some(t=>t.key===e&&t.diamondId)?n:{...n,items:n.items.map(n=>n.key===e?{...n,quantity:t}:n)}),N()}},8932:(e,t,n)=>{n.d(t,{Jw:()=>s,Oy:()=>d,nU:()=>f,oS:()=>m});var i=n(2115);let r="dnh-wishlist",a="dnh-wishlist-change";function l(){try{let e=JSON.parse(localStorage.getItem(r)||"[]");return Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.slug):[]}catch(e){return[]}}function o(e){let{fromAccount:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{localStorage.setItem(r,JSON.stringify(e))}catch(e){}window.dispatchEvent(new CustomEvent(a,{detail:{fromAccount:t}}))}function s(){o([],{fromAccount:!0})}let u=!1;async function d(){let e,t;if(u||!("undefined"!=typeof document&&/(?:^|;\s*)dnh_signed_in=1/.test(document.cookie)))return;u=!0;try{let t=await fetch("/api/wishlist",{cache:"no-store"});e=await t.json()}catch(e){}if(!(null==e?void 0:e.signedIn)||!Array.isArray(e.items)){u=!1;return}let n=new URLSearchParams(window.location.search).has("signed_in"),i=l(),r=n?[...i.filter(t=>!e.items.some(e=>e.slug===t.slug)),...e.items].slice(0,100):e.items;o(r,{fromAccount:!0}),JSON.stringify(r)!==JSON.stringify(e.items)&&c(r),window.addEventListener(a,e=>{var n;null!=(n=e.detail)&&n.fromAccount||(clearTimeout(t),t=setTimeout(()=>c(l()),400))})}function c(e){fetch("/api/wishlist",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e}),keepalive:!0}).catch(()=>{})}function m(e){var t;let n=l(),i=n.some(t=>t.slug===e.slug),r=(null==(t=e.images)?void 0:t[0])||Object.values(e.metal_images||{}).flat()[0]||null;return o(i?n.filter(t=>t.slug!==e.slug):[{slug:e.slug,name:e.name,image:r,price:e.price_display||"",collection:e.collection||""},...n].slice(0,100)),!i}function f(){let[e,t]=(0,i.useState)([]);return(0,i.useEffect)(()=>{let e=()=>t(l());return e(),window.addEventListener(a,e),window.addEventListener("storage",e),()=>{window.removeEventListener(a,e),window.removeEventListener("storage",e)}},[]),e}}}]);

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.