{"version":3,"file":"app_back_office-sPPTP8DW.js","sources":["../../../app/javascript/packs/map.js","../../../app/javascript/packs/webPushNotification.js","../../../app/javascript/libs/google-maps.js","../../../app/javascript/scrollTo.js","../../../app/javascript/navbarBackgroundOnScroll.js","../../../app/javascript/entrypoints/app_back_office.js"],"sourcesContent":["const mapElement = document.getElementById('map')\nif (mapElement) {\n // don't try to build a map if there's no div#map to inject in\n const mapLat = parseFloat(mapElement.dataset.lat)\n const mapLng = parseFloat(mapElement.dataset.lng)\n const map = new GMaps({ el: '#map', lat: mapLat, lng: mapLng, zoom: 13 })\n const markers = JSON.parse(mapElement.dataset.markers)\n map.addMarkers(markers)\n\n if (markers.length === 0) {\n map.setZoom(13)\n } else if (markers.length === 1) {\n map.setCenter(markers[0].lat, markers[0].lng)\n map.setZoom(16)\n } else {\n map.fitLatLngBounds(markers)\n }\n}\n\ngmapsAutoComplete()\n","function webpush_service_worker_registration_subscribe() {\n // Register the serviceWorker script at /serviceworker.js from your server if supported\n if (navigator.serviceWorker) {\n navigator.serviceWorker.register('/serviceworker.js').then(function (reg) {})\n }\n // Otherwise, no push notifications :(\n else {\n console.error('Service worker is not supported in this browser')\n }\n\n // When serviceWorker is supported, installed, and activated,\n // subscribe the pushManager property with the vapidPublicKey\n if (window.location.pathname.includes('my_notifications_page')) {\n navigator.serviceWorker.ready.then(serviceWorkerRegistration => {\n serviceWorkerRegistration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: window.vapidPublicKey\n })\n // subscribe_to_webpush_notification();\n })\n }\n}\n\nfunction subscribe_to_webpush_notification() {\n navigator.serviceWorker.ready.then(serviceWorkerRegistration => {\n serviceWorkerRegistration.pushManager\n .getSubscription()\n .then(subscription => {\n $.ajax({\n url: '/save_subscription',\n type: 'post',\n data: subscription.toJSON(),\n headers: {\n CSRFToken: document.querySelector('meta[name=\"csrf-token\"]').content\n }\n })\n })\n .finally(() => console.log('Abonné aux notifications!'))\n })\n}\n\n$(document).ready(function () {\n // ask notification permission to user\n webpush_service_worker_registration_subscribe()\n if (Notification.permission === 'granted') {\n subscribe_to_webpush_notification()\n }\n})\n","if (window.google == undefined) {\n const apiKey = import.meta.env.VITE_GOOGLE_API_BROWSER_KEY // Récupérez la clé API depuis les variables d'environnement Vite.js\n\n const script = document.createElement('script')\n script.src = `https://maps.googleapis.com/maps/api/js?libraries=places&key=${apiKey}`\n script.async = true\n script.defer = true\n\n document.head.appendChild(script)\n}\n\nwindow.initAutocomplete = function () {\n const event = new Event(\"google-maps-callback\", {\n bubbles: true,\n cancelable: true,\n })\n\n window.dispatchEvent(event)\n}\n","$('a[href*=\\\\#]:not([href=\\\\#])').click(function () {\n if (location.pathname.replace(/^\\//, '') == this.pathname.replace(/^\\//, '') || location.hostname == this.hostname) {\n var target = $(this.hash)\n target = target.length ? target : $('[name=' + this.hash.slice(1) + ']')\n if (target.length) {\n $('html,body').animate(\n {\n scrollTop: target.offset().top\n },\n 1000\n )\n return false\n }\n }\n})\n","var header = $('.navbar-home')\n\n$(window).scroll(function () {\n var scroll = $(window).scrollTop()\n if (scroll >= 50) {\n header.addClass('navbar-scrolled')\n } else {\n header.removeClass('navbar-scrolled')\n }\n})\n","import 'packs/map'\nimport 'packs/webPushNotification'\nimport 'libs/google-maps'\n\nimport '../scrollTo'\nimport '../navbarBackgroundOnScroll'\nimport '../app'\nimport '@hotwired/turbo-rails'\n\nTurbo.session.drive = false\n"],"names":["mapElement","mapLat","mapLng","map","markers","webpush_service_worker_registration_subscribe","reg","serviceWorkerRegistration","subscribe_to_webpush_notification","subscription","apiKey","script","event","target","header","scroll"],"mappings":"mFAAA,MAAMA,EAAa,SAAS,eAAe,KAAK,EAChD,GAAIA,EAAY,CAEd,MAAMC,EAAS,WAAWD,EAAW,QAAQ,GAAG,EAC1CE,EAAS,WAAWF,EAAW,QAAQ,GAAG,EAC1CG,EAAM,IAAI,MAAM,CAAE,GAAI,OAAQ,IAAKF,EAAQ,IAAKC,EAAQ,KAAM,EAAI,CAAA,EAClEE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