import{a as ee}from"./chunk-5L2Z4GZW.js";import{a as k}from"./chunk-5ZCHSHGJ.js";import{d as v}from"./chunk-355LM6CR.js";import{a as o,d as g,e as j,h as m,i as Z,j as x,l as U}from"./chunk-XXHI3I2Z.js";import{Y as J,a as W,h as X,u as z,x as K}from"./chunk-HMS3LRP2.js";import{a as $}from"./chunk-MTSPOHEH.js";import{g as G}from"./chunk-MGYJOL7Z.js";import{p as H}from"./chunk-767ZUJWF.js";import{A as d,B as I,D as l,d as p,e as f,v as S,w as Q}from"./chunk-QYQ7WNYU.js";import{a as n,b as a}from"./chunk-HC2G7LSI.js";var b=function(e){return e.not_eligible_any_for_staff_professional="not_eligible_any_for_staff_professional",e.not_eligible_any_for_non_orange_fallback="not_eligible_any_for_non_orange_fallback",e.not_eligible_any_for_staff_private="not_eligible_any_for_staff_private",e.not_eligible_loyalty_for_staff="not_eligible_loyalty_for_staff",e.not_eligible_installment_for_any="not_eligible_installment_for_any",e.eligibility_data_not_available="eligibility_data_not_available",e.not_eligible_loyalty_for_any="not_eligible_loyalty_for_any",e.not_eligible_loyalty_permanent_for_any="not_eligible_loyalty_permanent_for_any",e.not_eligible_loyalty_order_in_process_for_any="not_eligible_loyalty_order_in_process_for_any",e.not_eligible_loyalty_suspended_account="not_eligible_loyalty_suspended_account",e.not_eligible_loyalty_suspended_subscr="not_eligible_loyalty_suspended_subscr",e.notification_cart_has_installments="notification_cart_has_installments",e.notification_cart_has_loyalty_for_selected_msisdn="notification_cart_has_loyalty_for_selected_msisdn",e.acquisition_redirect_to_web_shop="acquisition_redirect_to_web_shop",e.acquisition_prepay_to_post_pay_redirect_to_web_shop="acquisition_prepay_to_post_pay_redirect_to_web_shop",e.not_eligible_ppy2_ppd_for_post_paid="not_eligible_ppy2_ppd_for_post_paid",e.not_eligible_ppy2_ppd_for_non_oro_customer="not_eligible_ppy2_ppd_for_non_oro_customer",e.notification_consumed_oty_in_cart="notification_consumed_oty_in_cart",e.not_eligible_installment_amount_below_threshold="not_eligible_installment_amount_below_threshold",e.not_eligible_phone_credit_already_used_cart="not_eligible_phone_credit_already_used_cart",e.notification_oty_availability="notification_oty_availability",e.installments_unavailable="installments_unavailable",e.not_eligible_prepay_user="not_eligible_prepay_user",e.not_eligible_loyalty_discount_offer_already_used="not_eligible_loyalty_discount_offer_already_used",e.not_eligible_budget_active_orders="not_eligible_budget_active_orders",e.notification_not_eligible_budget_subscriber_availability="not_eligible_budget_subscr",e.should_extend_contract_using_budget_points="should_extend_contract_using_budget_points",e.not_eligible_loyalty_current_pkg="not_eligible_loyalty_current_pkg",e.installments_unavailable_for_current_package="installments_unavailable_for_current_package",e.can_be_affected_by_products_with_installments_from_cart="can_be_affected_by_products_with_installments_from_cart",e}(b||{}),Oe=function(e){return e.badRequest="badRequest",e.entityNotFound="entityNotFound",e.guestCartEmpty="guestCartEmpty",e.illegalArgument="illegalArgument",e.illegalCartCmd="illegalCartCmd",e.illegalCartState="illegalCartState",e.maxItemQntyExceeded="maxItemQntyExceeded",e.maxSubscrQntyExceeded="maxSubscrQntyExceeded",e.noOrderId="noOrderId",e.notLoggedIn="notLoggedIn",e.orderNotPlaced="orderNotPlaced",e.productEndOfLife="productEndOfLife",e.productNotFound="productNotFound",e.required="required",e.timedout="timedout",e.tooManyRetries="tooManyRetries",e}(Oe||{});var Ee=[b.notification_cart_has_installments,b.not_eligible_any_for_staff_professional,b.notification_cart_has_loyalty_for_selected_msisdn,b.not_eligible_phone_credit_already_used_cart,b.should_extend_contract_using_budget_points];function A(e){if(!e?.length)return!1;for(let t of e)if(!Ee.includes(b[t.code]))return!0;return!1}var Xe={[o.Acquisition]:"Abonament nou",[o.AcquisitionPortIn]:"Portez un num\u0103r",[o.AcquisitionPrepayToPostpaid]:"Am cartel\u0103 PrePay",[o.Loyalty]:"Prelungire abonament",[o.Standard]:"F\u0103r\u0103 abonament",[o.BudgetAcquisition]:"Achizitie cu Buget",[o.BudgetLoyalty]:"Loyalizare cu Buget"},B=function(e){return e.Acquisition="ACQUISITION",e.AcquisitionPrepayToPostpaid="ACQUISITION_PREPAY_TO_POSTPAID",e}(B||{}),ze={[B.Acquisition]:"Pre\u021B \xEEntreg",[B.AcquisitionPrepayToPostpaid]:"Pre\u021B \xEEntreg"},Ke={[g.None]:"Pre\u021B \xEEntreg",[g.Oro]:"Pe factura Orange"},Je={[o.Standard]:"standard",[o.Loyalty]:"prelungire-abonament",[o.AcquisitionPrepayToPostpaid]:"prepay-postpay",[o.AcquisitionPortIn]:"portare",[o.Acquisition]:"abonament-nou",[o.BudgetAcquisition]:"acq-cu-buget",[o.BudgetLoyalty]:"lty-cu-buget"},je={[g.None]:"fara-rate",[g.Oro]:"cu-rate"},Ze={standard:o.Standard,"prelungire-abonament":o.Loyalty,"prepay-postpay":o.AcquisitionPrepayToPostpaid,portare:o.AcquisitionPortIn,"abonament-nou":o.Acquisition,"acq-cu-buget":o.BudgetAcquisition},$e={acquisition:o.Acquisition,installment:g.None,isTbi:!1,isNoSubsidy:!1},et={acquisition:o.Loyalty,installment:g.Oro,isTbi:!1,isNoSubsidy:!1},tt={acquisition:o.Standard,installment:g.None,isTbi:!1,isNoSubsidy:!1};var T=function(e){return e.RedirectToOld="RedirectToOld",e.BUY="BUY",e.LOGIN="LOGIN",e.NONE="NONE",e.DISPLAY="DISPLAY",e.RedirectToTKRShop="REDIRECT_TO_TKRSHOP",e}(T||{}),Ie=function(e){return e.Fix="FIX",e.Percentage="PERCENTAGE",e.Gift="GIFT",e}(Ie||{}),it=e=>e.package?.labels?.includes(j.Business)&&e.package?.labels?.length===1||!1,te=e=>e.package?.price?.value||0,N=(...e)=>t=>{let i=e.indexOf(t.label);return i===-1?e.length:i},V=e=>(t,i)=>e(t)-e(i)||te(i)-te(t);function De(e,t){return(t.acquisition===o.Acquisition||t.acquisition===o.AcquisitionPrepayToPostpaid)&&(t.actions?.includes(x.RedirectToWebshop)??!1)?[{__typename:"SellingNotification",code:b.acquisition_redirect_to_web_shop,params:[]}]:e}function ie(e,t,i,r){let s=e[t];if(s){let c=s[i];c&&!c.items.find(u=>u.label===m.Current)&&c.items.length!==0&&(c.items.push({productId:r.id,price:{hidePrice:!0},label:m.Current,package:r.currentSalePackage||void 0,discriminator:{acquisition:t,agrTerm:"",installment:i},ctaAction:T.NONE,displayOrder:null}),c.items.sort(V(N(m.Recommended,m.Current,m.Portfolio))))}}function L(e,t){if(!e)return;let i={};if(e.priceVariants?.standardPrice&&(i[o.Standard]={[g.None]:{actions:[],toggledPriceConversions:{oty:e.priceVariants.standardToggledPrice?.oty?.conversion,phoneCredit:e.priceVariants.standardToggledPrice?.phoneCredit?.conversion},discriminator:{acquisition:o.Standard,installment:g.None,agrTerm:""},items:[{productId:e.id,price:e.priceVariants.standardPrice,label:m.Recommended,discriminator:{acquisition:o.Standard,agrTerm:"",installment:g.None},ctaAction:T.BUY,toggledPrice:e.priceVariants.standardToggledPrice,msisdn:t,displayOrder:null}]}}),!e.supportedSubscrSellingOptions)return i;for(let r of e.supportedSubscrSellingOptions){i[r.acquisition]||(i[r.acquisition]={});let s=i[r.acquisition];s&&!s[r.installment]&&(s[r.installment]={items:[],actions:r.actions,discriminator:{agrTerm:"",installment:r.installment,acquisition:r.acquisition},sellingNotifications:De(r.notifications,r)})}if(e.priceVariants?.allPriceVariants)for(let r of e.priceVariants?.allPriceVariants){let{acquisition:s,installment:c}=r.discriminator,_=i[s];if(_){let u=_[c];u&&(u.toggledPriceConversions={oty:r.toggledPriceConversions?.oty,phoneCredit:r.toggledPriceConversions?.phoneCredit},r.items.forEach(P=>{let R=T.NONE;u.actions?.includes(x.RedirectToTkrshop)?R=T.RedirectToTKRShop:P.actions?.includes(Z.Buy)?A(u.sellingNotifications)?R=T.DISPLAY:R=T.BUY:u.actions?.includes(x.RedirectToWebshop)?R=T.RedirectToOld:u.actions?.includes(x.Login)&&(R=T.LOGIN);let E=n({},P.salePackage);E&&E?.termSalePackageBenefits?.length&&(E.pkgBenefits=E.termSalePackageBenefits[0].pkgBenefits);let M=null;P?.specialOfferDetails?.[0]?.id&&(M={id:P?.specialOfferDetails?.[0]?.id,optionId:P?.specialOfferDetails?.[0]?.optionId,toggled:P?.specialOfferDetails?.[0]?.isToggleable}),u.items.push({productId:e.id,discriminator:r.discriminator,label:P.label,price:P.price,package:E,ctaAction:R,sellingNotifications:P.notifications,toggledPrice:P.toggledPrice,msisdn:t,specialOffer:M,hasSpecialOffer:!!(r.discriminator.acquisition===o.AcquisitionPrepayToPostpaid&&P?.specialOfferDetails&&P?.specialOfferDetails.length>0),displayOrder:E.agrTermPrices?.find(w=>w?.term&&w.term===Number(r.discriminator.agrTerm))?.displayOrder})}),u&&(u.toggledPriceConversions={oty:r.toggledPriceConversions?.oty,phoneCredit:r.toggledPriceConversions?.phoneCredit},e.currentSalePackage?.notSellableReasons?.find(P=>P.code==="not_eligible_loyalty_discount_offer_already_used")?u.items.sort(V(N(m.Recommended,m.Portfolio,m.Current))):u.items.sort(V(N(m.Recommended,m.Current,m.Portfolio)))))}}return ie(i,o.Loyalty,g.Oro,e),ie(i,o.Loyalty,g.None,e),i.LOYALTY?.ORO&&(i.LOYALTY.ORO.items=re(i.LOYALTY.ORO.items)),i.LOYALTY?.NONE&&(i.LOYALTY.NONE.items=re(i.LOYALTY.NONE.items)),i}function re(e){if(e?.flatMap(i=>i.package?.agrTermPrices).some(i=>i?.displayOrder!=null)){let i=e?.findIndex(r=>r.label===m.Current);if(i&&i>-1)return e.toSpliced(i,1)}return e}function rt(e,t){return e.installment===t.installment&&e.acquisition===t.acquisition}var y=function(e){return e.CLEAR_PRODUCT="[Product] Clear product",e.CLEAR_ALL_PRODUCTS="[Product] Clear all products",e.GET_PRODUCT_GENERAL_DETAILS="[Product] Get product general details",e.GET_PRODUCT_GENERAL_DETAILS_ERROR="[Product] Get product general details [Error]",e.GET_PRODUCT_GENERAL_DETAILS_SUCCESS="[Product] Get product general details [Success]",e.GET_PRODUCT_DESCRIPTION="[Product] Get product description",e.GET_PRODUCT_DESCRIPTION_ERROR="[Product] Get product description [Error]",e.GET_PRODUCT_DESCRIPTION_SUCCESS="[Product] Get product description [Success]",e.GET_PRODUCT_PRICES="[Product] Get product prices",e.GET_PRODUCT_PRICES_ERROR="[Product] Get product prices [Error]",e.GET_PRODUCT_PRICES_SUCCESS="[Product] Get product prices [Success]",e.SET_PRODUCT_DESCRIPTION_TAB_OPEN="[Product] Set product description tab open",e.SET_PRODUCT_DESCRIPTION_TAB_CLOSE="[Product] Set product description tab close",e}(y||{}),oe=p(y.CLEAR_PRODUCT,f()),ne=p(y.CLEAR_ALL_PRODUCTS),q=p(y.GET_PRODUCT_GENERAL_DETAILS,f()),ae=p(y.GET_PRODUCT_GENERAL_DETAILS_ERROR,f()),se=p(y.GET_PRODUCT_GENERAL_DETAILS_SUCCESS,f()),C=p(y.GET_PRODUCT_PRICES,f()),ce=p(y.GET_PRODUCT_PRICES_ERROR,f()),h=p(y.GET_PRODUCT_PRICES_SUCCESS,f()),le=p(y.GET_PRODUCT_DESCRIPTION,f()),_e=p(y.GET_PRODUCT_DESCRIPTION_ERROR,f()),ue=p(y.GET_PRODUCT_DESCRIPTION_SUCCESS,f()),de=p(y.SET_PRODUCT_DESCRIPTION_TAB_OPEN,f()),pe=p(y.SET_PRODUCT_DESCRIPTION_TAB_CLOSE,f());var Y={status:l.initial,pricesStatus:l.initial,descriptionStatus:l.initial,descriptionTabVisible:!1},fe={},Pe=I(fe,d(ne,()=>fe),d(oe,(e,t)=>a(n({},e),{[t.productSlug]:Y})),d(q,(e,{productSlug:t})=>a(n({},e),{[t]:a(n({},e[t]||{}),{status:l.loading,pricesStatus:e[t]?.pricesStatus??l.initial,descriptionStatus:e[t]?.descriptionStatus??l.initial})})),d(se,(e,{params:{productSlug:t},product:i})=>a(n({},e),{[t]:a(n({},e[t]||{}),{item:n(n({},e[t]?.item),i),details:i,status:l.success})})),d(ae,(e,{params:{productSlug:t},error:i})=>a(n({},e),{[t]:a(n({},e[t]||{}),{status:l.error,error:i})})),d(de,(e,{productSlug:t})=>a(n({},e),{[t]:a(n({},e[t]||{}),{descriptionTabVisible:!0})})),d(pe,(e,{productSlug:t})=>a(n({},e),{[t]:a(n({},e[t]||{}),{descriptionTabVisible:!1})})),d(C,(e,{productSlug:t,msisdn:i})=>a(n({},e),{[t]:a(n({},e[t]||{}),{msisdn:i,pricesStatus:l.loading,status:e[t]?.status??l.initial,descriptionStatus:e[t]?.descriptionStatus??l.initial})})),d(h,(e,{params:{productSlug:t,msisdn:i},product:r})=>a(n({},e),{[t]:a(n({},e[t]||{}),{item:n(n({},e[t]?.item),r),prices:r,acquisitions:L(r,i),pricesStatus:l.success})})),d(ce,(e,{params:{productSlug:t},error:i})=>a(n({},e),{[t]:a(n({},e[t]||{}),{pricesStatus:l.error,pricesError:i})})),d(le,(e,{productSlug:t})=>a(n({},e),{[t]:a(n({},e[t]||{}),{pricesStatus:e[t]?.pricesStatus??l.initial,descriptionStatus:l.loading})})),d(ue,(e,{params:{productSlug:t},description:i})=>a(n({},e),{[t]:a(n({},e[t]||{}),{item:n({},e[t]?.item),description:i,descriptionStatus:l.success})})),d(_e,(e,{params:{productSlug:t},error:i})=>a(n({},e),{[t]:a(n({},e[t]||{}),{descriptionStatus:l.error,error:i})})));var Pt="GET_SIMILAR_PRODUCTS";var me=p("GET_SIMILAR_PRODUCTS",f()),ge=p("GET_SIMILAR_PRODUCTS_SUCCESS",f()),ye=p("GET_SIMILAR_PRODUCTS_ERROR",f());var xe={status:l.initial},Ge=H((e,t)=>(t?.price||0)-(e?.price||0)),Se=I(xe,d(me,(e,{product:t})=>({productId:t.id,status:l.loading})),d(ge,(e,{productId:t,similarProducts:i})=>({productId:t,similarProducts:Ge(i),status:l.success})),d(ye,(e,{productId:t,error:i})=>({productId:t,error:i,status:l.error})));var be=p("[Product Installment Periods] Set product package installment period",f());function Ae(e,t){let r=L(e,t)?.LOYALTY?.ORO?.items,s=new Map;r?.forEach(_=>{if(_.package?.ref){let u=s.get(_.package.ref);u?s.set(_.package.ref,[...u,_]):s.set(_.package.ref,[_])}});let c={};return s.forEach((_,u)=>{let P=!!_.find(R=>R.price.installmentPeriod===36);c[u]={has36Option:P,selectedPeriod:P?36:24}}),c}var Le={},Te=I(Le,d(h,(e,{params:{productSlug:t,msisdn:i},product:r})=>a(n({},e),{[t]:Ae(r,i)})),d(be,(e,{productSlug:t,packageRef:i,selectedPeriod:r})=>a(n({},e),{[t]:a(n({},e[t]),{[i]:a(n({},e[t][i]),{selectedPeriod:r})})})));var F=Q(ee),kt={products:Pe,similarProducts:Se,installmentsPeriods:Te};var qe=S(F,e=>e?.products),O=e=>S(qe,t=>t?.[e]||Y),D=e=>({selector:S(O(e),t=>t),shouldDispatch:t=>t.status===l.initial||k("selectorGetProductStateById"+e).isExpired(),action:t=>q({productSlug:e}),map:t=>t}),Zt=e=>a(n({},D(e)),{map:t=>t.description}),$t=e=>a(n({},D(e)),{map:t=>t.descriptionStatus}),ei=e=>a(n({},D(e)),{map:t=>t.details?.banner}),ti=e=>({selector:S(O(e),z,G,(t,i,r)=>[t,i,r]),shouldDispatchAsync:!0,shouldDispatch:([t,i,r])=>{if(r){if(i.status===l.initial)return!0;if(i.status!==l.success||!i.profile)return!1}return t.pricesStatus===l.initial||t.msisdn!==i.profile?.activeMsisdn||k("selectorGetProductPricesStateById"+e).isExpired()},action:([,t,i])=>i&&t.status===l.initial?X():C({productSlug:e,msisdn:t.profile?.activeMsisdn}),map:([t])=>t}),ii=e=>a(n({},D(e)),{map:t=>t.prices?.priceVariants?.allPriceVariants}),ri=e=>a(n({},D(e)),{map:t=>!!t.item?.supportedSubscrSellingOptions?.length});var oi=(e,t)=>a(n({},D(e)),{map:i=>!!i.item?.supportedSubscrSellingOptions?.find(r=>r.acquisition===t.acquisition&&r.installment===t.installment)});var Ce=(e,t)=>{if(e?.acquisitions){let i=e?.acquisitions[t.acquisition];if(i)return i[t.installment]}};var he=(e,t)=>S(O(e),i=>Ce(i,t)),ni=(e,t)=>S(he(e,t),Ue(e),(i,r)=>ke(i,t,r)),Ue=e=>S(F,t=>{if(t.installmentsPeriods&&t.installmentsPeriods[e])return t.installmentsPeriods[e]});function ke(e,t,i){let r=e?.items.filter(c=>c.label===m.Recommended),s=e?.items.find(c=>c?.package?.ref);return r?.length||(r=e?.items.filter(c=>c.package?.ref===s?.package?.ref)),r?.length===1?r||[]:t.acquisition===o.Loyalty&&t.installment===g.Oro?r?.filter(c=>{let _;if(i&&c.package?.ref&&(_=i[c.package.ref].selectedPeriod,_&&c.price.installmentPeriod===_))return!0})||[]:t.acquisition===o.AcquisitionPrepayToPostpaid?r?.slice(0,2)||[]:r?.slice(0,1)||[]}var ai=(e,t,i)=>S(G,K,O(t),(r,s,c)=>{if(!r)return!1;if(c.acquisitions){let _=c.acquisitions[i.acquisition];if(_){let u=_[i.installment];if(u&&A(u.sellingNotifications))return!1}}return s?.type===W.PREPAY?e===U.PhoneCredit&&i.acquisition===o.Standard:i.acquisition===o.Loyalty||i.acquisition===o.Standard||i.acquisition===o.BudgetAcquisition});function Re(e,t,i){if(!(!e?.item?.priceVariants||t==="default")){if((i.acquisition===o.Standard||i.acquisition===o.BudgetAcquisition)&&e.item.priceVariants.standardToggledPrice)return e.item.priceVariants.standardToggledPrice[t]?.conversion||void 0;if(e.item?.priceVariants.allPriceVariants)for(let r=0;r<e.item.priceVariants.allPriceVariants.length;r++){let s=e.item.priceVariants.allPriceVariants[r];if(s&&s.discriminator.installment===i.installment&&s.discriminator.acquisition===i.acquisition&&s.toggledPriceConversions&&s.toggledPriceConversions[t])return s.toggledPriceConversions[t]||void 0}}}var si=(e,t)=>S(v.selectTogglePrice,G,O(e),(i,r,s)=>{if(!r||i==="default")return"default";if(!i&&s.item?.priceVariants?.togglePriceTypes?.length&&(i=s.item?.priceVariants?.togglePriceTypes[0]),s.item?.priceVariants?.togglePriceTypes?.includes(i)){if(i===U.PhoneCredit&&s.item?.priceVariants?.standardToggledPrice?.phoneCredit?.notifications.find(u=>u?.code===b.not_eligible_phone_credit_already_used_cart))return"default";let c=Re(s,i,t);if(c){if(c.refCurrencyAmount.value>0)return i}else return i}return"default"}),ci=(e,t,i)=>S(O(e),r=>Re(r,t,i)),li=e=>S(O(e),t=>t.details?.banner?.promo?t.details.banner.promo:void 0),_i=e=>S(v.selectSellingOption,O(e),J,(t,i,r)=>{if(r)return;let s=i.details?.dotDiscountDetails,c;if(i.details?.category?.id!==$.phones)c=s?.noAbo;else switch(t.acquisition){case o.Acquisition:case o.BudgetAcquisition:case o.AcquisitionPortIn:case o.AcquisitionPrepayToPostpaid:c=s?.newAbo;break;case o.Loyalty:case o.BudgetLoyalty:c=s?.extendAbo;break;case o.Standard:c=s?.noAbo;break}if(c&&c.text){let _=JSON.parse(c.text);return{[i.details?.code]:a(n({},c),{config:a(n({},_),{text:_.text,type:_.type?_.type:"CLASSIC"})})}}return{}});export{b as a,Oe as b,Xe as c,ze as d,Ke as e,Je as f,je as g,Ze as h,et as i,tt as j,T as k,Ie as l,it as m,rt as n,oe as o,ne as p,q,ae as r,se as s,C as t,ce as u,h as v,le as w,_e as x,ue as y,Pt as z,me as A,ge as B,ye as C,F as D,kt as E,O as F,D as G,Zt as H,$t as I,ei as J,ti as K,ii as L,ri as M,oi as N,he as O,ni as P,Ue as Q,ai as R,si as S,ci as T,li as U,_i as V};