PageSourceSearch

https://www.emelpirlanta.com/_next/static/chunks/89548-6b4d7265a517882c.js

js emelpirlanta.com collected 2026-09-27 02:08:09 UTC 9,470 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[89548],{1600:(e,t,r)=>{r.d(t,{StorefrontI18nProvider:()=>d,_:()=>o});var n=r(95155),i=r(12115),a=r(89077);let u=(0,i.createContext)(null);function d(e){let{children:t,locale:r,dictionary:d}=e,o=(0,a.Y)(r),l=(0,i.useMemo)(()=>({locale:o,t:(e,t)=>{var r;return(0,a.P)(null!=(r=d[e])?r:"",t)}}),[d,o]);return(0,n.jsx)(u.Provider,{value:l,children:t})}function o(){let e=(0,i.useContext)(u);return e||{locale:"tr",t:()=>""}}},12834:(e,t,r)=>{r.d(t,{StorefrontUrlPolicyProvider:()=>u,x:()=>d});var n=r(95155),i=r(12115);let a=(0,i.createContext)({productUrlHtmlSuffix:!1});function u(e){let{children:t,productUrlHtmlSuffix:r=!1}=e,u=(0,i.useMemo)(()=>({productUrlHtmlSuffix:!!r}),[r]);return(0,n.jsx)(a.Provider,{value:u,children:t})}function d(){return(0,i.useContext)(a)}},32085:(e,t,r)=>{r.d(t,{FavoritesProvider:()=>w,r:()=>_});var n=r(95155),i=r(12115),a=r(3991),u=r(50449),d=r(12834),o=r(53926);let l=(0,i.createContext)(null),c="storefront_favorites_guest",s="storefront-currency-changed";function v(e,t){return"".concat(Number(e),":").concat(Number(t||0))}function f(e,t){let r="/api/storefront/favorites/".concat(e);return t?"".concat(r,"?variant_id=").concat(encodeURIComponent(String(t))):r}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TRY",r=Number(e.price||e.originalPrice||0),n=Number(e.originalPrice||r||0);return{productId:e.productId,variantId:e.variantId,productName:e.name,productSlug:e.slug,sku:e.variantSku,categoryName:e.categoryName,currency:e.currency||e.originalCurrency||t,quantity:1,unitPrice:r,amount:r,originalPrice:n||void 0,discount:n>r?n-r:void 0,imageUrl:e.image}}function m(e){return String(e||"").trim().toUpperCase()||"TRY"}function g(e,t,r){return e.map(e=>(function(e,t,r){let n=m(t),i=function(e){let t=String(e||"").trim();if(!t)return null;let r=t.includes("₺")?"TRY":t.includes("€")?"EUR":t.includes("$")?"USD":"";if(!r)return null;let n=t.replace(/[^\d,.-]/g,"");if(!n)return null;let i=Number(/,\d{1,2}$/.test(n)?n.replace(/\./g,"").replace(",","."):n.replace(/,/g,""));return!Number.isFinite(i)||i<=0?null:{price:i,currency:r}}(e.priceLabel),u=m(e.originalCurrency||e.currency||(null==i?void 0:i.currency)||n),d=Number(e.originalPrice||e.price||(null==i?void 0:i.price)||0);if(!Number.isFinite(d)||d<=0)return e;let o=(0,a.$n)(d,u,n,r);return!Number.isFinite(o)||o<=0?e:{...e,price:o,currency:n,originalPrice:d,originalCurrency:u,priceLabel:(0,a.HC)(o,n)}})(e,t,r))}function h(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return[];try{let r=JSON.parse(e);if(!Array.isArray(r))return[];return r.filter(e=>"object"==typeof e&&null!==e&&Number.isFinite(Number(e.productId))&&"string"==typeof e.name&&"string"==typeof e.slug).map(e=>({...e,productId:Number(e.productId),variantId:e.variantId?Number(e.variantId):void 0,href:e.href||(0,a.Xu)(e.slug,e.variantId,{htmlSuffix:t}),addedAt:e.addedAt||new Date().toISOString(),updatedAt:e.updatedAt||e.addedAt||new Date().toISOString()}))}catch(e){return[]}}function I(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.map(e=>({...e,href:(0,a.Xu)(e.slug,e.variantId,{htmlSuffix:t})}))}function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TRY",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{TRY:1},n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return I(g(h(window.localStorage.getItem(e),n),t,r),n)}function b(e,t){window.localStorage.setItem(e,JSON.stringify(t))}function S(e,t){let r=new Map;return[...t,...e].forEach(e=>{let t=v(e.productId,e.variantId),n=r.get(t);if(!n)return void r.set(t,e);let i=Date.parse(n.updatedAt||n.addedAt||""),a=Date.parse(e.updatedAt||e.addedAt||"");Number.isFinite(a)&&(!Number.isFinite(i)||a>=i)&&r.set(t,{...n,...e})}),Array.from(r.values()).sort((e,t)=>Date.parse(t.addedAt||"")-Date.parse(e.addedAt||""))}async function N(e,t,r,n,i){let u=arguments.length>5&&void 0!==arguments[5]&&arguments[5],d=await fetch(e,{...t,headers:{Accept:"application/json",...(null==t?void 0:t.body)?{"Content-Type":"application/json"}:null,...(null==t?void 0:t.headers)||{}},cache:"no-store"});if(!d.ok)throw Error("Favoriler sunucuya senkronlanamadı.");return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TRY",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{TRY:1},n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return(e.data||[]).filter(e=>Number.isFinite(Number(e.product_id))&&e.product_name&&e.product_slug).map(e=>{let u=Number(e.product_id),d=Number(e.variant_id||0),o=String(e.product_slug||""),l=m(e.currency),c=Number(e.price||0),s=m(t),v=c>0?(0,a.$n)(c,l,s,r):0;return{productId:u,variantId:d>0?d:void 0,name:String(e.product_name||""),slug:o,href:(0,a.Xu)(o,d,{htmlSuffix:i}),image:e.product_image?(0,a.uI)(e.product_image,{cdnBaseUrl:n,productMedia:!0}):void 0,categoryName:e.category_name||void 0,variantSku:e.variant_sku||void 0,price:v,currency:s,originalPrice
1:c,originalCurrency:l,priceLabel:v>0?(0,a.HC)(v,s):void 0,addedAt:e.added_at||new Date().toISOString(),updatedAt:e.updated_at||e.added_at||new Date().toISOString()}})}(await d.json(),r,n,i,u)}function w(e){let{children:t,selectedCurrency:r="TRY",rates:a={TRY:1},cdnBaseUrl:w}=e,{customer:_,isLoading:C}=(0,u.e)(),{productUrlHtmlSuffix:E}=(0,d.x)(),A=m(r),[P,k]=(0,i.useState)(A),[x,T]=(0,i.useState)([]),[L,R]=(0,i.useState)(!1),D=(0,i.useRef)(null),O=(0,i.useRef)(c),F=(0,i.useRef)(0);(0,i.useEffect)(()=>{k(A)},[A]),(0,i.useEffect)(()=>{let e=e=>{let t=e.detail;k(m(null==t?void 0:t.currency))};return window.addEventListener(s,e),()=>window.removeEventListener(s,e)},[]);let Y=(0,i.useCallback)((e,t)=>{var r;null==(r=D.current)||r.postMessage({type:"favorites-updated",storageKey:e,items:t})},[]),U=(0,i.useCallback)(e=>{let t=I(g(e,P,a),E),r=O.current;b(r,t),T(t),Y(r,t)},[P,E,Y,a]);(0,i.useEffect)(()=>{D.current="BroadcastChannel"in window?new BroadcastChannel("storefront-favorites"):null;let e=D.current,t=e=>{let t=e.data;(null==t?void 0:t.type)==="favorites-updated"&&t.storageKey===O.current&&T(I(g(h(JSON.stringify(t.items||[]),E),P,a),E))};return null==e||e.addEventListener("message",t),()=>{null==e||e.removeEventListener("message",t),null==e||e.close(),D.current=null}},[P,E,a]),(0,i.useEffect)(()=>{var e;if(C)return;let t=(null==_?void 0:_.id)?(e=_.id,"".concat("storefront_favorites_customer:").concat(e)):c;if(O.current=t,null==_?void 0:_.id){let e=F.current+1;F.current=e;let r=y(c,P,a,E),n=I(g(S(y(t,P,a,E),r),P,a),E);b(t,n),T(n),Y(t,n);let i=n.map(e=>({product_id:e.productId,variant_id:e.variantId||0}));(i.length>0?N("/api/storefront/favorites/sync",{method:"POST",body:JSON.stringify({items:i})},P,a,w,E):N("/api/storefront/favorites",void 0,P,a,w,E)).then(r=>{F.current===e&&(b(t,r),window.localStorage.removeItem(c),T(r),Y(t,r))}).catch(()=>{})}else F.current+=1,T(y(t,P,a,E));R(!0)},[P,w,null==_?void 0:_.id,C,E,Y,a]),(0,i.useEffect)(()=>{L&&T(e=>{let t=I(g(e,P,a),E);if(e.length===t.length&&e.every((e,r)=>{let n=t[r];return e.productId===(null==n?void 0:n.productId)&&Number(e.variantId||0)===Number(n.variantId||0)&&e.priceLabel===n.priceLabel&&e.currency===n.currency&&Number(e.price||0)===Number(n.price||0)&&Number(e.originalPrice||0)===Number(n.originalPrice||0)&&e.originalCurrency===n.originalCurrency}))return e;let r=O.current;return b(r,t),Y(r,t),t})},[P,L,E,Y,a]),(0,i.useEffect)(()=>{let e=e=>{e.key===O.current&&T(I(g(h(e.newValue,E),P,a),E))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[P,E,a]);let j=(0,i.useCallback)((e,t)=>x.some(r=>v(r.productId,r.variantId)===v(e,t)),[x]),M=(0,i.useCallback)(e=>{let t=v(e.productId,e.variantId),r=x.some(e=>v(e.productId,e.variantId)===t),n=O.current;if(r){let r=x.find(e=>v(e.productId,e.variantId)===t)||e;return(0,o.hW)(p(r,P),"remove"),U(x.filter(e=>v(e.productId,e.variantId)!==t)),(null==_?void 0:_.id)&&N(f(e.productId,e.variantId),{method:"DELETE"},P,a,w,E).then(e=>{b(n,e),T(e),Y(n,e)}).catch(()=>void 0),!1}let i=new Date().toISOString(),u=S([{...e,addedAt:e.addedAt||i,updatedAt:i}],x);return(0,o.hW)(p(e,P),"add"),U(u),(null==_?void 0:_.id)&&N("/api/storefront/favorites",{method:"POST",body:JSON.stringify({product_id:e.productId,variant_id:e.variantId||0})},P,a,w,E).then(e=>{b(n,e),T(e),Y(n,e)}).catch(()=>void 0),!0},[P,w,U,null==_?void 0:_.id,x,E,Y,a]),J=(0,i.useCallback)((e,t)=>{let r=O.current,n=v(e,t),i=x.find(e=>v(e.productId,e.variantId)===n);i&&(0,o.hW)(p(i,P),"remove"),U(x.filter(e=>v(e.productId,e.variantId)!==n)),(null==_?void 0:_.id)&&N(f(e,t),{method:"DELETE"},P,a,w,E).then(e=>{b(r,e),T(e),Y(r,e)}).catch(()=>void 0)},[P,w,U,null==_?void 0:_.id,x,E,Y,a]),H=(0,i.useCallback)(()=>{let e=x.map(e=>({productId:e.productId,variantId:e.variantId})),t=O.current;U([]),(null==_?void 0:_.id)&&e.length>0&&Promise.allSettled(e.map(e=>N(f(e.productId,e.variantId),{method:"DELETE"},P,a,w,E))).then(()=>N("/api/storefront/favorites",void 0,P,a,w,E)).then(e=>{b(t,e),T(e),Y(t,e)}).catch(()=>void 0)},[P,w,U,null==_?void 0:_.id,x,E,Y,a]),$=(0,i.useMemo)(()=>({items:x,count:x.length,isHydrated:L,isFavorite:j,toggleFavorite:M,removeFavorite:J,clearFavorites:H}),[H,j,L,x,J,M]);return(0,n.jsx)(l.Provider,{value:$,children:t})}function _(){let e=(0,i.useContext)(l);if(!e)throw Error("useFavorites must be used within a FavoritesProvi
1der");return e}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.