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-DtyiNRRn.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 b(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 I(e,a){var i={kind:e.kind,definitions:[b(e,a)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var n=S[a]||new Set,d=new Set,r=new Set;for(n.forEach(function(t){r.add(t)});r.size>0;){var l=r;r=new Set,l.forEach(function(t){if(!d.has(t)){d.add(t);var s=S[t]||new Set;s.forEach(function(o){r.add(o)})}})}return d.forEach(function(t){var s=b(e,t);s&&i.definitions.push(s)}),i}I(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 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=p[a]||new Set,d=new Set,r=new Set;for(n.forEach(function(t){r.add(t)});r.size>0;){var l=r;r=new Set,l.forEach(function(t){if(!d.has(t)){d.add(t);var s=p[t]||new Set;s.forEach(function(o){r.add(o)})}})}return d.forEach(function(t){var s=T(e,t);s&&i.definitions.push(s)}),i}R(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 D={};function L(e){return e.filter(function(a){if(a.kind!=="FragmentDefinition")return!0;var i=a.name.value;return D[i]?!1:(D[i]=!0,!0)})}m.definitions=m.definitions.concat(L(y.definitions));m.definitions=m.definitions.concat(L(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 P(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:[P(e,a)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var n=F[a]||new Set,d=new Set,r=new Set;for(n.forEach(function(t){r.add(t)});r.size>0;){var l=r;r=new Set,l.forEach(function(t){if(!d.has(t)){d.add(t);var s=F[t]||new Set;s.forEach(function(o){r.add(o)})}})}return d.forEach(function(t){var s=P(e,t);s&&i.definitions.push(s)}),i}E(m,"getCatalogProductDataById");const C=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)},$=()=>A(()=>import("./getBestPrice-BCuLTYaE.js"),__vite__mapDeps([0,1])),O={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,d)=>{if(!n)return;const r=n.CategoryRole==="FAMILY_PAGE",l={item_name:n.name||n.ProductName||n.CategoryName,item_id:r?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:d+1,...this.getCategories(n.CategoryDisplayNamePath)};i.push(l)}),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 d=a?(i=e.TextList.find(k=>k.Key==="BEZEICHNUNG"))==null?void 0:i.Value:(n=e.TextList.find(k=>k.Key==="ECOMLANG"))==null?void 0:n.Value,r=a?e.CategoryId:e.ProductId;let l={item_name:d,item_id:r,item_brand:this.brandName,...this.getCategories(e.CategoryDisplayNamePath)};a||(l.item_variant=e.ProductName);const{price:t,quantity:s,currency:o,totalPrice:v}=await this.getPriceForTracking(e.ProductId);t&&(l.price=t,l.quantity=s);let u;v&&(u={currency:o,value:v}),this.addToDataLayer("view_item",[l],u)}catch(d){console.error(d),c(d)}},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:d,quantity:r,currency:l,totalPrice:t}=await this.getPriceForTracking(e.ProductId);d&&(n.price=d,n.quantity=r);let s;t&&(s={currency:l,value:t}),this.addToDataLayer("add_to_wishlist",[n],s)}catch(i){console.error(i),c(i)}},trackAddCartToWishlist(e){var a,i;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const n=this.getCartItems(e),d={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,d)}catch(n){console.error(n),c(n)}},trackViewCart(e){var a,i;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const n=this.getCartItems(e),d={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,d)}catch(n){console.error(n),c(n)}},async trackAddToCart(e,a,i,n){var d,r;try{if(!(this.enableTracking&&this.enableTrackingShop))return;const l=await this.getProductById(a);if(!l){console.info(`product not found with id: ${a}`);return}let s={item_name:(r=(d=l.TextList)==null?void 0:d.find(V=>V.Key==="ECOMLANG"))==null?void 0:r.Value,item_id:a,item_brand:this.brandName,item_variant:l.ProductName,quantity:i,...this.getCategories(l.CategoryDisplayNamePath)};const{price:o,currency:v,totalPrice:u}=await this.getPriceForTracking(a,i);o&&(s.price=o);let k;u&&(k={currency:v,value:u}),this.addToDataLayer("add_to_cart",[s],k);const _=this.$fischer.shop.isClosedShop()?[{productId:a,quantity:i,productPrice:u,currency:v}]:[{productId:a}];this.sendEvent(n?"memo_list_cart_single":"add_to_cart",{cartId:e,items:_})}catch(l){console.error(l),c(l)}},async trackAddMultipleToCart(e,a){try{if(!(this.enableTracking&&this.enableTrackingShop))return;const i=(await Promise.all(a.map(async({id:n,quantity:d})=>{try{const r={productId:n,quantity:d},{totalPrice:l,currency:t}=await this.getPriceForTracking(n,d);return l&&(r.productPrice=l,r.currency=t),r}catch(r){return console.error("could not get info on product",n,d,r),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 d,r;let n={item_name:i.name,item_id:i.articleNo,item_brand:this.brandName,item_variant:(d=i.catalogProductData)==null?void 0:d.ProductName,quantity:i.quantity,...this.getCategories((r=i.catalogProductData)==null?void 0:r.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),d={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,d)}catch(n){console.error(n),c(n)}},trackPurchase(e){var a,i,n,d;try{if(!this.enableTracking&&!this.enableTrackingShop)return;const r=`${this.$fischer.hostname()}/${this.$fischer.siteLanguage().toLowerCase()}/`,l=this.getCartItems(e),t={affiliation:r,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:(d=e.deliveryCost)==null?void 0:d.value,transaction_id:e.code,order_channel:this.isAppView?"myfischer online APP":"myfischer online"};l.length&&this.addToDataLayer("purchase",l,t)}catch(r){console.error(r),c(r)}},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 d=n.catalogProductData||{},r={item_id:n.articleNo,item_name:n.name,item_brand:this.brandName,item_variant:d.ProductName,...this.getCategories(d.CategoryDisplayNamePath)};this.isShop&&(r.price=n.priceValue/n.initialQuantity,r.quantity=n.quantity),a.push(r)}),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,d,r,l;if(this.isShop&&e)try{const{data:t}=await this.$apollo.query({query:(await $()).default,errorPolicy:"all",variables:{baseSiteId:this.$fischer.baseSiteId(),accessToken:this.$fischer.user.accessToken(),productCode:e,qty:a,language:this.$fischer.siteLanguage(),expired:!0,userId:this.$fischer.user.id()}});return(n=(i=t==null?void 0:t.getBestPrice)==null?void 0:i.price)!=null&&n.valueFormatted&&((r=(d=t==null?void 0:t.getBestPrice)==null?void 0:d.price)!=null&&r.totalValueFormatted)&&((l=t==null?void 0:t.getBestPrice)!=null&&l.initialQuantity)?{currency:t.getBestPrice.price.currencyIso,price:C(t.getBestPrice.price.valueFormatted)/t.getBestPrice.initialQuantity,quantity:t.getBestPrice.initialQuantity||"1",totalPrice:C(t.getBestPrice.price.totalValueFormatted)}:{price:void 0,quantity:a,currency:"",totalPrice:void 0}}catch(t){console.trace("error getting best price",t,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{O as _,y as a,N as b,m as d,C as p};