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AEE,QAAS,GAET,UAAW,GAEX,QAAc,GACd,aAAc,GACd,UAAc,GAEd,wBAA0B,GAC1B,WAA0B,GAE9B,EACQ,KAAK,EACd,EACF,EACF,EAGI,KAEX,CAEA,MAAML,EAAU,CACd,OAAOG,EAA8CN,EAAyB,CACrE,WAAIK,EAA6B,CAAC,kBAAAC,EAAsC,SAAWN,GAAY,GAAI,EAE9G,EC9FMoB,EAAkB,oCAClBC,EAA8B,GAAG,OAAAD,EAAe,6BAEhDE,EAAO,IAAM,CACjBC,EAAE,IAAI,OAAAH,EAAiB,EAAE,KAAMI,GAAO,CAChCA,EAAG,UAAU,SAASH,CAA2B,IAClDG,EAAA,UAAU,IAAIH,CAA2B,EAE5ClB,EAAQ,OAAO,EACfsB,EAAmB,OAAOD,CAAE,GAC7B,CACH,EAEepB,EAAA,CACb,KAAAkB,CACF","names":["INIT_COMPLETE_CLASS","default_selector","FloorPlanImagesCarousel$1","selector","$","e","Factory","FloorPlanImagesCarousel","FloorPlanImagesCarouselSwipe","container_element","_extend","slide_data_objects","_idx","img_element","$img_element","image_width","image_height","image_src","image_msrc","n","PhotoSwipeUI_Default","__vitePreload","PhotoSwipe","CELL_CLASS_NAME","CELL_INITIALIZED_CLASS_NAME","init","u","el","Photoswipe_Factory"],"ignoreList":[],"sources":["../../../app/assets/javascripts/concepts/floor_plan/images/carousel/factory.ts","../../../app/assets/javascripts/concepts/floor_plan/images/carousel/photoswipe/factory.ts","../../../app/assets/javascripts/concepts/floor_plan/images/carousel/index.ts"],"sourcesContent":["\n// region external libs\nimport $ from \"jquery\"\nimport \"plugins/jquery_plugins/bootstrap-carousel\"\n// endregion external libs\n\n// region constants\nconst INIT_COMPLETE_CLASS = \"js-init-done\"\n\ninterface Selector {\n carousel: string\n images: string\n slide_to_prev_button: string\n slide_to_next_button: string\n}\ninterface InputSelector {\n carousel?: string\n images?: string\n slide_to_prev_button?: string\n slide_to_next_button?: string\n}\nconst default_selector = {\n carousel: \".cell--floor-plan-images--carousel\",\n images: \".cell--floor-plan-images--carousel--image\",\n slide_to_prev_button: \".cell--floor-plan-image--carousel__slide-prev-btn\",\n slide_to_next_button: \".cell--floor-plan-image--carousel__slide-next-btn\",\n}\n// endregion constants\n\n\nclass FloorPlanImagesCarousel {\n private selector: Selector\n\n private $carousel: JQuery\n private $slide_to_prev_button: JQuery\n private $slide_to_next_button: JQuery\n\n constructor(selector?: InputSelector){\n this.selector = Object.assign({}, default_selector, selector)\n\n this.$carousel = $(this.selector.carousel)\n\n this.$slide_to_prev_button = this.$carousel.find(this.selector.slide_to_prev_button)\n this.$slide_to_next_button = this.$carousel.find(this.selector.slide_to_next_button)\n\n this.bind_action()\n this.created()\n }\n protected bind_action(){\n if (this.$carousel.hasClass(INIT_COMPLETE_CLASS)){\n return this\n }\n\n this.$carousel.carousel(\"pause\")\n\n this.$carousel.addClass(INIT_COMPLETE_CLASS)\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 this.$carousel.on(\"slid.bs.carousel\", () => {\n this.process_active_buttons()\n })\n\n return this\n }\n\n protected created(){\n this.process_active_buttons()\n }\n\n protected process_active_buttons(){\n if (this.$carousel.find(\".item:first\").hasClass(\"active\")) {\n this.$slide_to_prev_button.hide()\n this.$slide_to_next_button.show()\n }else if (this.$carousel.find(\".item:last\").hasClass(\"active\")) {\n this.$slide_to_prev_button.show()\n this.$slide_to_next_button.hide()\n }else{\n this.$slide_to_prev_button.show()\n this.$slide_to_next_button.show()\n }\n }\n}\n\nconst Factory = {\n create(selector?: InputSelector){\n return new FloorPlanImagesCarousel(selector)\n },\n}\n\n// region export\nexport {\n Factory,\n Factory as default,\n}\n// endregion export\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 FloorPlanImagesCarouselSwipe {\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 private 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(\"<div class=\\\"pswp\\\" tabindex=\\\"-1\\\" role=\\\"dialog\\\" aria-hidden=\\\"true\\\"><div class=\\\"pswp__bg\\\"></div><div class=\\\"pswp__scroll-wrap\\\"><div class=\\\"pswp__container\\\"><div class=\\\"pswp__item\\\"></div><div class=\\\"pswp__item\\\"></div><div class=\\\"pswp__item\\\"></div></div><div class=\\\"pswp__ui pswp__ui--hidden\\\"><div class=\\\"pswp__top-bar\\\"><div class=\\\"pswp__counter\\\"></div><button class=\\\"pswp__button pswp__button--close\\\" title=\\\"Close (Esc)\\\"></button><button class=\\\"pswp__button pswp__button--share\\\" title=\\\"Share\\\"></button><button class=\\\"pswp__button pswp__button--fs\\\" title=\\\"Toggle fullscreen\\\"></button><button class=\\\"pswp__button pswp__button--zoom\\\" title=\\\"Zoom in/out\\\"></button><div class=\\\"pswp__preloader\\\"><div class=\\\"pswp__preloader__icn\\\"><div class=\\\"pswp__preloader__cut\\\"><div class=\\\"pswp__preloader__donut\\\"></div></div></div></div></div><div class=\\\"pswp__share-modal pswp__share-modal--hidden pswp__single-tap\\\"><div class=\\\"pswp__share-tooltip\\\"></div></div><button class=\\\"pswp__button pswp__button--arrow--left\\\" title=\\\"Previous (arrow left)\\\"> </button><button class=\\\"pswp__button pswp__button--arrow--right\\\" title=\\\"Next (arrow right)\\\"> </button><div class=\\\"pswp__caption\\\"><div class=\\\"pswp__caption__center\\\"></div></div></div></div></div>\")\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 FloorPlanImagesCarouselSwipe({container_element: container_element, selector: (selector || {})})\n },\n}\n\nexport { Factory as default }\n","\n// region JS Imports\n\n// region External Modules\nimport u from \"umbrellajs\"\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 Factory from \"./factory\"\nimport Photoswipe_Factory from \"./photoswipe/factory\"\n// endregion Private Components\n\n// endregion JS Imports\n\n\nconst CELL_CLASS_NAME = \"cell--floor-plan-images--carousel\"\nconst CELL_INITIALIZED_CLASS_NAME = `${CELL_CLASS_NAME}--js-spacious-initialized`\n\nconst init = () => {\n u(`.${CELL_CLASS_NAME}`).each((el) => {\n if (el.classList.contains(CELL_INITIALIZED_CLASS_NAME)) { return }\n el.classList.add(CELL_INITIALIZED_CLASS_NAME)\n\n Factory.create()\n Photoswipe_Factory.create(el)\n })\n}\n\nexport default {\n init,\n}\n"],"file":"assets/index-BEdMpFFj.js"}