const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/getBestPrice-BCuLTYaE.js","assets/bestPriceFragment-C1AoXVUX.js"])))=>i.map(i=>d[i]);
import{Y as w,S as c,J as A}from"./main-DHoZdmBw.js";var y={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"mediaSliderData"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"CatalogMedia"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Filename"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Format"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"OutputType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"NameConvention"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"altText"},name:{kind:"Name",value:"getTextListValue"},arguments:[{kind:"Argument",name:{kind:"Name",value:"key"},value:{kind:"StringValue",value:"KAT_NEU_PRODBILD",block:!1}}],directives:[]},{kind:"Field",alias:{kind:"Name",value:"videoId"},name:{kind:"Name",value:"getTextListValue"},arguments:[{kind:"Argument",name:{kind:"Name",value:"key"},value:{kind:"StringValue",value:"INFO1",block:!1}}],directives:[]}]}}],loc:{start:0,end:203}};y.loc.source={body:`fragment mediaSliderData on CatalogMedia {
  Url
  Filename
  Format
  Type
  OutputType
  NameConvention
  altText: getTextListValue(key: "KAT_NEU_PRODBILD")
  videoId: getTextListValue(key: "INFO1")
}
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function g(e,a){if(e.kind==="FragmentSpread")a.add(e.name.value);else if(e.kind==="VariableDefinition"){var i=e.type;i.kind==="NamedType"&&a.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(n){g(n,a)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(n){g(n,a)}),e.definitions&&e.definitions.forEach(function(n){g(n,a)})}var S={};(function(){y.definitions.forEach(function(a){if(a.name){var i=new Set;g(a,i),S[a.name.value]=i}})})();function T(e,a){for(var i=0;i<e.definitions.length;i++){var n=e.definitions[i];if(n.name&&n.name.value==a)return n}}function R(e,a){var i={kind:e.kind,definitions:[T(e,a)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var n=S[a]||new Set,r=new Set,t=new Set;for(n.forEach(function(d){t.add(d)});t.size>0;){var s=t;t=new Set,s.forEach(function(d){if(!r.has(d)){r.add(d);var l=S[d]||new Set;l.forEach(function(o){t.add(o)})}})}return r.forEach(function(d){var l=T(e,d);l&&i.definitions.push(l)}),i}R(y,"mediaSliderData");var N={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"documentDownloadData"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"CatalogDocument"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Format"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"FileSize"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Description"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"description"},name:{kind:"Name",value:"getTextListValue"},arguments:[{kind:"Argument",name:{kind:"Name",value:"key"},value:{kind:"StringValue",value:"DOKBSTMARKDESCR",block:!1}}],directives:[]},{kind:"Field",name:{kind:"Name",value:"Group"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"GroupRank"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"DocumentRank"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:211}};N.loc.source={body:`fragment documentDownloadData on CatalogDocument {
  Url
  Name
  Format
  FileSize
  Description
  description: getTextListValue(key: "DOKBSTMARKDESCR")
  Group {
    Value
    GroupRank
    DocumentRank
  }
}
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function f(e,a){if(e.kind==="FragmentSpread")a.add(e.name.value);else if(e.kind==="VariableDefinition"){var i=e.type;i.kind==="NamedType"&&a.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(n){f(n,a)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(n){f(n,a)}),e.definitions&&e.definitions.forEach(function(n){f(n,a)})}var p={};(function(){N.definitions.forEach(function(a){if(a.name){var i=new Set;f(a,i),p[a.name.value]=i}})})();function D(e,a){for(var i=0;i<e.definitions.length;i++){var n=e.definitions[i];if(n.name&&n.name.value==a)return n}}function E(e,a){var i={kind:e.kind,definitions:[D(e,a)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var n=p[a]||new Set,r=new Set,t=new Set;for(n.forEach(function(d){t.add(d)});t.size>0;){var s=t;t=new Set,s.forEach(function(d){if(!r.has(d)){r.add(d);var l=p[d]||new Set;l.forEach(function(o){t.add(o)})}})}return r.forEach(function(d){var l=D(e,d);l&&i.definitions.push(l)}),i}E(N,"documentDownloadData");var m={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getCatalogProductDataById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"baseSiteId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"BaseSiteId"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"apiLang"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CatalogLocale"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"getMandatoryAccessories"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}},defaultValue:{kind:"BooleanValue",value:!1},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getCatalogProductDataById"},arguments:[{kind:"Argument",name:{kind:"Name",value:"baseSiteId"},value:{kind:"Variable",name:{kind:"Name",value:"baseSiteId"}}},{kind:"Argument",name:{kind:"Name",value:"apiLang"},value:{kind:"Variable",name:{kind:"Name",value:"apiLang"}}},{kind:"Argument",name:{kind:"Name",value:"ProductId"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"ProductId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ProductName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Slug"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ParentCategory"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ParentCategoryList"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ProductPrice"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ProductPriceCurrency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"RootCategory"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"CategoryPath"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"CategoryDisplayNamePath"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"categoryData"},arguments:[{kind:"Argument",name:{kind:"Name",value:"baseSiteId"},value:{kind:"Variable",name:{kind:"Name",value:"baseSiteId"}}},{kind:"Argument",name:{kind:"Name",value:"apiLang"},value:{kind:"Variable",name:{kind:"Name",value:"apiLang"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"CategoryRole"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Slug"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"categoryName"},name:{kind:"Name",value:"getTextListValue"},arguments:[{kind:"Argument",name:{kind:"Name",value:"key"},value:{kind:"StringValue",value:"BEZEICHNUNG",block:!1}}],directives:[]},{kind:"Field",alias:{kind:"Name",value:"categoryMedia"},name:{kind:"Name",value:"getMediaUrl"},arguments:[{kind:"Argument",name:{kind:"Name",value:"outputType"},value:{kind:"StringValue",value:"PR",block:!1}},{kind:"Argument",name:{kind:"Name",value:"nameConvention"},value:{kind:"StringValue",value:"P_G_F",block:!1}}],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"Media"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"mediaSliderData"},directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"technicalDrawing"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"AssemblyMedia"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Name"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"media"},name:{kind:"Name",value:"filteredMedia"},arguments:[{kind:"Argument",name:{kind:"Name",value:"outputType"},value:{kind:"StringValue",value:"PR",block:!1}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Url"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"label"},name:{kind:"Name",value:"getTextListValue"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"BooleanValue",value:!0}}],directives:[]},{kind:"Field",name:{kind:"Name",value:"TextList"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Value"},arguments:[],directives:[]}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"Documents"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"AdditionalDocuments"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"documentDownloadData"},directives:[]},{kind:"Field",name:{kind:"Name",value:"Type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"CharacteristicValueNames"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"Approvals"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"DocumentId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Format"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"FileSize"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ValidFrom"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ValidTo"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Description"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"nr"},name:{kind:"Name",value:"getAttributeListValue"},arguments:[{kind:"Argument",name:{kind:"Name",value:"key"},value:{kind:"StringValue",value:"ZULANR",block:!1}}],directives:[]},{kind:"Field",name:{kind:"Name",value:"ChildDocumentIds"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ParentDocumentId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"TextList"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Value"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"Group"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"GroupRank"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"DocumentRank"},arguments:[],directives:[]}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"TextList"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Value"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"Attributes"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"AttributeKey"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"AttributeName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"TechnicalName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Unit"},arguments:[],directives:[]}]}},{kind:"Field",alias:{kind:"Name",value:"accessories"},name:{kind:"Name",value:"getReferences"},arguments:[{kind:"Argument",name:{kind:"Name",value:"type"},value:{kind:"StringValue",value:"ACCESSORY",block:!1}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"ProductId"},arguments:[],directives:[]}]}},{kind:"Field",alias:{kind:"Name",value:"mandatoryAccessories"},name:{kind:"Name",value:"getReferences"},arguments:[{kind:"Argument",name:{kind:"Name",value:"type"},value:{kind:"StringValue",value:"MANDATORY_ACCESSORY",block:!1}}],directives:[{kind:"Directive",name:{kind:"Name",value:"include"},arguments:[{kind:"Argument",name:{kind:"Name",value:"if"},value:{kind:"Variable",name:{kind:"Name",value:"getMandatoryAccessories"}}}]}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"ProductId"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"hasCADLink"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Links"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Url"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"RetailerLinks"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"Name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"LogoUrl"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:2067}};m.loc.source={body:`#import "./mediaSliderDataFragment.gql"
#import "./documentDownloadDataFragment.gql"

query getCatalogProductDataById(
  $baseSiteId: BaseSiteId!
  $apiLang: CatalogLocale!
  $id: String!
  $getMandatoryAccessories: Boolean = false
) {
  getCatalogProductDataById(
    baseSiteId: $baseSiteId
    apiLang: $apiLang
    ProductId: $id
  ) {
    ProductId
    ProductName
    Slug
    ParentCategory
    ParentCategoryList
    ProductPrice
    ProductPriceCurrency
    RootCategory
    CategoryPath
    CategoryDisplayNamePath
    categoryData(
      baseSiteId: $baseSiteId
      apiLang: $apiLang
    ){
      CategoryRole
      Slug
      categoryName: getTextListValue(key: "BEZEICHNUNG")
      categoryMedia: getMediaUrl(outputType: "PR", nameConvention: "P_G_F")
    }
    Media {
      ...mediaSliderData
    }
    technicalDrawing
    AssemblyMedia {
      Name
      media: filteredMedia(outputType: "PR") {
        Url
        label: getTextListValue(first: true)
        TextList {
          Key
          Value
        }
      }
    }
    Documents {
      AdditionalDocuments {
        ...documentDownloadData
        Type
        CharacteristicValueNames
      }
      Approvals {
        DocumentId
        Url
        Name
        Format
        FileSize
        ValidFrom
        ValidTo
        Description
        nr: getAttributeListValue(key: "ZULANR")
        ChildDocumentIds
        ParentDocumentId
        TextList {
          Key
          Value
        }
        Group {
          Value
          GroupRank
          DocumentRank
        }
      }
    }
    TextList {
      Key
      Value
    }
    Attributes {
      AttributeKey
      AttributeName
      TechnicalName
      Value
      Unit
    }
    accessories: getReferences(type: "ACCESSORY") {
      ProductId
    }
    mandatoryAccessories: getReferences(type: "MANDATORY_ACCESSORY") @include(if: $getMandatoryAccessories) {
      ProductId
    }
    hasCADLink
    Links {
      Type
      Url
    }
    RetailerLinks {
      Type
      Url
      Name
      LogoUrl
    }
  }
}

`,name:"GraphQL request",locationOffset:{line:1,column:1}};var P={};function _(e){return e.filter(function(a){if(a.kind!=="FragmentDefinition")return!0;var i=a.name.value;return P[i]?!1:(P[i]=!0,!0)})}m.definitions=m.definitions.concat(_(y.definitions));m.definitions=m.definitions.concat(_(N.definitions));function h(e,a){if(e.kind==="FragmentSpread")a.add(e.name.value);else if(e.kind==="VariableDefinition"){var i=e.type;i.kind==="NamedType"&&a.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(n){h(n,a)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(n){h(n,a)}),e.definitions&&e.definitions.forEach(function(n){h(n,a)})}var F={};(function(){m.definitions.forEach(function(a){if(a.name){var i=new Set;h(a,i),F[a.name.value]=i}})})();function C(e,a){for(var i=0;i<e.definitions.length;i++){var n=e.definitions[i];if(n.name&&n.name.value==a)return n}}function $(e,a){var i={kind:e.kind,definitions:[C(e,a)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var n=F[a]||new Set,r=new Set,t=new Set;for(n.forEach(function(d){t.add(d)});t.size>0;){var s=t;t=new Set,s.forEach(function(d){if(!r.has(d)){r.add(d);var l=F[d]||new Set;l.forEach(function(o){t.add(o)})}})}return r.forEach(function(d){var l=C(e,d);l&&i.definitions.push(l)}),i}$(m,"getCatalogProductDataById");const L=e=>{let a=e.toString()||"",i=".";return a=a.replace(/[^0-9$.,]/g,""),a.indexOf(",")>a.indexOf(".")&&(i=","),(a.match(new RegExp(`\\${i}`,"g"))||[]).length>1&&(i=""),a=a.replace(new RegExp(`[^0-9$${i}]`,"g"),""),a=a.replace(",","."),parseFloat(a)},x=()=>A(()=>import("./getBestPrice-BCuLTYaE.js"),__vite__mapDeps([0,1])),B={mixins:[w],computed:{isShop(){return this.$fischer.shop.isClosedShop()||this.$fischer.shop.isOnlineShop()},brandName(){return this.$fischer.brandName()},enableTracking(){return this.$fischer.enableAnalytics()},enableTrackingShop(){return this.isShop||this.$fischer.shop.isRetailConnectCart()},pageType(){return window.location.pathname}},methods:{trackViewItemList(e,a){try{if(!this.enableTracking)return;const i=[];e.forEach((n,r)=>{if(!n)return;const t=n.CategoryRole==="FAMILY_PAGE",s={item_name:n.name||n.ProductName||n.CategoryName,item_id:t?n.id||"FP":n.ProductId||n.id,item_brand:this.brandName,item_list_name:a?"accessories":"Featured Items",item_list_id:a?"A-PDP":this.pageType,index:r+1,...this.getCategories(n.CategoryDisplayNamePath)};i.push(s)}),i.length&&this.addToDataLayer("view_item_list",i)}catch(i){console.error(i),c(i)}},async trackViewItem(e,a){var i,n;try{if(!this.enableTracking)return;const r=a?(i=e.TextList.find(u=>u.Key==="BEZEICHNUNG"))==null?void 0:i.Value:(n=e.TextList.find(u=>u.Key==="ECOMLANG"))==null?void 0:n.Value,t=a?e.CategoryId:e.ProductId;let s={item_name:r,item_id:t,item_brand:this.brandName,...this.getCategories(e.CategoryDisplayNamePath)};a||(s.item_variant=e.ProductName);const{price:d,quantity:l,currency:o,totalPrice:k}=await this.getPriceForTracking(e.ProductId);d&&(s.price=d,s.quantity=l);let v;k&&(v={currency:o,value:k}),this.addToDataLayer("view_item",[s],v)}catch(r){console.error(r),c(r)}},async trackSelectItem(e,a){try{if(!this.enableTracking)return;const i=e.CategoryRole==="FAMILY_PAGE";if(!e.CategoryRole||i){const n={item_name:e.name||e.CategoryName,item_id:i?e.id||"FP":e.id,item_brand:this.brandName,item_list_name:a?"accessories":"Featured Items",item_list_id:a?"A-PDP":this.pageType,index:1,...this.getCategories(e.CategoryDisplayNamePath)};this.addToDataLayer("select_item",[n])}}catch(i){console.error(i),c(i)}},async trackAddProductToWishlist(e){var a;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const n={item_name:(a=e.TextList.find(o=>o.Key==="ECOMLANG"))==null?void 0:a.Value,item_id:e.ProductId,item_brand:this.brandName,item_variant:e.ProductName,...this.getCategories(e.CategoryDisplayNamePath)},{price:r,quantity:t,currency:s,totalPrice:d}=await this.getPriceForTracking(e.ProductId);r&&(n.price=r,n.quantity=t);let l;d&&(l={currency:s,value:d}),this.addToDataLayer("add_to_wishlist",[n],l)}catch(i){console.error(i),c(i)}},trackAddCartToWishlist(e){var a,i;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const n=this.getCartItems(e),r={currency:(a=e.subTotal)==null?void 0:a.currencyIso,value:(i=e.subTotal)==null?void 0:i.value};n.length&&this.addToDataLayer("add_to_wishlist",n,r)}catch(n){console.error(n),c(n)}},trackViewCart(e){var a,i;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const n=this.getCartItems(e),r={currency:(a=e.subTotal)==null?void 0:a.currencyIso,value:(i=e.subTotal)==null?void 0:i.value};n.length&&this.addToDataLayer("view_cart",n,r)}catch(n){console.error(n),c(n)}},async trackAddToCart(e,a,i,n){var r,t;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const s=a.padStart(6,"0"),d=await this.getProductById(s);if(!d){console.info(`product not found with id: ${s}`);return}let o={item_name:(t=(r=d.TextList)==null?void 0:r.find(I=>I.Key==="ECOMLANG"))==null?void 0:t.Value,item_id:s,item_brand:this.brandName,item_variant:d.ProductName,quantity:i,...this.getCategories(d.CategoryDisplayNamePath)};const{price:k,currency:v,totalPrice:u}=await this.getPriceForTracking(s,i);k&&(o.price=k);let b;u&&(b={currency:v,value:u}),this.addToDataLayer("add_to_cart",[o],b);const V=this.$fischer.shop.isClosedShop()?[{productId:s,quantity:i,productPrice:u,currency:v}]:[{productId:s}];this.sendEvent(n?"memo_list_cart_single":"add_to_cart",{cartId:e,items:V})}catch(s){console.error(s),c(s)}},async trackAddMultipleToCart(e,a){try{if(!(this.enableTracking&&this.enableTrackingShop))return;const i=(await Promise.all(a.map(async({id:n,quantity:r})=>{try{const t={productId:n,quantity:r},{totalPrice:s,currency:d}=await this.getPriceForTracking(n,r);return s&&(t.productPrice=s,t.currency=d),t}catch(t){return console.error("could not get info on product",n,r,t),null}}))).filter(n=>n);i.length&&this.sendEvent("add_to_cart",{cartId:e,items:i})}catch(i){console.error(i),c(i)}},async trackRemoveFromCart(e){try{if(!(this.enableTracking&&this.enableTrackingShop))return;const a=[];e.forEach(i=>{var r,t;let n={item_name:i.name,item_id:i.articleNo,item_brand:this.brandName,item_variant:(r=i.catalogProductData)==null?void 0:r.ProductName,quantity:i.quantity,...this.getCategories((t=i.catalogProductData)==null?void 0:t.CategoryDisplayNamePath)};i.priceValue&&i.initialQuantity&&(n.price=i.priceValue/i.initialQuantity),a.push(n)}),this.addToDataLayer("remove_from_cart",a)}catch(a){console.error(a),c(a)}},trackBeginCheckout(e){var a,i;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const n=this.getCartItems(e),r={currency:(a=e.subTotal)==null?void 0:a.currencyIso,value:(i=e.subTotal)==null?void 0:i.value};n.length&&this.addToDataLayer("begin_checkout",n,r)}catch(n){console.error(n),c(n)}},trackPurchase(e){var a,i,n,r;try{if(!this.enableTracking&&!this.enableTrackingShop)return;const t=`${this.$fischer.hostname()}/${this.$fischer.siteLanguage().toLowerCase()}/`,s=this.getCartItems(e),d={affiliation:t,currency:(a=e.subTotal)==null?void 0:a.currencyIso,value:(i=e.subTotal)==null?void 0:i.value,tax:(n=e.totalTax)==null?void 0:n.value,shipping:(r=e.deliveryCost)==null?void 0:r.value,transaction_id:e.code,order_channel:this.isAppView?"myfischer online APP":"myfischer online"};s.length&&this.addToDataLayer("purchase",s,d)}catch(t){console.error(t),c(t)}},trackOnlineRetailerClicked(e,a){try{if(!this.enableTracking&&!this.enableTrackingShop)return;const i=this.getCartItems(e),n={retailerName:a,cartItems:i==null?void 0:i.length};this.addToDataLayer("RCClickedOnRetailer",i,n)}catch(i){console.error(i),c(i)}},getCartItems(e){var i;const a=[];return(i=e==null?void 0:e.products)!=null&&i.length&&e.products.forEach(n=>{const r=n.catalogProductData||{},t={item_id:n.articleNo,item_name:n.name,item_brand:this.brandName,item_variant:r.ProductName,...this.getCategories(r.CategoryDisplayNamePath)};this.isShop&&(t.price=n.priceValue/n.initialQuantity,t.quantity=n.quantity),a.push(t)}),a},getCategories(e){const a={};return e!=null&&e.length&&e.forEach((i,n)=>{a[n===0?"item_category":`item_category${n+1}`]=i}),a},async getPriceForTracking(e,a=0){var i,n,r,t,s;if(this.isShop&&e)try{const d=e.padStart(6,"0"),{data:l}=await this.$apollo.query({query:(await x()).default,errorPolicy:"all",variables:{baseSiteId:this.$fischer.baseSiteId(),accessToken:this.$fischer.user.accessToken(),productCode:d,qty:a,language:this.$fischer.siteLanguage(),expired:!0,userId:this.$fischer.user.id()}});return(n=(i=l==null?void 0:l.getBestPrice)==null?void 0:i.price)!=null&&n.valueFormatted&&((t=(r=l==null?void 0:l.getBestPrice)==null?void 0:r.price)!=null&&t.totalValueFormatted)&&((s=l==null?void 0:l.getBestPrice)!=null&&s.initialQuantity)?{currency:l.getBestPrice.price.currencyIso,price:L(l.getBestPrice.price.valueFormatted)/l.getBestPrice.initialQuantity,quantity:l.getBestPrice.initialQuantity||"1",totalPrice:L(l.getBestPrice.price.totalValueFormatted)}:{price:void 0,quantity:a,currency:"",totalPrice:void 0}}catch(d){console.trace("error getting best price",d,e,a)}return{price:void 0,quantity:a,currency:"",totalPrice:void 0}},async getProductById(e){try{const{data:a}=await this.$apollo.query({query:m,errorPolicy:"all",variables:{baseSiteId:this.$fischer.baseSiteId(),apiLang:this.$fischer.catalogLocale(),id:e}});return a.getCatalogProductDataById||null}catch(a){return console.error("error getting product data",e,a),null}},addToDataLayer(e,a,i){typeof window.gtag=="function"?window.gtag("event",e,{...i,items:a}):(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:e,ecommerce:{...i,items:a}}))}}};export{B as _,y as a,N as b,m as d,L as p};