import p from"./ProductTeasersFi-n97c3UqI.js";import{_ as v,r as k,o as h,b as g,l as S,q as F}from"./main-DtyiNRRn.js";var c={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getRecommendations"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"factFinderChannel"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"FactFinderChannel"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"productIds"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getRecommendations"},arguments:[{kind:"Argument",name:{kind:"Name",value:"factFinderChannel"},value:{kind:"Variable",name:{kind:"Name",value:"factFinderChannel"}}},{kind:"Argument",name:{kind:"Name",value:"productIds"},value:{kind:"Variable",name:{kind:"Name",value:"productIds"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hits"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"variantValues"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:{kind:"Name",value:"id"},name:{kind:"Name",value:"ID"},arguments:[],directives:[]}]}}]}}]}}]}}],loc:{start:0,end:259}};c.loc.source={body:`query getRecommendations(
  $factFinderChannel: FactFinderChannel!
  $productIds: String
) {
  getRecommendations(
    factFinderChannel: $factFinderChannel
    productIds: $productIds
  ) {
    hits {
      variantValues {
        id: ID
      }
    }
  }
}
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function s(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var i=e.type;i.kind==="NamedType"&&n.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(t){s(t,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(t){s(t,n)}),e.definitions&&e.definitions.forEach(function(t){s(t,n)})}var u={};(function(){c.definitions.forEach(function(n){if(n.name){var i=new Set;s(n,i),u[n.name.value]=i}})})();function m(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}function N(e,n){var i={kind:e.kind,definitions:[m(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var t=u[n]||new Set,a=new Set,r=new Set;for(t.forEach(function(d){r.add(d)});r.size>0;){var l=r;r=new Set,l.forEach(function(d){if(!a.has(d)){a.add(d);var o=u[d]||new Set;o.forEach(function(f){r.add(f)})}})}return a.forEach(function(d){var o=m(e,d);o&&i.definitions.push(o)}),i}N(c,"getRecommendations");const C={name:"CrossSellingProductTeasersFi",components:{ProductTeasersFi:p},props:{productIds:{type:String,required:!0},light:{type:Boolean,default:!1}},emits:["product-added"],data(){return{recommendedProducts:null}},apollo:{getRecommendations:{query:c,variables(){return{factFinderChannel:this.$fischer.factFinderChannel(),productIds:this.productIds}},skip(){var e;return!((e=this.productIds)!=null&&e.length)}}},watch:{productIds(e){e!=null&&e.length||(this.recommendedProducts=null)},getRecommendations(e){var n;e&&(this.recommendedProducts=(n=e.hits.map(i=>{var t,a;return(a=(t=i==null?void 0:i.variantValues)==null?void 0:t[0])==null?void 0:a.id}))==null?void 0:n.join("|"))}}},y={key:0,class:"cross-selling-product-teasers-fi"};function b(e,n,i,t,a,r){const l=k("product-teasers-fi");return a.recommendedProducts?(h(),g("div",y,[S(l,{"custom-fields":{headline:{value:e.$dict.get("online-Shop.Product-Teaser.Cross-Selling.Headline")},productList:{value:a.recommendedProducts},hideContent:{value:!0}},light:i.light,"is-recommendation":"",onProductAdded:n[0]||(n[0]=d=>e.$emit("product-added",d))},null,8,["custom-fields","light"])])):F("",!0)}const _=v(C,[["render",b],["__scopeId","data-v-50989afe"]]);export{_ as C};