1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42839,e=>{"use strict";var t=e.i(71645),s=e.i(18566),i=e.i(55841);e.s(["default",0,function(){let e=(0,s.usePathname)(),a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{!e||e.startsWith("/admin")||a.current!==e&&(a.current=e,(0,i.sendTrack)("view",{includeReferrer:!0}))},[e]),null}])},72413,31272,e=>{"use strict";function t(e){let t=new Intl.DateTimeFormat("en-US",{timeZone:"Europe/Paris",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",hour12:!1,hourCycle:"h23"}).formatToParts(e),s=e=>t.find(t=>t.type===e)?.value??"00",i=s("hour");return"24"===i&&(i="00"),{year:s("year"),month:s("month"),day:s("day"),hour:i}}function s(e=new Date){let i=t(e);return`${i.year}-${i.month}-${i.day}`}function i(e,i){let a=function(e){let[i,a,n]=e.split("-").map(Number),r=Date.UTC(i,a-1,n,2,0,0);for(let i=-6;i<=6;i+=1){let a=r+60*i*6e4,n=new Date(a);if(s(n)===e&&"00"===t(n).hour){for(let i=0;i<60;i+=1){let n=a-60*i*1e3,r=new Date(n);if(s(r)===e&&"00"===t(r).hour)return n}return a}}return r}(e)+24*i*36e5;return s(new Date(a))}function a(e,t,s){return e.filter(e=>e.date>=t&&e.date<=s).reduce((e,t)=>e+t.count,0)}e.s(["countParisDaysInclusive",0,function(e,t){let s=0,a=e;for(;a<=t&&(s+=1,a!==t);)a=i(a,1);return s},"parisDaysAgo",0,function(e,t=new Date){return i(s(t),-e)},"shiftParisDayKey",0,i],31272),e.s(["PUSH_CATEGORIES_DRAFT_KEY",0,"alertedeals:push-categories-draft","normalizePushCategory",0,function(e){return e.normalize("NFC").trim()},"pushNewSubscribersForRange",0,function(e,t,s){let n=Math.max(1,Math.round((new Date(`${s}T12:00:00Z`).getTime()-new Date(`${t}T12:00:00Z`).getTime())/864e5)+1),r=i(t,-1),l=i(r,-(n-1));return{current:a(e,t,s),previous:a(e,l,r)}}],72413)},53040,e=>{"use strict";e.i(47167);var t=e.i(43476),s=e.i(71645);function i(){return"Notification"in window&&"serviceWorker"in navigator&&"PushManager"in window}async function a(){let e=await navigator.serviceWorker.getRegistration("/");return e?await e.update().catch(()=>{}):e=await navigator.serviceWorker.register("/sw.js",{scope:"/",updateViaCache:"none"}),await navigator.serviceWorker.ready,e}async function n(){if(!i())return null;let e=await navigator.serviceWorker.getRegistration("/"),t=await e?.pushManager.getSubscription();if(!t)return null;let s=t.toJSON();return s.endpoint&&s.keys?.p256dh&&s.keys?.auth?{endpoint:s.endpoint,keys:{p256dh:s.keys.p256dh,auth:s.keys.auth}}:null}async function r(e){let t="BCNvlEeQ3wbZ1RgjUtdz4IrNAX_ZvKX_XZgERABqio5GoiKJK_KTHZQbIGMcpNchvV96HZv2lDumuameVavsfBg".trim()||null;if(!t)throw Error("push_unconfigured");let s=await a();await navigator.serviceWorker.ready;let i=await Notification.requestPermission();if("granted"!==i)throw Error("denied"===i?"push_denied":"push_dismissed");let n=await s.pushManager.getSubscription();n&&(await n.unsubscribe(),n=null);let r=(n=await s.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),s=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),i=new Uint8Array(s.length);for(let e=0;e<s.length;e+=1)i[e]=s.charCodeAt(e);return i}(t)})).toJSON();if(!r.endpoint||!r.keys?.p256dh||!r.keys?.auth)throw Error("push_invalid_subscription");let l={endpoint:r.endpoint,keys:{p256dh:r.keys.p256dh,auth:r.keys.auth}};if(!(await fetch("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:l.endpoint,keys:l.keys,categories:e})})).ok)throw Error("push_subscribe_failed");return l}async function l(e,t){if(!(await fetch("/api/push/preferences",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:e,categories:t})})).ok)throw Error("push_preferences_failed")}async function o(){let e=await navigator.serviceWorker.getRegistration("/"),t=await e?.pushManager.getSubscription();t&&(await fetch("/api/push/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:t.endpoint})}),await t.unsubscribe())}async function c(e){let t=await fetch("/api/push/preferences",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:e})});return t.ok?(await t.json()).categories??null:null}async function d(e){let t=await fetch("/api/push/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"push_test_failed")}}var u=e.i(72413);function p(){if("u"<typeof navigator)return!1;let e=navigator.userAgent||"";return/iPad|iPhone|iPod/.test(e)&&!window.MSStream}function h(){return window.matchMedia("(display-mode: standalone)").matches||!0===navigator.standalone}e.s(["default",0,function({categories:e}
1){let[a,m]=(0,s.useState)("loading"),[b,f]=(0,s.useState)(!0),[x,g]=(0,s.useState)(new Set),[v,y]=(0,s.useState)(null),[j,N]=(0,s.useState)(null),w=(0,s.useMemo)(()=>p(),[]),S=(0,s.useMemo)(()=>!("u"<typeof navigator)&&/Android/i.test(navigator.userAgent||""),[]),A=(0,s.useMemo)(()=>h(),[]),C=w||S,z=(0,s.useCallback)(async()=>{if(!i())return p()&&!h()?void m("ios-install"):void m("unsupported");if(!"BCNvlEeQ3wbZ1RgjUtdz4IrNAX_ZvKX_XZgERABqio5GoiKJK_KTHZQbIGMcpNchvV96HZv2lDumuameVavsfBg".trim())return void m("unconfigured");if("denied"===Notification.permission)return void m("denied");let e=await n();if(e){N(e.endpoint);let t=await c(e.endpoint);t&&t.length>0?(f(!1),g(new Set(t))):(f(!0),g(new Set)),m("subscribed");return}let t=function(){try{let e=localStorage.getItem(u.PUSH_CATEGORIES_DRAFT_KEY);if(!e)return null;let t=JSON.parse(e);if(null===t||!Array.isArray(t))return null;let s=t.filter(e=>"string"==typeof e);return s.length>0?s:null}catch{return null}}();t&&t.length>0&&(f(!1),g(new Set(t))),m("ready")},[]);(0,s.useEffect)(()=>{z()},[z]);let T=b?null:Array.from(x),P=b||x.size>0,_=()=>{try{localStorage.setItem(u.PUSH_CATEGORIES_DRAFT_KEY,JSON.stringify(T))}catch{}},k=async()=>{if(!P)return void y("Choisissez au moins une catégorie, ou « Toutes les catégories ».");m("saving"),y(null),_();try{let e=await r(T);N(e.endpoint),m("subscribed"),y("Notifications activées. Une notification de confirmation vient d'être envoyée.")}catch(e){if(e instanceof Error&&"push_denied"===e.message){m("denied"),y("Notifications bloquées dans le navigateur.");return}if(e instanceof Error&&"push_subscribe_failed"===e.message){m("ready"),y("Abonnement refusé par le serveur. Rechargez la page et réessayez.");return}m("ready"),y("Impossible d'activer les notifications. Réessayez.")}},E=async()=>{if(j){y(null);try{await d(j),y("Notification test envoyée. Vérifiez la barre de notifications.")}catch(e){y("subscription_not_found"===(e instanceof Error?e.message:"push_test_failed")?"Abonnement introuvable. Réactivez les notifications.":"Ãchec de l'envoi test. Réactivez les notifications sur cette page.")}}},R=async()=>{if(!j||!P)return void y("Choisissez au moins une catégorie, ou « Toutes les catégories ».");m("saving"),y(null),_();try{await l(j,T),m("subscribed"),y("Préférences enregistrées.")}catch{m("subscribed"),y("Impossible d'enregistrer vos préférences.")}},D=async()=>{m("saving"),y(null);try{await o(),N(null),m("ready"),y("Notifications désactivées.")}catch{await z(),y("Impossible de désactiver les notifications.")}};return"ios-install"===a?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"rounded-2xl border border-blue-200 bg-blue-50 px-4 py-5 shadow-sm sm:px-5",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-slate-900",children:"iPhone : ajoutez AlerteDeals à l'écran d'accueil"}),(0,t.jsxs)("p",{className:"mt-2 text-sm leading-relaxed text-slate-700",children:["Sur iPhone, les notifications ne sont pas disponibles dans Safari classique. Pour recevoir les alertes deals, installez le site comme une application via"," ",(0,t.jsx)("span",{className:"font-semibold",children:"Sur l'écran d'accueil"}),", puis rouvrez cette page depuis l'icône installée."]}),(0,t.jsxs)("ol",{className:"mt-4 list-decimal space-y-2.5 pl-5 text-sm text-slate-800",children:[(0,t.jsxs)("li",{children:["Touchez ",(0,t.jsx)("span",{className:"font-semibold",children:"Partager"})," ",(0,t.jsx)("span",{"aria-hidden":!0,children:"(â¡â)"})," en bas de Safari"]}),(0,t.jsxs)("li",{children:["Faites défiler et choisissez"," ",(0,t.jsx)("span",{className:"font-semibold",children:"Sur l'écran d'accueil"})]}),(0,t.jsxs)("li",{children:["Confirmez avec ",(0,t.jsx)("span",{className:"font-semibold",children:"Ajouter"})]}),(0,t.jsxs)("li",{children:["Fermez Safari et ouvrez"," ",(0,t.jsx)("span",{className:"font-semibold",children:"AlerteDeals"}),"depuis la nouvelle icône sur votre écran d'accueil"]}),(0,t.jsxs)("li",{children:["Revenez sur cette page ",(0,t.jsx)("span",{className:"font-semibold",children:"/alertes"})," pour activer les notifications"]})]})]}),(0,t.jsx)("p",{className:"text-center text-xs text-slate-500",children:"Cette étape est obligatoire sur iPhone â ce n'est pas un problème de votre navigateur."})]}):"unsupported"===a?(0,t.jsx)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 px-4 py-4 text-sm text-amber-900",children:"Votre navigateur ne prend pas en charge les notifications Web Push. Essayez Chrome ou Firefox sur ordinateur ou Android."}):"unconfigured"===a?(0,t.jsx)("div",{className:"rounded-2xl border border-slate-200 bg-white px-4 py-4 text-sm text-slate-600",children:"Les notifications ne sont pas encore disponibles sur ce site."}):(0,t.jsxs)("div",{className:"space-y-6",children:[C?(0,t.jsxs)("section",{className:"rounded-2xl border border-blue-100 bg-white p-5 shadow-sm",children:[(0,t.jsxs)("h2",{className:"text-lg font-bold text-slate-900",children:["1. ",w?"Ajouter le site (iPhone)":"Utiliser Chrome (Android)"]}),w&&!A?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-slate-600",children:"Sur iPhone, les notifications nécessitent d'ajouter le site à l'écran d'accueil."}),(0,t.jsxs)("ol",{className:"mt-4 list-decimal space-y-2 pl-5 text-sm text-slate-700",children:[(0,t.jsxs)("li",{children:["Touchez ",(0,t.jsx)("span",{className:"font-semibold",children:"Partager"})," en bas de Safari"]}),(0,t.jsxs)("li",{children:["Choisissez"," ",(0,t.jsx)("span",{className:"font-semibold",children:"Sur l'écran d'accueil"})]}),(0,t.jsx)("li",{children:"Ouvrez AlerteDeals depuis l'icône installée"})]})]}):S?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"mt-2 text-sm leading-relaxed text-slate-600",children:["Sur Android, ouvrez cette page dans ",(0,t.jsx)("span",{className:"font-semibold",children:"Chrome"})," ","(pas depuis l'appli X/Twitter). L'installation n'est pas obligatoire."]}),(0,t.jsxs)("ul",{className:"mt-4 list-disc space-y-2 pl-5 text-sm text-slate-700",children:[(0,t.jsxs)("li",{children:["Menu Chrome ",(0,t.jsx)("span",{className:"font-semibold",children:"â®"})," â"," ",(0,t.jsx)("span",{className:"font-semibold",children:"Paramètres du site"})," â"," ",(0,t.jsx)("span",{className:"font-semibold",children:"Notifications"})," â Autoriser"]}),(0,t.jsxs)("li",{children:["Réglages Android â Applications â"," ",A?(0,t.jsx)("span",{className:"font-semibold",children:"AlerteDeals"}):(0,t.jsx)("span",{className:"font-semibold",children:"Chrome"})," ","â Notifications activées"]}),(0,t.jsxs)("li",{children:["Réglages Android â Applications â"," ",A?(0,t.jsx)("span",{className:"font-semibold",children:"AlerteDeals"}):(0,t.jsx)("span",{className:"font-semibold",children:"Chrome"})," ","â Batterie â ",(0,t.jsx)("span",{className:"font-semibold",children:"Sans restriction"})," ","(sinon les alertes peuvent n'arriver qu'à l'ouverture de l'appli)"]}
1),A?(0,t.jsx)("li",{className:"font-medium text-emerald-700",children:"Application déjà installée sur cet appareil."}):null]})]}):(0,t.jsx)("p",{className:"mt-2 text-sm text-emerald-700",children:"Application déjà installée sur cet appareil."})]}):null,(0,t.jsxs)("section",{className:"rounded-2xl border border-blue-100 bg-white p-5 shadow-sm",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-slate-900",children:C?"2. Choisir vos catégories":"1. Choisir vos catégories"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-slate-600",children:"Choisissez les grandes familles de deals. Les sous-catégories sont gérées automatiquement â pas besoin de tout cocher."}),!b&&x.size>0?(0,t.jsxs)("p",{className:"mt-2 text-xs text-amber-800",children:["Filtre actif : ",x.size," catégorie",x.size>1?"s":"",". Les deals hors sélection ne déclenchent pas de notification."]}):null,(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{f(!0),g(new Set),y(null)},className:`rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors ${b?"border-blue-600 bg-blue-600 text-white":"border-slate-200 bg-slate-50 text-slate-700 hover:border-blue-200"}`,children:"Toutes les catégories"}),e.map(e=>{let s=!b&&x.has((0,u.normalizePushCategory)(e.id));return(0,t.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.id,void(f(!1),g(e=>{let s=new Set(e),i=(0,u.normalizePushCategory)(t);return s.has(i)?s.delete(i):s.add(i),s}),y(null))},className:`rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors ${s?"border-blue-600 bg-blue-50 text-blue-800":"border-slate-200 bg-white text-slate-700 hover:border-blue-200"}`,children:[e.label,null!=e.count&&e.count>0?(0,t.jsxs)("span",{className:"ml-1 text-xs opacity-70",children:["(",e.count,")"]}):null]},e.id)})]}),b||0!==x.size?null:(0,t.jsx)("p",{className:"mt-3 text-xs text-amber-700",children:"Sélectionnez au moins une catégorie ou choisissez « Toutes les catégories »."})]}),(0,t.jsxs)("section",{className:"rounded-2xl border border-blue-100 bg-white p-5 shadow-sm",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-slate-900",children:C?"3. Activer les notifications":"2. Activer les notifications"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-slate-600",children:"Le navigateur vous demandera l'autorisation uniquement lorsque vous cliquerez sur le bouton ci-dessous. Une notification de confirmation est envoyée juste après l'activation."}),"denied"===a?(0,t.jsx)("p",{className:"mt-4 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:"Notifications bloquées. Autorisez-les dans les paramètres du navigateur pour ce site, puis rechargez la page."}):null,(0,t.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:"subscribed"===a||"saving"===a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:R,disabled:"saving"===a||!P,className:"rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-blue-700 disabled:opacity-60",children:"saving"===a?"Enregistrementâ¦":"Enregistrer mes catégories"}),(0,t.jsx)("button",{type:"button",onClick:E,disabled:"saving"===a,className:"rounded-xl border border-blue-200 bg-blue-50 px-4 py-2.5 text-sm font-medium text-blue-800 transition-colors hover:border-blue-300 disabled:opacity-60",children:"Envoyer une notification test"}),(0,t.jsx)("button",{type:"button",onClick:D,disabled:"saving"===a,className:"rounded-xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-600 transition-colors hover:border-slate-300 hover:text-slate-800 disabled:opacity-60",children:"Désactiver les notifications"})]}):(0,t.jsx)("button",{type:"button",onClick:k,disabled:"loading"===a||!P,className:"rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-blue-700 disabled:opacity-60",children:"Activer les notifications"})}),"subscribed"===a?(0,t.jsx)("p",{className:"mt-3 text-xs text-emerald-700",children:"Notifications actives sur cet appareil."}):null,v?(0,t.jsx)("p",{className:"mt-3 text-sm text-slate-600",role:"status",children:v}):null]})]})}],53040)}]);
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.