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pB,GAAE,KAAK,EACT,EAEDD,EAAE,IAAI,OAAAZ,EAAkC,EAAE,KAAMa,GAAO,CAErD,WAAW,IAAM,CACsBJ,EAAA,CACnC,kBAAmBI,CAAA,CACpB,EACF,EACF,EAEDD,EAAE,IAAI,OAAAV,EAAgC,EAAE,KAAMW,GAAO,CAC/CA,EAAG,UAAU,SAASV,CAAoC,IAC3DU,EAAA,UAAU,IAAIV,CAAoC,EAErDN,EAAU,KAAK,CACb,KAAMgB,CAAA,CACP,GACF,CACH,EAEA,SAASC,GAAqB,CACVV,EAAA,QAASW,GAAa,CACtCA,EAAS,MAAM,EAChB,CACH,CAEA,MAAeC,GAAA,CACb,KAAAvB,EACA,8BAAAY,EACA,aAAAS,CACF","names":["INIT_COMPLETE_CLASS","default_selector","ListingCarousel$1","container_element","selector","$","LazyLoad","e","$map_container","map_el","dom_id","DomIdGenerator","lat","lng","map_canvas_dom_id","__vitePreload","L","LeafletMapTileLayer","center","map_tile_layer","AssetsInfoStore","icon_image_data","leaflet_map","LeafletSettings","marker_icon","Factory","ListingCarousel","_extend","slide_data_objects","_idx","img_element","$img_element","image_width","image_height","image_src","image_msrc","n","PhotoSwipeUI_Default","PhotoSwipe","init","sele","_once","Promise","StaticMap","CELL_LISTING_CAROUSEL_DEFAULT","CELL_INITIALIZED_CLASS_NAME","CELL_LISTING_CAROUSEL_WITH_SWIPE","CELL_WITH_SWIPE_INITIALIZED_CLASS_NAME","CELL_LISTING_CAROUSEL_MAP_VIEW","CELL_MAP_VIEW_INITIALIZED_CLASS_NAME","LISTING_CAROUSELS","init_one_element_with_promise","options","listing_carousel_selector","Photoswipe_Factory","init_one_swiper_element_with_promise","resolve","Swiper_Factory","u","el","startCycling","carousel","ListingsCarousel"],"ignoreList":[],"sources":["../../../app/assets/javascripts/concepts/listings/carousel/factory.ts","../../../app/assets/javascripts/concepts/listings/carousel/photoswipe/factory.ts","../../../app/assets/javascripts/concepts/listings/carousel/map_view/index.ts","../../../app/assets/javascripts/concepts/listings/carousel/index.ts"],"sourcesContent":["\nimport $ from \"jquery\"\nimport \"plugins/jquery_plugins/bootstrap-carousel\"\nimport LazyLoad from \"vanilla-lazyload\"\n\nimport AssetsInfoStore from \"app/assets_info_store\"\n\nimport DomIdGenerator from \"app/utils/dom_id_generator\"\n\nimport LeafletSettings from \"app/map/leaflet/settings\"\n\nconst INIT_COMPLETE_CLASS = \"js-init-done\"\n\n\ninterface Selector {\n carousel: string\n slide_to_prev_button: string\n slide_to_next_button: string\n\n static_map_container: string\n}\nexport interface InputSelector {\n carousel?: string\n slide_to_prev_button?: string\n slide_to_next_button?: string\n\n static_map_container?: string\n}\nconst default_selector = {\n carousel: \".cell-listing-carousel--main\",\n slide_to_prev_button: \".cell-listing-carousel__slide-to-prev-btn\",\n slide_to_next_button: \".cell-listing-carousel__slide-to-next-btn\",\n\n static_map_container: \".cell-listing-carousel__static-map-box\",\n}\n\nexport class ListingCarousel {\n private selector: Selector\n\n private container_element: Element\n private $container_el: JQuery\n private $carousel: JQuery\n private $slide_to_prev_button: JQuery\n private $slide_to_next_button: JQuery\n private $static_map_container: JQuery\n\n\n constructor({container_element, selector = {}}: {container_element: Element, selector: InputSelector}){\n if (container_element == null) {\n throw new Error(\"container_element is absent\")\n }\n\n this.selector = Object.assign({}, default_selector, selector)\n this.container_element = container_element\n this.$container_el = $(container_element)\n\n this.$carousel = this.$container_el.find(this.selector.carousel)\n\n this.$slide_to_prev_button = this.$container_el.find(this.selector.slide_to_prev_button)\n this.$slide_to_next_button = this.$container_el.find(this.selector.slide_to_next_button)\n\n // Can be absent\n this.$static_map_container = this.$container_el.find(this.selector.static_map_container)\n\n this.created()\n this.bind_action()\n }\n\n public cycle(): void {\n this.$carousel.carousel(\"cycle\")\n }\n\n protected created() {\n const lazy_loader = new LazyLoad({\n container: this.container_element as HTMLElement,\n elements_selector: \"img[data-high-res-src]\",\n data_src: \"high-res-src\",\n use_native: false,\n })\n }\n\n protected bind_action(){\n if (this.$carousel.hasClass(INIT_COMPLETE_CLASS)) { return this }\n if (this.$carousel.hasClass(\"carousel-paused\")){\n this.$carousel.carousel(\"pause\")\n }\n else {\n // carousel autoplay recommended to be disabled for web vitals\n // https://web.dev/carousel-best-practices/\n this.$carousel.carousel(\"pause\")\n }\n\n this.$carousel.addClass(INIT_COMPLETE_CLASS)\n\n // region click behavior\n\n this.$slide_to_prev_button.on(\"click\", (e) => {\n // Might be an anchor with hash in href\n e.preventDefault()\n\n this.$carousel.carousel(\"prev\")\n })\n this.$slide_to_next_button.on(\"click\", (e) => {\n // Might be an anchor with hash in href\n e.preventDefault()\n\n this.$carousel.carousel(\"next\")\n })\n\n // endregion click behavior\n\n\n if (this.$static_map_container.length === 1) {\n const $map_container = this.$static_map_container\n const map_el = $map_container[0]\n\n const dom_id = DomIdGenerator.generateNewId()\n // Set new ID if applicable\n if (dom_id !== map_el.id) { map_el.setAttribute(\"id\", dom_id) }\n\n const lat = parseFloat($map_container.data(\"lat\"))\n const lng = parseFloat($map_container.data(\"lng\"))\n\n // Generate ID for Leaflet map, if absent\n const map_canvas_dom_id = dom_id\n\n import(\n \"plugins/leaflet\"\n )\n .then(({L}) => {\n import(\n \"app/map/leaflet/map_tile_layer\"\n )\n .then(({LeafletMapTileLayer}) => {\n const center = L.latLng(lat, lng)\n\n // If we add map tile layer AFTER creating map object\n // The location of tile layer is drifted on load\n // To workaround this we create tile layer first and\n // pass it on map object creation\n LeafletMapTileLayer.getNewTileLayerPromise()\n .then((map_tile_layer) => {\n return AssetsInfoStore.fetch(\"map/markers/s-spacious.png\")\n .then((icon_image_data) => {\n const leaflet_map =\n LeafletSettings.get_use_baidu_maps() ?\n L.map(map_canvas_dom_id, {\n center: center,\n\n zoom: 17,\n minZoom: 17,\n maxZoom: 17,\n\n // Interaction Options\n dragging: false,\n touchZoom: false,\n scrollWheelZoom: false,\n doubleClickZoom: false,\n boxZoom: false,\n tap: false,\n\n // Control options\n zoomControl: false,\n attributionControl: false,\n\n layers: [\n map_tile_layer,\n ],\n })\n :\n L.map(map_canvas_dom_id, {\n center: center,\n\n zoom: 17,\n minZoom: 17,\n maxZoom: 17,\n\n // Interaction Options\n dragging: false,\n touchZoom: false,\n scrollWheelZoom: false,\n doubleClickZoom: false,\n boxZoom: false,\n tap: false,\n\n // Control options\n zoomControl: false,\n attributionControl: false,\n\n layers: [\n map_tile_layer,\n ],\n })\n\n const marker_icon = L.icon({\n iconUrl: icon_image_data.url,\n iconSize: [25, 29],\n })\n L.marker(center, {\n icon: marker_icon,\n }).addTo(leaflet_map)\n })\n })\n .done()\n })\n })\n\n }\n\n return this\n }\n}\n\nconst Factory = {\n create(container_element: Element, selector?: InputSelector){\n return new ListingCarousel({\n container_element: container_element,\n selector: (selector || {}),\n })\n },\n}\n\nexport {\n Factory,\n Factory as default,\n}\n","\nimport $ from \"jquery\"\nimport _extend from \"lodash/assign\"\n\n\nconst INIT_COMPLETE_CLASS = \"js-photoswipe-init-done\"\n\ninterface Selector {\n carousel: string\n image: string\n}\ninterface InputSelector {\n carousel?: string\n image?: string\n}\nconst default_selector = {\n carousel: \".carousel\",\n image: \"img\",\n}\n\nclass ListingCarousel {\n private selector: Selector\n private $container_el: JQuery\n private $carousel: JQuery\n private $image: JQuery\n\n constructor({container_element, selector = {}}: {container_element: Element | string | JQuery, selector: InputSelector}) {\n if (container_element == null) {\n throw new Error(\"container_element is absent\")\n }\n\n this.selector = _extend({}, default_selector, selector)\n this.$container_el = $(container_element)\n\n this.$carousel = this.$container_el.find(this.selector.carousel)\n this.$image = this.$container_el.find(this.selector.image)\n\n this.bind_action()\n }\n\n protected bind_action(){\n if (this.$carousel.hasClass(INIT_COMPLETE_CLASS)) { return this }\n this.$carousel.addClass(INIT_COMPLETE_CLASS)\n\n const slide_data_objects = [] as PhotoSwipe.Item[]\n this.$image.each((_idx, img_element) => {\n const $img_element = $(img_element)\n const image_width = $img_element.data(\"photoswipe-width\")\n const image_height = $img_element.data(\"photoswipe-height\")\n const image_src = $img_element.data(\"photoswipe-src\")\n // Optional\n const image_msrc = $img_element.data(\"photoswipe-msrc\")\n\n if ([image_width, image_height, image_src].some((e) => e == null)) {\n return\n }\n\n slide_data_objects.push({\n src: image_src,\n w: image_width,\n h: image_height,\n\n // Optional\n msrc: image_msrc,\n })\n })\n\n if (document.querySelectorAll(\".pswp\")[0] == null) {\n // Minified from source code provided by photoswipe\n // https://photoswipe.com/documentation/getting-started.html\n $(\"body\").append(\"
\")\n }\n\n\n if (slide_data_objects.length > 0) {\n import(\n \"photoswipe/dist/photoswipe-ui-default\"\n )\n .then(({default: PhotoSwipeUI_Default}) => {\n import(\n \"photoswipe\"\n )\n .then(({default: PhotoSwipe}) => {\n this.$image.on(\"click\", () => {\n const gallery = new PhotoSwipe(\n document.querySelectorAll(\".pswp\")[0] as HTMLElement,\n PhotoSwipeUI_Default,\n slide_data_objects,\n {\n // Don't change history when browsing gallery\n history: false,\n\n bgOpacity: 0.8,\n\n shareEl: false,\n fullscreenEl: false,\n captionEl: false,\n\n clickToCloseNonZoomable: false,\n tapToClose: true,\n },\n )\n gallery.init()\n })\n })\n })\n }\n\n return this\n }\n}\n\nconst Factory = {\n create(container_element: Element | string | JQuery, selector?: InputSelector){\n return new ListingCarousel({container_element: container_element, selector: (selector || {})})\n },\n}\n\nexport { Factory as default }\n","\nimport $ from \"jquery\"\nimport _once from \"lodash/once\"\nimport L from \"plugins/leaflet\"\nimport Promise from \"plugins/bluebird\"\n\nimport AssetsInfoStore from \"app/assets_info_store\"\n\nimport DomIdGenerator from \"app/utils/dom_id_generator\"\n\nimport LeafletMapTileLayer from \"app/map/leaflet/map_tile_layer\"\n\n\ninterface InputSelector {\n main?: string | JQuery | HTMLElement,\n map_container?: string,\n}\n\ninterface Selector {\n main: string | JQuery,\n map_container: string,\n}\n\nconst default_selector: Selector = {\n main: \".cell-listing-carousel-map-view\",\n map_container: \".cell-listing-carousel-map-view__static-map-box\",\n}\n\n\nconst init = (selector?: InputSelector) => {\n const sele: Selector = Object.assign({}, default_selector, selector)\n\n const $el = $(sele.main)\n const $map_container = $el.find(sele.map_container)\n\n const render_map = _once(() => {\n const map_el = $map_container[0]\n\n const dom_id = DomIdGenerator.generateNewId()\n // Set new ID if applicable\n if (dom_id !== map_el.id) { map_el.setAttribute(\"id\", dom_id) }\n\n const lat = parseFloat($map_container.data(\"lat\"))\n const lng = parseFloat($map_container.data(\"lng\"))\n const center = L.latLng(lat, lng)\n\n // Generate ID for Leaflet map, if absent\n const map_canvas_dom_id = dom_id\n\n // If we add map tile layer AFTER creating map object\n // The location of tile layer is drifted on load\n // To workaround this we create tile layer first and\n // pass it on map object creation\n Promise.all([\n LeafletMapTileLayer.getNewTileLayerPromise(),\n AssetsInfoStore.fetch(\"map/markers/s-spacious.png\"),\n ])\n .spread((map_tile_layer, icon_image_data) => {\n const leaflet_map =\n L.map(map_canvas_dom_id, {\n center: center,\n\n zoom: 17,\n minZoom: 17,\n maxZoom: 17,\n\n // Interaction Options\n dragging: false,\n touchZoom: false,\n scrollWheelZoom: false,\n doubleClickZoom: false,\n boxZoom: false,\n tap: false,\n\n // Control options\n zoomControl: false,\n attributionControl: false,\n\n layers: [\n map_tile_layer,\n ],\n })\n\n const marker_icon = L.icon({\n iconUrl: icon_image_data.url,\n iconSize: [25, 29],\n })\n L.marker(center, {\n icon: marker_icon,\n }).addTo(leaflet_map)\n })\n .done()\n })\n\n\n render_map()\n}\n\n\nexport default {\n init: init,\n}\n","\n// region JS Imports\n\n// region External Modules\nimport u from \"umbrellajs\"\nimport Promise from \"plugins/bluebird\"\n// endregion External Modules\n\n// Private Modules\n// Private Modules\n\n// region Public Components\n// endregion Public Components\n\n// region Private Components\nimport {\n Factory,\n ListingCarousel,\n InputSelector as ListingCarouselInputSelector,\n} from \"./factory\"\nimport Photoswipe_Factory from \"./photoswipe/factory\"\nimport Swiper_Factory from \"components/swiper\"\nimport StaticMap from \"./map_view/index\"\n\n// endregion Private Components\n\n// endregion JS Imports\n\nconst CELL_LISTING_CAROUSEL_DEFAULT = \"cell-listing-carousel\"\nconst CELL_INITIALIZED_CLASS_NAME = `${CELL_LISTING_CAROUSEL_DEFAULT}--js-spacious-initialized`\n\nconst CELL_LISTING_CAROUSEL_WITH_SWIPE = \"cell-listing-carousel-with-swiper\"\nconst CELL_WITH_SWIPE_INITIALIZED_CLASS_NAME = `${CELL_LISTING_CAROUSEL_WITH_SWIPE}--js-spacious-initialized`\n\nconst CELL_LISTING_CAROUSEL_MAP_VIEW = \"cell-listing-carousel-map-view\"\nconst CELL_MAP_VIEW_INITIALIZED_CLASS_NAME = `${CELL_LISTING_CAROUSEL_MAP_VIEW}--js-spacious-initialized`\n\nconst LISTING_CAROUSELS = [] as ListingCarousel[]\n\n\nfunction init_one_element_with_promise(options: {\n container_element: Element,\n listing_carousel_selector?: ListingCarouselInputSelector,\n disable_init_protection?: true,\n}): Promise {\n // region inputs\n\n const container_element = options.container_element\n const listing_carousel_selector: ListingCarouselInputSelector = options.listing_carousel_selector || {}\n const disable_init_protection = options?.disable_init_protection || false\n const enable_init_protection = !disable_init_protection\n\n // endregion inputs\n\n if (enable_init_protection && container_element.classList.contains(CELL_INITIALIZED_CLASS_NAME)) {\n return Promise.resolve()\n }\n container_element.classList.add(CELL_INITIALIZED_CLASS_NAME)\n\n LISTING_CAROUSELS.push(\n Factory.create(\n container_element,\n listing_carousel_selector,\n ),\n )\n Photoswipe_Factory.create(container_element, {})\n return Promise.resolve()\n}\n\nfunction init_one_swiper_element_with_promise(options: {\n container_element: Element,\n listing_carousel_selector?: ListingCarouselInputSelector,\n disable_init_protection?: true,\n}): Promise {\n // region inputs\n\n const container_element = options.container_element\n const listing_carousel_selector: ListingCarouselInputSelector = options.listing_carousel_selector || {}\n const disable_init_protection = options?.disable_init_protection || false\n const enable_init_protection = !disable_init_protection\n\n // endregion inputs\n\n if (enable_init_protection && container_element.classList.contains(CELL_WITH_SWIPE_INITIALIZED_CLASS_NAME)) {\n return Promise.resolve()\n }\n container_element.classList.add(CELL_WITH_SWIPE_INITIALIZED_CLASS_NAME)\n\n LISTING_CAROUSELS.push(\n Factory.create(\n container_element,\n listing_carousel_selector,\n ),\n )\n\n // Slow, do it async\n return new Promise((resolve) => {\n // https://swiperjs.com/swiper-api\n Swiper_Factory.create(container_element, {})\n resolve()\n })\n}\n\nconst init = () => {\n u(`.${CELL_LISTING_CAROUSEL_DEFAULT}`).each((el) => {\n init_one_element_with_promise({\n container_element: el,\n }).done()\n })\n\n u(`.${CELL_LISTING_CAROUSEL_WITH_SWIPE}`).each((el) => {\n // Very slow, splitting tasks into smaller async tasks\n setTimeout(() => {\n init_one_swiper_element_with_promise({\n container_element: el,\n })\n })\n })\n\n u(`.${CELL_LISTING_CAROUSEL_MAP_VIEW}`).each((el) => {\n if (el.classList.contains(CELL_MAP_VIEW_INITIALIZED_CLASS_NAME)) { return }\n el.classList.add(CELL_MAP_VIEW_INITIALIZED_CLASS_NAME)\n\n StaticMap.init({\n main: el,\n })\n })\n}\n\nfunction startCycling(): void {\n LISTING_CAROUSELS.forEach((carousel) => {\n carousel.cycle()\n })\n}\n\nexport default {\n init,\n init_one_element_with_promise,\n startCycling,\n}\n"],"file":"assets/index-CxbJxg-L.js"}