useMDCAIGlassesMixAndMatchDataFetcher.react",["CometRelay","DollyMarketingSupernovaProductInformationUtils","FBLogger","MDCAIGlassesMixAndMatchConstants","MDCAIGlassesMixAndMatchLensUtils","SHOPCategory","XFBDollyMarketingRxStepTypeUtils.metadotcom","XSHSHOPRxOptionTransitionGlassTypeEnumUtils.metadotcom","getJSEnumSafe","isFalsey","snakeCase","useMDCAIGlassesMixAndMatchDataFetcherQuery.graphql"],(function(t,n,r,o,a,i,l){"use strict";var e,s=e!==void 0?e:e=n("useMDCAIGlassesMixAndMatchDataFetcherQuery.graphql");function u(e,t){var n,a,i,l,s,u,c,d,m,p,_,f=(n=(a=e.xmd_mdc_mix_and_match_data)==null?void 0:a.frames)!=null?n:[];if(f.length===0)throw r("FBLogger")("mdc_mix_and_match").mustfixThrow("No frames fetched for mix and match");var g=f[0],h=g==null||(i=g.product)==null?void 0:i.id,y=g==null?void 0:g.sku,C=(l=r("getJSEnumSafe")(r("SHOPCategory"),g==null?void 0:g.shop_category))!=null?l:"SUPERNOVA_RX_FRAME",b=f!=null?f.map(function(e){var t,n,a,i,l,s,u,c=e==null||(t=e.attributes)==null?void 0:t.color,d=e==null||(n=e.attributes)==null?void 0:n.size,m=e==null||(a=e.attributes)==null?void 0:a.style,p=e==null||(i=e.attributes)==null?void 0:i.nose_bridge_fit,_=e==null||(l=e.product)==null?void 0:l.id,f=e==null||(s=e.offer)==null?void 0:s.id,g=(u=r("getJSEnumSafe")(r("SHOPCategory"),e==null?void 0:e.shop_category))!=null?u:"SUPERNOVA_RX_FRAME";if(r("isFalsey")(c)||r("isFalsey")(d)||r("isFalsey")(m)||r("isFalsey")(_)||r("isFalsey")(p)||r("isFalsey")(f))throw r("FBLogger")("mdc_mix_and_match").mustfixThrow("Frame attributes must be present - color: %s, size: %s, style: %s, nose_bridge_fit: %s, id: %s, offer_id: %s",c!=null?c:"null",d!=null?d:"null",m!=null?m:"null",p!=null?p:"null",_!=null?_:"null",f!=null?f:"null");var h=o("DollyMarketingSupernovaProductInformationUtils").supernovaFrameColorEnumToHexCode(r("snakeCase")(c))[0];return{frameColor:c,frameHexCode:h,frameShopCategory:g,frameSize:d,frameStyle:m,id:_,frameNoseBridgeFit:p,offerID:f}}).filter(Boolean):[],v=(s=e.xmd_mdc_mix_and_match_data)==null||(s=s.lens_option_groups)==null?void 0:s.filter(function(e){return e.step_type&&o("MDCAIGlassesMixAndMatchConstants").mixAndMatchLensOptionGroups.has(e.step_type)}),S=new Map;v==null||v.forEach(function(e){var t,n=o("XFBDollyMarketingRxStepTypeUtils.metadotcom").toJSEnum(e.step_type);if(r("isFalsey")(e.options)||r("isFalsey")(e.id)||r("isFalsey")(n))return null;var a=e.options.nodes.map(function(e){var t,n,a,i,l,s,u,c,d,m,p,_,f,g,h,y,C,b,v,S=(t=(n=e.valid_offer_from_product_for_site_at_time)==null||(n=n.valid_price_for_country_at_time)==null||(n=n.offer_price)==null?void 0:n.formatted_amount)!=null?t:"";return r("isFalsey")((a=e.if_is_lens_option)==null?void 0:a.localized_customer_facing_title)||r("isFalsey")(e.id)?null:{id:e.id,isPolarized:(i=(l=e.if_is_lens_option)==null?void 0:l.is_polarized)!=null?i:!1,hexCodes:(s=(u=e.if_is_lens_option)==null?void 0:u.hex_codes)!=null?s:[],transitionGlassType:o("XSHSHOPRxOptionTransitionGlassTypeEnumUtils.metadotcom").toJSEnum((c=e.if_is_lens_option)==null?void 0:c.transition_glass_type),customerFacingTitle:(d=(m=e.if_is_lens_option)==null?void 0:m.localized_customer_facing_title)!=null?d:"",customerFacingDescription:(p=e.if_is_lens_option)==null?void 0:p.localized_customer_facing_description,salePrice:(_=e.valid_offer_from_product_for_site_at_time)==null||(_=_.valid_price_for_country_at_time)==null||(_=_.sale_price)==null?void 0:_.formatted_amount,price:S,offerID:(f=(g=e.valid_offer_from_product_for_site_at_time)==null?void 0:g.id)!=null?f:"",offerAmount:(h=e.valid_offer_from_product_for_site_at_time)==null||(h=h.valid_price_for_country_at_time)==null||(h=h.offer_price)==null?void 0:h.amount,internalName:(y=(C=e.if_is_lens_option)==null?void 0:C.internal_name)!=null?y:"",sequence:(b=(v=e.if_is_lens_option)==null?void 0:v.sequence)!=null?b:0}}).filter(Boolean);S.set(n,{id:(t=e.id)!=null?t:"",options:a,stepType:n})});var R=new Map;f==null||f.map(function(e){var t;if(!r("isFalsey")(e==null||(t=e.product)==null?void 0:t.id)){var n,a,i,l=(n=e.lenses)==null||(n=n.nodes)==null?void 0:n.map(function(e){var t,n,r=new Map;return(t=e.rx_data)==null||t.prescription_lens_options.forEach(function(e){var t,n,a,i=o("XFBDollyMarketingRxStepTypeUtils.metadotcom").toJSEnum(e==null||(t=e.if_is_lens_option)==null||(t=t.option_group)==null?void 0:t.step_type);i!=null&&(i==="lens_color_selection"||i==="lens_type_selection")&&(e==null||(n=e.if_is_lens_option)==null||(n=n.option_group)==null?void 0:n.id)!=null&&r.set(i,(a=e==null?void 0:e.id)!=null?a:"")}),{id:e.id,lensOptionMap:r,lensShopCategory:e.product_category,offerID:(n=e.valid_offer_from_product_for_site_at_time)==null?void 0:n.id}}),s=(l!=null?l:[]).sort(function(e,t){var n=function(t){var e,n,r,o,a=(e=t.lensOptionMap)==null?void 0:e.get("lens_type_selection"),i=(n=t.lensOptionMap)==null?void 0:n.get("lens_color_selection"),l=(r=S.get("lens_type_selection"))==null||(r=r.options)==null?void 0:r.find(function(e){return e.id===a}),s=(o=S.get("lens_color_selection"))==null||(o=o.options)==null?void 0:o.find(function(e){return e.id===i}),u=(l==null?void 0:l.offerAmount)!=null?parseFloat(l.offerAmount):0,c=(s==null?void 0:s.offerAmount)!=null?parseFloat(s.offerAmount):0;return u+c};return n(e)-n(t)});R.set((a=e==null||(i=e.product)==null?void 0:i.id)!=null?a:"",s)}});var L=new Map;b==null||b.forEach(function(e){var t,n=e.frameColor;if(!r("isFalsey")(n)){var o=(t=L.get(n))!=null?t:[];o.find(function(t){return t.frameSize===e.frameSize&&t.frameNoseBridgeFit===e.frameNoseBridgeFit})==null&&o.push(e),L.set(n,o)}});var E=[];L.entries().forEach(function(e){var t,n,r=e[0],o=e[1];o.sort(function(e,t){return e.frameSize==="Standard"&&t.frameSize==="Large"?-1:t.frameSize==="Standard"&&e.frameSize==="Large"?1:e.frameNoseBridgeFit==="Low Bridge Fit"&&t.frameNoseBridgeFit==="High Bridge Fit"?-1:t.frameNoseBridgeFit==="Low Bridge Fit"&&e.frameNoseBridgeFit==="High Bridge Fit"?1:0}),E.push({frameColor:r,frameHexCode:(t=(n=o[0])==null?void 0:n.frameHexCode)!=null?t:"",matchingFrames:o,validNoseBridgeFits:new Set(o.map(function(e){var t;return(t=e.frameNoseBridgeFit)!=null?t:""}).filter(Boolean)),validSizes:new Set(o.map(function(e){var t;return(t=e.frameSize)!=null?t:""}).filter(Boolean))})});var k=o("DollyMarketingSupernovaProductInformationUtils").supernovaFrameColorEnumToHexCode(r("snakeCase")((u=t.frameColor)!=null?u:""))[0],I=b.filter(function(e){return e.frameHexCode===k}),T=I.length>0?I:(c=(d=E[0])==null?void 0:d.matchingFrames)!=null?c:[],D=T[0];if(D==null)throw r("FBLogger")("mdc_mix_and_match").mustfixThrow("No initial frame found for mix and match - frameHexCode: %s, frameColors: %s",k!=null?k:"null",E.length);var x=(m=R.get(D.id))!=null?m:[],$=x[0],P=(p=S.get("lens_color_selection"))==null?void 0:p.options,N=P==null?void 0:P.filter(function(e){return o("MDCAIGlassesMixAndMatchLensUtils").isClearLens(e)}).map(function(e){return e.id}),M=new Map;b==null||b.forEach(function(e){var t,n=(t=R.get(e.id))==null?void 0:t.find(function(e){var t,n;return N==null?void 0:N.includes((t=(n=e.lensOptionMap)==null?void 0:n.get("lens_color_selection"))!=null?t:"")});M.set(e.id,n)});var w=M.get(D.id),A=D.offerID,F=[A,(_=w==null?void 0:w.offerID)!=null?_:$==null?void 0:$.offerID].filter(Boolean),O=t;return{colorFrameMap:L,currentProductOnPDP:O,defaultFrameColorProductID:h,defaultFrameColorProductSKU:y,defaultFrameColorShopCategory:C,frameColors:E,frameFirstClearLensMap:M,frameLensMap:R,initialFrameOfferID:A,initialOfferIDs:F,lensOptionGroupMap:S,mixAndMatchFrames:b}}function c(e){if(e==null||e.id==null)throw r("FBLogger")("mdc_mix_and_match").mustfixThrow("Current product must be present");var t=o("CometRelay").useLazyLoadQuery(s,{product_id:e.id});return u(t,e)}l.default=c}),98);
-----
useMDCAIGlassesMixAndMatchDataFetcherQuery.graphql",["useMDCAIGlassesMixAndMatchDataFetcherQuery_meta_dot_comRelayOperation"],(function(t,n,r,o,a,i){"use strict";var e=(function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"product_id"},{defaultValue:null,kind:"LocalArgument",name:"timestamp"}],t=[{kind:"Variable",name:"product_id",variableName:"product_id"}],r={alias:null,args:null,concreteType:"XMDMDCMixAndMatchFrameProductAttributes",kind:"LinkedField",name:"attributes",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"color",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"nose_bridge_fit",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"style",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"size",storageKey:null}],storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"shop_category",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"sku",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[i],s={alias:null,args:null,concreteType:"SHOPProduct",kind:"LinkedField",name:"product",plural:!1,selections:l,storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"product_category",storageKey:null},c=[{kind:"Variable",name:"timestamp",variableName:"timestamp"}],d={alias:null,args:null,kind:"ScalarField",name:"step_type",storageKey:null},m={alias:null,args:null,concreteType:"XSHLensOption",kind:"LinkedField",name:"if_is_lens_option",plural:!1,selections:[{alias:null,args:null,concreteType:"XSHSHOPRxOptionGroup",kind:"LinkedField",name:"option_group",plural:!1,selections:[d,i],storageKey:null}],storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"formatted_amount",storageKey:null},_={alias:null,args:null,concreteType:"CurrencyAmount",kind:"LinkedField",name:"offer_price",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"amount",storageKey:null},p],storageKey:null},f={alias:null,args:null,concreteType:"CurrencyAmount",kind:"LinkedField",name:"sale_price",plural:!1,selections:[p],storageKey:null},g={alias:null,args:null,concreteType:"XSHLensOption",kind:"LinkedField",name:"if_is_lens_option",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"is_polarized",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hex_codes",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"transition_glass_type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"localized_customer_facing_title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"localized_customer_facing_description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"internal_name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequence",storageKey:null}],storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},y=[h,i];return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useMDCAIGlassesMixAndMatchDataFetcherQuery",selections:[{alias:null,args:null,concreteType:"MDCMixAndMatchData",kind:"LinkedField",name:"xmd_mdc_mix_and_match_data",plural:!1,selections:[{alias:null,args:t,concreteType:"XMDMDCMixAndMatchFrameProduct",kind:"LinkedField",name:"frames",plural:!0,selections:[r,o,a,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"offer",plural:!1,selections:l,storageKey:null},s,{alias:null,args:null,concreteType:"XMDMDCMixAndMatchFrameProductLensesConnection",kind:"LinkedField",name:"lenses",plural:!1,selections:[{alias:null,args:null,concreteType:"SHOPProduct",kind:"LinkedField",name:"nodes",plural:!0,selections:[i,u,{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"valid_offer_from_product_for_site_at_time",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"XSHSHOPProductRxData",kind:"LinkedField",name:"rx_data",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"prescription_lens_options",plural:!0,selections:[i,m],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"XSHSHOPRxOptionGroup",kind:"LinkedField",name:"lens_option_groups",plural:!0,selections:[i,d,{alias:null,args:null,concreteType:"XSHSHOPRxOptionGroupOptionsConnection",kind:"LinkedField",name:"options",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"nodes",plural:!0,selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"valid_offer_from_product_for_site_at_time",plural:!1,selections:[i,{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"valid_price_for_country_at_time",plural:!1,selections:[_,f],storageKey:null}],storageKey:null},i,g],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useMDCAIGlassesMixAndMatchDataFetcherQuery",selections:[{alias:null,args:null,concreteType:"MDCMixAndMatchData",kind:"LinkedField",name:"xmd_mdc_mix_and_match_data",plural:!1,selections:[{alias:null,args:t,concreteType:"XMDMDCMixAndMatchFrameProduct",kind:"LinkedField",name:"frames",plural:!0,selections:[r,o,a,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"offer",plural:!1,selections:y,storageKey:null},s,{alias:null,args:null,concreteType:"XMDMDCMixAndMatchFrameProductLensesConnection",kind:"LinkedField",name:"lenses",plural:!1,selections:[{alias:null,args:null,concreteType:"SHOPProduct",kind:"LinkedField",name:"nodes",plural:!0,selections:[i,u,{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"valid_offer_from_product_for_site_at_time",plural:!1,selections:y,storageKey:null},{alias:null,args:null,concreteType:"XSHSHOPProductRxData",kind:"LinkedField",name:"rx_data",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"prescription_lens_options",plural:!0,selections:[h,i,m],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"XSHSHOPRxOptionGroup",kind:"LinkedField",name:"lens_option_groups",plural:!0,selections:[i,d,{alias:null,args:null,concreteType:"XSHSHOPRxOptionGroupOptionsConnection",kind:"LinkedField",name:"options",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"nodes",plural:!0,selections:[h,{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"valid_offer_from_product_for_site_at_time",plural:!1,selections:[h,i,{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"valid_price_for_country_at_time",plural:!1,selections:[h,_,f,i],storageKey:null}],storageKey:null},i,g],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{id:n("useMDCAIGlassesMixAndMatchDataFetcherQuery_meta_dot_comRelayOperation"),metadata:{},name:"useMDCAIGlassesMixAndMatchDataFetcherQuery",operationKind:"query",text:null}}})();a.exports=e}),null);
-----
useMDCAIGlassesMixAndMatchDataFetcherQuery_meta_dot_comRelayOperation",[],(function(t,n,r,o,a,i){a.exports="32209191682005069"}),null);
-----