PageSourceSearch

https://www.swarovskioptik.com/static/js/2252.af213685.chunk.js

js swarovskioptik.com collected 2026-10-02 03:03:26 UTC 16,446 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunk_swo_frontend=globalThis.webpackChunk_swo_frontend||[]).push([[2252],{42252:(e,t,r)=>{r.r(t),r.d(t,{ToolbeltPdpVariantsRoute:()=>H,default:()=>q});var a=r(44167),i=r(21126),n=r(59072),l=r(86176),o=r(59445),s=r(76945),d=r(1823),c=r(53446),u=r.n(c),p=r(18127);const f=({cell:e})=>{var t,r;switch(e.kind){case"empty":return(0,p.Y)(p.FK,{children:"\u2014"});case"text":case"rich-text":return(0,p.Y)(p.FK,{children:e.text});case"image":return(0,p.FD)("figure",{className:"flex max-w-[220px] flex-col gap-1",children:[(0,p.Y)("img",{src:e.image.url,alt:null!==(t=e.image.title)&&void 0!==t?t:"",width:e.image.width,height:e.image.height,className:"max-h-[160px] max-w-full object-contain",loading:"lazy"}),e.image.title&&(0,p.Y)("figcaption",{className:"text-x2ss text-gray-dark-2024",children:e.image.title})]});case"media-gallery":return(0,p.Y)("div",{className:"flex max-w-[320px] flex-wrap gap-2",children:e.items.map((e,t)=>{var r;return"image"===e.kind?(0,p.Y)("img",{src:e.image.url,alt:null!==(r=e.image.title)&&void 0!==r?r:"",className:"size-[130px] object-contain",loading:"lazy"}
1,`${e.image.url}-${t}`):(0,p.Y)("div",{className:"flex h-[80px] w-[80px] flex-col items-center justify-center gap-1 bg-gray-light-2024 text-center text-x1",children:e.posterUrl?(0,p.Y)("img",{src:e.posterUrl,alt:e.label,className:"h-full w-full object-contain",loading:"lazy"}):(0,p.Y)("span",{children:e.label})},`video-${t}`)})});case"attribute":return(0,p.FD)("div",{className:"flex max-w-[280px] flex-col gap-1",children:[(0,p.FD)("div",{className:"flex items-center gap-2",children:[e.attribute.colorHex&&(0,p.Y)("span",{className:"inline-block size-4 shrink-0 rounded-full border border-solid border-gray-2024",style:{backgroundColor:e.attribute.colorHex},title:e.attribute.colorHex}),(0,p.Y)("span",{className:"font-futura-500",children:e.attribute.valueText})]}),e.attribute.detailText&&(0,p.Y)("span",{className:"text-x1 text-gray-dark-2024",children:e.attribute.detailText}),e.attribute.colorHex&&(0,p.Y)("span",{className:"font-mono text-x2s text-gray-dark-2024",children:e.attribute.colorHex}),e.attribute.image&&(0,p.Y)("img",{src:e.attribute.image.url,alt:null!==(r=e.attribute.image.t
1itle)&&void 0!==r?r:e.attribute.valueText,className:"max-h-[80px] max-w-full object-contain",loading:"lazy"}),e.attribute.includeInTechSpec&&(0,p.Y)("span",{className:"text-x2ss uppercase tracking-wide text-gray-dark-2024",children:"In tech spec"})]})}};var h=r(80841);const g=["unique","filter","showcased","rest"];function m(e){return"object"===typeof e&&null!==e&&!Array.isArray(e)}function x(e){return m(e)&&"string"===typeof e.name&&"string"===typeof e.type&&"string"===typeof e.label}function v(e){return!!m(e)&&g.some(t=>Array.isArray(e[t]))}function y(e,t="attributes"){const r={};for(const a of g){const i=e[a];if(Array.isArray(i))for(const e of i)x(e)&&(r[`${t}.${a}.${e.name}`]=e)}return r}function b(e){var t,r,a,i,n;if(!m(e)||"string"!==typeof e.type)return{valueText:"\u2014"};switch(e.type){case"text":return{valueText:String(null!==(t=null!==(r=e.label)&&void 0!==r?r:e.data)&&void 0!==t?t:"\u2014")};case"number":return{valueText:String(null!==(a=e.data)&&void 0!==a?a:"\u2014")};case"boolean":return{valueText:String(null!==(i=null!==(n=e.label)&&void 0!==n?n:e.data)&&void 0!==i?i:"\u2014")};case"enum":{const t=e.data;return m(t)&&"string"===typeof t.label?{valueText:t.label,detailText:"string"===typeof t.key?t.key:void 0}:{valueText:"\u2014"}}case"enum-set":{if(!Array.isArray(e.data))return{valueText:"\u2014"};const t=e.data.flatMap(e=>m(e)&&"string"===typeof e.label?[e.label]:[]);return{valueText:t.length>0?t.join(", "):"\u2014"}}case"text-set":case"number-set":return{valueText:Array.isArray(e.data)?e.data.map(String).join(", "):"\u2014"};case"reference":{const t=e.data;return m(t)&&"string"===typeof t.id?{valueText:t.id,detailText:"string"===typeof t.typeId?t.typeId:void 0}:{valueText:"\u2014"}}default:return{valueText:JSON.stringify(e)}}}function k(e){const t={type:e.type,name:e.name,label:e.label,includeInTechSpec:!0===e.includeInTechSpec};switch(e.type){case"color":{const r=m(e.value)?e.value:void 0,a="string"===typeof(null===r||void 0===r?void 0:r.label)?r.label:"string"===typeof(null===r||void 0===r?void 0:r.colorKey)?r.colorKey:"\u2014",i="string"===typeof(null===r||void 0===r?void 0:r.hexValue)?r.hexValue:void 0,n="string"===typeof(null===r||void 0===r?void 0:r.colorKey)?r.colorKey:void 0;return{...t,valueText:a,colorHex:i,detailText:n&&n!==a?n:void 0}}case"reticle":{const r=null===e.value?void 0:m(e.value)?e.value:void 0,a="string"===typeof(null===r||void 0===r?void 0:r.reticleKey)?r.reticleKey:"\u2014",i=null!==r&&void 0!==r&&r.image?function(e){var t;if(m(e)&&"string"===typeof e.url)return{url:(t=e.url,t.startsWith("//")?`https:${t}`:t),title:"string"===typeof e.title?e.title:void 0,width:"number"===typeof e.width?e.width:void 0,height:"number"===typeof e.height?e.height:void 0}}(r.image):void 0;return{...t,valueText:a,image:i}}case"product variant":{const r=m(e.value)?e.value:void 0,a="string"===typeof(null===r||void 0===r?void 0:r.name)?r.name:"\u2014",i="string"===typeof(null===r||void 0===r?void 0:r.sku)?r.sku:void 0;return{...t,valueText:a,detailText:i}}case"clothing-size":case"price-only":{const r=b(e.value);return{...t,valueText:r.valueText,detailText:r.detailText}}case"plain":{const r=b(e.value);return{...t,valueText:r.valueText,detailText:r.detailText}}default:return{...t,valueText:void 0===e.value?"\u2014":JSON.stringify(e.value)}}}function w(e){const t=e.trim();if(!t)return"";try{if(t.startsWith("http://")||t.startsWith("https://")){const e=new URL(t),r=e.pathname.indexOf("/storefront/pages/by-path");return r>=0?e.pathname.slice(r+25)||"/":e.pathname}}catch{}return t.startsWith("/storefront/pages/by-path")?t.slice(25)||"/":t.startsWith("/")?t:`/${t}`}function N(e){return"object"===typeof e&&null!==e&&!Array.isArray(e)}function Y(e){return N(e)&&"document"===e.nodeType&&Array.isArray(e.content)}function T(e){return N(e)&&"expanded"===e.type&&Y(e.json)}function F(e){return T(e)||Y(e)}function D(e){return e.startsWith("//")?`https:${e}`:e}function S(e){return e.startsWith("//images.")||/^https?:\/\/.+\.(png|jpe?g|gif|webp|svg)(\?|$)/i.test(e)}function P(e){return N(e)&&"string"===typeof e.url&&e.url.length>0}function j(e){return P(e)?{url:D(e.url),title:"string"===typeof e.title?e.title:void 0,width:"number"===typeof e.width?e.width:void 0,height:"number"===typeof e.height?e.height:void 0}:function(e){return N(e)&&"UtilityImageWithFocalPoint"===e.__typename&&P(e.image)}(e)?j(e.image):void 0}function A(e){const t=j(e);if(t)return{kind:"image",image:t};if(function(e){return N(e)&&"UtilityVideo"===e.__typename}(e)){var r,a;return{kind:"video",label:"Video",posterUrl:null!==(r=e.video)&&void 0!==r&&null!==(a=r.poster)&&void 0!==a&&a.url?D(e.video.poster.url):void 0}}}function O(e){return void 0!==A(e)}function K(e){return Array.isArray(e)&&e.length>0&&e.every(e=>null===e||O(e))}function $(e){return T(e)?(0,h.l)(e.json).trim():Y(e)?(0,h.l)(e).trim():void 0}function _(e,t){return e.length>t?`${e.slice(0,t)}\u2026`:e}function z(e){if(void 0===e)return"";if(null===e)return"null";if(x(e))return function(e){var t,r,a,i;const n=k(e);return[n.type,n.valueText,null!==(t=n.detailText)&&void 0!==t?t:"",null!==(r=n.colorHex)&&void 0!==r?r:"",null!==(a=null===(i=n.image)||void 0===i?void 0:i.url)&&void 0!==a?a:"",n.includeInTechSpec?"1":"0"].join("|")}(e);const t=$(e);
1if(void 0!==t)return t;const r=j(e);return r?r.url:K(e)?e.map(e=>{var t;const r=null===e?void 0:A(e);return r?"image"===r.kind?r.image.url:null!==(t=r.posterUrl)&&void 0!==t?t:r.label:""}).join("|"):"string"===typeof e?S(e)?D(e):e:"number"===typeof e||"boolean"===typeof e?String(e):JSON.stringify(e,null,0)}function C(e){if(void 0===e)return{kind:"empty"};if(null===e)return{kind:"text",text:"null"};if(x(e))return{kind:"attribute",attribute:k(e)};const t=$(e);if(void 0!==t)return{kind:"rich-text",text:t.length>0?_(t,500):"\u2014"};const r=j(e);if(r)return{kind:"image",image:r};if(K(e)){const t=e.flatMap(e=>{if(null===e)return[];const t=A(e);return t?[t]:[]});if(t.length>0)return{kind:"media-gallery",items:t}}if("string"===typeof e)return S(e)?{kind:"image",image:{url:D(e)}}:{kind:"text",text:_(e,120)};if("number"===typeof e||"boolean"===typeof e)return{kind:"text",text:String(e)};return{kind:"text",text:_(JSON.stringify(e,null,0),160)}}function I(e,t=""){const r={};for(const[a,i]of Object.entries(e)){const e=t?`${t}.${a}`:a;if(null!==i&&void 0!==i&&"object"===typeof i)if(F(i)||O(i)||x(i))r[e]=i;else if(Array.isArray(i))r[e]=(K(i),i);else if(N(i)){if("attributes"===e&&v(i)){Object.assign(r,y(i,e));continue}Object.assign(r,I(i,e))}else r[e]=i;else r[e]=i}return r}function U(e){const t=new Set;for(const r of e)for(const e of Object.keys(r.flat))t.add(e);return[...t].sort((e,t)=>e.localeCompare(t)).map(t=>{var r,a;const i=e.map(e=>e.flat[t]),n=i.map(z),l=new Set(n).size>1,o=i.map(C),s=null!==(r=null===(a=o.find(e=>"empty"!==e.kind))||void 0===a?void 0:a.kind)&&void 0!==r?r:"empty";return{path:t,cells:o,differs:l,cellKind:s}})}function L(e){return e.map(e=>{const{sku:t,key:r,name:a}=function(e){return{sku:"string"===typeof e.sku?e.sku:"?",key:"string"===typeof e.key?e.key:"?",name:"string"===typeof e.name?e.name:"?"}}(e);return{id:t,sku:t,key:r,label:a,flat:I(e)}})}var E=r(4631);const M=new Set(["ProductDetailPage","ProductVariantDetailPage","BundleDetailPage"]);function V(e){const t=(0,i.useMemo)(()=>U(e.variants),[e.variants]),r=(0,i.useMemo)(()=>{const r=e.pathFilter.trim().toLowerCase();return t.filter(t=>!(e.differencesOnly&&!t.differs)&&!(r&&!t.path.toLowerCase().includes(r)))},[t,e.differencesOnly,e.pathFilter]);return 0===e.variants.length?(0,p.Y)("p",{children:"No variants found."}):1===e.variants.length?(0,p.Y)("p",{children:"This product has only one variant \u2014 nothing to compare."}):(0,p.FD)("div",{className:"overflow-x-auto border border-solid border-gray-2024 rounded-[4px]",children:[(0,p.FD)("table",{className:"w-full border-collapse text-left text-x2",children:[(0,p.Y)("thead",{children:(0,p.FD)("tr",{className:"bg-gray-light-2024",children:[(0,p.Y)("th",{className:"sticky left-0 z-[1] min-w-[220px] border-b border-solid border-gray-2024 bg-gray-light-2024 px-3 py-2 font-futura-500 text-x2ss",children:"Field"}),e.variants.map(t=>(0,p.FD)("th",{className:u()("min-w-[240px] border-b border-solid border-gray-2024 px-3 py-2 align-top font-futura-500",e.activeVariantSku===t.sku&&"bg-green-50"),children:[(0,p.Y)("div",{children:t.label}),(0,p.Y)("div",{className:"mt-[4px] font-futura-400 text-x2 text-gray-dark-2024",children:t.sku}),(0,p.Y)("div",{className:"font-futura-400 text-x2 text-gray-dark-2024",children:t.key})]},t.id))]})}),(0,p.Y)("tbody",{children:r.map(e=>{const t=e.differs?"bg-amber-50":"bg-gray-light-2024";return(0,p.FD)("tr",{className:t,children:[(0,p.Y)("td",{className:u()("sticky left-0 z-[1] border-b border-solid border-gray-2024 px-3 py-2 align-top font-mono text-x2 tracking-[-2px] text-x2s",t),children:e.path}),e.cells.map((r,a)=>(0,p.Y)("td",{className:u()("border-b border-solid border-gray-2024 px-3 py-2 align-top text-x2",t,"rich-text"===e.cellKind&&"font-futura-400 break-words whitespace-pre-wrap","text"===e.cellKind&&"font-mono break-all whitespace-pre-wrap","attribute"===e.cellKind&&"font-futura-400",("image"===e.cellKind||"media-gallery"===e.cellKind||"attribute"===e.cellKind)&&"align-middle"),children:(0,p.Y)(f,{cell:r})},`${e.path}-${a}`))]},e.path)})})]}),0===r.length&&(0,p.Y)("p",{className:"px-3 py-[16px] text-gray-dark-2024",children:"No rows match the current filters."})]})}const W=()=>{var e,t,r;const[s,c]=(0,n.ok)(),[u,f]=(0,i.useState)(null!==(e=s.get("path"))&&void 0!==e?e:""),[h,g]=(0,i.useState)(w(null!==(t=s.get("path"))&&void 0!==t?t:"")),[m,x]=(0,i.useState)("false"!==s.get("differencesOnly")),[v,y]=(0,i.useState)(null!==(r=s.get("filter"))&&void 0!==r?r:"");(0,i.useEffect)(()=>{const e={};h&&(e.path=h),m||(e.differencesOnly="false"),v&&(e.filter=v),c(e)},[h,m,v,c]);const{data:b,error:k,isFetching:N,refetch:Y}=(0,a.I)({queryKey:["toolbelt","pdp-variants",h],enabled:h.length>0,queryFn:async()=>{const e=await fetch(`${d.e}${h}`);
1if(!e.ok)throw new Error(`Failed to load PDP (${e.status})`);return e.json()}}),T=(0,i.useMemo)(()=>{if(b&&"Left"!==b.dataOrError._tag)return b.dataOrError.right.selectedProduct},[b]),F=(0,i.useMemo)(()=>{if(b)return"Both"===b.dataOrError._tag||"Left"===b.dataOrError._tag?b.dataOrError.left:void 0},[b]),D=(0,i.useMemo)(()=>function(e){return e?"single-product"===e._tag?[{id:e.key,title:e.name,variants:L(e.variants)}]:e.products.map(e=>({id:e.key,title:e.name,variants:L(e.variants)})):[]}(T),[T]),S=(0,i.useMemo)(()=>D.reduce((e,t)=>e+U(t.variants).filter(e=>e.differs).length,0),[D]);return(0,p.Y)(E.x,{children:(0,p.FD)("div",{children:[(0,p.Y)("h1",{className:"text-headline-1",children:"PDP variant comparison"}),(0,p.Y)("p",{className:"mt-2 text-x2 text-gray-dark-2024",children:"Load a product detail page and compare all variants side by side. Rows where values differ are highlighted."}),(0,p.Y)(l.h,{size:"md"}),(0,p.FD)("form",{className:"grid gap-3",onSubmit:e=>{e.preventDefault(),g(w(u))},children:[(0,p.FD)("label",{className:"grid gap-[6px]",children:[(0,p.Y)("span",{className:"font-futura-500 text-x2",children:"PDP path"}),(0,p.Y)("input",{className:"w-full rounded-[4px] border border-solid border-gray-2024 px-3 py-2 font-mono text-x2",placeholder:"/at/en/hunting/products/.../product-key or .../SKU",value:u,onChange:e=>f(e.target.value)})]}),(0,p.FD)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,p.Y)(o.i,{variant:"green",as:"button",type:"submit",children:"Load PDP"}),h&&(0,p.Y)(o.i,{variant:"white",as:"button",type:"button",onClick:()=>{Y()},children:"Refresh"})]})]}),(0,p.Y)(l.h,{size:"md"}),h&&(0,p.FD)("div",{className:"rounded-[4px] border border-solid border-gray-2024 bg-gray-light-2024 px-3 py-2 font-mono text-x2 break-all",children:[d.e,h]}),(0,p.Y)(l.h,{size:"md"}),N&&(0,p.Y)("p",{children:"Loading PDP data\u2026"}),k&&(0,p.Y)("pre",{className:"text-red-600",children:k instanceof Error?k.message:String(k)}),b&&!M.has(b.__typename)&&(0,p.FD)("p",{children:["This path is a ",(0,p.Y)("strong",{children:b.__typename})," page, not a product detail page. Use a product or variant PDP URL."]}),void 0!==F&&(0,p.FD)("div",{children:[(0,p.Y)("p",{className:"text-red-600",children:"Page data has validation errors (partial data may still render below)."}),(0,p.Y)("pre",{className:"mt-2 overflow-x-auto",children:JSON.stringify(F,null,2)})]}),T&&(0,p.FD)(p.FK,{children:[(0,p.FD)("div",{className:"grid gap-1",children:[(0,p.Y)("h2",{className:"text-headline-2",children:T.name}),(0,p.FD)("div",{className:"font-mono text-x2",children:["key: ",T.key," \xb7 path: ",T.path]}),(0,p.FD)("div",{className:"text-x2 text-gray-dark-2024",children:["page type: ",null===b||void 0===b?void 0:b.__typename," \xb7 differing fields: ",S]})]}),(0,p.Y)(l.h,{size:"md"}),(0,p.FD)("div",{className:"flex flex-wrap items-center gap-[16px]",children:[(0,p.FD)("label",{className:"inline-flex items-center gap-2 text-x2",children:[(0,p.Y)("input",{type:"checkbox",checked:m,onChange:e=>x(e.target.checked)}),"Show differences only"]}),(0,p.FD)("label",{className:"inline-flex min-w-[240px] flex-1 items-center gap-2 text-x2",children:[(0,p.Y)("span",{className:"shrink-0",children:"Filter fields"}),(0,p.Y)("input",{className:"w-full rounded-[4px] border border-solid border-gray-2024 px-2 py-[4px] font-mono text-x2",placeholder:"e.g. attributes.unique",value:v,onChange:e=>y(e.target.value)})]})]}),(0,p.Y)(l.h,{size:"md"}),D.map(e=>(0,p.FD)("section",{className:"mb-[32px]",children:[D.length>1&&(0,p.Y)("h3",{className:"mb-3 text-headline-3",children:e.title}),(0,p.Y)(V,{variants:e.variants,differencesOnly:m,pathFilter:v,activeVariantSku:null===b||void 0===b?void 0:b.page.variantSku})]},e.id))]})]})})},H=()=>(0,s.q)()?(0,p.Y)(W,{}):null,q=H},80841:(e,t,r)=>{var a=r(46065);t.l=function e(t,r){return void 0===r&&(r=" "),t&&t.content&&Array.isArray(t.content)?t.content.reduce(function(i,n,l){var o;if(a.helpers.isText(n))o=n.value;else if((a.helpers.isBlock(n)||a.helpers.isInline(n))&&!(o=e(n,r)).length)return i;var s=t.content[l+1];return i+o+(s&&a.helpers.isBlock(s)?r:"")},""):""}}}]);
2//# sourceMappingURL=2252.af213685.chunk.js.map

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.