1/* 2 Copyright MIT © <2013> <Nathawut Niemsuwan @ Kidkarnmai Studio co.,ltd.> 3 4 $(document).ready(function () { 5 $("body").kidkarnmaiPreloader({ 6 setPercent:setPercent, 7 setPercentComplete:setPercentComplete 8 }); 9 }); 10 11 function setPercent(num){ 12 $("body").hide(); 13 console.log("setPercent : "+num); 14 } 15 16 function setPercentComplete(){ 17 $("body").show(); 18 console.log("setPercentComplete"); 19 } 20 21*/ 22 23jQuery(function($){ 24 $.kidkarnmaiPreloader = function(el, options,arr_images){ 25 var _base = this; 26 27 _base.$el = $(el); 28 _base.el = el; 29 30 _base.$el.data("kidkarnmaiPreloader", _base); 31 32 _base.kkmimages = []; 33 _base.kkmbgimages = []; 34 _base.kkmimageCounter = 0; 35 _base.kkmdone = 0; 36 _base.kkmdestroyed = false; 37 38 _base.init = function(){ 39 40 arr_images = arr_images || []; 41 _base.kkmimages = arr_images; 42 43 _base.options = $.extend({},$.kidkarnmaiPreloader.defaultOptions, options); 44 45 _base.findImageInElement(_base.el); 46 _base.$el.find("*:not(script)").each(function() { 47 _base.findImageInElement(this); 48 }); 49 _base.createPreloadContainer(); 50 }; 51 52 //the container where unbindable images will go 53 _base.createPreloadContainer = function() { 54 _base.kkmimageCounter = _base.kkmimages.length; 55 //trace("_base.kkmimageCounter : "+ _base.kkmimageCounter); 56 if(_base.kkmimages.length>0){ 57 for (var i = 0; _base.kkmimages.length > i; i++) { 58 //trace(i+" : "+_base.kkmimages[i]); 59 $.ajax({ 60 url: _base.kkmimages[i], 61 type: 'GET', 62 complete: function (data) { 63 _base.addImageForPreload(_base.kkmimages[i]); 64 } 65 }); 66 } 67 } 68 else 69 { 70 _base.options.setPercentComplete(); 71 } 72 }; 73 74 _base.addImageForPreload = function(url) { 75 _base.bindLoadEvent(url); 76 }; 77 78 _base.findImageInElement = function (element) { 79 var url = ""; 80 var obj = $(element); 81 var type = "normal"; 82 83 if (obj.css("background-image") != "none") { 84 url = obj.css("background-image"); 85 type = "background"; 86 } else if (typeof(obj.attr("src")) != "undefined" && element.nodeName.toLowerCase() == "img") { 87 url = obj.attr("src"); 88 } 89 90 if (url.indexOf("gradient") == -1) { 91 url = url.replace(/url\(\"/g, ""); 92 url = url.replace(/url\(/g, ""); 93 url = url.replace(/\"\)/g, ""); 94 url = url.replace(/\)/g, ""); 95 96 var urls = url.split(", "); 97 98 for (var i = 0; i < urls.length; i++) { 99 if (urls[i].length > 0 && _base.kkmimages.indexOf(urls[i]) == -1 && !urls[i].match(/^(data:)/i)) { 100 var extra = ""; 101 102 if (_base.isIE() || _base.isOpera()){ 103 //filthy always no cache for IE, sorry peeps! 104 extra = "?rand=" + Math.random(); 105 _base.kkmbgimages.push(urls[i] + extra); 106 } else { 107 if (type == "background") { 108 _base.kkmbgimages.push(urls[i]); 109 } else { 110 // _base.bindLoadEvent(obj); 111 } 112 } 113 114 _base.kkmimages.push(urls[i]); 115 } 116 } 117 } 118 }; 119 120 _base.isIE = function () { 121 return navigator.userAgent.match(/msie/i); 122 }; 123 124 _base.isOpera = function () { 125 return navigator.userAgent.match(/Opera/i); 126 }; 127 128 _base.bindLoadEvent = function (element) { 129 _base.completeImageLoading(this); 130 }; 131 132 _base.completeImageLoading = function (el) { 133 _base.kkmdone++; 134 //trace(_base.kkmdone +" : "+ _base.kkmimageCounter); 135 var percentage = Math.round((_base.kkmdone / _base.kkmimageCounter) * 100); 136 137 _base.options.setPercent(percentage); 138 139 if (_base.kkmdone == _base.kkmimageCounter) { 140 _base.options.setPercentComplete(); 141 } 142 }; 143 144 _base.init(); 145 }; 146 147 148 $.fn.kidkarnmaiPreloader = function(options,arr){ 149 return this.each(function(){ 150 (new $.kidkarnmaiPreloader(this, options,arr)); 151 }); 152 }; 153}); 154 155//HERE COMES THE IE SHITSTORM 156if (!Array.prototype.indexOf) { 157 Array.prototype.indexOf = function (elt /*, from*/) { 158 var len = this.length >>> 0; 159 var from = Number(arguments[1]) || 0; 160 from = (from < 0) 161 ? Math.ceil(from) 162 : Math.floor(from); 163 if (from < 0) 164 from += len; 165 166 for (; from < len; from++) { 167 if (from in this && 168 this[from] === elt) 169 return from; 170 } 171 return -1; 172 }; 173} 174 175$(document).ready(function(){ 176var lifeCarousel = document.getElementsByClassName('lifeCarousel'); 177if(lifeCarousel && lifeCarousel.length > 0) { 178 fixSpaceMainLifeSec(); 179 initializelifeSwiper(); 180} 181}); 182 183 184$(window).on("load resize", function () { 185 fixSpaceMainLifeSec(); 186}); 187 188function fixSpaceMainLifeSec() { 189 setTimeout(() => { 190 $(".mainLifeSec .lifeSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 191 $(".mainLifeSec .lifeSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 192 }, 50); 193} 194 195function initializelifeSwiper() { 196 const swipers = document.querySelectorAll('.lifeSwiper');
197 swipers.forEach(swiper => { 198 new Swiper(swiper, { 199 spaceBetween: 20, 200 speed: 500, 201 pagination: { 202 el: '.swiper-pagination', 203 clickable: true, 204 }, 205 breakpoints: { 206 1480: { 207 slidesPerView: 1.4, 208 spaceBetween: 20, 209 centeredSlides: false, 210 slidesPerGroup: 1, 211 }, 212 768: { 213 slidesPerView: 1, 214 spaceBetween: 20, 215 centeredSlides: false, 216 slidesPerGroup: 1, 217 }, 218 250: { 219 slidesPerView: 1.1, 220 spaceBetween: 10, 221 slidesPerGroup: 1, 222 centeredSlides: true, 223 } 224 } 225 }); 226 }); 227} 228 229$(document).ready(function(){ 230var sectionsustain = document.getElementsByClassName('sustainlist'); 231 if (sectionsustain && sectionsustain.length > 0) { 232 // Event listeners for pagination buttons 233 document.querySelector('.sustainlist .pagPrev').addEventListener('click', () => { 234 if (currentPage > 0) { 235 currentPage--; 236 renderPage(currentPage); 237 } 238 }); 239 240 document.querySelector('.sustainlist .pagNext').addEventListener('click', () => { 241 if (currentPage < paginatedData.length - 1) { 242 currentPage++; 243 renderPage(currentPage); 244 } 245 }); 246 } 247 }); 248 249const ReportPageGoToTop = true 250 251var Download_obk 252if($(".mainListMediaSec") && $(".mainListMediaSec").length > 0){ 253const generateArticleThumbnailSustain = ({ title, imagePath, pdfpath }) => { 254 let item = ` 255 <div class="itemMedia"> 256 <div class="boxImg"> 257 <a class="btn_download_file" data-pdf-title="${title}" data-pdf-link="${pdfpath}"> 258 <img src="${imagePath}"> 259 </a> 260 </div> 261 <div class="boxContent"> 262 <a class="btn_download_file" data-pdf-title="${title}" data-pdf-link="${pdfpath}"> 263 <p class="subText">${title}</p> 264 </a> 265 <div class="download"> 266 <a class="btn_download_file" data-pdf-title="${title}" data-pdf-link="${pdfpath}"> 267 <p class="descText"> 268 <i class="icon-ic-download"></i> 269 ${Download_obk} 270 </p> 271 </a> 272 </div> 273 </div> 274 </div>`; 275 return htmlToElement(item); 276}; 277 278 279const chunkArray = (array, chunkSize) => { 280 const result = []; 281 for (let i = 0; i < array.length; i += chunkSize) { 282 result.push(array.slice(i, i + chunkSize)); 283 } 284 return result; 285}; 286 287let paginatedData = []; 288let currentPage = 0; 289var reportLength = 0; 290 291 292const renderPage = (pageIndex) => { 293 const container = document.getElementById('container-id'); 294 container.innerHTML = ''; 295 paginatedData[pageIndex].forEach(item => {
296 const articleThumbnail = generateArticleThumbnailSustain(item); 297 container.appendChild(articleThumbnail); 298 }); 299 if(reportLength > 12){ 300 updatePaginationControls(pageIndex); 301 $('.sustainlist .paginationMedia').removeClass("hidden"); 302 } else{ 303 $('.sustainlist .paginationMedia').addClass("hidden"); 304 } 305 ReportPageGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }); 306 downloadPDF(); 307 handlePaginationScroll(pageIndex); 308}; 309 310// Function to handle pagination scroll 311const handlePaginationScroll = (pageIndex) => { 312 const paginationContainer = document.querySelector('.sustainlist .paginationMedia .innerPag'); 313 const activeItem = document.querySelector('.sustainlist .paginationMedia .ui.pagination.menu .active'); 314 const nextItem = activeItem ? activeItem.nextElementSibling : null; 315 const prevItem = activeItem ? activeItem.previousElementSibling : null; 316 317 if (activeItem) { 318 updatePagination(); // Ensure pagination is updated 319 320 const items = Array.from(document.querySelectorAll('.sustainlist .paginationMedia .ui.pagination.menu .item')); 321 const itemWidth = activeItem.offsetWidth; // Get the width of one pagination item 322 const itemsPerPage = 6; 323 const scrollValue = itemWidth * itemsPerPage; // Scroll by the width of `itemsPerPage` items 324 325 if (nextItem) { 326 // Scrolling to the next page 327 const activeIndex = items.indexOf(nextItem) + 1; 328 if (activeIndex > itemsPerPage && (activeIndex - 1) % itemsPerPage === 0) { 329 setTimeout(() => { 330 paginationContainer.scrollBy({ 331 left: scrollValue, 332 behavior: 'smooth' 333 }); 334 }, 30); 335 } 336 } else if (prevItem) { 337 // Scrolling to the previous page 338 const activeIndex = items.indexOf(prevItem) + 1; 339 if ((activeIndex % itemsPerPage === 0) || (activeIndex < itemsPerPage)) { 340 setTimeout(() => { 341 paginationContainer.scrollBy({ 342 left: -scrollValue, 343 behavior: 'smooth' 344 }); 345 }, 30); 346 } 347 } 348 349 // Handle scrolling for the last page 350 if (pageIndex === paginatedData.length - 1) { 351 setTimeout(() => { 352 paginationContainer.scrollTo({ 353 left: paginationContainer.scrollWidth - paginationContainer.clientWidth, 354 behavior: 'smooth' 355 }); 356 }, 30); 357 } 358 359 // Handle scrolling for the first page 360 if (pageIndex === 0) { 361 setTimeout(() => { 362 paginationContainer.scrollTo({ 363 left: 0, 364 behavior: 'smooth' 365 }); 366 }, 30); 367 } 368 369 // Adjust main content view 370 document.querySelector('html, body').scrollTo({ 371 top: document.querySelector(".mainListMediaSec").offsetTop - 100, 372 behavior: 'smooth' 373 }); 374 } 375}; 376 377 378// Function to update pagination controls 379const updatePaginationControls = (pageIndex) => { 380 const paginationContainer = document.querySelector('.innerPag'); 381 paginationContainer.innerHTML = ''; 382 383 paginatedData.forEach((_, index) => { 384 const pageItem = document.createElement('a'); 385 pageItem.classList.add('item'); 386 if (index === pageIndex) { 387 pageItem.classList.add('active'); 388 } 389 pageItem.textContent = index + 1; 390 pageItem.addEventListener('click', () => { 391 if (currentPage !== index) { 392 currentPage = index; 393 renderPage(index); 394 } 395 }); 396 paginationContainer.appendChild(pageItem); 397 }); 398 399 document.querySelector('.pagPrev').classList.toggle('disabled', pageIndex === 0); 400 document.querySelector('.pagNext').classList.toggle('disabled', pageIndex === paginatedData.length - 1); 401}; 402 403var mainListMediaSec = $(".mainListMediaSec") 404// Event listeners for pagination buttons 405if(mainListMediaSec && mainListMediaSec.length > 0){ 406 document.querySelector('.pagPrev').addEventListener('click', () => { 407 if (currentPage > 0) { 408 currentPage--; 409 renderPage(currentPage); 410 } 411 }); 412 413 document.querySelector('.pagNext').addEventListener('click', () => { 414 if (currentPage < paginatedData.length - 1) { 415 currentPage++; 416 renderPage(currentPage); 417 } 418 }); 419} 420// Initial render 421const initPageListingSustain = (url) => { 422 const reqUrl = `${url}`; 423 424 axios.get(reqUrl).then((res) => { 425 const responseData = JSON.parse(res.data.sustainDetails); 426 Download_obk = res.data.donwloadtranslation; 427 const boxNotFound = document.querySelector('.sustainlist .boxNotFound'); 428 const paginationhide = document.querySelector('.sustainlist .paginationMedia'); 429 reportLength = responseData.length; 430 if (responseData && responseData.length > 0) { 431 paginatedData = chunkArray(responseData, 12); 432 currentPage = 0; 433 renderPage(currentPage); 434 if (boxNotFound) { 435 boxNotFound.classList.add('hidden'); 436 if(responseData.length > 12){ 437 paginationhide.classList.remove('hidden'); 438 } 439 } 440 441 } else { 442 if (boxNotFound) { 443 paginationhide.classList.add('hidden'); 444 boxNotFound.classList.remove('hidden'); 445 } 446 } 447 }).catch((error) => { 448 console.error('Error fetching data:', error); 449 const boxNotFound = document.querySelector('.boxNotFound'); 450 if (boxNotFound) { 451 boxNotFound.classList.remove('hidden'); 452 } 453 }); 454}; 455 456 457const __initContentSustainList = () => { 458 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]'); 459 var current_page = window.location.href; 460 var current_page_split = current_page.split(".html"); 461 _.forEach(dataContentRenderingContainer, (contentRender) => { 462 if (contentRender.dataset.contentRender === 'page') { 463 var pagetype = getPageTypeInSectionBlog(); 464 initPageListingSustain(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json'); 465 } 466 }); 467}; 468 469(function () { 470 let stateCheck = setInterval(() => { 471 if (document.readyState === 'complete' && getPageTypeInSectionBlog() == "sustainlist") { 472 clearInterval(stateCheck); 473 __initContentSustainList(); 474 console.log('Init page Sustain listing script imported'); 475 } 476 }, 100); 477})(); 478 479function downloadPDF(){ 480$(".sustainlist .mainListMediaSec .mediaList .itemMedia .btn_download_file").click(function (event) { 481 const fileUrl = $(this).data('pdf-link'); 482 const titlepdf = $(this).data('pdf-title'); 483 fetch(fileUrl) 484 .then(response => response.blob()) 485 .then(blob => { 486 const url = window.URL.createObjectURL(blob); 487 const a = document.createElement('a'); 488 a.style.display = 'none'; 489 a.href = url; 490 a.download = titlepdf + '.pdf'; 491 document.body.appendChild(a); 492 a.click(); 493 window.URL.revokeObjectURL(url); 494 }) 495 .catch(() => alert('An error occurred while downloading the file.')); 496}); 497} 498} 499$(document).ready(function() { 500 $('.mainReportContentSec #sustainability_report_download').click(function() { 501 502 let input = document.getElementById('sustainability_report_download'); 503 const fileUrl = input.getAttribute('data-file'); 504 505 fetch(fileUrl) 506 .then(response => response.blob()) 507 .then(blob => { 508 const url = window.URL.createObjectURL(blob); 509 const a = document.createElement('a'); 510 a.style.display = 'none'; 511 a.href = url; 512 a.download = 'Sustainability-Report.pdf'; 513 document.body.appendChild(a); 514 a.click(); 515 window.URL.revokeObjectURL(url); 516 }) 517 .catch(() => alert('An error occurred while downloading the file.')); 518 }); 519 520}); 521$(document).ready(function () { 522 function animateCounter(counter, target) { 523 const isDecimal = target % 1 !== 0; // Check if the target is a decimal number
524 $({ count: parseFloat(removeCommas(counter.text())) }).animate({ 525 count: target 526 }, { 527 duration: 1500, 528 easing: 'swing', 529 step: function () { 530 if (isDecimal) { 531 counter.text(this.count.toFixed(1)); 532 } else { 533 var count = removeCommas(this.count); 534 var text = Math.floor(count); 535 text = addCommas(text); 536 counter.text(text); 537 } 538 }, 539 complete: function () { 540 if (isDecimal) { 541 counter.text(this.count.toFixed(1)); 542 } else { 543 counter.text(this.count.toLocaleString("en-US")); 544 } 545 } 546 }); 547 } 548 549 function addCommas(count){ 550 551 return count.toLocaleString("en-US"); 552 } 553 554 function removeCommas(text){ 555 return text.toString().replaceAll(",", ''); 556 } 557 558 function isScrolledIntoView(elem) { 559 var docViewTop = $(window).scrollTop(); 560 var docViewBottom = docViewTop + $(window).height(); 561 var elemTop = $(elem).offset().top; 562 return elemTop <= docViewBottom; 563 } 564var sustainability = document.getElementsByClassName('mainSustainabilltySec'); 565 $(window).scroll(function () { 566 if(sustainability && sustainability.length>0) { 567 if (isScrolledIntoView('.mainSustainabilltySec')) { 568 $('.counter').each(function () { 569 var target = parseFloat($(this).data('target')); 570 animateCounter($(this), target); 571 }); 572 } 573 } 574 }); 575}); 576$(document).ready(function () { 577 accordionValues(); 578}); 579 580function accordionValues() { 581 $('.mainValueSec').each(function (index, section) { 582 var accordions = $(section).find('.valueAccordion .ui.accordion'); 583 $(accordions).accordion(); 584 585 $(section).find('.valueAccordion .ui.accordion .title').on('click', function () { 586 var isActive = $(this).hasClass('active'); 587 $(section).find(".valueAccordion .ui.accordion .content").removeClass('showImg'); 588 if (isActive) { 589 $(this).next(".content").addClass('showImg'); 590 } 591 }); 592 }); 593} 594 595$(document).ready(function(){ 596 597}); 598$(document).ready(function () { 599 spaceTop = FixSpecTop(); 600 ClickScroll(); 601 $(window).scroll(function () { 602 ScrollActiveSec(); 603 }); 604}); 605 606$(window).on("load resize", function () { 607 spaceTop = FixSpecTop(); 608}); 609 610function FixSpecTop() { 611 if ($(window).width() <= 5000 && $(window).width() >= 1480) { 612 return 165; 613 } else if($(window).width() <= 1479 && $(window).width() >= 1200) { 614 return 155; 615 } else if($(window).width() <= 1199 && $(window).width() >= 992) { 616 return 140; 617 } else { 618 return 0; 619 } 620} 621 622function ClickScroll() { 623 $('.mainPrivacySec .boxTitle ul li').each(function (index) { 624 $(this).data('index', index + 1); 625 var buttonId = 'btnScrollTo_' + (index + 1); 626 $(this).click(function () { 627 var currentIndex = $(this).data('id'); 628 $('html, body').animate({ 629 scrollTop: $("#" + currentIndex).offset().top -spaceTop 630 }, 800); 631 }); 632 }); 633} 634 635function ScrollActiveSec() { 636 const currentScroll = $(this).scrollTop(); 637 $('.mainPrivacySec .boxDetail .item').each(function (index) { 638 const sectionTop = $(this).offset().top - (spaceTop + 15); 639 const sectionHeight = $(this).outerHeight(); 640 641 if (currentScroll >= sectionTop && currentScroll < sectionTop + sectionHeight) { 642 $(this).data('index', index); 643 var currentIndex = $(this).closest('.mainPrivacySec .boxDetail .item').data('index'); 644 $('.mainPrivacySec .boxTitle ul li').removeClass('active'); 645 $('.mainPrivacySec .boxTitle ul li').eq(currentIndex).addClass('active'); 646 } 647 }); 648} 649$(document).ready(function () { 650 var sectionmainLoopSectwo = document.getElementsByClassName('mainLoopSec'); 651 if (sectionmainLoopSectwo && sectionmainLoopSectwo.length > 0) { 652 fixSpaceMainLoopSec(); 653 } 654}); 655 656$(window).on("load resize", function () { 657 fixSpaceMainLoopSec(); 658}); 659 660function fixSpaceMainLoopSec() {
661 $(".mainLoopSec .loopSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 662 $(".mainLoopSec .loopSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 663} 664 665$(".mainLoopSec .loopSwiper .slideItem").click(function () { 666 $(this).toggleClass('show'); 667 668 if ($(this).hasClass('show')) { 669 var heightText = $(this).find('.descText').outerHeight(); 670 $(this).find(".detail").css('height', heightText); 671 } else { 672 $(this).find(".detail").removeAttr('style'); 673 } 674}); 675 676var loopSwiper = new Swiper(".loopSwiper", { 677 slidesPerView: 3, 678 spaceBetween: 20, 679 resizeObserver:!($("body").data('custom-mode') == "edit"), 680 speed: 500, 681 682 breakpoints: { 683 992: { 684 slidesPerView: 3, 685 spaceBetween: 20, 686 centeredSlides: false, 687 }, 688 768: { 689 slidesPerView: 2, 690 spaceBetween: 20, 691 centeredSlides: false, 692 }, 693 250: { 694 slidesPerView: 1.1, 695 spaceBetween: 10, 696 slidesPerGroup: 1, 697 centeredSlides: true, 698 } 699 } 700}); 701$(document).ready(function(){ 702 703 if($(".locationSwiper") && $(".locationSwiper").length >0){ 704 initializeLocationSwiper(); 705 updateIframeHeight(); 706 } 707}); 708function updateIframeHeight(){ 709 $(".mainLocationSec iframe").each(function(){ 710 711 var height = $(".locationSlide").height(); 712 height = height > 774 ? height : 774; 713 714 $(this).css("height",height); 715 $(this).parent().css("width","100%"); 716 }); 717} 718 719function initializeLocationSwiper() { 720 const swipers = document.querySelectorAll('.locationSwiper'); 721 swipers.forEach(swiper => { 722 new Swiper(swiper, { 723 slidesPerView: 1, 724 spaceBetween: 20, 725 slidesPerGroup: 1, 726 speed: 500, 727 resizeObserver:!($("body").data('custom-mode') == "edit"), 728 pagination: { 729 el: '.swiper-pagination', 730 type: "fraction", 731 }, 732 navigation: { 733 nextEl: ".swiper-button-next", 734 prevEl: ".swiper-button-prev", 735 }, 736 breakpoints: { 737 992: { 738 spaceBetween: 20, 739 }, 740 768: { 741 spaceBetween: 20, 742 }, 743 250: { 744 slidesPerView: 1, 745 spaceBetween: 10, 746 } 747 } 748 }); 749 }); 750} 751$(document).ready(function () { 752 var listAccord = document.getElementsByClassName('mainListAccordionSec'); 753 if(listAccord && listAccord.length > 0) { 754 755 756 $(".mainListAccordionSec").each(function () { 757 var $section = $(this); 758 759 $section.find(".titleAccordion").click(function () { 760 var $clickedTitle = $(this); 761 var isOpen = $clickedTitle.hasClass('show'); 762 763 $section.find(".titleAccordion").removeClass('show'); 764 $section.find(".bodyAccordion").slideUp(); 765 766 $clickedTitle.toggleClass('show', !isOpen); 767 if (!isOpen) { 768 $clickedTitle.next(".bodyAccordion").slideDown(); 769 } 770 }); 771 }); 772 } 773}); 774$(document).ready(function(){ 775var mainParkingSec = document.getElementsByClassName('mainParkingSec'); 776if(mainParkingSec && mainParkingSec.length > 0) { 777 $(".mainParkingSec .parkinAccordion .ui.accordion").accordion(); 778 779 initializeParkingZoomClicks(); 780} 781}); 782 783function initializeParkingZoomClicks() { 784 const sections = document.querySelectorAll('.mainParkingSec'); 785 786 sections.forEach(section => { 787 const button = section.querySelector('.parkingMap .btnViewFull'); 788 const modal = section.querySelector('.ui.modal.modalParkingZoom'); 789 const zoomistContainer = section.querySelector('.modalParkingZoom .zoomist-container'); 790 791 if (button && modal && zoomistContainer) { 792 button.addEventListener('click', function () { 793 $(modal).modal('show'); 794 795 new Zoomist(zoomistContainer, { 796 maxScale: 4, 797 bounds: true, 798 slider: true, 799 zoomer: true 800 }); 801 }); 802 } 803 }); 804} 805$(document).ready(function(){ 806var aswiper = $(".awardsSwiper"); 807if(aswiper && aswiper.length > 0){ 808 var awardsSwiper = new Swiper(".awardsSwiper", { 809 slidesPerView: 2, 810 spaceBetween: 20, 811 slidesPerGroup: 2, 812 resizeObserver:!($("body").data('custom-mode') == "edit"), 813 speed: 500, 814 pagination: { 815 el: ".swiper-pagination", 816 clickable: true, 817 }, 818 breakpoints: { 819 992: { 820 slidesPerView: 2, 821 slidesPerGroup: 2, 822 spaceBetween: 20, 823 }, 824 768: { 825 slidesPerView: 1, 826 slidesPerGroup: 1, 827 spaceBetween: 20, 828 }, 829 250: { 830 slidesPerView: 1, 831 slidesPerGroup: 1, 832 spaceBetween: 20, 833 } 834 } 835 836 }); 837} 838 839}); 840$(document).ready(function(){ 841var lifeCarousel = document.getElementsByClassName('lifeCarousel'); 842if(lifeCarousel && lifeCarousel.length > 0) { 843 var lifeCarousel = $('.lifeCarousel') 844lifeCarousel.owlCarousel({ 845 center: true, 846 loop: true, 847 margin: 20, 848 speed: 500, 849 responsive: { 850 1480: { 851 items: 1.85 852 }, 853 768: { 854 items: 1.25 855 }, 856 250: { 857 items: 1.1, 858 margin: 10 859 } 860 } 861}); 862 } 863}); 864$(document).ready(function () { 865 var sectionmainWorkplaceSec = document.getElementsByClassName('mainWorkplaceSec'); 866 if (sectionmainWorkplaceSec && sectionmainWorkplaceSec.length > 0) { 867 fixSpaceMainWorkplaceSec(); 868 869 initializeWorkplaceSwiper(); 870 871 var numberOfSlides = $('.workplaceSwiper .swiper-slide').length; 872 873 if (numberOfSlides == 1) { 874 $('.mainWorkplaceSec .headlineSec .titleText').addClass('w100'); 875 $('.mainWorkplaceSec .workplaceSwiper .swiper-number').addClass('d-none'); 876 877 } else { 878 $('.mainWorkplaceSec .headlineSec .titleText').addClass('w60'); 879 } 880 } 881}); 882 883$(window).on("load resize", function () { 884 fixSpaceMainWorkplaceSec(); 885}); 886 887function fixSpaceMainWorkplaceSec() { 888 $(".mainWorkplaceSec .workplaceSlide .workplaceSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 889 $(".mainWorkplaceSec .workplaceSlide .workplaceSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 890 $(".mainWorkplaceSec .workplaceSlide .workplaceSwiper .swiper-number").css("margin-right", $(".container.custom-container").offset().left + 15); 891} 892 893function initializeWorkplaceSwiper() { 894 const swipers = document.querySelectorAll('.workplaceSwiper');
895 swipers.forEach(swiper => { 896 new Swiper(swiper, { 897 slidesPerView: 3, 898 spaceBetween: 20, 899 slidesPerGroup: 3, 900 resizeObserver: !($("body").data('custom-mode') == "edit"), 901 speed: 500, 902 pagination: { 903 el: '.swiper-pagination', 904 type: "fraction", 905 }, 906 navigation: { 907 nextEl: ".swiper-button-next", 908 prevEl: ".swiper-button-prev", 909 }, 910 breakpoints: { 911 992: { 912 slidesPerView: 3, 913 spaceBetween: 20, 914 slidesPerGroup: 3, 915 centeredSlides: false, 916 }, 917 768: { 918 slidesPerView: 2, 919 spaceBetween: 20, 920 slidesPerGroup: 2, 921 centeredSlides: false, 922 }, 923 250: { 924 slidesPerView: 1.1, 925 spaceBetween: 10, 926 slidesPerGroup: 1, 927 centeredSlides: true, 928 } 929 } 930 }); 931 }); 932} 933$(document).ready(function(){ 934var storyCarousel = document.getElementsByClassName('storyCarousel'); 935if(storyCarousel && storyCarousel.length > 0) { 936 var storyCarousel = $('.storyCarousel') 937storyCarousel.owlCarousel({ 938 center: true, 939 loop: true, 940 margin: 20, 941 speed: 500, 942 responsive: { 943 1480: { 944 items: 1.85 945 }, 946 768: { 947 items: 1.25 948 }, 949 250: { 950 items: 1.1, 951 margin: 10 952 } 953 } 954}); 955} 956}); 957$(document).ready(function () { 958 checkScreenWidth(); 959 $(window).resize(function () { 960 checkScreenWidth(); 961 }); 962 if( $(".mainFormLookingSec .FormDropdown button.btn-default") && 963 $(".mainFormLookingSec .FormDropdown button.btn-default").length >0 ){ 964 $(".mainFormLookingSec .FormDropdown button.btn-default").on("click",function(){ 965 var url = $(".mainFormLookingSec .FormDropdown .boxDropdown .menu>.item.active").data("link"); 966 window.location.href=url; 967 }); 968 969 $(".mainFormLookingSec .boxDropdown .ui.inline.dropdown").dropdown({ 970 forceSelection: false, //***** 971 direction: "downward", 972 delay: { 973 touch: 2000, 974 }, 975 }); 976 977 } 978}); 979 980function removeCurrentPageLink(){ 981 $(".explore .mainFormLookingSec .boxDropdown .dropdown .menu .item").each(function(){ 982 var link = $(this).data("link") || ""; 983 var currentPage = window.location.pathname; 984 if(currentPage.endsWith('/')){ 985 currentPage = currentPage.slice(0, -1); 986 } 987 if(link.includes(currentPage)){ 988 $(this).remove(); 989 } 990 }); 991} 992 993function checkScreenWidth() { 994 var screenWidth = $(window).width(); 995 996 var src = $(".mainFormLookingSec").data("src"); 997 var src_m = $(".mainFormLookingSec").data("src_m"); 998 999 if (screenWidth < 767) { 1000 $(".mainFormLookingSec").css("background-image", "url("+src_m+")"); 1001 } else { 1002 $(".mainFormLookingSec").css("background-image", "url("+src+")"); 1003 } 1004} 1005$(window).on("scroll", function () { 1006 var sectionmainContentBotSec = document.getElementsByClassName('mainContentBotSec'); 1007 if (sectionmainContentBotSec && sectionmainContentBotSec.length > 0) { 1008 PauseContentVideo(); 1009 } 1010}); 1011 1012 1013function PauseContentVideo() { 1014 var ContentVideo = document.querySelector(".mainContentBotSec"); 1015 if (ContentVideo) { 1016 var allVideos = ContentVideo.getElementsByTagName("video"); 1017 var offsetTop = ContentVideo.offsetTop; 1018 var scrollPosition = window.pageYOffset; 1019 var elementHeight = ContentVideo.offsetHeight - 100; 1020 for (var i = 0; i < allVideos.length; i++) { 1021 if (allVideos[i].dataset.autoplayenable === "true") { 1022 if (scrollPosition > (offsetTop - 100) && scrollPosition < offsetTop + elementHeight) { 1023 allVideos[i].play().catch(function (error) { 1024 console.log(error); 1025 }); 1026 } else { 1027 allVideos[i].pause(); 1028 } 1029 } else { 1030 allVideos[i].pause(); 1031 } 1032 } 1033 } 1034} 1035window.addEventListener("load", function() { 1036 PauseContentVideo(); 1037}); 1038$(document).ready(function () { 1039 1040 var sectmainContactBannerSec = document.getElementsByClassName('mainContactBannerSec'); 1041 if (sectmainContactBannerSec && sectmainContactBannerSec.length > 0) { 1042 1043 // Use event delegation in case buttons are added dynamically 1044 $(document).on('click', '.btn_to_contact', function () { 1045 var linkType = $(this).data('link-type'); 1046 var link = $(this).data('link'); 1047 var scroll = $(this).data('scroll'); 1048 var newPage = $(this).data('newpage'); // Get the data-newpage attribute 1049 1050 // Check if it's a link type action 1051 if (linkType === "link" && link) { 1052 if (newPage === true) { 1053 // Open the link in a new tab 1054 window.open(link, '_blank'); 1055 } else if (newPage === false) { 1056 // Open the link in the same tab 1057 window.location.href = link; 1058 } else { 1059 window.location.href = link; 1060 console.warn('data-newpage is missing or invalid.'); 1061 } 1062 } else if (linkType === "scroll" && scroll) { 1063 // Check if the scroll target exists 1064 var $target = $("#" + scroll); 1065 if ($target.length) { 1066 // Animate the scroll to the target element 1067 $('html, body').animate({ 1068 scrollTop: $target.offset().top 1069 }, 1200); 1070 } else { 1071 console.warn('Scroll target not found: ' + scroll); 1072 } 1073 } else { 1074 console.warn('Invalid link type or missing data attributes.'); 1075 } 1076 }); 1077 1078 } 1079 1080}); 1081 1082$(document).ready(function(){ 1083 1084 /**Click event listener to open modal*/ 1085 $(".mainSpaceSec .btn_view_plan").click(function () { 1086 var thisModalElem = $(this).closest(".tableBody").find('.ui.modal.modalPlanContact>.contentModal'); 1087 var url = $(this).data("path"); 1088 if(url){ 1089 url = url + "/floor-details.html"; 1090 $.get( url, function( data ) { 1091 var modalElem = $('.ui.modal.modalPlanContact.customModal') 1092 1093 modalElem.find(".contentModal").html(data); 1094 modalElem.find(".contentModal>.stepPlanContent").show(); 1095 1096 modalElem.modal('show'); 1097 $(".modalPlanContact .btn_form_contact").click(function () { 1098 // $('.ui.modal.modalFormContact').modal('show'); 1099 window.location.href= $(".mainSpaceSec").data("redirectpath")+"#"+ $(".mainSpaceSec").data("c
1099ontactusid"); 1100 }); 1101 }); 1102 }else{ 1103 $(this).attr('disabled', true); 1104 } 1105 }); 1106 /** Adding disable class to buttons which are not having modal configured*/ 1107 $(".btn-default.btn_view_plan").each(function(){ 1108 var thisModalElem = $(this).closest(".tableBody").find('.ui.modal.modalPlanContact>.contentModal'); 1109 var url = $(this).data("path"); 1110 if(!url){ 1111 $(this).addClass('disabled'); 1112 } 1113 }); 1114 1115 $(document).on("click",".btn-close-modal",function(){ 1116 var modalElem = $('.ui.modal.modalPlanContact.customModal'); 1117 modalElem.modal('hide'); 1118 }); 1119 1120 $(".mainSpaceSec .btnLoadMore").click(function () { 1121 $(".mainSpaceSec .tableSpace .innerBody").addClass('show'); 1122 $(this).parent().addClass('d-none'); 1123 }); 1124 1125}); 1126 1127$(document).ready(function () { 1128 initializeInspiringSwiper(); 1129 var sectionmainInspiringSec = document.getElementsByClassName('mainInspiringSec'); 1130 if (sectionmainInspiringSec && sectionmainInspiringSec.length > 0) { 1131 fixSpaceMainInspiringSec(); 1132 } 1133}); 1134 1135$(window).on("load resize", function () { 1136 fixSpaceMainInspiringSec(); 1137}); 1138 1139function fixSpaceMainInspiringSec() { 1140 setTimeout(() => { 1141 $(".mainInspiringSec .slideContent").css("padding-left", $(".container.custom-container").offset().left + 15); 1142 $(".mainInspiringSec .inspiringSlide .swiper-number").css("margin-left", $(".container.custom-container").offset().left + 15); 1143 $(".mainInspiringSec .inspiringSlide .inspiringSwiper").css("padding-right", $(".container.custom-container").offset().left + 120); 1144 }, 50); 1145 1146 if ($(window).width() >= 250 && $(window).width() <= 991) { 1147 var heightTitle = $(".mainInspiringSec .slideContent .title").innerHeight(); 1148 $(".mainInspiringSec .inspiringSlide .inspiringSwiper").css('padding-top', heightTitle + 30); 1149 } else { 1150 $(".mainInspiringSec .inspiringSlide .inspiringSwiper").css('padding-top', '0'); 1151 } 1152} 1153 1154 1155function initializeInspiringSwiper() { 1156 const swipers = document.querySelectorAll('.inspiringSwiper'); 1157 swipers.forEach(swiperContainer => { 1158 const mainInspiringSec = swiperContainer.closest('.mainInspiringSec'); 1159 //const backgroundColor = swiperContainer.closest('.mainInspiringSec .slideItem .active'); 1160 1161 new Swiper(swiperContainer, { 1162 slidesPerView: 1, 1163 spaceBetween: 10, 1164 speed: 500, 1165 resizeObserver:!($("body").data('custom-mode') == "edit"), 1166 pagination: { 1167 el: swiperContainer.querySelector('.swiper-pagination'), 1168 type: "fraction", 1169 }, 1170 navigation: { 1171 nextEl: swiperContainer.querySelector(".swiper-button-next"), 1172 prevEl: swiperContainer.querySelector(".swiper-button-prev"), 1173 }, 1174 on: { 1175 slideChange: function () { 1176 const targetIndex = this.activeIndex; 1177 const targetItemContent = swiperContainer.querySelectorAll('.inspiringSlide .slideContent .itemDesc'); 1178 const targetBgColor = swiperContainer.querySelectorAll('.slideItem .slideImg'); 1179 const targetSlide = swiperContainer.querySelectorAll('.swiper-slide')[targetIndex]; 1180 const videoElement = targetSlide.querySelector('video'); 1181 const allVideos = swiperContainer.querySelectorAll('video'); 1182 1183 allVideos.forEach(video => { 1184 video.pause(); 1185 video.currentTime = 0; 1186 }); 1187 1188 if (videoElement) { 1189 videoElement.currentTime = 0; 1190 videoElement.play(); 1191 } 1192 var innermainInspiringSec = swiperContainer.closest('.mainInspiringSec'); 1193 1194 targetItemContent.forEach(item => item.classList.remove('active')); 1195 targetBgColor.forEach(item => item.classList.remove('active')); 1196 1197 1198 if (targetItemContent.length > 0) { 1199 targetItemContent[targetIndex].classList.add('active'); 1200 targetBgColor[targetIndex].classList.add('active'); 1201 innermainInspiringSec.classList.remove('bgThemeWhite', 'bgThemeBlack', 'bgThemeGray', 'bgThemeGreen', 1202 'bgThemeNavy', 'bgThemeStone', 'bgThemeBlue', 'bgThemePine', 1203 'bgThemeRed', 'bgThemeMint', 'bgThemeOrange', 'bgThemePink', 1204 'bgThemeYellow', 'bgThemeLightRed', 'bgThemeDarkRed', 1205 'bgThemeDark', 'bgThemeSky', 'bgThemeIvory', 'bgThemeBeige', 'bgThemeCloud'); 1206 var backgroundColor = $(swiperContainer.querySelectorAll('.slideItem .active')[0]).data('backcolor'); 1207 innermainInspiringSec.classList.add(backgroundColor); 1208 } 1209 }, 1210 }, 1211 breakpoints: { 1212 768: { 1213 slidesPerView: 1, 1214 spaceBetween: 10, 1215 }, 1216 250: { 1217 slidesPerView: 1.1, 1218 spaceBetween: 10, 1219 centeredSlides: true, 1220 } 1221 } 1222 }); 1223 }); 1224$('.mainInspiringSec').each(function(index) {
1225 applyBackgroundColor(index); 1226}); 1227} 1228 1229function applyBackgroundColor(index) { 1230 var activeSlide = $('.mainInspiringSec').eq(index).find('.inspiringSwiper .swiper-wrapper .swiper-slide-active .slideItem .slideImg'); 1231 var backgroundColor = activeSlide.data('backcolor'); 1232 1233 if (backgroundColor) { 1234 $('.mainInspiringSec').eq(index).addClass(backgroundColor); 1235 } 1236} 1237$(document).ready(function () { 1238 var numberOfSlides = $('.amenitiesSwiper .swiper-slide').length; 1239 1240 if (numberOfSlides == 1) { 1241 $('.mainAmenitiesSec .headlineSec .titleText').addClass('w100'); 1242 $('.mainAmenitiesSec .amenitiesSwiper .swiper-number').addClass('d-none'); 1243 } else { 1244 $('.mainAmenitiesSec .headlineSec .titleText').addClass('w60'); 1245 } 1246 initializeAmenitiesSwiper(); 1247}); 1248 1249function initializeAmenitiesSwiper() { 1250 const swipers = document.querySelectorAll('.amenitiesSwiper'); 1251 swipers.forEach(swiper => { 1252 new Swiper(swiper, { 1253 slidesPerView: 3, 1254 spaceBetween: 20, 1255 slidesPerGroup: 3, 1256 resizeObserver:!($("body").data('custom-mode') == "edit"), 1257 speed: 500, 1258 pagination: { 1259 el: '.swiper-pagination', 1260 type: "fraction", 1261 }, 1262 navigation: { 1263 nextEl: ".swiper-button-next", 1264 prevEl: ".swiper-button-prev", 1265 }, 1266 breakpoints: { 1267 992: { 1268 slidesPerView: 3, 1269 spaceBetween: 20, 1270 slidesPerGroup: 3, 1271 }, 1272 768: { 1273 slidesPerView: 2, 1274 spaceBetween: 20, 1275 slidesPerGroup: 2, 1276 }, 1277 540: { 1278 slidesPerView: 2, 1279 spaceBetween: 15, 1280 slidesPerGroup: 2, 1281 }, 1282 250: { 1283 slidesPerView: 1, 1284 spaceBetween: 10, 1285 slidesPerGroup: 1, 1286 } 1287 } 1288 }); 1289 }); 1290} 1291$(document).ready(function () { 1292 FixButton(); 1293}); 1294 1295$(window).on("load resize", function () { 1296 FixButton(); 1297}); 1298var splashBanner = document.getElementsByClassName('splashBannerVideo'); 1299function FixButton() { 1300if(splashBanner && splashBanner.length > 0) { 1301 if (window.matchMedia("(min-device-width: 250px) and (max-device-width: 1000px) and (orientation: landscape)").matches) { 1302 $("body").addClass('backdrop'); 1303 $(".blockRotateScreen").addClass('show'); 1304 } else { 1305 $("body").removeClass('backdrop'); 1306 $(".blockRotateScreen").removeClass('show'); 1307 } 1308} 1309} 1310 1311if(splashBanner && splashBanner.length > 0) { 1312$(".blockRotateScreen").click(function(){ 1313 $(this).removeClass("show"); 1314 $("body").removeClass('backdrop'); 1315}); 1316} 1317 1318$(document).ready(function () { 1319 $('.mainSocialMedia').each(function () { 1320 const $thisSection = $(this); 1321 if ($(window).width() <= 5000 && $(window).width() >= 768) { 1322 HoverEvent($thisSection); 1323 } 1324 1325 var slideHeights = []; 1326 1327 function calculateSlideHeights() { 1328 slideHeights = []; 1329 $thisSection.find('.socialSwiper .swiper-slide').each(function () { 1330 slideHeights.push($(this).outerHeight()); 1331 }); 1332 } 1333 1334 calculateSlideHeights(); 1335 1336 function setWrapperHeight(index) { 1337 var newHeight = slideHeights[index]; 1338 $thisSection.find('.socialSwiper').height(newHeight + 40); 1339 } 1340 1341 var socialSwiper = new Swiper($thisSection.find(".socialSwiper")[0], { 1342 slidesPerView: 1, 1343 spaceBetween: 20, 1344 slidesPerGroup: 1, 1345 resizeObserver: !($("body").data('custom-mode') == "edit"), 1346 speed: 500, 1347 pagination: { 1348 el: $thisSection.find('.swiper-pagination')[0], 1349 clickable: true, 1350 }, 1351 breakpoints: { 1352 768: { 1353 slidesPerView: 1, 1354 spaceBetween: 20, 1355 slidesPerGroup: 1, 1356 } 1357 }, 1358 on: { 1359 init: function () { 1360 if ($(window).width() <= 767) { 1361 setWrapperHeight(this.activeIndex); 1362 } 1363 }, 1364 slideChange: function () { 1365 if ($(window).width() <= 767) { 1366 setWrapperHeight(this.activeIndex); 1367 } 1368 } 1369 } 1370 }); 1371 1372 $(window).resize(function () { 1373 if ($(window).width() < 768) { 1374 $thisSection.find('.socialSwiper').height('auto'); 1375 calculateSlideHeights(); 1376 setWrapperHeight(socialSwiper.activeIndex); 1377 } else { 1378 $thisSection.find('.socialSwiper').css('height', 'auto'); 1379 } 1380 }); 1381 1382 if ($(window).width() <= 767) { 1383 setWrapperHeight(socialSwiper.activeIndex); 1384 } 1385 }); 1386}); 1387 1388$(window).on("load resize", function () { 1389 if ($(window).width() <= 5000 && $(window).width() >= 768) { 1390 $('.mainSocialMedia').each(function () { 1391 HoverEvent($(this)); 1392 }); 1393 } 1394}); 1395 1396function HoverEvent(section) { 1397 section.find(".socialList .itemSocial").hover( 1398 function () { 1399 var heightItem = $(this).innerHeight(); 1400 $(this).find('.boxContent').css('min-height', heightItem); 1401 var itemSocialIndex = $(this).parent().index(); 1402 if (itemSocialIndex % 4 === 0) { 1403 $(this).find('.boxContent').addClass('bgThemeBlue'); 1404 } else if (itemSocialIndex % 4 === 1) { 1405 $(this).find('.boxContent').addClass('bgThemeMint'); 1406 } else if (itemSocialIndex % 4 === 2) { 1407 $(this).find('.boxContent').addClass('bgThemeOrange'); 1408 } else if (itemSocialIndex % 4 === 3) { 1409 $(this).find('.boxContent').addClass('bgThemeYellow'); 1410 } 1411 }, 1412 function () { 1413 $(this).find('.boxContent').removeClass("bgThemeBlue bgThemeMint bgThemeOrange bgThemeYellow").removeAttr('style'); 1414 } 1415 ); 1416} 1417 1418$(document).ready(function () { 1419 fixSpaceMainSmartManagement(); 1420 TabsManagement(); 1421 initializeSwiper(); 1422}); 1423 1424$(window).on("load resize", function () { 1425 fixSpaceMainSmartManagement(); 1426}); 1427 1428function fixSpaceMainSmartManagement() { 1429 setTimeout(() => { 1430 $(".mainSmartManagement .boxLeft").css("padding-left", $(".container.custom-container").offset().left + 15); 1431 $(".mainSmartManagement .boxTitleTabs").css("padding-left", $(".container.custom-container").offset().left + 15); 1432 $(".mainSmartManagement .boxTitleTabs").css("padding-right", $(".container.custom-container").offset().left + 15); 1433 $(".mainSmartManagement .headlineSec").css("padding-left", $(".container.custom-container").offset().left + 15); 1434 $(".mainSmartManagement .headlineSec").css("padding-right", $(".container.custom-container").offset().left + 15); 1435 }, 50); 1436} 1437 1438function TabsManagement() { 1439 var $sections = $(".mainSmartManagement"); 1440 1441 $sections.each(function () { 1442 var $section = $(this); 1443 1444 $section.find(".boxTitleTabs .smartTitleTapSwiper .swiper-slide .itemTab").click(function () { 1445 $section.find(".boxTitleTabs .smartTitleTapSwiper .swiper-slide .itemTab").removeClass("active"); 1446 $(this).addClass("active"); 1447 1448 var clickedTabIndex = $(this).parent().index(); 1449 1450 $section.find(".boxLeft .itemContent").removeClass("show"); 1451 $section.find(".boxLeft .itemContent").eq(clickedTabIndex).addClass("show"); 1452 1453 $section.find(".boxRight .itemVideo").removeClass("show"); 1454 $section.find(".boxRight .itemVideo").eq(clickedTabIndex).addClass("show"); 1455 $section.find(".boxRight .itemVideo video").get(clickedTabIndex).currentTime = 0; 1456 }); 1457 }); 1458} 1459 1460function initializeSwiper() { 1461 const swipers = document.querySelectorAll('.smartTitleTapSwiper');
1462 swipers.forEach(swiper => { 1463 new Swiper(swiper, { 1464 slidesPerView: "auto", 1465 scrollbar: { 1466 el: ".swiper-scrollbar", 1467 draggable: true, 1468 }, 1469 }); 1470 }); 1471} 1472 1473$(document).ready(function () { 1474 var sectionmainDiningSec = document.getElementsByClassName('mainDiningSec'); 1475 if (sectionmainDiningSec && sectionmainDiningSec.length > 0) { 1476 fixSpaceMainDiningSec(); 1477 initializeDiningSwipers(); 1478 } 1479}); 1480 1481$(window).on("load resize", function () { 1482 fixSpaceMainDiningSec(); 1483}); 1484 1485 1486 1487 /**Click event listener to open modal*/ 1488 $(".mainDiningSec .diningSwiper .itemMedia").click(function () { 1489 var url = $(this).data("path"); 1490 if(url){ 1491 $.get( url, function( data ) { 1492 var modalElem = $('.ui.modal.modalDiningDetail') 1493 modalElem.addClass('bgThemeWhite'); 1494 modalElem.html(data); 1495 setTimeout(function(){ 1496 modalElem.modal('show'); 1497 }, 500); 1498 }); 1499 }else{ 1500 $(this).attr('disabled', true); 1501 } 1502 }); 1503 1504 $(document).on("click",".btn-close-modal",function(){ 1505 var modalElem = $('.ui.modal.modalDiningDetail'); 1506 modalElem.modal('hide'); 1507 }); 1508 1509 1510function fixSpaceMainDiningSec() { 1511 var offsetContainer = $(".container.custom-container").offset().left; 1512 1513 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 1514 var arrowPo1 = 75; 1515 var arrowPo2 = 10; 1516 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 1517 var arrowPo1 = 65; 1518 var arrowPo2 = 5; 1519 } 1520 1521 if (offsetContainer < 85) { 1522 $(".mainDiningSec .diningSlide .swiperDiningPrev").css("margin-left", $(".container.custom-container").offset().left - arrowPo2); 1523 $(".mainDiningSec .diningSlide .swiperDiningNext").css("margin-right", $(".container.custom-container").offset().left - arrowPo2); 1524 } else { 1525 $(".mainDiningSec .diningSlide .swiperDiningPrev").css("margin-left", $(".container.custom-container").offset().left - arrowPo1); 1526 $(".mainDiningSec .diningSlide .swiperDiningNext").css("margin-right", $(".container.custom-container").offset().left - arrowPo1); 1527 } 1528 1529} 1530 1531function initializeDiningSwipers() { 1532 const swipers = document.querySelectorAll('.mainDiningSec .diningSwiper'); 1533 1534 swipers.forEach(swiper => { 1535 const section = swiper.closest('.mainDiningSec'); 1536 new Swiper(swiper, { 1537 slidesPerView: 3, 1538 spaceBetween: 20, 1539 slidesPerGroup: 3, 1540 resizeObserver:!($("body").data('custom-mode') == "edit"), 1541 speed: 500, 1542 pagination: { 1543 el: swiper.querySelector('.swiper-pagination'), 1544 clickable: true, 1545 }, 1546 navigation: { 1547 nextEl: section.querySelector(".swiperDiningNext"), 1548 prevEl: section.querySelector(".swiperDiningPrev"), 1549 }, 1550 breakpoints: { 1551 992: { 1552 slidesPerView: 3, 1553 spaceBetween: 20, 1554 slidesPerGroup: 3, 1555 }, 1556 768: { 1557 slidesPerView: 2, 1558 spaceBetween: 20, 1559 slidesPerGroup: 2, 1560 }, 1561 540: { 1562 slidesPerView: 2, 1563 spaceBetween: 15, 1564 slidesPerGroup: 2, 1565 }, 1566 250: { 1567 slidesPerView: 1, 1568 spaceBetween: 20, 1569 slidesPerGroup: 1, 1570 } 1571 } 1572 }); 1573 }); 1574} 1575/**! 1576 1577 @license 1578 handlebars v4.7.8 1579 1580Copyright (C) 2011-2019 by Yehuda Katz 1581 1582Permission is hereby granted, free of charge, to any person obtaining a copy 1583of this software and associated documentation files (the "Software"), to deal 1584in the Software without restriction, including without limitation the rights 1585to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1586copies of the Software, and to permit persons to whom the Software is 1587furnished to do so, subject to the following conditions: 1588 1589The above copyright notice and this permission notice shall be included in 1590all copies or substantial portions of the Software. 1591 1592THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1593IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1594FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1595AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1596LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1597OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1598THE SOFTWARE. 1599 1600*/ 1601(function webpackUniversalModuleDefinition(root, factory) { 1602 if(typeof exports === 'object' && typeof module === 'object') 1603 module.exports = factory(); 1604 else if(typeof define === 'function' && define.amd) 1605 define([], factory); 1606 else if(typeof exports === 'object') 1607 exports["Handlebars"] = factory(); 1608 else 1609 root["Handlebars"] = factory(); 1610})(this, function() { 1611return /******/ (function(modules) { // webpackBootstrap 1612/******/ // The module cache 1613/******/ var installedModules = {}; 1614 1615/******/ // The require function 1616/******/ function __webpack_require__(moduleId) { 1617 1618/******/ // Check if module is in cache 1619/******/ if(installedModules[moduleId]) 1620/******/ return installedModules[moduleId].exports; 1621 1622/******/ // Create a new module (and put it into the cache) 1623/******/ var module = installedModules[moduleId] = { 1624/******/ exports: {}, 1625/******/ id: moduleId, 1626/******/ loaded: false 1627/******/ }; 1628 1629/******/ // Execute the module function 1630/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 1631 1632/******/ // Flag the module as loaded
vendor: 15,937 bytes, lines 1633-2232
1633/******/ module.loaded = true; 1634 1635/******/ // Return the exports of the module 1636/******/ return module.exports; 1637/******/ } 1638 1639 1640/******/ // expose the modules object (__webpack_modules__) 1641/******/ __webpack_require__.m = modules; 1642 1643/******/ // expose the module cache 1644/******/ __webpack_require__.c = installedModules; 1645 1646/******/ // __webpack_public_path__ 1647/******/ __webpack_require__.p = ""; 1648 1649/******/ // Load entry module and return exports 1650/******/ return __webpack_require__(0); 1651/******/ }) 1652/************************************************************************/ 1653/******/ ([ 1654/* 0 */ 1655/***/ (function(module, exports, __webpack_require__) { 1656 1657 'use strict'; 1658 1659 var _interopRequireDefault = __webpack_require__(1)['default']; 1660 1661 exports.__esModule = true; 1662 1663 var _handlebarsRuntime = __webpack_require__(2); 1664 1665 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 1666 1667 // Compiler imports 1668 1669 var _handlebarsCompilerAst = __webpack_require__(84); 1670 1671 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 1672 1673 var _handlebarsCompilerBase = __webpack_require__(85); 1674 1675 var _handlebarsCompilerCompiler = __webpack_require__(90); 1676 1677 var _handlebarsCompilerJavascriptCompiler = __webpack_require__(91); 1678 1679 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 1680 1681 var _handlebarsCompilerVisitor = __webpack_require__(88); 1682 1683 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 1684 1685 var _handlebarsNoConflict = __webpack_require__(83); 1686 1687 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 1688 1689 var _create = _handlebarsRuntime2['default'].create; 1690 function create() { 1691 var hb = _create(); 1692 1693 hb.compile = function (input, options) { 1694 return _handlebarsCompilerCompiler.compile(input, options, hb); 1695 }; 1696 hb.precompile = function (input, options) { 1697 return _handlebarsCompilerCompiler.precompile(input, options, hb); 1698 }; 1699 1700 hb.AST = _handlebarsCompilerAst2['default']; 1701 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 1702 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 1703 hb.Parser = _handlebarsCompilerBase.parser; 1704 hb.parse = _handlebarsCompilerBase.parse; 1705 hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; 1706 1707 return hb; 1708 } 1709 1710 var inst = create(); 1711 inst.create = create; 1712 1713 _handlebarsNoConflict2['default'](inst); 1714 1715 inst.Visitor = _handlebarsCompilerVisitor2['default']; 1716 1717 inst['default'] = inst; 1718 1719 exports['default'] = inst; 1720 module.exports = exports['default']; 1721 1722/***/ }), 1723/* 1 */ 1724/***/ (function(module, exports) { 1725 1726 "use strict"; 1727 1728 exports["default"] = function (obj) { 1729 return obj && obj.__esModule ? obj : { 1730 "default": obj 1731 }; 1732 }; 1733 1734 exports.__esModule = true; 1735 1736/***/ }), 1737/* 2 */ 1738/***/ (function(module, exports, __webpack_require__) { 1739 1740 'use strict'; 1741 1742 var _interopRequireWildcard = __webpack_require__(3)['default']; 1743 1744 var _interopRequireDefault = __webpack_require__(1)['default']; 1745 1746 exports.__esModule = true; 1747 1748 var _handlebarsBase = __webpack_require__(4); 1749 1750 var base = _interopRequireWildcard(_handlebarsBase); 1751 1752 // Each of these augment the Handlebars object. No need to setup here. 1753 // (This is done to easily share code between commonjs and browse envs) 1754 1755 var _handlebarsSafeString = __webpack_require__(77); 1756 1757 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 1758 1759 var _handlebarsException = __webpack_require__(6); 1760 1761 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 1762 1763 var _handlebarsUtils = __webpack_require__(5); 1764 1765 var Utils = _interopRequireWildcard(_handlebarsUtils); 1766 1767 var _handlebarsRuntime = __webpack_require__(78); 1768 1769 var runtime = _interopRequireWildcard(_handlebarsRuntime); 1770 1771 var _handlebarsNoConflict = __webpack_require__(83); 1772 1773 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 1774 1775 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 1776 function create() { 1777 var hb = new base.HandlebarsEnvironment(); 1778 1779 Utils.extend(hb, base); 1780 hb.SafeString = _handlebarsSafeString2['default']; 1781 hb.Exception = _handlebarsException2['default']; 1782 hb.Utils = Utils; 1783 hb.escapeExpression = Utils.escapeExpression; 1784 1785 hb.VM = runtime; 1786 hb.template = function (spec) { 1787 return runtime.template(spec, hb); 1788 }; 1789 1790 return hb; 1791 } 1792 1793 var inst = create(); 1794 inst.create = create; 1795 1796 _handlebarsNoConflict2['default'](inst); 1797 1798 inst['default'] = inst; 1799 1800 exports['default'] = inst; 1801 module.exports = exports['default']; 1802 1803/***/ }), 1804/* 3 */ 1805/***/ (function(module, exports) { 1806 1807 "use strict"; 1808 1809 exports["default"] = function (obj) { 1810 if (obj && obj.__esModule) { 1811 return obj; 1812 } else { 1813 var newObj = {}; 1814 1815 if (obj != null) { 1816 for (var key in obj) { 1817 if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; 1818 } 1819 } 1820 1821 newObj["default"] = obj; 1822 return newObj; 1823 } 1824 }; 1825 1826 exports.__esModule = true; 1827 1828/***/ }), 1829/* 4 */ 1830/***/ (function(module, exports, __webpack_require__) { 1831 1832 'use strict'; 1833 1834 var _interopRequireDefault = __webpack_require__(1)['default']; 1835 1836 exports.__esModule = true; 1837 exports.HandlebarsEnvironment = HandlebarsEnvironment; 1838 1839 var _utils = __webpack_require__(5); 1840 1841 var _exception = __webpack_require__(6); 1842 1843 var _exception2 = _interopRequireDefault(_exception); 1844 1845 var _helpers = __webpack_require__(10); 1846 1847 var _decorators = __webpack_require__(70); 1848 1849 var _logger = __webpack_require__(72); 1850 1851 var _logger2 = _interopRequireDefault(_logger); 1852 1853 var _internalProtoAccess = __webpack_require__(73); 1854 1855 var VERSION = '4.7.8'; 1856 exports.VERSION = VERSION; 1857 var COMPILER_REVISION = 8; 1858 exports.COMPILER_REVISION = COMPILER_REVISION; 1859 var LAST_COMPATIBLE_COMPILER_REVISION = 7; 1860 1861 exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; 1862 var REVISION_CHANGES = { 1863 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 1864 2: '== 1.0.0-rc.3', 1865 3: '== 1.0.0-rc.4', 1866 4: '== 1.x.x', 1867 5: '== 2.0.0-alpha.x', 1868 6: '>= 2.0.0-beta.1', 1869 7: '>= 4.0.0 <4.3.0', 1870 8: '>= 4.3.0' 1871 }; 1872 1873 exports.REVISION_CHANGES = REVISION_CHANGES; 1874 var objectType = '[object Object]'; 1875 1876 function HandlebarsEnvironment(helpers, partials, decorators) { 1877 this.helpers = helpers || {}; 1878 this.partials = partials || {}; 1879 this.decorators = decorators || {}; 1880 1881 _helpers.registerDefaultHelpers(this); 1882 _decorators.registerDefaultDecorators(this); 1883 } 1884 1885 HandlebarsEnvironment.prototype = { 1886 constructor: HandlebarsEnvironment, 1887 1888 logger: _logger2['default'], 1889 log: _logger2['default'].log, 1890 1891 registerHelper: function registerHelper(name, fn) { 1892 if (_utils.toString.call(name) === objectType) { 1893 if (fn) { 1894 throw new _exception2['default']('Arg not supported with multiple helpers'); 1895 } 1896 _utils.extend(this.helpers, name); 1897 } else { 1898 this.helpers[name] = fn; 1899 } 1900 }, 1901 unregisterHelper: function unregisterHelper(name) { 1902 delete this.helpers[name]; 1903 }, 1904 1905 registerPartial: function registerPartial(name, partial) { 1906 if (_utils.toString.call(name) === objectType) { 1907 _utils.extend(this.partials, name); 1908 } else { 1909 if (typeof partial === 'undefined') { 1910 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 1911 } 1912 this.partials[name] = partial; 1913 } 1914 }, 1915 unregisterPartial: function unregisterPartial(name) { 1916 delete this.partials[name]; 1917 }, 1918 1919 registerDecorator: function registerDecorator(name, fn) { 1920 if (_utils.toString.call(name) === objectType) { 1921 if (fn) { 1922 throw new _exception2['default']('Arg not supported with multiple decorators'); 1923 } 1924 _utils.extend(this.decorators, name); 1925 } else { 1926 this.decorators[name] = fn; 1927 } 1928 }, 1929 unregisterDecorator: function unregisterDecorator(name) { 1930 delete this.decorators[name]; 1931 }, 1932 /** 1933 * Reset the memory of illegal property accesses that have already been logged. 1934 * @deprecated should only be used in handlebars test-cases 1935 */ 1936 resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { 1937 _internalProtoAccess.resetLoggedProperties(); 1938 } 1939 }; 1940 1941 var log = _logger2['default'].log; 1942 1943 exports.log = log; 1944 exports.createFrame = _utils.createFrame; 1945 exports.logger = _logger2['default']; 1946 1947/***/ }), 1948/* 5 */ 1949/***/ (function(module, exports) { 1950 1951 'use strict'; 1952 1953 exports.__esModule = true; 1954 exports.extend = extend; 1955 exports.indexOf = indexOf; 1956 exports.escapeExpression = escapeExpression; 1957 exports.isEmpty = isEmpty; 1958 exports.createFrame = createFrame; 1959 exports.blockParams = blockParams; 1960 exports.appendContextPath = appendContextPath; 1961 var escape = { 1962 '&': '&', 1963 '<': '<', 1964 '>': '>', 1965 '"': '"', 1966 "'": ''', 1967 '`': '`', 1968 '=': '=' 1969 }; 1970 1971 var badChars = /[&<>"'`=]/g, 1972 possible = /[&<>"'`=]/; 1973 1974 function escapeChar(chr) { 1975 return escape[chr]; 1976 } 1977 1978 function extend(obj /* , ...source */) { 1979 for (var i = 1; i < arguments.length; i++) { 1980 for (var key in arguments[i]) { 1981 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 1982 obj[key] = arguments[i][key]; 1983 } 1984 } 1985 } 1986 1987 return obj; 1988 } 1989 1990 var toString = Object.prototype.toString; 1991 1992 exports.toString = toString; 1993 // Sourced from lodash 1994 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 1995 /* eslint-disable func-style */ 1996 var isFunction = function isFunction(value) { 1997 return typeof value === 'function'; 1998 }; 1999 // fallback for older versions of Chrome and Safari 2000 /* istanbul ignore next */ 2001 if (isFunction(/x/)) { 2002 exports.isFunction = isFunction = function (value) { 2003 return typeof value === 'function' && toString.call(value) === '[object Function]'; 2004 }; 2005 } 2006 exports.isFunction = isFunction; 2007 2008 /* eslint-enable func-style */ 2009 2010 /* istanbul ignore next */ 2011 var isArray = Array.isArray || function (value) { 2012 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 2013 }; 2014 2015 exports.isArray = isArray; 2016 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 2017 2018 function indexOf(array, value) { 2019 for (var i = 0, len = array.length; i < len; i++) { 2020 if (array[i] === value) { 2021 return i; 2022 } 2023 } 2024 return -1; 2025 } 2026 2027 function escapeExpression(string) { 2028 if (typeof string !== 'string') { 2029 // don't escape SafeStrings, since they're already safe 2030 if (string && string.toHTML) { 2031 return string.toHTML(); 2032 } else if (string == null) { 2033 return ''; 2034 } else if (!string) { 2035 return string + ''; 2036 } 2037 2038 // Force a string conversion as this will be done by the append regardless and 2039 // the regex test will do this transparently behind the scenes, causing issues if 2040 // an object's to string has escaped characters in it. 2041 string = '' + string; 2042 } 2043 2044 if (!possible.test(string)) { 2045 return string; 2046 } 2047 return string.replace(badChars, escapeChar); 2048 } 2049 2050 function isEmpty(value) { 2051 if (!value && value !== 0) { 2052 return true; 2053 } else if (isArray(value) && value.length === 0) { 2054 return true; 2055 } else { 2056 return false; 2057 } 2058 } 2059 2060 function createFrame(object) { 2061 var frame = extend({}, object); 2062 frame._parent = object; 2063 return frame; 2064 } 2065 2066 function blockParams(params, ids) { 2067 params.path = ids; 2068 return params; 2069 } 2070 2071 function appendContextPath(contextPath, id) { 2072 return (contextPath ? contextPath + '.' : '') + id; 2073 } 2074 2075/***/ }), 2076/* 6 */ 2077/***/ (function(module, exports, __webpack_require__) { 2078 2079 'use strict'; 2080 2081 var _Object$defineProperty = __webpack_require__(7)['default']; 2082 2083 exports.__esModule = true; 2084 var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; 2085 2086 function Exception(message, node) { 2087 var loc = node && node.loc, 2088 line = undefined, 2089 endLineNumber = undefined, 2090 column = undefined, 2091 endColumn = undefined; 2092 2093 if (loc) { 2094 line = loc.start.line; 2095 endLineNumber = loc.end.line; 2096 column = loc.start.column; 2097 endColumn = loc.end.column; 2098 2099 message += ' - ' + line + ':' + column; 2100 } 2101 2102 var tmp = Error.prototype.constructor.call(this, message); 2103 2104 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 2105 for (var idx = 0; idx < errorProps.length; idx++) { 2106 this[errorProps[idx]] = tmp[errorProps[idx]]; 2107 } 2108 2109 /* istanbul ignore else */ 2110 if (Error.captureStackTrace) { 2111 Error.captureStackTrace(this, Exception); 2112 } 2113 2114 try { 2115 if (loc) { 2116 this.lineNumber = line; 2117 this.endLineNumber = endLineNumber; 2118 2119 // Work around issue under safari where we can't directly set the column value 2120 /* istanbul ignore next */ 2121 if (_Object$defineProperty) { 2122 Object.defineProperty(this, 'column', { 2123 value: column, 2124 enumerable: true 2125 }); 2126 Object.defineProperty(this, 'endColumn', { 2127 value: endColumn, 2128 enumerable: true 2129 }); 2130 } else { 2131 this.column = column; 2132 this.endColumn = endColumn; 2133 } 2134 } 2135 } catch (nop) { 2136 /* Ignore if the browser is very particular */ 2137 } 2138 } 2139 2140 Exception.prototype = new Error(); 2141 2142 exports['default'] = Exception; 2143 module.exports = exports['default']; 2144 2145/***/ }), 2146/* 7 */ 2147/***/ (function(module, exports, __webpack_require__) { 2148 2149 module.exports = { "default": __webpack_require__(8), __esModule: true }; 2150 2151/***/ }), 2152/* 8 */ 2153/***/ (function(module, exports, __webpack_require__) { 2154 2155 var $ = __webpack_require__(9); 2156 module.exports = function defineProperty(it, key, desc){ 2157 return $.setDesc(it, key, desc); 2158 }; 2159 2160/***/ }), 2161/* 9 */ 2162/***/ (function(module, exports) { 2163 2164 var $Object = Object; 2165 module.exports = { 2166 create: $Object.create, 2167 getProto: $Object.getPrototypeOf, 2168 isEnum: {}.propertyIsEnumerable, 2169 getDesc: $Object.getOwnPropertyDescriptor, 2170 setDesc: $Object.defineProperty, 2171 setDescs: $Object.defineProperties, 2172 getKeys: $Object.keys, 2173 getNames: $Object.getOwnPropertyNames, 2174 getSymbols: $Object.getOwnPropertySymbols, 2175 each: [].forEach 2176 }; 2177 2178/***/ }), 2179/* 10 */ 2180/***/ (function(module, exports, __webpack_require__) { 2181 2182 'use strict'; 2183 2184 var _interopRequireDefault = __webpack_require__(1)['default']; 2185 2186 exports.__esModule = true; 2187 exports.registerDefaultHelpers = registerDefaultHelpers; 2188 exports.moveHelperToHooks = moveHelperToHooks; 2189 2190 var _helpersBlockHelperMissing = __webpack_require__(11); 2191 2192 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 2193 2194 var _helpersEach = __webpack_require__(12); 2195 2196 var _helpersEach2 = _interopRequireDefault(_helpersEach); 2197 2198 var _helpersHelperMissing = __webpack_require__(65); 2199 2200 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 2201 2202 var _helpersIf = __webpack_require__(66); 2203 2204 var _helpersIf2 = _interopRequireDefault(_helpersIf); 2205 2206 var _helpersLog = __webpack_require__(67); 2207 2208 var _helpersLog2 = _interopRequireDefault(_helpersLog); 2209 2210 var _helpersLookup = __webpack_require__(68); 2211 2212 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 2213 2214 var _helpersWith = __webpack_require__(69); 2215 2216 var _helpersWith2 = _interopRequireDefault(_helpersWith); 2217 2218 function registerDefaultHelpers(instance) { 2219 _helpersBlockHelperMissing2['default'](instance); 2220 _helpersEach2['default'](instance); 2221 _helpersHelperMissing2['default'](instance); 2222 _helpersIf2['default'](instance); 2223 _helpersLog2['default'](instance); 2224 _helpersLookup2['default'](instance); 2225 _helpersWith2['default'](instance); 2226 } 2227 2228 function moveHelperToHooks(instance, helperName, keepHelper) { 2229 if (instance.helpers[helperName]) { 2230 instance.hooks[helperName] = instance.helpers[helperName]; 2231 if (!keepHelper) { 2232 delete instance.helpers[helperName]
vendor: 39,428 bytes, lines 2232-3618
2232; 2233 } 2234 } 2235 } 2236 2237/***/ }), 2238/* 11 */ 2239/***/ (function(module, exports, __webpack_require__) { 2240 2241 'use strict'; 2242 2243 exports.__esModule = true; 2244 2245 var _utils = __webpack_require__(5); 2246 2247 exports['default'] = function (instance) { 2248 instance.registerHelper('blockHelperMissing', function (context, options) { 2249 var inverse = options.inverse, 2250 fn = options.fn; 2251 2252 if (context === true) { 2253 return fn(this); 2254 } else if (context === false || context == null) { 2255 return inverse(this); 2256 } else if (_utils.isArray(context)) { 2257 if (context.length > 0) { 2258 if (options.ids) { 2259 options.ids = [options.name]; 2260 } 2261 2262 return instance.helpers.each(context, options); 2263 } else { 2264 return inverse(this); 2265 } 2266 } else { 2267 if (options.data && options.ids) { 2268 var data = _utils.createFrame(options.data); 2269 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 2270 options = { data: data }; 2271 } 2272 2273 return fn(context, options); 2274 } 2275 }); 2276 }; 2277 2278 module.exports = exports['default']; 2279 2280/***/ }), 2281/* 12 */ 2282/***/ (function(module, exports, __webpack_require__) { 2283 2284 'use strict'; 2285 2286 var _Symbol = __webpack_require__(13)['default']; 2287 2288 var _Symbol$iterator = __webpack_require__(43)['default']; 2289 2290 var _getIterator = __webpack_require__(55)['default']; 2291 2292 var _Object$keys = __webpack_require__(60)['default']; 2293 2294 var _interopRequireDefault = __webpack_require__(1)['default']; 2295 2296 exports.__esModule = true; 2297 2298 var _utils = __webpack_require__(5); 2299 2300 var _exception = __webpack_require__(6); 2301 2302 var _exception2 = _interopRequireDefault(_exception); 2303 2304 exports['default'] = function (instance) { 2305 instance.registerHelper('each', function (context, options) { 2306 if (!options) { 2307 throw new _exception2['default']('Must pass iterator to #each'); 2308 } 2309 2310 var fn = options.fn, 2311 inverse = options.inverse, 2312 i = 0, 2313 ret = '', 2314 data = undefined, 2315 contextPath = undefined; 2316 2317 if (options.data && options.ids) { 2318 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 2319 } 2320 2321 if (_utils.isFunction(context)) { 2322 context = context.call(this); 2323 } 2324 2325 if (options.data) { 2326 data = _utils.createFrame(options.data); 2327 } 2328 2329 function execIteration(field, index, last) { 2330 if (data) { 2331 data.key = field; 2332 data.index = index; 2333 data.first = index === 0; 2334 data.last = !!last; 2335 2336 if (contextPath) { 2337 data.contextPath = contextPath + field; 2338 } 2339 } 2340 2341 ret = ret + fn(context[field], { 2342 data: data, 2343 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 2344 }); 2345 } 2346 2347 if (context && typeof context === 'object') { 2348 if (_utils.isArray(context)) { 2349 for (var j = context.length; i < j; i++) { 2350 if (i in context) { 2351 execIteration(i, i, i === context.length - 1); 2352 } 2353 } 2354 } else if (typeof _Symbol === 'function' && context[_Symbol$iterator]) { 2355 var newContext = []; 2356 var iterator = _getIterator(context); 2357 for (var it = iterator.next(); !it.done; it = iterator.next()) { 2358 newContext.push(it.value); 2359 } 2360 context = newContext; 2361 for (var j = context.length; i < j; i++) { 2362 execIteration(i, i, i === context.length - 1); 2363 } 2364 } else { 2365 (function () { 2366 var priorKey = undefined; 2367 2368 _Object$keys(context).forEach(function (key) { 2369 // We're running the iterations one step out of sync so we can detect 2370 // the last iteration without have to scan the object twice and create 2371 // an itermediate keys array. 2372 if (priorKey !== undefined) { 2373 execIteration(priorKey, i - 1); 2374 } 2375 priorKey = key; 2376 i++; 2377 }); 2378 if (priorKey !== undefined) { 2379 execIteration(priorKey, i - 1, true); 2380 } 2381 })(); 2382 } 2383 } 2384 2385 if (i === 0) { 2386 ret = inverse(this); 2387 } 2388 2389 return ret; 2390 }); 2391 }; 2392 2393 module.exports = exports['default']; 2394 2395/***/ }), 2396/* 13 */ 2397/***/ (function(module, exports, __webpack_require__) { 2398 2399 module.exports = { "default": __webpack_require__(14), __esModule: true }; 2400 2401/***/ }), 2402/* 14 */ 2403/***/ (function(module, exports, __webpack_require__) { 2404 2405 __webpack_require__(15); 2406 __webpack_require__(42); 2407 module.exports = __webpack_require__(21).Symbol; 2408 2409/***/ }), 2410/* 15 */ 2411/***/ (function(module, exports, __webpack_require__) { 2412 2413 'use strict'; 2414 // ECMAScript 6 symbols shim 2415 var $ = __webpack_require__(9) 2416 , global = __webpack_require__(16) 2417 , has = __webpack_require__(17) 2418 , DESCRIPTORS = __webpack_require__(18) 2419 , $export = __webpack_require__(20) 2420 , redefine = __webpack_require__(24) 2421 , $fails = __webpack_require__(19) 2422 , shared = __webpack_require__(27) 2423 , setToStringTag = __webpack_require__(28) 2424 , uid = __webpack_require__(30) 2425 , wks = __webpack_require__(29) 2426 , keyOf = __webpack_require__(31) 2427 , $names = __webpack_require__(36) 2428 , enumKeys = __webpack_require__(37) 2429 , isArray = __webpack_require__(38) 2430 , anObject = __webpack_require__(39) 2431 , toIObject = __webpack_require__(32) 2432 , createDesc = __webpack_require__(26) 2433 , getDesc = $.getDesc 2434 , setDesc = $.setDesc 2435 , _create = $.create 2436 , getNames = $names.get 2437 , $Symbol = global.Symbol 2438 , $JSON = global.JSON 2439 , _stringify = $JSON && $JSON.stringify 2440 , setter = false 2441 , HIDDEN = wks('_hidden') 2442 , isEnum = $.isEnum 2443 , SymbolRegistry = shared('symbol-registry') 2444 , AllSymbols = shared('symbols') 2445 , useNative = typeof $Symbol == 'function' 2446 , ObjectProto = Object.prototype; 2447 2448 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 2449 var setSymbolDesc = DESCRIPTORS && $fails(function(){ 2450 return _create(setDesc({}, 'a', { 2451 get: function(){ return setDesc(this, 'a', {value: 7}).a; } 2452 })).a != 7; 2453 }) ? function(it, key, D){ 2454 var protoDesc = getDesc(ObjectProto, key); 2455 if(protoDesc)delete ObjectProto[key]; 2456 setDesc(it, key, D); 2457 if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc); 2458 } : setDesc; 2459 2460 var wrap = function(tag){ 2461 var sym = AllSymbols[tag] = _create($Symbol.prototype); 2462 sym._k = tag; 2463 DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, { 2464 configurable: true, 2465 set: function(value){ 2466 if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; 2467 setSymbolDesc(this, tag, createDesc(1, value)); 2468 } 2469 }); 2470 return sym; 2471 }; 2472 2473 var isSymbol = function(it){ 2474 return typeof it == 'symbol'; 2475 }; 2476 2477 var $defineProperty = function defineProperty(it, key, D){ 2478 if(D && has(AllSymbols, key)){ 2479 if(!D.enumerable){ 2480 if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {})); 2481 it[HIDDEN][key] = true; 2482 } else { 2483 if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; 2484 D = _create(D, {enumerable: createDesc(0, false)}); 2485 } return setSymbolDesc(it, key, D); 2486 } return setDesc(it, key, D); 2487 }; 2488 var $defineProperties = function defineProperties(it, P){ 2489 anObject(it); 2490 var keys = enumKeys(P = toIObject(P)) 2491 , i = 0 2492 , l = keys.length 2493 , key; 2494 while(l > i)$defineProperty(it, key = keys[i++], P[key]); 2495 return it; 2496 }; 2497 var $create = function create(it, P){ 2498 return P === undefined ? _create(it) : $defineProperties(_create(it), P); 2499 }; 2500 var $propertyIsEnumerable = function propertyIsEnumerable(key){ 2501 var E = isEnum.call(this, key); 2502 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] 2503 ? E : true; 2504 }; 2505 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ 2506 var D = getDesc(it = toIObject(it), key); 2507 if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; 2508 return D; 2509 }; 2510 var $getOwnPropertyNames = function getOwnPropertyNames(it){ 2511 var names = getNames(toIObject(it)) 2512 , result = [] 2513 , i = 0 2514 , key; 2515 while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key); 2516 return result; 2517 }; 2518 var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ 2519 var names = getNames(toIObject(it)) 2520 , result = [] 2521 , i = 0 2522 , key; 2523 while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]); 2524 return result; 2525 }; 2526 var $stringify = function stringify(it){ 2527 if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined 2528 var args = [it] 2529 , i = 1 2530 , $$ = arguments 2531 , replacer, $replacer; 2532 while($$.length > i)args.push($$[i++]); 2533 replacer = args[1]; 2534 if(typeof replacer == 'function')$replacer = replacer; 2535 if($replacer || !isArray(replacer))replacer = function(key, value){ 2536 if($replacer)value = $replacer.call(this, key, value); 2537 if(!isSymbol(value))return value; 2538 }; 2539 args[1] = replacer; 2540 return _stringify.apply($JSON, args); 2541 }; 2542 var buggyJSON = $fails(function(){ 2543 var S = $Symbol(); 2544 // MS Edge converts symbol values to JSON as {} 2545 // WebKit converts symbol values to JSON as null 2546 // V8 throws on boxed symbols 2547 return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; 2548 }); 2549 2550 // 19.4.1.1 Symbol([description]) 2551 if(!useNative){ 2552 $Symbol = function Symbol(){ 2553 if(isSymbol(this))throw TypeError('Symbol is not a constructor'); 2554 return wrap(uid(arguments.length > 0 ? arguments[0] : undefined)); 2555 }; 2556 redefine($Symbol.prototype, 'toString', function toString(){ 2557 return this._k; 2558 }); 2559 2560 isSymbol = function(it){ 2561 return it instanceof $Symbol; 2562 }; 2563 2564 $.create = $create; 2565 $.isEnum = $propertyIsEnumerable; 2566 $.getDesc = $getOwnPropertyDescriptor; 2567 $.setDesc = $defineProperty; 2568 $.setDescs = $defineProperties; 2569 $.getNames = $names.get = $getOwnPropertyNames; 2570 $.getSymbols = $getOwnPropertySymbols; 2571 2572 if(DESCRIPTORS && !__webpack_require__(41)){ 2573 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); 2574 } 2575 } 2576 2577 var symbolStatics = { 2578 // 19.4.2.1 Symbol.for(key) 2579 'for': function(key){ 2580 return has(SymbolRegistry, key += '') 2581 ? SymbolRegistry[key] 2582 : SymbolRegistry[key] = $Symbol(key); 2583 }, 2584 // 19.4.2.5 Symbol.keyFor(sym) 2585 keyFor: function keyFor(key){ 2586 return keyOf(SymbolRegistry, key); 2587 }, 2588 useSetter: function(){ setter = true; }, 2589 useSimple: function(){ setter = false; } 2590 }; 2591 // 19.4.2.2 Symbol.hasInstance 2592 // 19.4.2.3 Symbol.isConcatSpreadable 2593 // 19.4.2.4 Symbol.iterator 2594 // 19.4.2.6 Symbol.match 2595 // 19.4.2.8 Symbol.replace 2596 // 19.4.2.9 Symbol.search 2597 // 19.4.2.10 Symbol.species 2598 // 19.4.2.11 Symbol.split 2599 // 19.4.2.12 Symbol.toPrimitive 2600 // 19.4.2.13 Symbol.toStringTag 2601 // 19.4.2.14 Symbol.unscopables 2602 $.each.call(( 2603 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' + 2604 'species,split,toPrimitive,toStringTag,unscopables' 2605 ).split(','), function(it){ 2606 var sym = wks(it); 2607 symbolStatics[it] = useNative ? sym : wrap(sym); 2608 }); 2609 2610 setter = true; 2611 2612 $export($export.G + $export.W, {Symbol: $Symbol}); 2613 2614 $export($export.S, 'Symbol', symbolStatics); 2615 2616 $export($export.S + $export.F * !useNative, 'Object', { 2617 // 19.1.2.2 Object.create(O [, Properties]) 2618 create: $create, 2619 // 19.1.2.4 Object.defineProperty(O, P, Attributes) 2620 defineProperty: $defineProperty, 2621 // 19.1.2.3 Object.defineProperties(O, Properties) 2622 defineProperties: $defineProperties, 2623 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) 2624 getOwnPropertyDescriptor: $getOwnPropertyDescriptor, 2625 // 19.1.2.7 Object.getOwnPropertyNames(O) 2626 getOwnPropertyNames: $getOwnPropertyNames, 2627 // 19.1.2.8 Object.getOwnPropertySymbols(O) 2628 getOwnPropertySymbols: $getOwnPropertySymbols 2629 }); 2630 2631 // 24.3.2 JSON.stringify(value [, replacer [, space]]) 2632 $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify}); 2633 2634 // 19.4.3.5 Symbol.prototype[@@toStringTag] 2635 setToStringTag($Symbol, 'Symbol'); 2636 // 20.2.1.9 Math[@@toStringTag] 2637 setToStringTag(Math, 'Math', true); 2638 // 24.3.3 JSON[@@toStringTag] 2639 setToStringTag(global.JSON, 'JSON', true); 2640 2641/***/ }), 2642/* 16 */ 2643/***/ (function(module, exports) { 2644 2645 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 2646 var global = module.exports = typeof window != 'undefined' && window.Math == Math 2647 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); 2648 if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef 2649 2650/***/ }), 2651/* 17 */ 2652/***/ (function(module, exports) { 2653 2654 var hasOwnProperty = {}.hasOwnProperty; 2655 module.exports = function(it, key){ 2656 return hasOwnProperty.call(it, key); 2657 }; 2658 2659/***/ }), 2660/* 18 */ 2661/***/ (function(module, exports, __webpack_require__) { 2662 2663 // Thank's IE8 for his funny defineProperty 2664 module.exports = !__webpack_require__(19)(function(){ 2665 return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; 2666 }); 2667 2668/***/ }), 2669/* 19 */ 2670/***/ (function(module, exports) { 2671 2672 module.exports = function(exec){ 2673 try { 2674 return !!exec(); 2675 } catch(e){ 2676 return true; 2677 } 2678 }; 2679 2680/***/ }), 2681/* 20 */ 2682/***/ (function(module, exports, __webpack_require__) { 2683 2684 var global = __webpack_require__(16) 2685 , core = __webpack_require__(21) 2686 , ctx = __webpack_require__(22) 2687 , PROTOTYPE = 'prototype'; 2688 2689 var $export = function(type, name, source){ 2690 var IS_FORCED = type & $export.F 2691 , IS_GLOBAL = type & $export.G 2692 , IS_STATIC = type & $export.S 2693 , IS_PROTO = type & $export.P 2694 , IS_BIND = type & $export.B 2695 , IS_WRAP = type & $export.W 2696 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) 2697 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] 2698 , key, own, out; 2699 if(IS_GLOBAL)source = name; 2700 for(key in source){ 2701 // contains in native 2702 own = !IS_FORCED && target && key in target; 2703 if(own && key in exports)continue; 2704 // export native or passed 2705 out = own ? target[key] : source[key]; 2706 // prevent global pollution for namespaces 2707 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] 2708 // bind timers to global for call from export context 2709 : IS_BIND && own ? ctx(out, global) 2710 // wrap global constructors for prevent change them in library 2711 : IS_WRAP && target[key] == out ? (function(C){ 2712 var F = function(param){ 2713 return this instanceof C ? new C(param) : C(param); 2714 }; 2715 F[PROTOTYPE] = C[PROTOTYPE]; 2716 return F; 2717 // make static versions for prototype methods 2718 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 2719 if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; 2720 } 2721 }; 2722 // type bitmap 2723 $export.F = 1; // forced 2724 $export.G = 2; // global 2725 $export.S = 4; // static 2726 $export.P = 8; // proto 2727 $export.B = 16; // bind 2728 $export.W = 32; // wrap 2729 module.exports = $export; 2730 2731/***/ }), 2732/* 21 */ 2733/***/ (function(module, exports) { 2734 2735 var core = module.exports = {version: '1.2.6'}; 2736 if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef 2737 2738/***/ }), 2739/* 22 */ 2740/***/ (function(module, exports, __webpack_require__) { 2741 2742 // optional / simple context binding 2743 var aFunction = __webpack_require__(23); 2744 module.exports = function(fn, that, length){ 2745 aFunction(fn); 2746 if(that === undefined)return fn; 2747 switch(length){ 2748 case 1: return function(a){ 2749 return fn.call(that, a); 2750 }; 2751 case 2: return function(a, b){ 2752 return fn.call(that, a, b); 2753 }; 2754 case 3: return function(a, b, c){ 2755 return fn.call(that, a, b, c); 2756 }; 2757 } 2758 return function(/* ...args */){ 2759 return fn.apply(that, arguments); 2760 }; 2761 }; 2762 2763/***/ }), 2764/* 23 */ 2765/***/ (function(module, exports) { 2766 2767 module.exports = function(it){ 2768 if(typeof it != 'function')throw TypeError(it + ' is not a function!'); 2769 return it; 2770 }; 2771 2772/***/ }), 2773/* 24 */ 2774/***/ (function(module, exports, __webpack_require__) { 2775 2776 module.exports = __webpack_require__(25); 2777 2778/***/ }), 2779/* 25 */ 2780/***/ (function(module, exports, __webpack_require__) { 2781 2782 var $ = __webpack_require__(9) 2783 , createDesc = __webpack_require__(26); 2784 module.exports = __webpack_require__(18) ? function(object, key, value){ 2785 return $.setDesc(object, key, createDesc(1, value)); 2786 } : function(object, key, value){ 2787 object[key] = value; 2788 return object; 2789 }; 2790 2791/***/ }), 2792/* 26 */ 2793/***/ (function(module, exports) { 2794 2795 module.exports = function(bitmap, value){ 2796 return { 2797 enumerable : !(bitmap & 1), 2798 configurable: !(bitmap & 2), 2799 writable : !(bitmap & 4), 2800 value : value 2801 }; 2802 }; 2803 2804/***/ }), 2805/* 27 */ 2806/***/ (function(module, exports, __webpack_require__) { 2807 2808 var global = __webpack_require__(16) 2809 , SHARED = '__core-js_shared__' 2810 , store = global[SHARED] || (global[SHARED] = {}); 2811 module.exports = function(key){ 2812 return store[key] || (store[key] = {}); 2813 }; 2814 2815/***/ }), 2816/* 28 */ 2817/***/ (function(module, exports, __webpack_require__) { 2818 2819 var def = __webpack_require__(9).setDesc 2820 , has = __webpack_require__(17) 2821 , TAG = __webpack_require__(29)('toStringTag'); 2822 2823 module.exports = function(it, tag, stat){ 2824 if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); 2825 }; 2826 2827/***/ }), 2828/* 29 */ 2829/***/ (function(module, exports, __webpack_require__) { 2830 2831 var store = __webpack_require__(27)('wks') 2832 , uid = __webpack_require__(30) 2833 , Symbol = __webpack_require__(16).Symbol; 2834 module.exports = function(name){ 2835 return store[name] || (store[name] = 2836 Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); 2837 }; 2838 2839/***/ }), 2840/* 30 */ 2841/***/ (function(module, exports) { 2842 2843 var id = 0 2844 , px = Math.random(); 2845 module.exports = function(key){ 2846 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 2847 }; 2848 2849/***/ }), 2850/* 31 */ 2851/***/ (function(module, exports, __webpack_require__) { 2852 2853 var $ = __webpack_require__(9) 2854 , toIObject = __webpack_require__(32); 2855 module.exports = function(object, el){ 2856 var O = toIObject(object) 2857 , keys = $.getKeys(O) 2858 , length = keys.length 2859 , index = 0 2860 , key; 2861 while(length > index)if(O[key = keys[index++]] === el)return key; 2862 }; 2863 2864/***/ }), 2865/* 32 */ 2866/***/ (function(module, exports, __webpack_require__) { 2867 2868 // to indexed object, toObject with fallback for non-array-like ES3 strings 2869 var IObject = __webpack_require__(33) 2870 , defined = __webpack_require__(35); 2871 module.exports = function(it){ 2872 return IObject(defined(it)); 2873 }; 2874 2875/***/ }), 2876/* 33 */ 2877/***/ (function(module, exports, __webpack_require__) { 2878 2879 // fallback for non-array-like ES3 and non-enumerable old V8 strings 2880 var cof = __webpack_require__(34); 2881 module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ 2882 return cof(it) == 'String' ? it.split('') : Object(it); 2883 }; 2884 2885/***/ }), 2886/* 34 */ 2887/***/ (function(module, exports) { 2888 2889 var toString = {}.toString; 2890 2891 module.exports = function(it){ 2892 return toString.call(it).slice(8, -1); 2893 }; 2894 2895/***/ }), 2896/* 35 */ 2897/***/ (function(module, exports) { 2898 2899 // 7.2.1 RequireObjectCoercible(argument) 2900 module.exports = function(it){ 2901 if(it == undefined)throw TypeError("Can't call method on " + it); 2902 return it; 2903 }; 2904 2905/***/ }), 2906/* 36 */ 2907/***/ (function(module, exports, __webpack_require__) { 2908 2909 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window 2910 var toIObject = __webpack_require__(32) 2911 , getNames = __webpack_require__(9).getNames 2912 , toString = {}.toString; 2913 2914 var windowNames = typeof window == 'object' && Object.getOwnPropertyNames 2915 ? Object.getOwnPropertyNames(window) : []; 2916 2917 var getWindowNames = function(it){ 2918 try { 2919 return getNames(it); 2920 } catch(e){ 2921 return windowNames.slice(); 2922 } 2923 }; 2924 2925 module.exports.get = function getOwnPropertyNames(it){ 2926 if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); 2927 return getNames(toIObject(it)); 2928 }; 2929 2930/***/ }), 2931/* 37 */ 2932/***/ (function(module, exports, __webpack_require__) { 2933 2934 // all enumerable object keys, includes symbols 2935 var $ = __webpack_require__(9); 2936 module.exports = function(it){ 2937 var keys = $.getKeys(it) 2938 , getSymbols = $.getSymbols; 2939 if(getSymbols){ 2940 var symbols = getSymbols(it) 2941 , isEnum = $.isEnum 2942 , i = 0 2943 , key; 2944 while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key); 2945 } 2946 return keys; 2947 }; 2948 2949/***/ }), 2950/* 38 */ 2951/***/ (function(module, exports, __webpack_require__) { 2952 2953 // 7.2.2 IsArray(argument) 2954 var cof = __webpack_require__(34); 2955 module.exports = Array.isArray || function(arg){ 2956 return cof(arg) == 'Array'; 2957 }; 2958 2959/***/ }), 2960/* 39 */ 2961/***/ (function(module, exports, __webpack_require__) { 2962 2963 var isObject = __webpack_require__(40); 2964 module.exports = function(it){ 2965 if(!isObject(it))throw TypeError(it + ' is not an object!'); 2966 return it; 2967 }; 2968 2969/***/ }), 2970/* 40 */ 2971/***/ (function(module, exports) { 2972 2973 module.exports = function(it){ 2974 return typeof it === 'object' ? it !== null : typeof it === 'function'; 2975 }; 2976 2977/***/ }), 2978/* 41 */ 2979/***/ (function(module, exports) { 2980 2981 module.exports = true; 2982 2983/***/ }), 2984/* 42 */ 2985/***/ (function(module, exports) { 2986 2987 2988 2989/***/ }), 2990/* 43 */ 2991/***/ (function(module, exports, __webpack_require__) { 2992 2993 module.exports = { "default": __webpack_require__(44), __esModule: true }; 2994 2995/***/ }), 2996/* 44 */ 2997/***/ (function(module, exports, __webpack_require__) { 2998 2999 __webpack_require__(45); 3000 __webpack_require__(51); 3001 module.exports = __webpack_require__(29)('iterator'); 3002 3003/***/ }), 3004/* 45 */ 3005/***/ (function(module, exports, __webpack_require__) { 3006 3007 'use strict'; 3008 var $at = __webpack_require__(46)(true); 3009 3010 // 21.1.3.27 String.prototype[@@iterator]() 3011 __webpack_require__(48)(String, 'String', function(iterated){ 3012 this._t = String(iterated); // target 3013 this._i = 0; // next index 3014 // 21.1.5.2.1 %StringIteratorPrototype%.next() 3015 }, function(){ 3016 var O = this._t 3017 , index = this._i 3018 , point; 3019 if(index >= O.length)return {value: undefined, done: true}; 3020 point = $at(O, index); 3021 this._i += point.length; 3022 return {value: point, done: false}; 3023 }); 3024 3025/***/ }), 3026/* 46 */ 3027/***/ (function(module, exports, __webpack_require__) { 3028 3029 var toInteger = __webpack_require__(47) 3030 , defined = __webpack_require__(35); 3031 // true -> String#at 3032 // false -> String#codePointAt 3033 module.exports = function(TO_STRING){ 3034 return function(that, pos){ 3035 var s = String(defined(that)) 3036 , i = toInteger(pos) 3037 , l = s.length 3038 , a, b; 3039 if(i < 0 || i >= l)return TO_STRING ? '' : undefined; 3040 a = s.charCodeAt(i); 3041 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff 3042 ? TO_STRING ? s.charAt(i) : a 3043 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; 3044 }; 3045 }; 3046 3047/***/ }), 3048/* 47 */ 3049/***/ (function(module, exports) { 3050 3051 // 7.1.4 ToInteger 3052 var ceil = Math.ceil 3053 , floor = Math.floor; 3054 module.exports = function(it){ 3055 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 3056 }; 3057 3058/***/ }), 3059/* 48 */ 3060/***/ (function(module, exports, __webpack_require__) { 3061 3062 'use strict'; 3063 var LIBRARY = __webpack_require__(41) 3064 , $export = __webpack_require__(20) 3065 , redefine = __webpack_require__(24) 3066 , hide = __webpack_require__(25) 3067 , has = __webpack_require__(17) 3068 , Iterators = __webpack_require__(49) 3069 , $iterCreate = __webpack_require__(50) 3070 , setToStringTag = __webpack_require__(28) 3071 , getProto = __webpack_require__(9).getProto 3072 , ITERATOR = __webpack_require__(29)('iterator') 3073 , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` 3074 , FF_ITERATOR = '@@iterator' 3075 , KEYS = 'keys' 3076 , VALUES = 'values'; 3077 3078 var returnThis = function(){ return this; }; 3079 3080 module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ 3081 $iterCreate(Constructor, NAME, next); 3082 var getMethod = function(kind){ 3083 if(!BUGGY && kind in proto)return proto[kind]; 3084 switch(kind){ 3085 case KEYS: return function keys(){ return new Constructor(this, kind); }; 3086 case VALUES: return function values(){ return new Constructor(this, kind); }; 3087 } return function entries(){ return new Constructor(this, kind); }; 3088 }; 3089 var TAG = NAME + ' Iterator' 3090 , DEF_VALUES = DEFAULT == VALUES 3091 , VALUES_BUG = false 3092 , proto = Base.prototype 3093 , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] 3094 , $default = $native || getMethod(DEFAULT) 3095 , methods, key; 3096 // Fix native 3097 if($native){ 3098 var IteratorPrototype = getProto($default.call(new Base)); 3099 // Set @@toStringTag to native iterators 3100 setToStringTag(IteratorPrototype, TAG, true); 3101 // FF fix 3102 if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); 3103 // fix Array#{values, @@iterator}.name in V8 / FF 3104 if(DEF_VALUES && $native.name !== VALUES){ 3105 VALUES_BUG = true; 3106 $default = function values(){ return $native.call(this); }; 3107 } 3108 } 3109 // Define iterator 3110 if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ 3111 hide(proto, ITERATOR, $default); 3112 } 3113 // Plug for library 3114 Iterators[NAME] = $default; 3115 Iterators[TAG] = returnThis; 3116 if(DEFAULT){ 3117 methods = { 3118 values: DEF_VALUES ? $default : getMethod(VALUES), 3119 keys: IS_SET ? $default : getMethod(KEYS), 3120 entries: !DEF_VALUES ? $default : getMethod('entries') 3121 }; 3122 if(FORCED)for(key in methods){ 3123 if(!(key in proto))redefine(proto, key, methods[key]); 3124 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); 3125 } 3126 return methods; 3127 }; 3128 3129/***/ }), 3130/* 49 */ 3131/***/ (function(module, exports) { 3132 3133 module.exports = {}; 3134 3135/***/ }), 3136/* 50 */ 3137/***/ (function(module, exports, __webpack_require__) { 3138 3139 'use strict'; 3140 var $ = __webpack_require__(9) 3141 , descriptor = __webpack_require__(26) 3142 , setToStringTag = __webpack_require__(28) 3143 , IteratorPrototype = {}; 3144 3145 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() 3146 __webpack_require__(25)(IteratorPrototype, __webpack_require__(29)('iterator'), function(){ return this; }); 3147 3148 module.exports = function(Constructor, NAME, next){ 3149 Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)}); 3150 setToStringTag(Constructor, NAME + ' Iterator'); 3151 }; 3152 3153/***/ }), 3154/* 51 */ 3155/***/ (function(module, exports, __webpack_require__) { 3156 3157 __webpack_require__(52); 3158 var Iterators = __webpack_require__(49); 3159 Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; 3160 3161/***/ }), 3162/* 52 */ 3163/***/ (function(module, exports, __webpack_require__) { 3164 3165 'use strict'; 3166 var addToUnscopables = __webpack_require__(53) 3167 , step = __webpack_require__(54) 3168 , Iterators = __webpack_require__(49) 3169 , toIObject = __webpack_require__(32); 3170 3171 // 22.1.3.4 Array.prototype.entries() 3172 // 22.1.3.13 Array.prototype.keys() 3173 // 22.1.3.29 Array.prototype.values() 3174 // 22.1.3.30 Array.prototype[@@iterator]() 3175 module.exports = __webpack_require__(48)(Array, 'Array', function(iterated, kind){ 3176 this._t = toIObject(iterated); // target 3177 this._i = 0; // next index 3178 this._k = kind; // kind 3179 // 22.1.5.2.1 %ArrayIteratorPrototype%.next() 3180 }, function(){ 3181 var O = this._t 3182 , kind = this._k 3183 , index = this._i++; 3184 if(!O || index >= O.length){ 3185 this._t = undefined; 3186 return step(1); 3187 } 3188 if(kind == 'keys' )return step(0, index); 3189 if(kind == 'values')return step(0, O[index]); 3190 return step(0, [index, O[index]]); 3191 }, 'values'); 3192 3193 // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) 3194 Iterators.Arguments = Iterators.Array; 3195 3196 addToUnscopables('keys'); 3197 addToUnscopables('values'); 3198 addToUnscopables('entries'); 3199 3200/***/ }), 3201/* 53 */ 3202/***/ (function(module, exports) { 3203 3204 module.exports = function(){ /* empty */ }; 3205 3206/***/ }), 3207/* 54 */ 3208/***/ (function(module, exports) { 3209 3210 module.exports = function(done, value){ 3211 return {value: value, done: !!done}; 3212 }; 3213 3214/***/ }), 3215/* 55 */ 3216/***/ (function(module, exports, __webpack_require__) { 3217 3218 module.exports = { "default": __webpack_require__(56), __esModule: true }; 3219 3220/***/ }), 3221/* 56 */ 3222/***/ (function(module, exports, __webpack_require__) { 3223 3224 __webpack_require__(51); 3225 __webpack_require__(45); 3226 module.exports = __webpack_require__(57); 3227 3228/***/ }), 3229/* 57 */ 3230/***/ (function(module, exports, __webpack_require__) { 3231 3232 var anObject = __webpack_require__(39) 3233 , get = __webpack_require__(58); 3234 module.exports = __webpack_require__(21).getIterator = function(it){ 3235 var iterFn = get(it); 3236 if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); 3237 return anObject(iterFn.call(it)); 3238 }; 3239 3240/***/ }), 3241/* 58 */ 3242/***/ (function(module, exports, __webpack_require__) { 3243 3244 var classof = __webpack_require__(59) 3245 , ITERATOR = __webpack_require__(29)('iterator') 3246 , Iterators = __webpack_require__(49); 3247 module.exports = __webpack_require__(21).getIteratorMethod = function(it){ 3248 if(it != undefined)return it[ITERATOR] 3249 || it['@@iterator'] 3250 || Iterators[classof(it)]; 3251 }; 3252 3253/***/ }), 3254/* 59 */ 3255/***/ (function(module, exports, __webpack_require__) { 3256 3257 // getting tag from 19.1.3.6 Object.prototype.toString() 3258 var cof = __webpack_require__(34) 3259 , TAG = __webpack_require__(29)('toStringTag') 3260 // ES3 wrong here 3261 , ARG = cof(function(){ return arguments; }()) == 'Arguments'; 3262 3263 module.exports = function(it){ 3264 var O, T, B; 3265 return it === undefined ? 'Undefined' : it === null ? 'Null' 3266 // @@toStringTag case 3267 : typeof (T = (O = Object(it))[TAG]) == 'string' ? T 3268 // builtinTag case 3269 : ARG ? cof(O) 3270 // ES3 arguments fallback 3271 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; 3272 }; 3273 3274/***/ }), 3275/* 60 */ 3276/***/ (function(module, exports, __webpack_require__) { 3277 3278 module.exports = { "default": __webpack_require__(61), __esModule: true }; 3279 3280/***/ }), 3281/* 61 */ 3282/***/ (function(module, exports, __webpack_require__) { 3283 3284 __webpack_require__(62); 3285 module.exports = __webpack_require__(21).Object.keys; 3286 3287/***/ }), 3288/* 62 */ 3289/***/ (function(module, exports, __webpack_require__) { 3290 3291 // 19.1.2.14 Object.keys(O) 3292 var toObject = __webpack_require__(63); 3293 3294 __webpack_require__(64)('keys', function($keys){ 3295 return function keys(it){ 3296 return $keys(toObject(it)); 3297 }; 3298 }); 3299 3300/***/ }), 3301/* 63 */ 3302/***/ (function(module, exports, __webpack_require__) { 3303 3304 // 7.1.13 ToObject(argument) 3305 var defined = __webpack_require__(35); 3306 module.exports = function(it){ 3307 return Object(defined(it)); 3308 }; 3309 3310/***/ }), 3311/* 64 */ 3312/***/ (function(module, exports, __webpack_require__) { 3313 3314 // most Object methods by ES6 should accept primitives 3315 var $export = __webpack_require__(20) 3316 , core = __webpack_require__(21) 3317 , fails = __webpack_require__(19); 3318 module.exports = function(KEY, exec){ 3319 var fn = (core.Object || {})[KEY] || Object[KEY] 3320 , exp = {}; 3321 exp[KEY] = exec(fn); 3322 $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); 3323 }; 3324 3325/***/ }), 3326/* 65 */ 3327/***/ (function(module, exports, __webpack_require__) { 3328 3329 'use strict'; 3330 3331 var _interopRequireDefault = __webpack_require__(1)['default']; 3332 3333 exports.__esModule = true; 3334 3335 var _exception = __webpack_require__(6); 3336 3337 var _exception2 = _interopRequireDefault(_exception); 3338 3339 exports['default'] = function (instance) { 3340 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 3341 if (arguments.length === 1) { 3342 // A missing field in a {{foo}} construct. 3343 return undefined; 3344 } else { 3345 // Someone is actually trying to call something, blow up. 3346 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 3347 } 3348 }); 3349 }; 3350 3351 module.exports = exports['default']; 3352 3353/***/ }), 3354/* 66 */ 3355/***/ (function(module, exports, __webpack_require__) { 3356 3357 'use strict'; 3358 3359 var _interopRequireDefault = __webpack_require__(1)['default']; 3360 3361 exports.__esModule = true; 3362 3363 var _utils = __webpack_require__(5); 3364 3365 var _exception = __webpack_require__(6); 3366 3367 var _exception2 = _interopRequireDefault(_exception); 3368 3369 exports['default'] = function (instance) { 3370 instance.registerHelper('if', function (conditional, options) { 3371 if (arguments.length != 2) { 3372 throw new _exception2['default']('#if requires exactly one argument'); 3373 } 3374 if (_utils.isFunction(conditional)) { 3375 conditional = conditional.call(this); 3376 } 3377 3378 // Default behavior is to render the positive path if the value is truthy and not empty. 3379 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 3380 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 3381 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 3382 return options.inverse(this); 3383 } else { 3384 return options.fn(this); 3385 } 3386 }); 3387 3388 instance.registerHelper('unless', function (conditional, options) { 3389 if (arguments.length != 2) { 3390 throw new _exception2['default']('#unless requires exactly one argument'); 3391 } 3392 return instance.helpers['if'].call(this, conditional, { 3393 fn: options.inverse, 3394 inverse: options.fn, 3395 hash: options.hash 3396 }); 3397 }); 3398 }; 3399 3400 module.exports = exports['default']; 3401 3402/***/ }), 3403/* 67 */ 3404/***/ (function(module, exports) { 3405 3406 'use strict'; 3407 3408 exports.__esModule = true; 3409 3410 exports['default'] = function (instance) { 3411 instance.registerHelper('log', function () /* message, options */{ 3412 var args = [undefined], 3413 options = arguments[arguments.length - 1]; 3414 for (var i = 0; i < arguments.length - 1; i++) { 3415 args.push(arguments[i]); 3416 } 3417 3418 var level = 1; 3419 if (options.hash.level != null) { 3420 level = options.hash.level; 3421 } else if (options.data && options.data.level != null) { 3422 level = options.data.level; 3423 } 3424 args[0] = level; 3425 3426 instance.log.apply(instance, args); 3427 }); 3428 }; 3429 3430 module.exports = exports['default']; 3431 3432/***/ }), 3433/* 68 */ 3434/***/ (function(module, exports) { 3435 3436 'use strict'; 3437 3438 exports.__esModule = true; 3439 3440 exports['default'] = function (instance) { 3441 instance.registerHelper('lookup', function (obj, field, options) { 3442 if (!obj) { 3443 // Note for 5.0: Change to "obj == null" in 5.0 3444 return obj; 3445 } 3446 return options.lookupProperty(obj, field); 3447 }); 3448 }; 3449 3450 module.exports = exports['default']; 3451 3452/***/ }), 3453/* 69 */ 3454/***/ (function(module, exports, __webpack_require__) { 3455 3456 'use strict'; 3457 3458 var _interopRequireDefault = __webpack_require__(1)['default']; 3459 3460 exports.__esModule = true; 3461 3462 var _utils = __webpack_require__(5); 3463 3464 var _exception = __webpack_require__(6); 3465 3466 var _exception2 = _interopRequireDefault(_exception); 3467 3468 exports['default'] = function (instance) { 3469 instance.registerHelper('with', function (context, options) { 3470 if (arguments.length != 2) { 3471 throw new _exception2['default']('#with requires exactly one argument'); 3472 } 3473 if (_utils.isFunction(context)) { 3474 context = context.call(this); 3475 } 3476 3477 var fn = options.fn; 3478 3479 if (!_utils.isEmpty(context)) { 3480 var data = options.data; 3481 if (options.data && options.ids) { 3482 data = _utils.createFrame(options.data); 3483 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 3484 } 3485 3486 return fn(context, { 3487 data: data, 3488 blockParams: _utils.blockParams([context], [data && data.contextPath]) 3489 }); 3490 } else { 3491 return options.inverse(this); 3492 } 3493 }); 3494 }; 3495 3496 module.exports = exports['default']; 3497 3498/***/ }), 3499/* 70 */ 3500/***/ (function(module, exports, __webpack_require__) { 3501 3502 'use strict'; 3503 3504 var _interopRequireDefault = __webpack_require__(1)['default']; 3505 3506 exports.__esModule = true; 3507 exports.registerDefaultDecorators = registerDefaultDecorators; 3508 3509 var _decoratorsInline = __webpack_require__(71); 3510 3511 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 3512 3513 function registerDefaultDecorators(instance) { 3514 _decoratorsInline2['default'](instance); 3515 } 3516 3517/***/ }), 3518/* 71 */ 3519/***/ (function(module, exports, __webpack_require__) { 3520 3521 'use strict'; 3522 3523 exports.__esModule = true; 3524 3525 var _utils = __webpack_require__(5); 3526 3527 exports['default'] = function (instance) { 3528 instance.registerDecorator('inline', function (fn, props, container, options) { 3529 var ret = fn; 3530 if (!props.partials) { 3531 props.partials = {}; 3532 ret = function (context, options) { 3533 // Create a new partials stack frame prior to exec. 3534 var original = container.partials; 3535 container.partials = _utils.extend({}, original, props.partials); 3536 var ret = fn(context, options); 3537 container.partials = original; 3538 return ret; 3539 }; 3540 } 3541 3542 props.partials[options.args[0]] = options.fn; 3543 3544 return ret; 3545 }); 3546 }; 3547 3548 module.exports = exports['default']; 3549 3550/***/ }), 3551/* 72 */ 3552/***/ (function(module, exports, __webpack_require__) { 3553 3554 'use strict'; 3555 3556 exports.__esModule = true; 3557 3558 var _utils = __webpack_require__(5); 3559 3560 var logger = { 3561 methodMap: ['debug', 'info', 'warn', 'error'], 3562 level: 'info', 3563 3564 // Maps a given level value to the `methodMap` indexes above. 3565 lookupLevel: function lookupLevel(level) { 3566 if (typeof level === 'string') { 3567 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 3568 if (levelMap >= 0) { 3569 level = levelMap; 3570 } else { 3571 level = parseInt(level, 10); 3572 } 3573 } 3574 3575 return level; 3576 }, 3577 3578 // Can be overridden in the host environment 3579 log: function log(level) { 3580 level = logger.lookupLevel(level); 3581 3582 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 3583 var method = logger.methodMap[level]; 3584 // eslint-disable-next-line no-console 3585 if (!console[method]) { 3586 method = 'log'; 3587 } 3588 3589 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 3590 message[_key - 1] = arguments[_key]; 3591 } 3592 3593 console[method].apply(console, message); // eslint-disable-line no-console 3594 } 3595 } 3596 }; 3597 3598 exports['default'] = logger; 3599 module.exports = exports['default']; 3600 3601/***/ }), 3602/* 73 */ 3603/***/ (function(module, exports, __webpack_require__) { 3604 3605 'use strict'; 3606 3607 var _Object$create = __webpack_require__(74)['default']; 3608 3609 var _Object$keys = __webpack_require__(60)['default']; 3610 3611 var _interopRequireDefault = __webpack_require__(1)['default']; 3612 3613 exports.__esModule = true; 3614 exports.createProtoAccessControl = createProtoAccessControl; 3615 exports.resultIsAllowed = resultIsAllowed; 3616 exports.resetLoggedProperties = resetLoggedProperties; 3617 3618 var _
3618createNewLookupObject = __webpack_require__(76); 3619 3620 var _logger = __webpack_require__(72); 3621 3622 var _logger2 = _interopRequireDefault(_logger); 3623 3624 var loggedProperties = _Object$create(null); 3625 3626 function createProtoAccessControl(runtimeOptions) { 3627 var defaultMethodWhiteList = _Object$create(null); 3628 defaultMethodWhiteList['constructor'] = false;
vendor: 11,824 bytes, lines 3629-3977
3629 defaultMethodWhiteList['__defineGetter__'] = false; 3630 defaultMethodWhiteList['__defineSetter__'] = false; 3631 defaultMethodWhiteList['__lookupGetter__'] = false; 3632 3633 var defaultPropertyWhiteList = _Object$create(null); 3634 // eslint-disable-next-line no-proto 3635 defaultPropertyWhiteList['__proto__'] = false; 3636 3637 return { 3638 properties: { 3639 whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), 3640 defaultValue: runtimeOptions.allowProtoPropertiesByDefault 3641 }, 3642 methods: { 3643 whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), 3644 defaultValue: runtimeOptions.allowProtoMethodsByDefault 3645 } 3646 }; 3647 } 3648 3649 function resultIsAllowed(result, protoAccessControl, propertyName) { 3650 if (typeof result === 'function') { 3651 return checkWhiteList(protoAccessControl.methods, propertyName); 3652 } else { 3653 return checkWhiteList(protoAccessControl.properties, propertyName); 3654 } 3655 } 3656 3657 function checkWhiteList(protoAccessControlForType, propertyName) { 3658 if (protoAccessControlForType.whitelist[propertyName] !== undefined) { 3659 return protoAccessControlForType.whitelist[propertyName] === true; 3660 } 3661 if (protoAccessControlForType.defaultValue !== undefined) { 3662 return protoAccessControlForType.defaultValue; 3663 } 3664 logUnexpecedPropertyAccessOnce(propertyName); 3665 return false; 3666 } 3667 3668 function logUnexpecedPropertyAccessOnce(propertyName) { 3669 if (loggedProperties[propertyName] !== true) { 3670 loggedProperties[propertyName] = true; 3671 _logger2['default'].log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); 3672 } 3673 } 3674 3675 function resetLoggedProperties() { 3676 _Object$keys(loggedProperties).forEach(function (propertyName) { 3677 delete loggedProperties[propertyName]; 3678 }); 3679 } 3680 3681/***/ }), 3682/* 74 */ 3683/***/ (function(module, exports, __webpack_require__) { 3684 3685 module.exports = { "default": __webpack_require__(75), __esModule: true }; 3686 3687/***/ }), 3688/* 75 */ 3689/***/ (function(module, exports, __webpack_require__) { 3690 3691 var $ = __webpack_require__(9); 3692 module.exports = function create(P, D){ 3693 return $.create(P, D); 3694 }; 3695 3696/***/ }), 3697/* 76 */ 3698/***/ (function(module, exports, __webpack_require__) { 3699 3700 'use strict'; 3701 3702 var _Object$create = __webpack_require__(74)['default']; 3703 3704 exports.__esModule = true; 3705 exports.createNewLookupObject = createNewLookupObject; 3706 3707 var _utils = __webpack_require__(5); 3708 3709 /** 3710 * Create a new object with "null"-prototype to avoid truthy results on prototype properties. 3711 * The resulting object can be used with "object[property]" to check if a property exists 3712 * @param {...object} sources a varargs parameter of source objects that will be merged 3713 * @returns {object} 3714 */ 3715 3716 function createNewLookupObject() { 3717 for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { 3718 sources[_key] = arguments[_key]; 3719 } 3720 3721 return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); 3722 } 3723 3724/***/ }), 3725/* 77 */ 3726/***/ (function(module, exports) { 3727 3728 // Build out our basic SafeString type 3729 'use strict'; 3730 3731 exports.__esModule = true; 3732 function SafeString(string) { 3733 this.string = string; 3734 } 3735 3736 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 3737 return '' + this.string; 3738 }; 3739 3740 exports['default'] = SafeString; 3741 module.exports = exports['default']; 3742 3743/***/ }), 3744/* 78 */ 3745/***/ (function(module, exports, __webpack_require__) { 3746 3747 'use strict'; 3748 3749 var _Object$seal = __webpack_require__(79)['default']; 3750 3751 var _Object$keys = __webpack_require__(60)['default']; 3752 3753 var _interopRequireWildcard = __webpack_require__(3)['default']; 3754 3755 var _interopRequireDefault = __webpack_require__(1)['default']; 3756 3757 exports.__esModule = true; 3758 exports.checkRevision = checkRevision; 3759 exports.template = template; 3760 exports.wrapProgram = wrapProgram; 3761 exports.resolvePartial = resolvePartial; 3762 exports.invokePartial = invokePartial; 3763 exports.noop = noop; 3764 3765 var _utils = __webpack_require__(5); 3766 3767 var Utils = _interopRequireWildcard(_utils); 3768 3769 var _exception = __webpack_require__(6); 3770 3771 var _exception2 = _interopRequireDefault(_exception); 3772 3773 var _base = __webpack_require__(4); 3774 3775 var _helpers = __webpack_require__(10); 3776 3777 var _internalWrapHelper = __webpack_require__(82); 3778 3779 var _internalProtoAccess = __webpack_require__(73); 3780 3781 function checkRevision(compilerInfo) { 3782 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 3783 currentRevision = _base.COMPILER_REVISION; 3784 3785 if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { 3786 return; 3787 } 3788 3789 if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { 3790 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 3791 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 3792 throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); 3793 } else { 3794 // Use the embedded version info since the runtime doesn't know about this revision yet 3795 throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); 3796 } 3797 } 3798 3799 function template(templateSpec, env) { 3800 /* istanbul ignore next */ 3801 if (!env) { 3802 throw new _exception2['default']('No environment passed to template'); 3803 } 3804 if (!templateSpec || !templateSpec.main) { 3805 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 3806 } 3807 3808 templateSpec.main.decorator = templateSpec.main_d; 3809 3810 // Note: Using env.VM references rather than local var references throughout this section to allow 3811 // for external users to override these as pseudo-supported APIs. 3812 env.VM.checkRevision(templateSpec.compiler); 3813 3814 // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) 3815 var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; 3816 3817 function invokePartialWrapper(partial, context, options) { 3818 if (options.hash) { 3819 context = Utils.extend({}, context, options.hash); 3820 if (options.ids) { 3821 options.ids[0] = true; 3822 } 3823 } 3824 partial = env.VM.resolvePartial.call(this, partial, context, options); 3825 3826 var extendedOptions = Utils.extend({}, options, { 3827 hooks: this.hooks, 3828 protoAccessControl: this.protoAccessControl 3829 }); 3830 3831 var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); 3832 3833 if (result == null && env.compile) { 3834 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 3835 result = options.partials[options.name](context, extendedOptions); 3836 } 3837 if (result != null) { 3838 if (options.indent) { 3839 var lines = result.split('\n'); 3840 for (var i = 0, l = lines.length; i < l; i++) { 3841 if (!lines[i] && i + 1 === l) { 3842 break; 3843 } 3844 3845 lines[i] = options.indent + lines[i]; 3846 } 3847 result = lines.join('\n'); 3848 } 3849 return result; 3850 } else { 3851 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 3852 } 3853 } 3854 3855 // Just add water 3856 var container = { 3857 strict: function strict(obj, name, loc) { 3858 if (!obj || !(name in obj)) { 3859 throw new _exception2['default']('"' + name + '" not defined in ' + obj, { 3860 loc: loc 3861 }); 3862 } 3863 return container.lookupProperty(obj, name); 3864 }, 3865 lookupProperty: function lookupProperty(parent, propertyName) { 3866 var result = parent[propertyName]; 3867 if (result == null) { 3868 return result; 3869 } 3870 if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { 3871 return result; 3872 } 3873 3874 if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { 3875 return result; 3876 } 3877 return undefined; 3878 }, 3879 lookup: function lookup(depths, name) { 3880 var len = depths.length; 3881 for (var i = 0; i < len; i++) { 3882 var result = depths[i] && container.lookupProperty(depths[i], name); 3883 if (result != null) { 3884 return depths[i][name]; 3885 } 3886 } 3887 }, 3888 lambda: function lambda(current, context) { 3889 return typeof current === 'function' ? current.call(context) : current; 3890 }, 3891 3892 escapeExpression: Utils.escapeExpression, 3893 invokePartial: invokePartialWrapper, 3894 3895 fn: function fn(i) { 3896 var ret = templateSpec[i]; 3897 ret.decorator = templateSpec[i + '_d']; 3898 return ret; 3899 }, 3900 3901 programs: [], 3902 program: function program(i, data, declaredBlockParams, blockParams, depths) { 3903 var programWrapper = this.programs[i], 3904 fn = this.fn(i); 3905 if (data || depths || blockParams || declaredBlockParams) { 3906 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 3907 } else if (!programWrapper) { 3908 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 3909 } 3910 return programWrapper; 3911 }, 3912 3913 data: function data(value, depth) { 3914 while (value && depth--) { 3915 value = value._parent; 3916 } 3917 return value; 3918 }, 3919 mergeIfNeeded: function mergeIfNeeded(param, common) { 3920 var obj = param || common; 3921 3922 if (param && common && param !== common) { 3923 obj = Utils.extend({}, common, param); 3924 } 3925 3926 return obj; 3927 }, 3928 // An empty object to use as replacement for null-contexts 3929 nullContext: _Object$seal({}), 3930 3931 noop: env.VM.noop, 3932 compilerInfo: templateSpec.compiler 3933 }; 3934 3935 function ret(context) { 3936 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 3937 3938 var data = options.data; 3939 3940 ret._setup(options); 3941 if (!options.partial && templateSpec.useData) { 3942 data = initData(context, data); 3943 } 3944 var depths = undefined, 3945 blockParams = templateSpec.useBlockParams ? [] : undefined; 3946 if (templateSpec.useDepths) { 3947 if (options.depths) { 3948 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 3949 } else { 3950 depths = [context]; 3951 } 3952 } 3953 3954 function main(context /*, options*/) { 3955 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 3956 } 3957 3958 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 3959 return main(context, options); 3960 } 3961 3962 ret.isTop = true; 3963 3964 ret._setup = function (options) { 3965 if (!options.partial) { 3966 var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); 3967 wrapHelpersToPassLookupProperty(mergedHelpers, container); 3968 container.helpers = mergedHelpers; 3969 3970 if (templateSpec.usePartial) { 3971 // Use mergeIfNeeded here to prevent compiling global partials multiple times 3972 container.partials = container.mergeIfNeeded(options.partials, env.partials); 3973 } 3974 if (templateSpec.usePartial || templateSpec.useDecorators) { 3975 container.decorators = Utils.extend({}, env.decorators, options.decorators); 3976 } 3977
vendor: 4,565 bytes, lines 3978-4106
3978 container.hooks = {}; 3979 container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); 3980 3981 var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; 3982 _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); 3983 _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); 3984 } else { 3985 container.protoAccessControl = options.protoAccessControl; // internal option 3986 container.helpers = options.helpers; 3987 container.partials = options.partials; 3988 container.decorators = options.decorators; 3989 container.hooks = options.hooks; 3990 } 3991 }; 3992 3993 ret._child = function (i, data, blockParams, depths) { 3994 if (templateSpec.useBlockParams && !blockParams) { 3995 throw new _exception2['default']('must pass block params'); 3996 } 3997 if (templateSpec.useDepths && !depths) { 3998 throw new _exception2['default']('must pass parent depths'); 3999 } 4000 4001 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 4002 }; 4003 return ret; 4004 } 4005 4006 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 4007 function prog(context) { 4008 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 4009 4010 var currentDepths = depths; 4011 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 4012 currentDepths = [context].concat(depths); 4013 } 4014 4015 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 4016 } 4017 4018 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 4019 4020 prog.program = i; 4021 prog.depth = depths ? depths.length : 0; 4022 prog.blockParams = declaredBlockParams || 0; 4023 return prog; 4024 } 4025 4026 /** 4027 * This is currently part of the official API, therefore implementation details should not be changed. 4028 */ 4029 4030 function resolvePartial(partial, context, options) { 4031 if (!partial) { 4032 if (options.name === '@partial-block') { 4033 partial = options.data['partial-block']; 4034 } else { 4035 partial = options.partials[options.name]; 4036 } 4037 } else if (!partial.call && !options.name) { 4038 // This is a dynamic partial that returned a string 4039 options.name = partial; 4040 partial = options.partials[partial]; 4041 } 4042 return partial; 4043 } 4044 4045 function invokePartial(partial, context, options) { 4046 // Use the current closure context to save the partial-block if this partial 4047 var currentPartialBlock = options.data && options.data['partial-block']; 4048 options.partial = true; 4049 if (options.ids) { 4050 options.data.contextPath = options.ids[0] || options.data.contextPath; 4051 } 4052 4053 var partialBlock = undefined; 4054 if (options.fn && options.fn !== noop) { 4055 (function () { 4056 options.data = _base.createFrame(options.data); 4057 // Wrapper function to get access to currentPartialBlock from the closure 4058 var fn = options.fn; 4059 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 4060 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 4061 4062 // Restore the partial-block from the closure for the execution of the block 4063 // i.e. the part inside the block of the partial call. 4064 options.data = _base.createFrame(options.data); 4065 options.data['partial-block'] = currentPartialBlock; 4066 return fn(context, options); 4067 }; 4068 if (fn.partials) { 4069 options.partials = Utils.extend({}, options.partials, fn.partials); 4070 } 4071 })(); 4072 } 4073 4074 if (partial === undefined && partialBlock) { 4075 partial = partialBlock; 4076 } 4077 4078 if (partial === undefined) { 4079 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 4080 } else if (partial instanceof Function) { 4081 return partial(context, options); 4082 } 4083 } 4084 4085 function noop() { 4086 return ''; 4087 } 4088 4089 function initData(context, data) { 4090 if (!data || !('root' in data)) { 4091 data = data ? _base.createFrame(data) : {}; 4092 data.root = context; 4093 } 4094 return data; 4095 } 4096 4097 function executeDecorators(fn, prog, container, depths, data, blockParams) { 4098 if (fn.decorator) { 4099 var props = {}; 4100 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 4101 Utils.extend(prog, props); 4102 } 4103 return prog; 4104 } 4105 4106 function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
vendor: 9,825 bytes, lines 4107-4342
4107 _Object$keys(mergedHelpers).forEach(function (helperName) { 4108 var helper = mergedHelpers[helperName]; 4109 mergedHelpers[helperName] = passLookupPropertyOption(helper, container); 4110 }); 4111 } 4112 4113 function passLookupPropertyOption(helper, container) { 4114 var lookupProperty = container.lookupProperty; 4115 return _internalWrapHelper.wrapHelper(helper, function (options) { 4116 return Utils.extend({ lookupProperty: lookupProperty }, options); 4117 }); 4118 } 4119 4120/***/ }), 4121/* 79 */ 4122/***/ (function(module, exports, __webpack_require__) { 4123 4124 module.exports = { "default": __webpack_require__(80), __esModule: true }; 4125 4126/***/ }), 4127/* 80 */ 4128/***/ (function(module, exports, __webpack_require__) { 4129 4130 __webpack_require__(81); 4131 module.exports = __webpack_require__(21).Object.seal; 4132 4133/***/ }), 4134/* 81 */ 4135/***/ (function(module, exports, __webpack_require__) { 4136 4137 // 19.1.2.17 Object.seal(O) 4138 var isObject = __webpack_require__(40); 4139 4140 __webpack_require__(64)('seal', function($seal){ 4141 return function seal(it){ 4142 return $seal && isObject(it) ? $seal(it) : it; 4143 }; 4144 }); 4145 4146/***/ }), 4147/* 82 */ 4148/***/ (function(module, exports) { 4149 4150 'use strict'; 4151 4152 exports.__esModule = true; 4153 exports.wrapHelper = wrapHelper; 4154 4155 function wrapHelper(helper, transformOptionsFn) { 4156 if (typeof helper !== 'function') { 4157 // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 4158 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. 4159 return helper; 4160 } 4161 var wrapper = function wrapper() /* dynamic arguments */{ 4162 var options = arguments[arguments.length - 1]; 4163 arguments[arguments.length - 1] = transformOptionsFn(options); 4164 return helper.apply(this, arguments); 4165 }; 4166 return wrapper; 4167 } 4168 4169/***/ }), 4170/* 83 */ 4171/***/ (function(module, exports) { 4172 4173 /* global globalThis */ 4174 'use strict'; 4175 4176 exports.__esModule = true; 4177 4178 exports['default'] = function (Handlebars) { 4179 /* istanbul ignore next */ 4180 // https://mathiasbynens.be/notes/globalthis 4181 (function () { 4182 if (typeof globalThis === 'object') return; 4183 Object.prototype.__defineGetter__('__magic__', function () { 4184 return this; 4185 }); 4186 __magic__.globalThis = __magic__; // eslint-disable-line no-undef 4187 delete Object.prototype.__magic__; 4188 })(); 4189 4190 var $Handlebars = globalThis.Handlebars; 4191 4192 /* istanbul ignore next */ 4193 Handlebars.noConflict = function () { 4194 if (globalThis.Handlebars === Handlebars) { 4195 globalThis.Handlebars = $Handlebars; 4196 } 4197 return Handlebars; 4198 }; 4199 }; 4200 4201 module.exports = exports['default']; 4202 4203/***/ }), 4204/* 84 */ 4205/***/ (function(module, exports) { 4206 4207 'use strict'; 4208 4209 exports.__esModule = true; 4210 var AST = { 4211 // Public API used to evaluate derived attributes regarding AST nodes 4212 helpers: { 4213 // a mustache is definitely a helper if: 4214 // * it is an eligible helper, and 4215 // * it has at least one parameter or hash segment 4216 helperExpression: function helperExpression(node) { 4217 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 4218 }, 4219 4220 scopedId: function scopedId(path) { 4221 return (/^\.|this\b/.test(path.original) 4222 ); 4223 }, 4224 4225 // an ID is simple if it only has one part, and that part is not 4226 // `..` or `this`. 4227 simpleId: function simpleId(path) { 4228 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 4229 } 4230 } 4231 }; 4232 4233 // Must be exported as an object rather than the root of the module as the jison lexer 4234 // must modify the object to operate properly. 4235 exports['default'] = AST; 4236 module.exports = exports['default']; 4237 4238/***/ }), 4239/* 85 */ 4240/***/ (function(module, exports, __webpack_require__) { 4241 4242 'use strict'; 4243 4244 var _interopRequireDefault = __webpack_require__(1)['default']; 4245 4246 var _interopRequireWildcard = __webpack_require__(3)['default']; 4247 4248 exports.__esModule = true; 4249 exports.parseWithoutProcessing = parseWithoutProcessing; 4250 exports.parse = parse; 4251 4252 var _parser = __webpack_require__(86); 4253 4254 var _parser2 = _interopRequireDefault(_parser); 4255 4256 var _whitespaceControl = __webpack_require__(87); 4257 4258 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 4259 4260 var _helpers = __webpack_require__(89); 4261 4262 var Helpers = _interopRequireWildcard(_helpers); 4263 4264 var _utils = __webpack_require__(5); 4265 4266 exports.parser = _parser2['default']; 4267 4268 var yy = {}; 4269 _utils.extend(yy, Helpers); 4270 4271 function parseWithoutProcessing(input, options) { 4272 // Just return if an already-compiled AST was passed in. 4273 if (input.type === 'Program') { 4274 return input; 4275 } 4276 4277 _parser2['default'].yy = yy; 4278 4279 // Altering the shared object here, but this is ok as parser is a sync operation 4280 yy.locInfo = function (locInfo) { 4281 return new yy.SourceLocation(options && options.srcName, locInfo); 4282 }; 4283 4284 var ast = _parser2['default'].parse(input); 4285 4286 return ast; 4287 } 4288 4289 function parse(input, options) { 4290 var ast = parseWithoutProcessing(input, options); 4291 var strip = new _whitespaceControl2['default'](options); 4292 4293 return strip.accept(ast); 4294 } 4295 4296/***/ }), 4297/* 86 */ 4298/***/ (function(module, exports) { 4299 4300 // File ignored in coverage tests via setting in .istanbul.yml 4301 /* Jison generated parser */ 4302 "use strict"; 4303 4304 exports.__esModule = true; 4305 var handlebars = (function () { 4306 var parser = { trace: function trace() {}, 4307 yy: {}, 4308 symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, 4309 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, 4310 productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], 4311 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { 4312 4313 var $0 = $$.length - 1; 4314 switch (yystate) { 4315 case 1: 4316 return $$[$0 - 1]; 4317 break; 4318 case 2: 4319 this.$ = yy.prepareProgram($$[$0]); 4320 break; 4321 case 3: 4322 this.$ = $$[$0]; 4323 break; 4324 case 4: 4325 this.$ = $$[$0]; 4326 break; 4327 case 5: 4328 this.$ = $$[$0]; 4329 break; 4330 case 6: 4331 this.$ = $$[$0]; 4332 break; 4333 case 7: 4334 this.$ = $$[$0]; 4335 break; 4336 case 8: 4337 this.$ = $$[$0]; 4338 break; 4339 case 9: 4340 this.$ = { 4341 type: 'CommentStatement', 4342 value: yy.stripComment($$[$0]),
vendor: 8,908 bytes, lines 4343-4563
4343 strip: yy.stripFlags($$[$0], $$[$0]), 4344 loc: yy.locInfo(this._$) 4345 }; 4346 4347 break; 4348 case 10: 4349 this.$ = { 4350 type: 'ContentStatement', 4351 original: $$[$0], 4352 value: $$[$0], 4353 loc: yy.locInfo(this._$) 4354 }; 4355 4356 break; 4357 case 11: 4358 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 4359 break; 4360 case 12: 4361 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 4362 break; 4363 case 13: 4364 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 4365 break; 4366 case 14: 4367 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 4368 break; 4369 case 15: 4370 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 4371 break; 4372 case 16: 4373 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 4374 break; 4375 case 17: 4376 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 4377 break; 4378 case 18: 4379 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 4380 break; 4381 case 19: 4382 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 4383 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 4384 program.chained = true; 4385 4386 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 4387 4388 break; 4389 case 20: 4390 this.$ = $$[$0]; 4391 break; 4392 case 21: 4393 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 4394 break; 4395 case 22: 4396 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 4397 break; 4398 case 23: 4399 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 4400 break; 4401 case 24: 4402 this.$ = { 4403 type: 'PartialStatement', 4404 name: $$[$0 - 3], 4405 params: $$[$0 - 2], 4406 hash: $$[$0 - 1], 4407 indent: '', 4408 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 4409 loc: yy.locInfo(this._$) 4410 }; 4411 4412 break; 4413 case 25: 4414 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 4415 break; 4416 case 26: 4417 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 4418 break; 4419 case 27: 4420 this.$ = $$[$0]; 4421 break; 4422 case 28: 4423 this.$ = $$[$0]; 4424 break; 4425 case 29: 4426 this.$ = { 4427 type: 'SubExpression', 4428 path: $$[$0 - 3], 4429 params: $$[$0 - 2], 4430 hash: $$[$0 - 1], 4431 loc: yy.locInfo(this._$) 4432 }; 4433 4434 break; 4435 case 30: 4436 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 4437 break; 4438 case 31: 4439 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 4440 break; 4441 case 32: 4442 this.$ = yy.id($$[$0 - 1]); 4443 break; 4444 case 33: 4445 this.$ = $$[$0]; 4446 break; 4447 case 34: 4448 this.$ = $$[$0]; 4449 break; 4450 case 35: 4451 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 4452 break; 4453 case 36: 4454 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 4455 break; 4456 case 37: 4457 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 4458 break; 4459 case 38: 4460 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 4461 break; 4462 case 39: 4463 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 4464 break; 4465 case 40: 4466 this.$ = $$[$0]; 4467 break; 4468 case 41: 4469 this.$ = $$[$0]; 4470 break; 4471 case 42: 4472 this.$ = yy.preparePath(true, $$[$0], this._$); 4473 break; 4474 case 43: 4475 this.$ = yy.preparePath(false, $$[$0], this._$); 4476 break; 4477 case 44: 4478 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 4479 break; 4480 case 45: 4481 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 4482 break; 4483 case 46: 4484 this.$ = []; 4485 break; 4486 case 47: 4487 $$[$0 - 1].push($$[$0]); 4488 break; 4489 case 48: 4490 this.$ = []; 4491 break; 4492 case 49: 4493 $$[$0 - 1].push($$[$0]); 4494 break; 4495 case 50: 4496 this.$ = []; 4497 break; 4498 case 51: 4499 $$[$0 - 1].push($$[$0]); 4500 break; 4501 case 58: 4502 this.$ = []; 4503 break; 4504 case 59: 4505 $$[$0 - 1].push($$[$0]); 4506 break; 4507 case 64: 4508 this.$ = []; 4509 break; 4510 case 65: 4511 $$[$0 - 1].push($$[$0]); 4512 break; 4513 case 70: 4514 this.$ = []; 4515 break; 4516 case 71: 4517 $$[$0 - 1].push($$[$0]); 4518 break; 4519 case 78: 4520 this.$ = []; 4521 break; 4522 case 79: 4523 $$[$0 - 1].push($$[$0]); 4524 break; 4525 case 82: 4526 this.$ = []; 4527 break; 4528 case 83: 4529 $$[$0 - 1].push($$[$0]); 4530 break; 4531 case 86: 4532 this.$ = []; 4533 break; 4534 case 87: 4535 $$[$0 - 1].push($$[$0]); 4536 break; 4537 case 90: 4538 this.$ = []; 4539 break; 4540 case 91: 4541 $$[$0 - 1].push($$[$0]); 4542 break; 4543 case 94: 4544 this.$ = []; 4545 break; 4546 case 95: 4547 $$[$0 - 1].push($$[$0]); 4548 break; 4549 case 98: 4550 this.$ = [$$[$0]]; 4551 break; 4552 case 99: 4553 $$[$0 - 1].push($$[$0]); 4554 break; 4555 case 100: 4556 this.$ = [$$[$0]]; 4557 break; 4558 case 101: 4559 $$[$0 - 1].push($$[$0]); 4560 break; 4561 } 4562 }, 4563
vendor: 11,458 bytes, line 4563
4563 table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }
vendor: 24,487 bytes, lines 4563-5038
4563, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], 4564 defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, 4565 parseError: function parseError(str, hash) { 4566 throw new Error(str); 4567 }, 4568 parse: function parse(input) { 4569 var self = this, 4570 stack = [0], 4571 vstack = [null], 4572 lstack = [], 4573 table = this.table, 4574 yytext = "", 4575 yylineno = 0, 4576 yyleng = 0, 4577 recovering = 0, 4578 TERROR = 2, 4579 EOF = 1; 4580 this.lexer.setInput(input); 4581 this.lexer.yy = this.yy; 4582 this.yy.lexer = this.lexer; 4583 this.yy.parser = this; 4584 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 4585 var yyloc = this.lexer.yylloc; 4586 lstack.push(yyloc); 4587 var ranges = this.lexer.options && this.lexer.options.ranges; 4588 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 4589 function popStack(n) { 4590 stack.length = stack.length - 2 * n; 4591 vstack.length = vstack.length - n; 4592 lstack.length = lstack.length - n; 4593 } 4594 function lex() { 4595 var token; 4596 token = self.lexer.lex() || 1; 4597 if (typeof token !== "number") { 4598 token = self.symbols_[token] || token; 4599 } 4600 return token; 4601 } 4602 var symbol, 4603 preErrorSymbol, 4604 state, 4605 action, 4606 a, 4607 r, 4608 yyval = {}, 4609 p, 4610 len, 4611 newState, 4612 expected; 4613 while (true) { 4614 state = stack[stack.length - 1]; 4615 if (this.defaultActions[state]) { 4616 action = this.defaultActions[state]; 4617 } else { 4618 if (symbol === null || typeof symbol == "undefined") { 4619 symbol = lex(); 4620 } 4621 action = table[state] && table[state][symbol]; 4622 } 4623 if (typeof action === "undefined" || !action.length || !action[0]) { 4624 var errStr = ""; 4625 if (!recovering) { 4626 expected = []; 4627 for (p in table[state]) if (this.terminals_[p] && p > 2) { 4628 expected.push("'" + this.terminals_[p] + "'"); 4629 } 4630 if (this.lexer.showPosition) { 4631 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 4632 } else { 4633 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 4634 } 4635 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 4636 } 4637 } 4638 if (action[0] instanceof Array && action.length > 1) { 4639 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 4640 } 4641 switch (action[0]) { 4642 case 1: 4643 stack.push(symbol); 4644 vstack.push(this.lexer.yytext); 4645 lstack.push(this.lexer.yylloc); 4646 stack.push(action[1]); 4647 symbol = null; 4648 if (!preErrorSymbol) { 4649 yyleng = this.lexer.yyleng; 4650 yytext = this.lexer.yytext; 4651 yylineno = this.lexer.yylineno; 4652 yyloc = this.lexer.yylloc; 4653 if (recovering > 0) recovering--; 4654 } else { 4655 symbol = preErrorSymbol; 4656 preErrorSymbol = null; 4657 } 4658 break; 4659 case 2: 4660 len = this.productions_[action[1]][1]; 4661 yyval.$ = vstack[vstack.length - len]; 4662 yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; 4663 if (ranges) { 4664 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 4665 } 4666 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 4667 if (typeof r !== "undefined") { 4668 return r; 4669 } 4670 if (len) { 4671 stack = stack.slice(0, -1 * len * 2); 4672 vstack = vstack.slice(0, -1 * len); 4673 lstack = lstack.slice(0, -1 * len); 4674 } 4675 stack.push(this.productions_[action[1]][0]); 4676 vstack.push(yyval.$); 4677 lstack.push(yyval._$); 4678 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 4679 stack.push(newState); 4680 break; 4681 case 3: 4682 return true; 4683 } 4684 } 4685 return true; 4686 } 4687 }; 4688 /* Jison generated lexer */ 4689 var lexer = (function () { 4690 var lexer = { EOF: 1, 4691 parseError: function parseError(str, hash) { 4692 if (this.yy.parser) { 4693 this.yy.parser.parseError(str, hash); 4694 } else { 4695 throw new Error(str); 4696 } 4697 }, 4698 setInput: function setInput(input) { 4699 this._input = input; 4700 this._more = this._less = this.done = false; 4701 this.yylineno = this.yyleng = 0; 4702 this.yytext = this.matched = this.match = ''; 4703 this.conditionStack = ['INITIAL']; 4704 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 4705 if (this.options.ranges) this.yylloc.range = [0, 0]; 4706 this.offset = 0; 4707 return this; 4708 }, 4709 input: function input() { 4710 var ch = this._input[0]; 4711 this.yytext += ch; 4712 this.yyleng++; 4713 this.offset++; 4714 this.match += ch; 4715 this.matched += ch; 4716 var lines = ch.match(/(?:\r\n?|\n).*/g); 4717 if (lines) { 4718 this.yylineno++; 4719 this.yylloc.last_line++; 4720 } else { 4721 this.yylloc.last_column++; 4722 } 4723 if (this.options.ranges) this.yylloc.range[1]++; 4724 4725 this._input = this._input.slice(1); 4726 return ch; 4727 }, 4728 unput: function unput(ch) { 4729 var len = ch.length; 4730 var lines = ch.split(/(?:\r\n?|\n)/g); 4731 4732 this._input = ch + this._input; 4733 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 4734 //this.yyleng -= len; 4735 this.offset -= len; 4736 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 4737 this.match = this.match.substr(0, this.match.length - 1); 4738 this.matched = this.matched.substr(0, this.matched.length - 1); 4739 4740 if (lines.length - 1) this.yylineno -= lines.length - 1; 4741 var r = this.yylloc.range; 4742 4743 this.yylloc = { first_line: this.yylloc.first_line, 4744 last_line: this.yylineno + 1, 4745 first_column: this.yylloc.first_column, 4746 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len 4747 }; 4748 4749 if (this.options.ranges) { 4750 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 4751 } 4752 return this; 4753 }, 4754 more: function more() { 4755 this._more = true; 4756 return this; 4757 }, 4758 less: function less(n) { 4759 this.unput(this.match.slice(n)); 4760 }, 4761 pastInput: function pastInput() { 4762 var past = this.matched.substr(0, this.matched.length - this.match.length); 4763 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 4764 }, 4765 upcomingInput: function upcomingInput() { 4766 var next = this.match; 4767 if (next.length < 20) { 4768 next += this._input.substr(0, 20 - next.length); 4769 } 4770 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 4771 }, 4772 showPosition: function showPosition() { 4773 var pre = this.pastInput(); 4774 var c = new Array(pre.length + 1).join("-"); 4775 return pre + this.upcomingInput() + "\n" + c + "^"; 4776 }, 4777 next: function next() { 4778 if (this.done) { 4779 return this.EOF; 4780 } 4781 if (!this._input) this.done = true; 4782 4783 var token, match, tempMatch, index, col, lines; 4784 if (!this._more) { 4785 this.yytext = ''; 4786 this.match = ''; 4787 } 4788 var rules = this._currentRules(); 4789 for (var i = 0; i < rules.length; i++) { 4790 tempMatch = this._input.match(this.rules[rules[i]]); 4791 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 4792 match = tempMatch; 4793 index = i; 4794 if (!this.options.flex) break; 4795 } 4796 } 4797 if (match) { 4798 lines = match[0].match(/(?:\r\n?|\n).*/g); 4799 if (lines) this.yylineno += lines.length; 4800 this.yylloc = { first_line: this.yylloc.last_line, 4801 last_line: this.yylineno + 1, 4802 first_column: this.yylloc.last_column, 4803 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 4804 this.yytext += match[0]; 4805 this.match += match[0]; 4806 this.matches = match; 4807 this.yyleng = this.yytext.length; 4808 if (this.options.ranges) { 4809 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 4810 } 4811 this._more = false; 4812 this._input = this._input.slice(match[0].length); 4813 this.matched += match[0]; 4814 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 4815 if (this.done && this._input) this.done = false; 4816 if (token) return token;else return; 4817 } 4818 if (this._input === "") { 4819 return this.EOF; 4820 } else { 4821 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 4822 } 4823 }, 4824 lex: function lex() { 4825 var r = this.next(); 4826 if (typeof r !== 'undefined') { 4827 return r; 4828 } else { 4829 return this.lex(); 4830 } 4831 }, 4832 begin: function begin(condition) { 4833 this.conditionStack.push(condition); 4834 }, 4835 popState: function popState() { 4836 return this.conditionStack.pop(); 4837 }, 4838 _currentRules: function _currentRules() { 4839 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 4840 }, 4841 topState: function topState() { 4842 return this.conditionStack[this.conditionStack.length - 2]; 4843 }, 4844 pushState: function begin(condition) { 4845 this.begin(condition); 4846 } }; 4847 lexer.options = {}; 4848 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { 4849 4850 function strip(start, end) { 4851 return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); 4852 } 4853 4854 var YYSTATE = YY_START; 4855 switch ($avoiding_name_collisions) { 4856 case 0: 4857 if (yy_.yytext.slice(-2) === "\\\\") { 4858 strip(0, 1); 4859 this.begin("mu"); 4860 } else if (yy_.yytext.slice(-1) === "\\") { 4861 strip(0, 1); 4862 this.begin("emu"); 4863 } else { 4864 this.begin("mu"); 4865 } 4866 if (yy_.yytext) return 15; 4867 4868 break; 4869 case 1: 4870 return 15; 4871 break; 4872 case 2: 4873 this.popState(); 4874 return 15; 4875 4876 break; 4877 case 3: 4878 this.begin('raw');return 15; 4879 break; 4880 case 4: 4881 this.popState(); 4882 // Should be using `this.topState()` below, but it currently 4883 // returns the second top instead of the first top. Opened an 4884 // issue about it at https://github.com/zaach/jison/issues/291 4885 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 4886 return 15; 4887 } else { 4888 strip(5, 9); 4889 return 'END_RAW_BLOCK'; 4890 } 4891 4892 break; 4893 case 5: 4894 return 15; 4895 break; 4896 case 6: 4897 this.popState(); 4898 return 14; 4899 4900 break; 4901 case 7: 4902 return 65; 4903 break; 4904 case 8: 4905 return 68; 4906 break; 4907 case 9: 4908 return 19; 4909 break; 4910 case 10: 4911 this.popState(); 4912 this.begin('raw'); 4913 return 23; 4914 4915 break; 4916 case 11: 4917 return 55; 4918 break; 4919 case 12: 4920 return 60; 4921 break; 4922 case 13: 4923 return 29; 4924 break; 4925 case 14: 4926 return 47; 4927 break; 4928 case 15: 4929 this.popState();return 44; 4930 break; 4931 case 16: 4932 this.popState();return 44; 4933 break; 4934 case 17: 4935 return 34; 4936 break; 4937 case 18: 4938 return 39; 4939 break; 4940 case 19: 4941 return 51; 4942 break; 4943 case 20: 4944 return 48; 4945 break; 4946 case 21: 4947 this.unput(yy_.yytext); 4948 this.popState(); 4949 this.begin('com'); 4950 4951 break; 4952 case 22: 4953 this.popState(); 4954 return 14; 4955 4956 break; 4957 case 23: 4958 return 48; 4959 break; 4960 case 24: 4961 return 73; 4962 break; 4963 case 25: 4964 return 72; 4965 break; 4966 case 26: 4967 return 72; 4968 break; 4969 case 27: 4970 return 87; 4971 break; 4972 case 28: 4973 // ignore whitespace 4974 break; 4975 case 29: 4976 this.popState();return 54; 4977 break; 4978 case 30: 4979 this.popState();return 33; 4980 break; 4981 case 31: 4982 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 4983 break; 4984 case 32: 4985 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 4986 break; 4987 case 33: 4988 return 85; 4989 break; 4990 case 34: 4991 return 82; 4992 break; 4993 case 35: 4994 return 82; 4995 break; 4996 case 36: 4997 return 83; 4998 break; 4999 case 37: 5000 return 84; 5001 break; 5002 case 38: 5003 return 81; 5004 break; 5005 case 39: 5006 return 75; 5007 break; 5008 case 40: 5009 return 77; 5010 break; 5011 case 41: 5012 return 72; 5013 break; 5014 case 42: 5015 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 5016 break; 5017 case 43: 5018 return 'INVALID'; 5019 break; 5020 case 44: 5021 return 5; 5022 break; 5023 } 5024 }; 5025 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 5026 lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; 5027 return lexer; 5028 })(); 5029 parser.lexer = lexer; 5030 function Parser() { 5031 this.yy = {}; 5032 }Parser.prototype = parser;parser.Parser = Parser; 5033 return new Parser(); 5034 })();exports["default"] = handlebars; 5035 module.exports = exports["default"]; 5036 5037/***/ }), 5038/* 8
vendor: 10,642 bytes, lines 5038-5405
50387 */ 5039/***/ (function(module, exports, __webpack_require__) { 5040 5041 'use strict'; 5042 5043 var _interopRequireDefault = __webpack_require__(1)['default']; 5044 5045 exports.__esModule = true; 5046 5047 var _visitor = __webpack_require__(88); 5048 5049 var _visitor2 = _interopRequireDefault(_visitor); 5050 5051 function WhitespaceControl() { 5052 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 5053 5054 this.options = options; 5055 } 5056 WhitespaceControl.prototype = new _visitor2['default'](); 5057 5058 WhitespaceControl.prototype.Program = function (program) { 5059 var doStandalone = !this.options.ignoreStandalone; 5060 5061 var isRoot = !this.isRootSeen; 5062 this.isRootSeen = true; 5063 5064 var body = program.body; 5065 for (var i = 0, l = body.length; i < l; i++) { 5066 var current = body[i], 5067 strip = this.accept(current); 5068 5069 if (!strip) { 5070 continue; 5071 } 5072 5073 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 5074 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 5075 openStandalone = strip.openStandalone && _isPrevWhitespace, 5076 closeStandalone = strip.closeStandalone && _isNextWhitespace, 5077 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 5078 5079 if (strip.close) { 5080 omitRight(body, i, true); 5081 } 5082 if (strip.open) { 5083 omitLeft(body, i, true); 5084 } 5085 5086 if (doStandalone && inlineStandalone) { 5087 omitRight(body, i); 5088 5089 if (omitLeft(body, i)) { 5090 // If we are on a standalone node, save the indent info for partials 5091 if (current.type === 'PartialStatement') { 5092 // Pull out the whitespace from the final line 5093 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 5094 } 5095 } 5096 } 5097 if (doStandalone && openStandalone) { 5098 omitRight((current.program || current.inverse).body); 5099 5100 // Strip out the previous content node if it's whitespace only 5101 omitLeft(body, i); 5102 } 5103 if (doStandalone && closeStandalone) { 5104 // Always strip the next node 5105 omitRight(body, i); 5106 5107 omitLeft((current.inverse || current.program).body); 5108 } 5109 } 5110 5111 return program; 5112 }; 5113 5114 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 5115 this.accept(block.program); 5116 this.accept(block.inverse); 5117 5118 // Find the inverse program that is involed with whitespace stripping. 5119 var program = block.program || block.inverse, 5120 inverse = block.program && block.inverse, 5121 firstInverse = inverse, 5122 lastInverse = inverse; 5123 5124 if (inverse && inverse.chained) { 5125 firstInverse = inverse.body[0].program; 5126 5127 // Walk the inverse chain to find the last inverse that is actually in the chain. 5128 while (lastInverse.chained) { 5129 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 5130 } 5131 } 5132 5133 var strip = { 5134 open: block.openStrip.open, 5135 close: block.closeStrip.close, 5136 5137 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 5138 // so our parent can determine if we actually are standalone 5139 openStandalone: isNextWhitespace(program.body), 5140 closeStandalone: isPrevWhitespace((firstInverse || program).body) 5141 }; 5142 5143 if (block.openStrip.close) { 5144 omitRight(program.body, null, true); 5145 } 5146 5147 if (inverse) { 5148 var inverseStrip = block.inverseStrip; 5149 5150 if (inverseStrip.open) { 5151 omitLeft(program.body, null, true); 5152 } 5153 5154 if (inverseStrip.close) { 5155 omitRight(firstInverse.body, null, true); 5156 } 5157 if (block.closeStrip.open) { 5158 omitLeft(lastInverse.body, null, true); 5159 } 5160 5161 // Find standalone else statments 5162 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 5163 omitLeft(program.body); 5164 omitRight(firstInverse.body); 5165 } 5166 } else if (block.closeStrip.open) { 5167 omitLeft(program.body, null, true); 5168 } 5169 5170 return strip; 5171 }; 5172 5173 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 5174 return mustache.strip; 5175 }; 5176 5177 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 5178 /* istanbul ignore next */ 5179 var strip = node.strip || {}; 5180 return { 5181 inlineStandalone: true, 5182 open: strip.open, 5183 close: strip.close 5184 }; 5185 }; 5186 5187 function isPrevWhitespace(body, i, isRoot) { 5188 if (i === undefined) { 5189 i = body.length; 5190 } 5191 5192 // Nodes that end with newlines are considered whitespace (but are special 5193 // cased for strip operations) 5194 var prev = body[i - 1], 5195 sibling = body[i - 2]; 5196 if (!prev) { 5197 return isRoot; 5198 } 5199 5200 if (prev.type === 'ContentStatement') { 5201 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 5202 } 5203 } 5204 function isNextWhitespace(body, i, isRoot) { 5205 if (i === undefined) { 5206 i = -1; 5207 } 5208 5209 var next = body[i + 1], 5210 sibling = body[i + 2]; 5211 if (!next) { 5212 return isRoot; 5213 } 5214 5215 if (next.type === 'ContentStatement') { 5216 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 5217 } 5218 } 5219 5220 // Marks the node to the right of the position as omitted. 5221 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 5222 // 5223 // If i is undefined, then the first child will be marked as such. 5224 // 5225 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 5226 // content is met. 5227 function omitRight(body, i, multiple) { 5228 var current = body[i == null ? 0 : i + 1]; 5229 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 5230 return; 5231 } 5232 5233 var original = current.value; 5234 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 5235 current.rightStripped = current.value !== original; 5236 } 5237 5238 // Marks the node to the left of the position as omitted. 5239 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 5240 // 5241 // If i is undefined then the last child will be marked as such. 5242 // 5243 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 5244 // content is met. 5245 function omitLeft(body, i, multiple) { 5246 var current = body[i == null ? body.length - 1 : i - 1]; 5247 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 5248 return; 5249 } 5250 5251 // We omit the last node if it's whitespace only and not preceded by a non-content node. 5252 var original = current.value; 5253 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 5254 current.leftStripped = current.value !== original; 5255 return current.leftStripped; 5256 } 5257 5258 exports['default'] = WhitespaceControl; 5259 module.exports = exports['default']; 5260 5261/***/ }), 5262/* 88 */ 5263/***/ (function(module, exports, __webpack_require__) { 5264 5265 'use strict'; 5266 5267 var _interopRequireDefault = __webpack_require__(1)['default']; 5268 5269 exports.__esModule = true; 5270 5271 var _exception = __webpack_require__(6); 5272 5273 var _exception2 = _interopRequireDefault(_exception); 5274 5275 function Visitor() { 5276 this.parents = []; 5277 } 5278 5279 Visitor.prototype = { 5280 constructor: Visitor, 5281 mutating: false, 5282 5283 // Visits a given value. If mutating, will replace the value if necessary. 5284 acceptKey: function acceptKey(node, name) { 5285 var value = this.accept(node[name]); 5286 if (this.mutating) { 5287 // Hacky sanity check: This may have a few false positives for type for the helper 5288 // methods but will generally do the right thing without a lot of overhead. 5289 if (value && !Visitor.prototype[value.type]) { 5290 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 5291 } 5292 node[name] = value; 5293 } 5294 }, 5295 5296 // Performs an accept operation with added sanity check to ensure 5297 // required keys are not removed. 5298 acceptRequired: function acceptRequired(node, name) { 5299 this.acceptKey(node, name); 5300 5301 if (!node[name]) { 5302 throw new _exception2['default'](node.type + ' requires ' + name); 5303 } 5304 }, 5305 5306 // Traverses a given array. If mutating, empty respnses will be removed 5307 // for child elements. 5308 acceptArray: function acceptArray(array) { 5309 for (var i = 0, l = array.length; i < l; i++) { 5310 this.acceptKey(array, i); 5311 5312 if (!array[i]) { 5313 array.splice(i, 1); 5314 i--; 5315 l--; 5316 } 5317 } 5318 }, 5319 5320 accept: function accept(object) { 5321 if (!object) { 5322 return; 5323 } 5324 5325 /* istanbul ignore next: Sanity code */ 5326 if (!this[object.type]) { 5327 throw new _exception2['default']('Unknown type: ' + object.type, object); 5328 } 5329 5330 if (this.current) { 5331 this.parents.unshift(this.current); 5332 } 5333 this.current = object; 5334 5335 var ret = this[object.type](object); 5336 5337 this.current = this.parents.shift(); 5338 5339 if (!this.mutating || ret) { 5340 return ret; 5341 } else if (ret !== false) { 5342 return object; 5343 } 5344 }, 5345 5346 Program: function Program(program) { 5347 this.acceptArray(program.body); 5348 }, 5349 5350 MustacheStatement: visitSubExpression, 5351 Decorator: visitSubExpression, 5352 5353 BlockStatement: visitBlock, 5354 DecoratorBlock: visitBlock, 5355 5356 PartialStatement: visitPartial, 5357 PartialBlockStatement: function PartialBlockStatement(partial) { 5358 visitPartial.call(this, partial); 5359 5360 this.acceptKey(partial, 'program'); 5361 }, 5362 5363 ContentStatement: function ContentStatement() /* content */{}, 5364 CommentStatement: function CommentStatement() /* comment */{}, 5365 5366 SubExpression: visitSubExpression, 5367 5368 PathExpression: function PathExpression() /* path */{}, 5369 5370 StringLiteral: function StringLiteral() /* string */{}, 5371 NumberLiteral: function NumberLiteral() /* number */{}, 5372 BooleanLiteral: function BooleanLiteral() /* bool */{}, 5373 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 5374 NullLiteral: function NullLiteral() /* literal */{}, 5375 5376 Hash: function Hash(hash) { 5377 this.acceptArray(hash.pairs); 5378 }, 5379 HashPair: function HashPair(pair) { 5380 this.acceptRequired(pair, 'value'); 5381 } 5382 }; 5383 5384 function visitSubExpression(mustache) { 5385 this.acceptRequired(mustache, 'path'); 5386 this.acceptArray(mustache.params); 5387 this.acceptKey(mustache, 'hash'); 5388 } 5389 function visitBlock(block) { 5390 visitSubExpression.call(this, block); 5391 5392 this.acceptKey(block, 'program'); 5393 this.acceptKey(block, 'inverse'); 5394 } 5395 function visitPartial(partial) { 5396 this.acceptRequired(partial, 'name'); 5397 this.acceptArray(partial.params); 5398 this.acceptKey(partial, 'hash'); 5399 } 5400 5401 exports['default'] = Visitor; 5402 module.exports = exports['default']; 5403 5404/***/ }), 5405/* 89
vendor: 5,593 bytes, lines 5405-5636
5405 */ 5406/***/ (function(module, exports, __webpack_require__) { 5407 5408 'use strict'; 5409 5410 var _interopRequireDefault = __webpack_require__(1)['default']; 5411 5412 exports.__esModule = true; 5413 exports.SourceLocation = SourceLocation; 5414 exports.id = id; 5415 exports.stripFlags = stripFlags; 5416 exports.stripComment = stripComment; 5417 exports.preparePath = preparePath; 5418 exports.prepareMustache = prepareMustache; 5419 exports.prepareRawBlock = prepareRawBlock; 5420 exports.prepareBlock = prepareBlock; 5421 exports.prepareProgram = prepareProgram; 5422 exports.preparePartialBlock = preparePartialBlock; 5423 5424 var _exception = __webpack_require__(6); 5425 5426 var _exception2 = _interopRequireDefault(_exception); 5427 5428 function validateClose(open, close) { 5429 close = close.path ? close.path.original : close; 5430 5431 if (open.path.original !== close) { 5432 var errorNode = { loc: open.path.loc }; 5433 5434 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 5435 } 5436 } 5437 5438 function SourceLocation(source, locInfo) { 5439 this.source = source; 5440 this.start = { 5441 line: locInfo.first_line, 5442 column: locInfo.first_column 5443 }; 5444 this.end = { 5445 line: locInfo.last_line, 5446 column: locInfo.last_column 5447 }; 5448 } 5449 5450 function id(token) { 5451 if (/^\[.*\]$/.test(token)) { 5452 return token.substring(1, token.length - 1); 5453 } else { 5454 return token; 5455 } 5456 } 5457 5458 function stripFlags(open, close) { 5459 return { 5460 open: open.charAt(2) === '~', 5461 close: close.charAt(close.length - 3) === '~' 5462 }; 5463 } 5464 5465 function stripComment(comment) { 5466 return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 5467 } 5468 5469 function preparePath(data, parts, loc) { 5470 loc = this.locInfo(loc); 5471 5472 var original = data ? '@' : '', 5473 dig = [], 5474 depth = 0; 5475 5476 for (var i = 0, l = parts.length; i < l; i++) { 5477 var part = parts[i].part, 5478 5479 // If we have [] syntax then we do not treat path references as operators, 5480 // i.e. foo.[this] resolves to approximately context.foo['this'] 5481 isLiteral = parts[i].original !== part; 5482 original += (parts[i].separator || '') + part; 5483 5484 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 5485 if (dig.length > 0) { 5486 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 5487 } else if (part === '..') { 5488 depth++; 5489 } 5490 } else { 5491 dig.push(part); 5492 } 5493 } 5494 5495 return { 5496 type: 'PathExpression', 5497 data: data, 5498 depth: depth, 5499 parts: dig, 5500 original: original, 5501 loc: loc 5502 }; 5503 } 5504 5505 function prepareMustache(path, params, hash, open, strip, locInfo) { 5506 // Must use charAt to support IE pre-10 5507 var escapeFlag = open.charAt(3) || open.charAt(2), 5508 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 5509 5510 var decorator = /\*/.test(open); 5511 return { 5512 type: decorator ? 'Decorator' : 'MustacheStatement', 5513 path: path, 5514 params: params, 5515 hash: hash, 5516 escaped: escaped, 5517 strip: strip, 5518 loc: this.locInfo(locInfo) 5519 }; 5520 } 5521 5522 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 5523 validateClose(openRawBlock, close); 5524 5525 locInfo = this.locInfo(locInfo); 5526 var program = { 5527 type: 'Program', 5528 body: contents, 5529 strip: {}, 5530 loc: locInfo 5531 }; 5532 5533 return { 5534 type: 'BlockStatement', 5535 path: openRawBlock.path, 5536 params: openRawBlock.params, 5537 hash: openRawBlock.hash, 5538 program: program, 5539 openStrip: {}, 5540 inverseStrip: {}, 5541 closeStrip: {}, 5542 loc: locInfo 5543 }; 5544 } 5545 5546 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 5547 if (close && close.path) { 5548 validateClose(openBlock, close); 5549 } 5550 5551 var decorator = /\*/.test(openBlock.open); 5552 5553 program.blockParams = openBlock.blockParams; 5554 5555 var inverse = undefined, 5556 inverseStrip = undefined; 5557 5558 if (inverseAndProgram) { 5559 if (decorator) { 5560 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 5561 } 5562 5563 if (inverseAndProgram.chain) { 5564 inverseAndProgram.program.body[0].closeStrip = close.strip; 5565 } 5566 5567 inverseStrip = inverseAndProgram.strip; 5568 inverse = inverseAndProgram.program; 5569 } 5570 5571 if (inverted) { 5572 inverted = inverse; 5573 inverse = program; 5574 program = inverted; 5575 } 5576 5577 return { 5578 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 5579 path: openBlock.path, 5580 params: openBlock.params, 5581 hash: openBlock.hash, 5582 program: program, 5583 inverse: inverse, 5584 openStrip: openBlock.strip, 5585 inverseStrip: inverseStrip, 5586 closeStrip: close && close.strip, 5587 loc: this.locInfo(locInfo) 5588 }; 5589 } 5590 5591 function prepareProgram(statements, loc) { 5592 if (!loc && statements.length) { 5593 var firstLoc = statements[0].loc, 5594 lastLoc = statements[statements.length - 1].loc; 5595 5596 /* istanbul ignore else */ 5597 if (firstLoc && lastLoc) { 5598 loc = { 5599 source: firstLoc.source, 5600 start: { 5601 line: firstLoc.start.line, 5602 column: firstLoc.start.column 5603 }, 5604 end: { 5605 line: lastLoc.end.line, 5606 column: lastLoc.end.column 5607 } 5608 }; 5609 } 5610 } 5611 5612 return { 5613 type: 'Program', 5614 body: statements, 5615 strip: {}, 5616 loc: loc 5617 }; 5618 } 5619 5620 function preparePartialBlock(open, program, close, locInfo) { 5621 validateClose(open, close); 5622 5623 return { 5624 type: 'PartialBlockStatement', 5625 name: open.path, 5626 params: open.params, 5627 hash: open.hash, 5628 program: program, 5629 openStrip: open.strip, 5630 closeStrip: close && close.strip, 5631 loc: this.locInfo(locInfo) 5632 }; 5633 } 5634 5635/***/ }), 5636/*
563690 */ 5637/***/ (function(module, exports, __webpack_require__) { 5638 5639 /* eslint-disable new-cap */ 5640 5641 'use strict'; 5642 5643 var _Object$create = __webpack_require__(74)['default']; 5644 5645 var _interopRequireDefault = __webpack_require__(1)['default']; 5646 5647 exports.__esModule = true; 5648 exports.Compiler = Compiler; 5649 exports.precompile = precompile; 5650 exports.compile = compile; 5651 5652 var _exception = __webpack_require__(6); 5653 5654 var _exception2 = _interopRequireDefault(_exception); 5655 5656 var _utils = __webpack_require__(5); 5657 5658 var _ast = __webpack_require__(84
vendor: 15,890 bytes, lines 5658-6207
5658); 5659 5660 var _ast2 = _interopRequireDefault(_ast); 5661 5662 var slice = [].slice; 5663 5664 function Compiler() {} 5665 5666 // the foundHelper register will disambiguate helper lookup from finding a 5667 // function in a context. This is necessary for mustache compatibility, which 5668 // requires that context functions in blocks are evaluated by blockHelperMissing, 5669 // and then proceed as if the resulting value was provided to blockHelperMissing. 5670 5671 Compiler.prototype = { 5672 compiler: Compiler, 5673 5674 equals: function equals(other) { 5675 var len = this.opcodes.length; 5676 if (other.opcodes.length !== len) { 5677 return false; 5678 } 5679 5680 for (var i = 0; i < len; i++) { 5681 var opcode = this.opcodes[i], 5682 otherOpcode = other.opcodes[i]; 5683 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 5684 return false; 5685 } 5686 } 5687 5688 // We know that length is the same between the two arrays because they are directly tied 5689 // to the opcode behavior above. 5690 len = this.children.length; 5691 for (var i = 0; i < len; i++) { 5692 if (!this.children[i].equals(other.children[i])) { 5693 return false; 5694 } 5695 } 5696 5697 return true; 5698 }, 5699 5700 guid: 0, 5701 5702 compile: function compile(program, options) { 5703 this.sourceNode = []; 5704 this.opcodes = []; 5705 this.children = []; 5706 this.options = options; 5707 this.stringParams = options.stringParams; 5708 this.trackIds = options.trackIds; 5709 5710 options.blockParams = options.blockParams || []; 5711 5712 options.knownHelpers = _utils.extend(_Object$create(null), { 5713 helperMissing: true, 5714 blockHelperMissing: true, 5715 each: true, 5716 'if': true, 5717 unless: true, 5718 'with': true, 5719 log: true, 5720 lookup: true 5721 }, options.knownHelpers); 5722 5723 return this.accept(program); 5724 }, 5725 5726 compileProgram: function compileProgram(program) { 5727 var childCompiler = new this.compiler(), 5728 // eslint-disable-line new-cap 5729 result = childCompiler.compile(program, this.options), 5730 guid = this.guid++; 5731 5732 this.usePartial = this.usePartial || result.usePartial; 5733 5734 this.children[guid] = result; 5735 this.useDepths = this.useDepths || result.useDepths; 5736 5737 return guid; 5738 }, 5739 5740 accept: function accept(node) { 5741 /* istanbul ignore next: Sanity code */ 5742 if (!this[node.type]) { 5743 throw new _exception2['default']('Unknown type: ' + node.type, node); 5744 } 5745 5746 this.sourceNode.unshift(node); 5747 var ret = this[node.type](node); 5748 this.sourceNode.shift(); 5749 return ret; 5750 }, 5751 5752 Program: function Program(program) { 5753 this.options.blockParams.unshift(program.blockParams); 5754 5755 var body = program.body, 5756 bodyLength = body.length; 5757 for (var i = 0; i < bodyLength; i++) { 5758 this.accept(body[i]); 5759 } 5760 5761 this.options.blockParams.shift(); 5762 5763 this.isSimple = bodyLength === 1; 5764 this.blockParams = program.blockParams ? program.blockParams.length : 0; 5765 5766 return this; 5767 }, 5768 5769 BlockStatement: function BlockStatement(block) { 5770 transformLiteralToPath(block); 5771 5772 var program = block.program, 5773 inverse = block.inverse; 5774 5775 program = program && this.compileProgram(program); 5776 inverse = inverse && this.compileProgram(inverse); 5777 5778 var type = this.classifySexpr(block); 5779 5780 if (type === 'helper') { 5781 this.helperSexpr(block, program, inverse); 5782 } else if (type === 'simple') { 5783 this.simpleSexpr(block); 5784 5785 // now that the simple mustache is resolved, we need to 5786 // evaluate it by executing `blockHelperMissing` 5787 this.opcode('pushProgram', program); 5788 this.opcode('pushProgram', inverse); 5789 this.opcode('emptyHash'); 5790 this.opcode('blockValue', block.path.original); 5791 } else { 5792 this.ambiguousSexpr(block, program, inverse); 5793 5794 // now that the simple mustache is resolved, we need to 5795 // evaluate it by executing `blockHelperMissing` 5796 this.opcode('pushProgram', program); 5797 this.opcode('pushProgram', inverse); 5798 this.opcode('emptyHash'); 5799 this.opcode('ambiguousBlockValue'); 5800 } 5801 5802 this.opcode('append'); 5803 }, 5804 5805 DecoratorBlock: function DecoratorBlock(decorator) { 5806 var program = decorator.program && this.compileProgram(decorator.program); 5807 var params = this.setupFullMustacheParams(decorator, program, undefined), 5808 path = decorator.path; 5809 5810 this.useDecorators = true; 5811 this.opcode('registerDecorator', params.length, path.original); 5812 }, 5813 5814 PartialStatement: function PartialStatement(partial) { 5815 this.usePartial = true; 5816 5817 var program = partial.program; 5818 if (program) { 5819 program = this.compileProgram(partial.program); 5820 } 5821 5822 var params = partial.params; 5823 if (params.length > 1) { 5824 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 5825 } else if (!params.length) { 5826 if (this.options.explicitPartialContext) { 5827 this.opcode('pushLiteral', 'undefined'); 5828 } else { 5829 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 5830 } 5831 } 5832 5833 var partialName = partial.name.original, 5834 isDynamic = partial.name.type === 'SubExpression'; 5835 if (isDynamic) { 5836 this.accept(partial.name); 5837 } 5838 5839 this.setupFullMustacheParams(partial, program, undefined, true); 5840 5841 var indent = partial.indent || ''; 5842 if (this.options.preventIndent && indent) { 5843 this.opcode('appendContent', indent); 5844 indent = ''; 5845 } 5846 5847 this.opcode('invokePartial', isDynamic, partialName, indent); 5848 this.opcode('append'); 5849 }, 5850 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 5851 this.PartialStatement(partialBlock); 5852 }, 5853 5854 MustacheStatement: function MustacheStatement(mustache) { 5855 this.SubExpression(mustache); 5856 5857 if (mustache.escaped && !this.options.noEscape) { 5858 this.opcode('appendEscaped'); 5859 } else { 5860 this.opcode('append'); 5861 } 5862 }, 5863 Decorator: function Decorator(decorator) { 5864 this.DecoratorBlock(decorator); 5865 }, 5866 5867 ContentStatement: function ContentStatement(content) { 5868 if (content.value) { 5869 this.opcode('appendContent', content.value); 5870 } 5871 }, 5872 5873 CommentStatement: function CommentStatement() {}, 5874 5875 SubExpression: function SubExpression(sexpr) { 5876 transformLiteralToPath(sexpr); 5877 var type = this.classifySexpr(sexpr); 5878 5879 if (type === 'simple') { 5880 this.simpleSexpr(sexpr); 5881 } else if (type === 'helper') { 5882 this.helperSexpr(sexpr); 5883 } else { 5884 this.ambiguousSexpr(sexpr); 5885 } 5886 }, 5887 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 5888 var path = sexpr.path, 5889 name = path.parts[0], 5890 isBlock = program != null || inverse != null; 5891 5892 this.opcode('getContext', path.depth); 5893 5894 this.opcode('pushProgram', program); 5895 this.opcode('pushProgram', inverse); 5896 5897 path.strict = true; 5898 this.accept(path); 5899 5900 this.opcode('invokeAmbiguous', name, isBlock); 5901 }, 5902 5903 simpleSexpr: function simpleSexpr(sexpr) { 5904 var path = sexpr.path; 5905 path.strict = true; 5906 this.accept(path); 5907 this.opcode('resolvePossibleLambda'); 5908 }, 5909 5910 helperSexpr: function helperSexpr(sexpr, program, inverse) { 5911 var params = this.setupFullMustacheParams(sexpr, program, inverse), 5912 path = sexpr.path, 5913 name = path.parts[0]; 5914 5915 if (this.options.knownHelpers[name]) { 5916 this.opcode('invokeKnownHelper', params.length, name); 5917 } else if (this.options.knownHelpersOnly) { 5918 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 5919 } else { 5920 path.strict = true; 5921 path.falsy = true; 5922 5923 this.accept(path); 5924 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 5925 } 5926 }, 5927 5928 PathExpression: function PathExpression(path) { 5929 this.addDepth(path.depth); 5930 this.opcode('getContext', path.depth); 5931 5932 var name = path.parts[0], 5933 scoped = _ast2['default'].helpers.scopedId(path), 5934 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 5935 5936 if (blockParamId) { 5937 this.opcode('lookupBlockParam', blockParamId, path.parts); 5938 } else if (!name) { 5939 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 5940 this.opcode('pushContext'); 5941 } else if (path.data) { 5942 this.options.data = true; 5943 this.opcode('lookupData', path.depth, path.parts, path.strict); 5944 } else { 5945 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 5946 } 5947 }, 5948 5949 StringLiteral: function StringLiteral(string) { 5950 this.opcode('pushString', string.value); 5951 }, 5952 5953 NumberLiteral: function NumberLiteral(number) { 5954 this.opcode('pushLiteral', number.value); 5955 }, 5956 5957 BooleanLiteral: function BooleanLiteral(bool) { 5958 this.opcode('pushLiteral', bool.value); 5959 }, 5960 5961 UndefinedLiteral: function UndefinedLiteral() { 5962 this.opcode('pushLiteral', 'undefined'); 5963 }, 5964 5965 NullLiteral: function NullLiteral() { 5966 this.opcode('pushLiteral', 'null'); 5967 }, 5968 5969 Hash: function Hash(hash) { 5970 var pairs = hash.pairs, 5971 i = 0, 5972 l = pairs.length; 5973 5974 this.opcode('pushHash'); 5975 5976 for (; i < l; i++) { 5977 this.pushParam(pairs[i].value); 5978 } 5979 while (i--) { 5980 this.opcode('assignToHash', pairs[i].key); 5981 } 5982 this.opcode('popHash'); 5983 }, 5984 5985 // HELPERS 5986 opcode: function opcode(name) { 5987 this.opcodes.push({ 5988 opcode: name, 5989 args: slice.call(arguments, 1), 5990 loc: this.sourceNode[0].loc 5991 }); 5992 }, 5993 5994 addDepth: function addDepth(depth) { 5995 if (!depth) { 5996 return; 5997 } 5998 5999 this.useDepths = true; 6000 }, 6001 6002 classifySexpr: function classifySexpr(sexpr) { 6003 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 6004 6005 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 6006 6007 // a mustache is an eligible helper if: 6008 // * its id is simple (a single part, not `this` or `..`) 6009 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 6010 6011 // if a mustache is an eligible helper but not a definite 6012 // helper, it is ambiguous, and will be resolved in a later 6013 // pass or at runtime. 6014 var isEligible = !isBlockParam && (isHelper || isSimple); 6015 6016 // if ambiguous, we can possibly resolve the ambiguity now 6017 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 6018 if (isEligible && !isHelper) { 6019 var _name = sexpr.path.parts[0], 6020 options = this.options; 6021 if (options.knownHelpers[_name]) { 6022 isHelper = true; 6023 } else if (options.knownHelpersOnly) { 6024 isEligible = false; 6025 } 6026 } 6027 6028 if (isHelper) { 6029 return 'helper'; 6030 } else if (isEligible) { 6031 return 'ambiguous'; 6032 } else { 6033 return 'simple'; 6034 } 6035 }, 6036 6037 pushParams: function pushParams(params) { 6038 for (var i = 0, l = params.length; i < l; i++) { 6039 this.pushParam(params[i]); 6040 } 6041 }, 6042 6043 pushParam: function pushParam(val) { 6044 var value = val.value != null ? val.value : val.original || ''; 6045 6046 if (this.stringParams) { 6047 if (value.replace) { 6048 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 6049 } 6050 6051 if (val.depth) { 6052 this.addDepth(val.depth); 6053 } 6054 this.opcode('getContext', val.depth || 0); 6055 this.opcode('pushStringParam', value, val.type); 6056 6057 if (val.type === 'SubExpression') { 6058 // SubExpressions get evaluated and passed in 6059 // in string params mode. 6060 this.accept(val); 6061 } 6062 } else { 6063 if (this.trackIds) { 6064 var blockParamIndex = undefined; 6065 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 6066 blockParamIndex = this.blockParamIndex(val.parts[0]); 6067 } 6068 if (blockParamIndex) { 6069 var blockParamChild = val.parts.slice(1).join('.'); 6070 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 6071 } else { 6072 value = val.original || value; 6073 if (value.replace) { 6074 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 6075 } 6076 6077 this.opcode('pushId', val.type, value); 6078 } 6079 } 6080 this.accept(val); 6081 } 6082 }, 6083 6084 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 6085 var params = sexpr.params; 6086 this.pushParams(params); 6087 6088 this.opcode('pushProgram', program); 6089 this.opcode('pushProgram', inverse); 6090 6091 if (sexpr.hash) { 6092 this.accept(sexpr.hash); 6093 } else { 6094 this.opcode('emptyHash', omitEmpty); 6095 } 6096 6097 return params; 6098 }, 6099 6100 blockParamIndex: function blockParamIndex(name) { 6101 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 6102 var blockParams = this.options.blockParams[depth], 6103 param = blockParams && _utils.indexOf(blockParams, name); 6104 if (blockParams && param >= 0) { 6105 return [depth, param]; 6106 } 6107 } 6108 } 6109 }; 6110 6111 function precompile(input, options, env) { 6112 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 6113 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 6114 } 6115 6116 options = options || {}; 6117 if (!('data' in options)) { 6118 options.data = true; 6119 } 6120 if (options.compat) { 6121 options.useDepths = true; 6122 } 6123 6124 var ast = env.parse(input, options), 6125 environment = new env.Compiler().compile(ast, options); 6126 return new env.JavaScriptCompiler().compile(environment, options); 6127 } 6128 6129 function compile(input, options, env) { 6130 if (options === undefined) options = {}; 6131 6132 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 6133 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 6134 } 6135 6136 options = _utils.extend({}, options); 6137 if (!('data' in options)) { 6138 options.data = true; 6139 } 6140 if (options.compat) { 6141 options.useDepths = true; 6142 } 6143 6144 var compiled = undefined; 6145 6146 function compileInput() { 6147 var ast = env.parse(input, options), 6148 environment = new env.Compiler().compile(ast, options), 6149 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 6150 return env.template(templateSpec); 6151 } 6152 6153 // Template is only compiled on first use and cached after that point. 6154 function ret(context, execOptions) { 6155 if (!compiled) { 6156 compiled = compileInput(); 6157 } 6158 return compiled.call(this, context, execOptions); 6159 } 6160 ret._setup = function (setupOptions) { 6161 if (!compiled) { 6162 compiled = compileInput(); 6163 } 6164 return compiled._setup(setupOptions); 6165 }; 6166 ret._child = function (i, data, blockParams, depths) { 6167 if (!compiled) { 6168 compiled = compileInput(); 6169 } 6170 return compiled._child(i, data, blockParams, depths); 6171 }; 6172 return ret; 6173 } 6174 6175 function argEquals(a, b) { 6176 if (a === b) { 6177 return true; 6178 } 6179 6180 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 6181 for (var i = 0; i < a.length; i++) { 6182 if (!argEquals(a[i], b[i])) { 6183 return false; 6184 } 6185 } 6186 return true; 6187 } 6188 } 6189 6190 function transformLiteralToPath(sexpr) { 6191 if (!sexpr.path.parts) { 6192 var literal = sexpr.path; 6193 // Casting to string here to make false and 0 literal values play nicely with the rest 6194 // of the system. 6195 sexpr.path = { 6196 type: 'PathExpression', 6197 data: false, 6198 depth: 0, 6199 parts: [literal.original + ''], 6200 original: literal.original + '', 6201 loc: literal.loc 6202 }; 6203 } 6204 } 6205 6206/***/ }), 6207/* 9
vendor: 5,335 bytes, lines 6207-6376
62071 */ 6208/***/ (function(module, exports, __webpack_require__) { 6209 6210 'use strict'; 6211 6212 var _Object$keys = __webpack_require__(60)['default']; 6213 6214 var _interopRequireDefault = __webpack_require__(1)['default']; 6215 6216 exports.__esModule = true; 6217 6218 var _base = __webpack_require__(4); 6219 6220 var _exception = __webpack_require__(6); 6221 6222 var _exception2 = _interopRequireDefault(_exception); 6223 6224 var _utils = __webpack_require__(5); 6225 6226 var _codeGen = __webpack_require__(92); 6227 6228 var _codeGen2 = _interopRequireDefault(_codeGen); 6229 6230 function Literal(value) { 6231 this.value = value; 6232 } 6233 6234 function JavaScriptCompiler() {} 6235 6236 JavaScriptCompiler.prototype = { 6237 // PUBLIC API: You can override these methods in a subclass to provide 6238 // alternative compiled forms for name lookup and buffering semantics 6239 nameLookup: function nameLookup(parent, name /*, type */) { 6240 return this.internalNameLookup(parent, name); 6241 }, 6242 depthedLookup: function depthedLookup(name) { 6243 return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; 6244 }, 6245 6246 compilerInfo: function compilerInfo() { 6247 var revision = _base.COMPILER_REVISION, 6248 versions = _base.REVISION_CHANGES[revision]; 6249 return [revision, versions]; 6250 }, 6251 6252 appendToBuffer: function appendToBuffer(source, location, explicit) { 6253 // Force a source as this simplifies the merge logic. 6254 if (!_utils.isArray(source)) { 6255 source = [source]; 6256 } 6257 source = this.source.wrap(source, location); 6258 6259 if (this.environment.isSimple) { 6260 return ['return ', source, ';']; 6261 } else if (explicit) { 6262 // This is a case where the buffer operation occurs as a child of another 6263 // construct, generally braces. We have to explicitly output these buffer 6264 // operations to ensure that the emitted code goes in the correct location. 6265 return ['buffer += ', source, ';']; 6266 } else { 6267 source.appendToBuffer = true; 6268 return source; 6269 } 6270 }, 6271 6272 initializeBuffer: function initializeBuffer() { 6273 return this.quotedString(''); 6274 }, 6275 // END PUBLIC API 6276 internalNameLookup: function internalNameLookup(parent, name) { 6277 this.lookupPropertyFunctionIsUsed = true; 6278 return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; 6279 }, 6280 6281 lookupPropertyFunctionIsUsed: false, 6282 6283 compile: function compile(environment, options, context, asObject) { 6284 this.environment = environment; 6285 this.options = options; 6286 this.stringParams = this.options.stringParams; 6287 this.trackIds = this.options.trackIds; 6288 this.precompile = !asObject; 6289 6290 this.name = this.environment.name; 6291 this.isChild = !!context; 6292 this.context = context || { 6293 decorators: [], 6294 programs: [], 6295 environments: [] 6296 }; 6297 6298 this.preamble(); 6299 6300 this.stackSlot = 0; 6301 this.stackVars = []; 6302 this.aliases = {}; 6303 this.registers = { list: [] }; 6304 this.hashes = []; 6305 this.compileStack = []; 6306 this.inlineStack = []; 6307 this.blockParams = []; 6308 6309 this.compileChildren(environment, options); 6310 6311 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 6312 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 6313 6314 var opcodes = environment.opcodes, 6315 opcode = undefined, 6316 firstLoc = undefined, 6317 i = undefined, 6318 l = undefined; 6319 6320 for (i = 0, l = opcodes.length; i < l; i++) { 6321 opcode = opcodes[i]; 6322 6323 this.source.currentLocation = opcode.loc; 6324 firstLoc = firstLoc || opcode.loc; 6325 this[opcode.opcode].apply(this, opcode.args); 6326 } 6327 6328 // Flush any trailing content that might be pending. 6329 this.source.currentLocation = firstLoc; 6330 this.pushSource(''); 6331 6332 /* istanbul ignore next */ 6333 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 6334 throw new _exception2['default']('Compile completed with content left on stack'); 6335 } 6336 6337 if (!this.decorators.isEmpty()) { 6338 this.useDecorators = true; 6339 6340 this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); 6341 this.decorators.push('return fn;'); 6342 6343 if (asObject) { 6344 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 6345 } else { 6346 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 6347 this.decorators.push('}\n'); 6348 this.decorators = this.decorators.merge(); 6349 } 6350 } else { 6351 this.decorators = undefined; 6352 } 6353 6354 var fn = this.createFunctionContext(asObject); 6355 if (!this.isChild) { 6356 var ret = { 6357 compiler: this.compilerInfo(), 6358 main: fn 6359 }; 6360 6361 if (this.decorators) { 6362 ret.main_d = this.decorators; // eslint-disable-line camelcase 6363 ret.useDecorators = true; 6364 } 6365 6366 var _context = this.context; 6367 var programs = _context.programs; 6368 var decorators = _context.decorators; 6369 6370 for (i = 0, l = programs.length; i < l; i++) { 6371 if (programs[i]) { 6372 ret[i] = programs[i]; 6373 if (decorators[i]) { 6374 ret[i + '_d'] = decorators[i]; 6375 ret.useDecorators = true; 6376 }
vendor: 10,178 bytes, lines 6376-6702
6376 6377 } 6378 } 6379 6380 if (this.environment.usePartial) { 6381 ret.usePartial = true; 6382 } 6383 if (this.options.data) { 6384 ret.useData = true; 6385 } 6386 if (this.useDepths) { 6387 ret.useDepths = true; 6388 } 6389 if (this.useBlockParams) { 6390 ret.useBlockParams = true; 6391 } 6392 if (this.options.compat) { 6393 ret.compat = true; 6394 } 6395 6396 if (!asObject) { 6397 ret.compiler = JSON.stringify(ret.compiler); 6398 6399 this.source.currentLocation = { start: { line: 1, column: 0 } }; 6400 ret = this.objectLiteral(ret); 6401 6402 if (options.srcName) { 6403 ret = ret.toStringWithSourceMap({ file: options.destName }); 6404 ret.map = ret.map && ret.map.toString(); 6405 } else { 6406 ret = ret.toString(); 6407 } 6408 } else { 6409 ret.compilerOptions = this.options; 6410 } 6411 6412 return ret; 6413 } else { 6414 return fn; 6415 } 6416 }, 6417 6418 preamble: function preamble() { 6419 // track the last context pushed into place to allow skipping the 6420 // getContext opcode when it would be a noop 6421 this.lastContext = 0; 6422 this.source = new _codeGen2['default'](this.options.srcName); 6423 this.decorators = new _codeGen2['default'](this.options.srcName); 6424 }, 6425 6426 createFunctionContext: function createFunctionContext(asObject) { 6427 // istanbul ignore next 6428 6429 var _this = this; 6430 6431 var varDeclarations = ''; 6432 6433 var locals = this.stackVars.concat(this.registers.list); 6434 if (locals.length > 0) { 6435 varDeclarations += ', ' + locals.join(', '); 6436 } 6437 6438 // Generate minimizer alias mappings 6439 // 6440 // When using true SourceNodes, this will update all references to the given alias 6441 // as the source nodes are reused in situ. For the non-source node compilation mode, 6442 // aliases will not be used, but this case is already being run on the client and 6443 // we aren't concern about minimizing the template size. 6444 var aliasCount = 0; 6445 _Object$keys(this.aliases).forEach(function (alias) { 6446 var node = _this.aliases[alias]; 6447 if (node.children && node.referenceCount > 1) { 6448 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 6449 node.children[0] = 'alias' + aliasCount; 6450 } 6451 }); 6452 6453 if (this.lookupPropertyFunctionIsUsed) { 6454 varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); 6455 } 6456 6457 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 6458 6459 if (this.useBlockParams || this.useDepths) { 6460 params.push('blockParams'); 6461 } 6462 if (this.useDepths) { 6463 params.push('depths'); 6464 } 6465 6466 // Perform a second pass over the output to merge content when possible 6467 var source = this.mergeSource(varDeclarations); 6468 6469 if (asObject) { 6470 params.push(source); 6471 6472 return Function.apply(this, params); 6473 } else { 6474 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 6475 } 6476 }, 6477 mergeSource: function mergeSource(varDeclarations) { 6478 var isSimple = this.environment.isSimple, 6479 appendOnly = !this.forceBuffer, 6480 appendFirst = undefined, 6481 sourceSeen = undefined, 6482 bufferStart = undefined, 6483 bufferEnd = undefined; 6484 this.source.each(function (line) { 6485 if (line.appendToBuffer) { 6486 if (bufferStart) { 6487 line.prepend(' + '); 6488 } else { 6489 bufferStart = line; 6490 } 6491 bufferEnd = line; 6492 } else { 6493 if (bufferStart) { 6494 if (!sourceSeen) { 6495 appendFirst = true; 6496 } else { 6497 bufferStart.prepend('buffer += '); 6498 } 6499 bufferEnd.add(';'); 6500 bufferStart = bufferEnd = undefined; 6501 } 6502 6503 sourceSeen = true; 6504 if (!isSimple) { 6505 appendOnly = false; 6506 } 6507 } 6508 }); 6509 6510 if (appendOnly) { 6511 if (bufferStart) { 6512 bufferStart.prepend('return '); 6513 bufferEnd.add(';'); 6514 } else if (!sourceSeen) { 6515 this.source.push('return "";'); 6516 } 6517 } else { 6518 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 6519 6520 if (bufferStart) { 6521 bufferStart.prepend('return buffer + '); 6522 bufferEnd.add(';'); 6523 } else { 6524 this.source.push('return buffer;'); 6525 } 6526 } 6527 6528 if (varDeclarations) { 6529 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 6530 } 6531 6532 return this.source.merge(); 6533 }, 6534 6535 lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { 6536 return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); 6537 }, 6538 6539 // [blockValue] 6540 // 6541 // On stack, before: hash, inverse, program, value 6542 // On stack, after: return value of blockHelperMissing 6543 // 6544 // The purpose of this opcode is to take a block of the form 6545 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 6546 // replace it on the stack with the result of properly 6547 // invoking blockHelperMissing. 6548 blockValue: function blockValue(name) { 6549 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 6550 params = [this.contextName(0)]; 6551 this.setupHelperArgs(name, 0, params); 6552 6553 var blockName = this.popStack(); 6554 params.splice(1, 0, blockName); 6555 6556 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 6557 }, 6558 6559 // [ambiguousBlockValue] 6560 // 6561 // On stack, before: hash, inverse, program, value 6562 // Compiler value, before: lastHelper=value of last found helper, if any 6563 // On stack, after, if no lastHelper: same as [blockValue] 6564 // On stack, after, if lastHelper: value 6565 ambiguousBlockValue: function ambiguousBlockValue() { 6566 // We're being a bit cheeky and reusing the options value from the prior exec 6567 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 6568 params = [this.contextName(0)]; 6569 this.setupHelperArgs('', 0, params, true); 6570 6571 this.flushInline(); 6572 6573 var current = this.topStack(); 6574 params.splice(1, 0, current); 6575 6576 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 6577 }, 6578 6579 // [appendContent] 6580 // 6581 // On stack, before: ... 6582 // On stack, after: ... 6583 // 6584 // Appends the string value of `content` to the current buffer 6585 appendContent: function appendContent(content) { 6586 if (this.pendingContent) { 6587 content = this.pendingContent + content; 6588 } else { 6589 this.pendingLocation = this.source.currentLocation; 6590 } 6591 6592 this.pendingContent = content; 6593 }, 6594 6595 // [append] 6596 // 6597 // On stack, before: value, ... 6598 // On stack, after: ... 6599 // 6600 // Coerces `value` to a String and appends it to the current buffer. 6601 // 6602 // If `value` is truthy, or 0, it is coerced into a string and appended 6603 // Otherwise, the empty string is appended 6604 append: function append() { 6605 if (this.isInline()) { 6606 this.replaceStack(function (current) { 6607 return [' != null ? ', current, ' : ""']; 6608 }); 6609 6610 this.pushSource(this.appendToBuffer(this.popStack())); 6611 } else { 6612 var local = this.popStack(); 6613 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 6614 if (this.environment.isSimple) { 6615 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 6616 } 6617 } 6618 }, 6619 6620 // [appendEscaped] 6621 // 6622 // On stack, before: value, ... 6623 // On stack, after: ... 6624 // 6625 // Escape `value` and append it to the buffer 6626 appendEscaped: function appendEscaped() { 6627 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 6628 }, 6629 6630 // [getContext] 6631 // 6632 // On stack, before: ... 6633 // On stack, after: ... 6634 // Compiler value, after: lastContext=depth 6635 // 6636 // Set the value of the `lastContext` compiler value to the depth 6637 getContext: function getContext(depth) { 6638 this.lastContext = depth; 6639 }, 6640 6641 // [pushContext] 6642 // 6643 // On stack, before: ... 6644 // On stack, after: currentContext, ... 6645 // 6646 // Pushes the value of the current context onto the stack. 6647 pushContext: function pushContext() { 6648 this.pushStackLiteral(this.contextName(this.lastContext)); 6649 }, 6650 6651 // [lookupOnContext] 6652 // 6653 // On stack, before: ... 6654 // On stack, after: currentContext[name], ... 6655 // 6656 // Looks up the value of `name` on the current context and pushes 6657 // it onto the stack. 6658 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 6659 var i = 0; 6660 6661 if (!scoped && this.options.compat && !this.lastContext) { 6662 // The depthed query is expected to handle the undefined logic for the root level that 6663 // is implemented below, so we evaluate that directly in compat mode 6664 this.push(this.depthedLookup(parts[i++])); 6665 } else { 6666 this.pushContext(); 6667 } 6668 6669 this.resolvePath('context', parts, i, falsy, strict); 6670 }, 6671 6672 // [lookupBlockParam] 6673 // 6674 // On stack, before: ... 6675 // On stack, after: blockParam[name], ... 6676 // 6677 // Looks up the value of `parts` on the given block param and pushes 6678 // it onto the stack. 6679 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 6680 this.useBlockParams = true; 6681 6682 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 6683 this.resolvePath('context', parts, 1); 6684 }, 6685 6686 // [lookupData] 6687 // 6688 // On stack, before: ... 6689 // On stack, after: data, ... 6690 // 6691 // Push the data lookup operator 6692 lookupData: function lookupData(depth, parts, strict) { 6693 if (!depth) { 6694 this.pushStackLiteral('data'); 6695 } else { 6696 this.pushStackLiteral('container.data(data, ' + depth + ')'); 6697 } 6698 6699 this.resolvePath('data', parts, 0, true, strict); 6700 }, 6701 6702 resolvePath: function resolvePath(type, parts,
vendor: 2,919 bytes, lines 6702-6799
6702i, falsy, strict) { 6703 // istanbul ignore next 6704 6705 var _this2 = this; 6706 6707 if (this.options.strict || this.options.assumeObjects) { 6708 this.push(strictLookup(this.options.strict && strict, this, parts, i, type)); 6709 return; 6710 } 6711 6712 var len = parts.length; 6713 for (; i < len; i++) { 6714 /* eslint-disable no-loop-func */ 6715 this.replaceStack(function (current) { 6716 var lookup = _this2.nameLookup(current, parts[i], type); 6717 // We want to ensure that zero and false are handled properly if the context (falsy flag) 6718 // needs to have the special handling for these values. 6719 if (!falsy) { 6720 return [' != null ? ', lookup, ' : ', current]; 6721 } else { 6722 // Otherwise we can use generic falsy handling 6723 return [' && ', lookup]; 6724 } 6725 }); 6726 /* eslint-enable no-loop-func */ 6727 } 6728 }, 6729 6730 // [resolvePossibleLambda] 6731 // 6732 // On stack, before: value, ... 6733 // On stack, after: resolved value, ... 6734 // 6735 // If the `value` is a lambda, replace it on the stack by 6736 // the return value of the lambda 6737 resolvePossibleLambda: function resolvePossibleLambda() { 6738 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 6739 }, 6740 6741 // [pushStringParam] 6742 // 6743 // On stack, before: ... 6744 // On stack, after: string, currentContext, ... 6745 // 6746 // This opcode is designed for use in string mode, which 6747 // provides the string value of a parameter along with its 6748 // depth rather than resolving it immediately. 6749 pushStringParam: function pushStringParam(string, type) { 6750 this.pushContext(); 6751 this.pushString(type); 6752 6753 // If it's a subexpression, the string result 6754 // will be pushed after this opcode. 6755 if (type !== 'SubExpression') { 6756 if (typeof string === 'string') { 6757 this.pushString(string); 6758 } else { 6759 this.pushStackLiteral(string); 6760 } 6761 } 6762 }, 6763 6764 emptyHash: function emptyHash(omitEmpty) { 6765 if (this.trackIds) { 6766 this.push('{}'); // hashIds 6767 } 6768 if (this.stringParams) { 6769 this.push('{}'); // hashContexts 6770 this.push('{}'); // hashTypes 6771 } 6772 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 6773 }, 6774 pushHash: function pushHash() { 6775 if (this.hash) { 6776 this.hashes.push(this.hash); 6777 } 6778 this.hash = { values: {}, types: [], contexts: [], ids: [] }; 6779 }, 6780 popHash: function popHash() { 6781 var hash = this.hash; 6782 this.hash = this.hashes.pop(); 6783 6784 if (this.trackIds) { 6785 this.push(this.objectLiteral(hash.ids)); 6786 } 6787 if (this.stringParams) { 6788 this.push(this.objectLiteral(hash.contexts)); 6789 this.push(this.objectLiteral(hash.types)); 6790 } 6791 6792 this.push(this.objectLiteral(hash.values)); 6793 }, 6794 6795 // [pushString] 6796 // 6797 // On stack, before: ... 6798 // On stack, after: quotedString(string), ... 6799 //
vendor: 7,424 bytes, lines 6800-7028
6800 // Push a quoted version of `string` onto the stack 6801 pushString: function pushString(string) { 6802 this.pushStackLiteral(this.quotedString(string)); 6803 }, 6804 6805 // [pushLiteral] 6806 // 6807 // On stack, before: ... 6808 // On stack, after: value, ... 6809 // 6810 // Pushes a value onto the stack. This operation prevents 6811 // the compiler from creating a temporary variable to hold 6812 // it. 6813 pushLiteral: function pushLiteral(value) { 6814 this.pushStackLiteral(value); 6815 }, 6816 6817 // [pushProgram] 6818 // 6819 // On stack, before: ... 6820 // On stack, after: program(guid), ... 6821 // 6822 // Push a program expression onto the stack. This takes 6823 // a compile-time guid and converts it into a runtime-accessible 6824 // expression. 6825 pushProgram: function pushProgram(guid) { 6826 if (guid != null) { 6827 this.pushStackLiteral(this.programExpression(guid)); 6828 } else { 6829 this.pushStackLiteral(null); 6830 } 6831 }, 6832 6833 // [registerDecorator] 6834 // 6835 // On stack, before: hash, program, params..., ... 6836 // On stack, after: ... 6837 // 6838 // Pops off the decorator's parameters, invokes the decorator, 6839 // and inserts the decorator into the decorators list. 6840 registerDecorator: function registerDecorator(paramSize, name) { 6841 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 6842 options = this.setupHelperArgs(name, paramSize); 6843 6844 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 6845 }, 6846 6847 // [invokeHelper] 6848 // 6849 // On stack, before: hash, inverse, program, params..., ... 6850 // On stack, after: result of helper invocation 6851 // 6852 // Pops off the helper's parameters, invokes the helper, 6853 // and pushes the helper's return value onto the stack. 6854 // 6855 // If the helper is not found, `helperMissing` is called. 6856 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 6857 var nonHelper = this.popStack(), 6858 helper = this.setupHelper(paramSize, name); 6859 6860 var possibleFunctionCalls = []; 6861 6862 if (isSimple) { 6863 // direct call to helper 6864 possibleFunctionCalls.push(helper.name); 6865 } 6866 // call a function from the input object 6867 possibleFunctionCalls.push(nonHelper); 6868 if (!this.options.strict) { 6869 possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); 6870 } 6871 6872 var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; 6873 var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); 6874 this.push(functionCall); 6875 }, 6876 6877 itemsSeparatedBy: function itemsSeparatedBy(items, separator) { 6878 var result = []; 6879 result.push(items[0]); 6880 for (var i = 1; i < items.length; i++) { 6881 result.push(separator, items[i]); 6882 } 6883 return result; 6884 }, 6885 // [invokeKnownHelper] 6886 // 6887 // On stack, before: hash, inverse, program, params..., ... 6888 // On stack, after: result of helper invocation 6889 // 6890 // This operation is used when the helper is known to exist, 6891 // so a `helperMissing` fallback is not required. 6892 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 6893 var helper = this.setupHelper(paramSize, name); 6894 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 6895 }, 6896 6897 // [invokeAmbiguous] 6898 // 6899 // On stack, before: hash, inverse, program, params..., ... 6900 // On stack, after: result of disambiguation 6901 // 6902 // This operation is used when an expression like `{{foo}}` 6903 // is provided, but we don't know at compile-time whether it 6904 // is a helper or a path. 6905 // 6906 // This operation emits more code than the other options, 6907 // and can be avoided by passing the `knownHelpers` and 6908 // `knownHelpersOnly` flags at compile-time. 6909 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 6910 this.useRegister('helper'); 6911 6912 var nonHelper = this.popStack(); 6913 6914 this.emptyHash(); 6915 var helper = this.setupHelper(0, name, helperCall); 6916 6917 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 6918 6919 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 6920 if (!this.options.strict) { 6921 lookup[0] = '(helper = '; 6922 lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); 6923 } 6924 6925 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 6926 }, 6927 6928 // [invokePartial] 6929 // 6930 // On stack, before: context, ... 6931 // On stack after: result of partial invocation 6932 // 6933 // This operation pops off a context, invokes a partial with that context, 6934 // and pushes the result of the invocation back. 6935 invokePartial: function invokePartial(isDynamic, name, indent) { 6936 var params = [], 6937 options = this.setupParams(name, 1, params); 6938 6939 if (isDynamic) { 6940 name = this.popStack(); 6941 delete options.name; 6942 } 6943 6944 if (indent) { 6945 options.indent = JSON.stringify(indent); 6946 } 6947 options.helpers = 'helpers'; 6948 options.partials = 'partials'; 6949 options.decorators = 'container.decorators'; 6950 6951 if (!isDynamic) { 6952 params.unshift(this.nameLookup('partials', name, 'partial')); 6953 } else { 6954 params.unshift(name); 6955 } 6956 6957 if (this.options.compat) { 6958 options.depths = 'depths'; 6959 } 6960 options = this.objectLiteral(options); 6961 params.push(options); 6962 6963 this.push(this.source.functionCall('container.invokePartial', '', params)); 6964 }, 6965 6966 // [assignToHash] 6967 // 6968 // On stack, before: value, ..., hash, ... 6969 // On stack, after: ..., hash, ... 6970 // 6971 // Pops a value off the stack and assigns it to the current hash 6972 assignToHash: function assignToHash(key) { 6973 var value = this.popStack(), 6974 context = undefined, 6975 type = undefined, 6976 id = undefined; 6977 6978 if (this.trackIds) { 6979 id = this.popStack(); 6980 } 6981 if (this.stringParams) { 6982 type = this.popStack(); 6983 context = this.popStack(); 6984 } 6985 6986 var hash = this.hash; 6987 if (context) { 6988 hash.contexts[key] = context; 6989 } 6990 if (type) { 6991 hash.types[key] = type; 6992 } 6993 if (id) { 6994 hash.ids[key] = id; 6995 } 6996 hash.values[key] = value; 6997 }, 6998 6999 pushId: function pushId(type, name, child) { 7000 if (type === 'BlockParam') { 7001 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 7002 } else if (type === 'PathExpression') { 7003 this.pushString(name); 7004 } else if (type === 'SubExpression') { 7005 this.pushStackLiteral('true'); 7006 } else { 7007 this.pushStackLiteral('null'); 7008 } 7009 }, 7010 7011 // HELPERS 7012 7013 compiler: JavaScriptCompiler, 7014 7015 compileChildren: function compileChildren(environment, options) { 7016 var children = environment.children, 7017 child = undefined, 7018 compiler = undefined; 7019 7020 for (var i = 0, l = children.length; i < l; i++) { 7021 child = children[i]; 7022 compiler = new this.compiler(); // eslint-disable-line new-cap 7023 7024 var existing = this.matchExistingProgram(child); 7025 7026 if (existing == null) { 7027 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 7028 var index = this.context.programs.length
vendor: 9,546 bytes, lines 7028-7348
7028; 7029 child.index = index; 7030 child.name = 'program' + index; 7031 this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); 7032 this.context.decorators[index] = compiler.decorators; 7033 this.context.environments[index] = child; 7034 7035 this.useDepths = this.useDepths || compiler.useDepths; 7036 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 7037 child.useDepths = this.useDepths; 7038 child.useBlockParams = this.useBlockParams; 7039 } else { 7040 child.index = existing.index; 7041 child.name = 'program' + existing.index; 7042 7043 this.useDepths = this.useDepths || existing.useDepths; 7044 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 7045 } 7046 } 7047 }, 7048 matchExistingProgram: function matchExistingProgram(child) { 7049 for (var i = 0, len = this.context.environments.length; i < len; i++) { 7050 var environment = this.context.environments[i]; 7051 if (environment && environment.equals(child)) { 7052 return environment; 7053 } 7054 } 7055 }, 7056 7057 programExpression: function programExpression(guid) { 7058 var child = this.environment.children[guid], 7059 programParams = [child.index, 'data', child.blockParams]; 7060 7061 if (this.useBlockParams || this.useDepths) { 7062 programParams.push('blockParams'); 7063 } 7064 if (this.useDepths) { 7065 programParams.push('depths'); 7066 } 7067 7068 return 'container.program(' + programParams.join(', ') + ')'; 7069 }, 7070 7071 useRegister: function useRegister(name) { 7072 if (!this.registers[name]) { 7073 this.registers[name] = true; 7074 this.registers.list.push(name); 7075 } 7076 }, 7077 7078 push: function push(expr) { 7079 if (!(expr instanceof Literal)) { 7080 expr = this.source.wrap(expr); 7081 } 7082 7083 this.inlineStack.push(expr); 7084 return expr; 7085 }, 7086 7087 pushStackLiteral: function pushStackLiteral(item) { 7088 this.push(new Literal(item)); 7089 }, 7090 7091 pushSource: function pushSource(source) { 7092 if (this.pendingContent) { 7093 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 7094 this.pendingContent = undefined; 7095 } 7096 7097 if (source) { 7098 this.source.push(source); 7099 } 7100 }, 7101 7102 replaceStack: function replaceStack(callback) { 7103 var prefix = ['('], 7104 stack = undefined, 7105 createdStack = undefined, 7106 usedLiteral = undefined; 7107 7108 /* istanbul ignore next */ 7109 if (!this.isInline()) { 7110 throw new _exception2['default']('replaceStack on non-inline'); 7111 } 7112 7113 // We want to merge the inline statement into the replacement statement via ',' 7114 var top = this.popStack(true); 7115 7116 if (top instanceof Literal) { 7117 // Literals do not need to be inlined 7118 stack = [top.value]; 7119 prefix = ['(', stack]; 7120 usedLiteral = true; 7121 } else { 7122 // Get or create the current stack name for use by the inline 7123 createdStack = true; 7124 var _name = this.incrStack(); 7125 7126 prefix = ['((', this.push(_name), ' = ', top, ')']; 7127 stack = this.topStack(); 7128 } 7129 7130 var item = callback.call(this, stack); 7131 7132 if (!usedLiteral) { 7133 this.popStack(); 7134 } 7135 if (createdStack) { 7136 this.stackSlot--; 7137 } 7138 this.push(prefix.concat(item, ')')); 7139 }, 7140 7141 incrStack: function incrStack() { 7142 this.stackSlot++; 7143 if (this.stackSlot > this.stackVars.length) { 7144 this.stackVars.push('stack' + this.stackSlot); 7145 } 7146 return this.topStackName(); 7147 }, 7148 topStackName: function topStackName() { 7149 return 'stack' + this.stackSlot; 7150 }, 7151 flushInline: function flushInline() { 7152 var inlineStack = this.inlineStack; 7153 this.inlineStack = []; 7154 for (var i = 0, len = inlineStack.length; i < len; i++) { 7155 var entry = inlineStack[i]; 7156 /* istanbul ignore if */ 7157 if (entry instanceof Literal) { 7158 this.compileStack.push(entry); 7159 } else { 7160 var stack = this.incrStack(); 7161 this.pushSource([stack, ' = ', entry, ';']); 7162 this.compileStack.push(stack); 7163 } 7164 } 7165 }, 7166 isInline: function isInline() { 7167 return this.inlineStack.length; 7168 }, 7169 7170 popStack: function popStack(wrapped) { 7171 var inline = this.isInline(), 7172 item = (inline ? this.inlineStack : this.compileStack).pop(); 7173 7174 if (!wrapped && item instanceof Literal) { 7175 return item.value; 7176 } else { 7177 if (!inline) { 7178 /* istanbul ignore next */ 7179 if (!this.stackSlot) { 7180 throw new _exception2['default']('Invalid stack pop'); 7181 } 7182 this.stackSlot--; 7183 } 7184 return item; 7185 } 7186 }, 7187 7188 topStack: function topStack() { 7189 var stack = this.isInline() ? this.inlineStack : this.compileStack, 7190 item = stack[stack.length - 1]; 7191 7192 /* istanbul ignore if */ 7193 if (item instanceof Literal) { 7194 return item.value; 7195 } else { 7196 return item; 7197 } 7198 }, 7199 7200 contextName: function contextName(context) { 7201 if (this.useDepths && context) { 7202 return 'depths[' + context + ']'; 7203 } else { 7204 return 'depth' + context; 7205 } 7206 }, 7207 7208 quotedString: function quotedString(str) { 7209 return this.source.quotedString(str); 7210 }, 7211 7212 objectLiteral: function objectLiteral(obj) { 7213 return this.source.objectLiteral(obj); 7214 }, 7215 7216 aliasable: function aliasable(name) { 7217 var ret = this.aliases[name]; 7218 if (ret) { 7219 ret.referenceCount++; 7220 return ret; 7221 } 7222 7223 ret = this.aliases[name] = this.source.wrap(name); 7224 ret.aliasable = true; 7225 ret.referenceCount = 1; 7226 7227 return ret; 7228 }, 7229 7230 setupHelper: function setupHelper(paramSize, name, blockHelper) { 7231 var params = [], 7232 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 7233 var foundHelper = this.nameLookup('helpers', name, 'helper'), 7234 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 7235 7236 return { 7237 params: params, 7238 paramsInit: paramsInit, 7239 name: foundHelper, 7240 callParams: [callContext].concat(params) 7241 }; 7242 }, 7243 7244 setupParams: function setupParams(helper, paramSize, params) { 7245 var options = {}, 7246 contexts = [], 7247 types = [], 7248 ids = [], 7249 objectArgs = !params, 7250 param = undefined; 7251 7252 if (objectArgs) { 7253 params = []; 7254 } 7255 7256 options.name = this.quotedString(helper); 7257 options.hash = this.popStack(); 7258 7259 if (this.trackIds) { 7260 options.hashIds = this.popStack(); 7261 } 7262 if (this.stringParams) { 7263 options.hashTypes = this.popStack(); 7264 options.hashContexts = this.popStack(); 7265 } 7266 7267 var inverse = this.popStack(), 7268 program = this.popStack(); 7269 7270 // Avoid setting fn and inverse if neither are set. This allows 7271 // helpers to do a check for `if (options.fn)` 7272 if (program || inverse) { 7273 options.fn = program || 'container.noop'; 7274 options.inverse = inverse || 'container.noop'; 7275 } 7276 7277 // The parameters go on to the stack in order (making sure that they are evaluated in order) 7278 // so we need to pop them off the stack in reverse order 7279 var i = paramSize; 7280 while (i--) { 7281 param = this.popStack(); 7282 params[i] = param; 7283 7284 if (this.trackIds) { 7285 ids[i] = this.popStack(); 7286 } 7287 if (this.stringParams) { 7288 types[i] = this.popStack(); 7289 contexts[i] = this.popStack(); 7290 } 7291 } 7292 7293 if (objectArgs) { 7294 options.args = this.source.generateArray(params); 7295 } 7296 7297 if (this.trackIds) { 7298 options.ids = this.source.generateArray(ids); 7299 } 7300 if (this.stringParams) { 7301 options.types = this.source.generateArray(types); 7302 options.contexts = this.source.generateArray(contexts); 7303 } 7304 7305 if (this.options.data) { 7306 options.data = 'data'; 7307 } 7308 if (this.useBlockParams) { 7309 options.blockParams = 'blockParams'; 7310 } 7311 return options; 7312 }, 7313 7314 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 7315 var options = this.setupParams(helper, paramSize, params); 7316 options.loc = JSON.stringify(this.source.currentLocation); 7317 options = this.objectLiteral(options); 7318 if (useRegister) { 7319 this.useRegister('options'); 7320 params.push('options'); 7321 return ['options=', options]; 7322 } else if (params) { 7323 params.push(options); 7324 return ''; 7325 } else { 7326 return options; 7327 } 7328 } 7329 }; 7330 7331 (function () { 7332 var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); 7333 7334 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 7335 7336 for (var i = 0, l = reservedWords.length; i < l; i++) { 7337 compilerWords[reservedWords[i]] = true; 7338 } 7339 })(); 7340 7341 /** 7342 * @deprecated May be removed in the next major version 7343 */ 7344 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 7345 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 7346 }; 7347 7348 function strictLookup(requireTerminal, compiler, parts,
vendor: 4,006 bytes, lines 7348-7496
7348i, type) { 7349 var stack = compiler.popStack(), 7350 len = parts.length; 7351 if (requireTerminal) { 7352 len--; 7353 } 7354 7355 for (; i < len; i++) { 7356 stack = compiler.nameLookup(stack, parts[i], type); 7357 } 7358 7359 if (requireTerminal) { 7360 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; 7361 } else { 7362 return stack; 7363 } 7364 } 7365 7366 exports['default'] = JavaScriptCompiler; 7367 module.exports = exports['default']; 7368 7369/***/ }), 7370/* 92 */ 7371/***/ (function(module, exports, __webpack_require__) { 7372 7373 /* global define, require */ 7374 'use strict'; 7375 7376 var _Object$keys = __webpack_require__(60)['default']; 7377 7378 exports.__esModule = true; 7379 7380 var _utils = __webpack_require__(5); 7381 7382 var SourceNode = undefined; 7383 7384 try { 7385 /* istanbul ignore next */ 7386 if (false) { 7387 // We don't support this in AMD environments. For these environments, we assume that 7388 // they are running on the browser and thus have no need for the source-map library. 7389 var SourceMap = require('source-map'); 7390 SourceNode = SourceMap.SourceNode; 7391 } 7392 } catch (err) {} 7393 /* NOP */ 7394 7395 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 7396 if (!SourceNode) { 7397 SourceNode = function (line, column, srcFile, chunks) { 7398 this.src = ''; 7399 if (chunks) { 7400 this.add(chunks); 7401 } 7402 }; 7403 /* istanbul ignore next */ 7404 SourceNode.prototype = { 7405 add: function add(chunks) { 7406 if (_utils.isArray(chunks)) { 7407 chunks = chunks.join(''); 7408 } 7409 this.src += chunks; 7410 }, 7411 prepend: function prepend(chunks) { 7412 if (_utils.isArray(chunks)) { 7413 chunks = chunks.join(''); 7414 } 7415 this.src = chunks + this.src; 7416 }, 7417 toStringWithSourceMap: function toStringWithSourceMap() { 7418 return { code: this.toString() }; 7419 }, 7420 toString: function toString() { 7421 return this.src; 7422 } 7423 }; 7424 } 7425 7426 function castChunk(chunk, codeGen, loc) { 7427 if (_utils.isArray(chunk)) { 7428 var ret = []; 7429 7430 for (var i = 0, len = chunk.length; i < len; i++) { 7431 ret.push(codeGen.wrap(chunk[i], loc)); 7432 } 7433 return ret; 7434 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 7435 // Handle primitives that the SourceNode will throw up on 7436 return chunk + ''; 7437 } 7438 return chunk; 7439 } 7440 7441 function CodeGen(srcFile) { 7442 this.srcFile = srcFile; 7443 this.source = []; 7444 } 7445 7446 CodeGen.prototype = { 7447 isEmpty: function isEmpty() { 7448 return !this.source.length; 7449 }, 7450 prepend: function prepend(source, loc) { 7451 this.source.unshift(this.wrap(source, loc)); 7452 }, 7453 push: function push(source, loc) { 7454 this.source.push(this.wrap(source, loc)); 7455 }, 7456 7457 merge: function merge() { 7458 var source = this.empty(); 7459 this.each(function (line) { 7460 source.add([' ', line, '\n']); 7461 }); 7462 return source; 7463 }, 7464 7465 each: function each(iter) { 7466 for (var i = 0, len = this.source.length; i < len; i++) { 7467 iter(this.source[i]); 7468 } 7469 }, 7470 7471 empty: function empty() { 7472 var loc = this.currentLocation || { start: {} }; 7473 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 7474 }, 7475 wrap: function wrap(chunk) { 7476 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 7477 7478 if (chunk instanceof SourceNode) { 7479 return chunk; 7480 } 7481 7482 chunk = castChunk(chunk, this, loc); 7483 7484 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 7485 }, 7486 7487 functionCall: function functionCall(fn, type, params) { 7488 params = this.generateList(params); 7489 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 7490 }, 7491 7492 quotedString: function quotedString(str) { 7493 return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 7494 .replace(/\u2029/g, '\\u2029') + '"'; 7495 }, 7496
7497 objectLiteral: function objectLiteral(obj) { 7498 // istanbul ignore next 7499 7500 var _this = this; 7501 7502 var pairs = []; 7503 7504 _Object$keys(obj).forEach(function (key) { 7505 var value = castChunk(obj[key], _this); 7506 if (value !== 'undefined') { 7507 pairs.push([_this.quotedString(key), ':', value]); 7508 } 7509 }); 7510 7511 var ret = this.generateList(pairs); 7512 ret.prepend('{'); 7513 ret.add('}'); 7514 return ret; 7515 }, 7516 7517 generateList: function generateList(entries) { 7518 var ret = this.empty(); 7519 7520 for (var i = 0, len = entries.length; i < len; i++) { 7521 if (i) { 7522 ret.add(','); 7523 } 7524 7525 ret.add(castChunk(entries[i], this)); 7526 } 7527 7528 return ret; 7529 }, 7530 7531 generateArray: function generateArray(entries) { 7532 var ret = this.generateList(entries); 7533 ret.prepend('['); 7534 ret.add(']'); 7535 7536 return ret; 7537 } 7538 }; 7539 7540 exports['default'] = CodeGen; 7541 module.exports = exports['default']; 7542 7543/***/ }) 7544/******/ ]) 7545}); 7546; 7547var totalCount; 7548var searchText; 7549var searchTag; 7550var dataPageNumber; 7551$(document).ready(function(){ 7552 7553 searchText = getParameterByName("keywords"); 7554 //registerContains(); 7555 getSearchResults(searchText,1,false,true); 7556 getCatCounts(searchText,1); 7557 $("#idSearchedText").text(searchText); 7558 7559 7560 //To handle category click 7561 $(".resultTitle .titleTabs .descText").click(function(){ 7562 $(".resultTitle .titleTabs .descText").removeClass("active"); 7563 $(this).addClass("active"); 7564 var tag = $(this).data("tag"); 7565 searchTag = tag; 7566 console.log(tag); 7567 getSearchResults(searchText,1,tag,true); 7568 }); 7569 7570 $("#pageSearch").click(function(){ 7571 searchTo($(this).siblings(".fm-control").val()); 7572 }); 7573 7574 $("#result-content").on("click", ".tags.bottom .tag",function(e){ 7575 e.preventDefault(); 7576 searchTo($(this).text().trim()); 7577 }); 7578 7579 7580 activateEnterButton("pageSearch-text", "pageSearch"); 7581 7582$(document).on("click",".btn-close-modal",function(){ 7583 var modalElem = $('.ui.modal.modalDirectoryDetail'); 7584 modalElem.modal('hide'); 7585 }); 7586}); 7587 7588function searchTo(value){ 7589 if(value.trim()!=""){ 7590 window.location.href=window.location.pathname+"?keywords="+encodeURIComponent(value); 7591 } 7592} 7593 7594 7595function getSearchResults(searchText,requestedPageNumber,tag,isFirst){ 7596var currentNodePath = $('.mainSearchResult').data("path"); 7597 if(currentNodePath){ 7598 var tagElement = tag && tag != "all" ?"&tag="+tag : ""; 7599 var pageSize = $('.mainSearchResult').data("pagesize"); 7600 var ps=pageSize?"&ps="+pageSize:""; 7601 var url = currentNodePath + ".getsearchresults.json?keywords="+searchText+"&pageNumber="+requestedPageNumber+tagElement+ps; 7602 $.ajax({ 7603 url: url, 7604 dataType: 'json', 7605 contentType: 'application/json;charset=utf-8', 7606 success: function(data) { 7607// totalCount=data.totalCount; 7608 console.log("success"); 7609 dataPageNumber=data.requestedPageNumber; 7610 console.log(data); 7611 if(data && data.searchResults!=null && data.searchResults.length>0) 7612 { 7613 $("#resultItems").html(searchHandleBar("searchResultsContent-template",data)); 7614 setTabActive("result-content"); 7615 7616 setTimeout(() => { 7617 countTags(data, tag); 7618 },100); 7619 if(isFirst){ 7620 search_updatePagination(data.totalCount, pageSize); 7621 } 7622 $('html, body').animate({ 7623 scrollTop: $(".main-body").offset().top 7624 }, 800); 7625 7626 } 7627 else 7628 { 7629 //$(".paginationResult, .itemFilter").hide(); 7630 countTags(data,tag); 7631 setTabActive("no-result"); 7632 setTimeout(() => { 7633 checkDirectoryShopCount(); 7634 },200); 7635 } 7636 }, 7637 error: function(xhr, status, error) { 7638 console.log('Error data:',error); 7639 } 7640 }); 7641 } 7642} 7643 7644 7645function getParameterByName(name) { 7646 var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); 7647 return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); 7648} 7649 7650 7651function searchHandleBar(id,json){ 7652registerHandleBarHelpers(); 7653registerAppenOriginHelper(); 7654registerHandleBarTranslation(); 7655 var template = $("#"+id).html(); 7656 const templateFunction = Handlebars.compile(template); 7657 const htmlStr = templateFunction(json); 7658 return htmlStr; 7659} 7660 7661 7662function setTabActive(id){ 7663 7664 7665 $("#"+id).parent(".listTabs").find(".itemTab").removeClass("active"); 7666 $("#"+id).addClass("active"); 7667} 7668 7669 7670 7671 7672function activateEnterButton(text, btn){ 7673 // Get the input field 7674 var input = document.getElementById(text); 7675 7676 7677 // Execute a function when the user presses a key on the keyboard 7678 if(input){ 7679 input.addEventListener("keypress", function(event) { 7680 // If the user presses the "Enter" key on the keyboard 7681 if (event.key === "Enter") { 7682 // Cancel the default action, if needed 7683 event.preventDefault(); 7684 // Trigger the button element with a click 7685 document.getElementById(btn).click(); 7686 } 7687 }); 7688 } 7689} 7690 7691 7692function countTags(json,tag){ 7693var AllCount = 0; 7694var tags = []; 7695$(".mainSearchResult .titleTabs .descText").each(function(){ 7696 if(($(this).data("tag") && $(this).data("tag").trim().toLowerCase() === "all" || 7697 $(this).data("tagtitle") && $(this).data("tagtitle").trim().toLowerCase() === "all" ) 7698 && (tag === "all" || !tag)){ 7699 $(this).addClass("active"); 7700 $(this).find(".categoryTagCount").text("("+json.totalCount+")"); 7701 } 7702}); 7703$(".mainSearchResult .menu .item").each(function(){ 7704 if(($(this).data("tag") && $(this).data("tag").trim().toLowerCase() === "all" || 7705 $(this).data("tagtitle") && $(this).data("tagtitle").trim().toLowerCase() === "all" ) 7706 && (tag === "all" || !tag)){ 7707 $(this).addClass("active"); 7708 $(this).find(".categoryTagCount").text(" ("+json.totalCount+")"); 7709 $(".mainSearchResult .functionTabs .ui.inline.dropdown .text").text($(this).text()); 7710 } 7711 }); 7712} 7713 7714 7715 7716 7717function isKeyExist(obj, val){ 7718 for(i=0;i<obj.length;i++){ 7719 if(obj[i].key === val){ 7720 return true; 7721 } 7722 } 7723 return false;
7724} 7725 7726 7727$(".titleTabs ul li").click(function () { 7728 $(".titleTabs ul li").removeClass("active"); 7729 $(this).addClass("active"); 7730 var clickedTabIndex = $(this).index(); 7731 $(".listTabs .itemTab").removeClass("active"); 7732 //$(".listTabs .itemTab:eq(" + clickedTabIndex + ")").addClass("active"); 7733 7734 7735 $("html, body").animate({ 7736 scrollTop: $(".resultList").offset().top - 150 7737 }, 800); 7738 7739 7740 setTimeout(() => { 7741 HeightItemShopResult(); 7742 }, 50); 7743 }); 7744 7745 7746 $(".mainSearchResult .itemFilter .ui.inline.dropdown").dropdown({ 7747 forceSelection: false, //***** 7748 direction: "downward", 7749 delay: { 7750 touch: 2000, 7751 }, 7752 }); 7753 7754 7755 $(".mainSearchResult .functionTabs .ui.inline.dropdown").dropdown({ 7756 forceSelection: false, 7757 direction: "downward", 7758 delay: { 7759 touch: 2000, 7760 }, 7761 onChange: function (value, text, $selectedItem) { 7762 var $item = $('.mainSearchResult .menu .item[data-text="' + text + '"]'); 7763 var selectedIndex = $item.data('index') 7764 //$(".itemTab").removeClass("active"); 7765 //$(".itemTab:eq(" + selectedIndex + ")").addClass("active"); 7766 7767 var tag = $($selectedItem).data("tag"); 7768 console.log(tag); 7769 getSearchResults(searchText,1,tag,true); 7770 $(".mainSearchResult .functionTabs .ui.inline.dropdown .text").text($($selectedItem).text().trim()); 7771 /*$("html, body").animate({ 7772 scrollTop: $(".main-body").offset().top - 100 7773 }, 800);*/ 7774 7775 7776 setTimeout(() => { 7777 HeightItemShopResult(); 7778 }, 50); 7779 } 7780 }); 7781 7782 7783function checkDirectoryShopCount() { 7784 if ($(".innerResult .swiper-pagination-total").text() == 1) { 7785 $(".innerResult .swiper-pagination-total").parent().hide(); 7786 } 7787} 7788 7789$(window).on("load resize", function () { 7790 setTimeout(() => { 7791 HeightItemShopResult(); 7792 }, 100); 7793}); 7794 7795 7796var shopResultSwiper = new Swiper(".shopResultSwiper", { 7797 slidesPerView: 6, 7798 spaceBetween: 20, 7799 slidesPerGroup: 1, 7800 speed: 500, 7801 pagination: { 7802 el: '.swiper-pagination', 7803 type: "fraction", 7804 }, 7805 navigation: { 7806 nextEl: ".swiper-button-next", 7807 prevEl: ".swiper-button-prev", 7808 }, 7809 breakpoints: { 7810 1479: { 7811 slidesPerView: 6, 7812 spaceBetween: 20, 7813 slidesPerGroup: 1, 7814 centeredSlides: false, 7815 }, 7816 1200: { 7817 slidesPerView: 5, 7818 spaceBetween: 20, 7819 slidesPerGroup: 1, 7820 centeredSlides: false, 7821 }, 7822 992: { 7823 slidesPerView: 4, 7824 spaceBetween: 20, 7825 slidesPerGroup: 2, 7826 centeredSlides: false, 7827 }, 7828 768: { 7829 slidesPerView: 5, 7830 spaceBetween: 10, 7831 slidesPerGroup: 2, 7832 centeredSlides: false, 7833 }, 7834 250: { 7835 slidesPerView: 2.5, 7836 spaceBetween: 10, 7837 centeredSlides: false, 7838 slidesPerGroup: 1, 7839 } 7840 } 7841}); 7842 7843 7844function HeightItemShopResult() { 7845 var itemShopResult = $(".mainSearchResult .shopResultSwiper .itemSearchShop").innerWidth(); 7846 $(".mainSearchResult .shopResultSwiper .itemSearchShop").css('height', itemShopResult); 7847} 7848 7849 7850function getCatCounts(searchText){ 7851var AllCount = 0; 7852var tags = []; 7853if($(".selectTabs").is(":hidden")){ 7854 $(".titleTabs .descText").each(function(){ 7855 if($(this).data("tag")){ 7856 var tag = $(this).data("tag"); 7857 getCatCount(searchText,1,tag,this); 7858 } 7859 }); 7860}else { 7861 $(".menu .item").each(function(){ 7862 if($(this).data("tag")){ 7863 var tag = $(this).data("tag"); 7864 getCatCount(searchText,1,tag,this); 7865 } 7866 }); 7867} 7868} 7869function getCatCount(searchText,requestedPageNumber,tag,that){ 7870var currentNodePath = $('.mainSearchResult').data("path"); 7871 if(currentNodePath){ 7872 var tagElement = tag?"&tag="+tag : ""; 7873 var pageSize = $('.mainSearchResult').data("pagesize"); 7874 var ps=pageSize?"&ps="+pageSize:""; 7875 var url = currentNodePath + ".getsearchresults.json?keywords="+searchText+"&pageNumber="+requestedPageNumber+tagElement+ps; 7876 $.ajax({ 7877 url: url, 7878 dataType: 'json', 7879 contentType: 'application/json;charset=utf-8', 7880 success: function(data) { 7881// totalCount=data.totalCount; 7882 console.log("success"); 7883 console.log(data); 7884 if(data && data.totalCount) 7885 { 7886 console.log($(that).text()); 7887 if($(".selectTabs").is(":hidden")) 7888 { 7889 $(that).find(".categoryTagCount").text("("+data.totalCount+")"); 7890 } 7891 else 7892 { 7893 $(that).find(".categoryTagCount").text(" ("+data.totalCount+")"); 7894 } 7895 } 7896 else if(data && data.totalCount==0) 7897 { 7898 if($(".selectTabs").is(":hidden")) 7899 { 7900 $(that).find(".categoryTagCount").text("("+0+")"); 7901 } 7902 else 7903 { 7904 $(that).find(".categoryTagCount").text(" ("+0+")"); 7905 } 7906 } 7907 7908 7909 }, 7910 error: function(xhr, status, error) { 7911 console.log('Error data:',error); 7912 } 7913 }); 7914 } 7915} 7916 7917 7918 7919 7920function search_updatePagination(totalCount,pageSize){ 7921 var numberOfPages = totalCount/pageSize; 7922 if(numberOfPages>1) 7923 { 7924 $(".paginationResult .menu").html(""); 7925 $(".paginationResult .menu").append('<a class="pagPrev"><i class="icon-ic-left"></i></a>'); 7926 for(i=0;i<numberOfPages;i++){ 7927 $(".paginationResult .menu").append('<a class="item">'+(i+1)+'</a>'); 7928 } 7929 $(".paginationResult .menu").append('<a class="pagNext"><i class="icon-ic-right"></i></a>'); 7930 7931 7932 $(".paginationResult .pagination .item").click(function(){ 7933 if(!$(this).hasClass("active")){ 7934 $(".paginationResult .pagination .item").removeClass("active"); 7935 $(this).addClass("active"); 7936 7937 7938 7939 var pagNum = $(this).text().trim(); 7940 getSearchResults(searchText,pagNum,searchTag,false); 7941 handlePaginationButtons(this) 7942 } 7943 }); 7944 // Handle 'Previous' button click 7945 $('.pagPrev').click(function(e) { 7946 e.preventDefault(); 7947 $(".pagPrev").removeClass('disabled'); 7948 $(".pagNext").removeClass('disabled'); 7949 var currentPage = dataPageNumber; 7950 if (currentPage > 1) { 7951 7952 getSearchResults(searchText,currentPage-1,searchTag,false); 7953 handlePaginationButtons($(".paginationResult .menu .item.active").prev()[0]); 7954 } 7955 else{ 7956 $(".pagPrev").addClass('disabled'); 7957 $(".pagNext").removeClass('disabled'); 7958 } 7959 }); 7960 7961 7962 // Handle 'Next' button click 7963 $('.pagNext').click(function(e) { 7964 e.preventDefault(); 7965 $(".pagNext").removeClass('disabled'); 7966 $(".pagPrev").removeClass('disabled'); 7967 var currentPage = dataPageNumber; 7968 if (currentPage < numberOfPages) { 7969 7970 getSearchResults(searchText,currentPage + 1,searchTag,false); 7971 handlePaginationButtons($(".paginationResult .menu .item.active").next()[0]); 7972 } 7973 else{ 7974 $(".pagNext").addClass('disabled'); 7975 $(".pagPrev").removeClass('disabled'); 7976 } 7977 }); 7978 $(".paginationResult .menu .item").removeClass("active"); 7979 handlePaginationButtons($($(".paginationResult .menu .item")[0])); 7980 $(".paginationResult").show(); 7981 } 7982 else 7983 { 7984 $(".paginationResult").hide(); 7985 } 7986} 7987 7988 7989function handlePaginationButtons(that){ 7990 var maxPages = parseInt($("section.mainSearchResult").data("maxpages"));
7991 var ceil = Math.ceil(maxPages/2); 7992 7993 var allItems = $(".paginationResult .menu .item"); 7994 var currentIndex = parseInt($(that).text())-1;//allItems.index($(that)); 7995 $(that).siblings(".item").addClass("hidden").removeClass("active"); 7996 $(that).addClass("active"); 7997 7998 7999 8000 var startIndex = (currentIndex - ceil); 8001 var endIndex = currentIndex + (maxPages - ceil); 8002 8003 if(currentIndex < ceil){ 8004 startIndex = 0; 8005 endIndex = maxPages; 8006 } else if(allItems.length - currentIndex < ceil){ 8007 startIndex = allItems.length - maxPages; 8008 endIndex = allItems.length; 8009 } 8010 for(i=startIndex;i<allItems.length;i++){ 8011 if((startIndex <= i && i < endIndex)){ 8012 $(allItems[i]).removeClass("hidden"); 8013 }else{ 8014 $(allItems[i]).addClass("hidden"); 8015 } 8016 } 8017 if(currentIndex == 0){ 8018 $(".pagPrev").addClass('disabled'); 8019 }else{ 8020 $(".pagPrev").removeClass('disabled'); 8021 } 8022 if(currentIndex < allItems.length - 1){ 8023 $(".pagNext").removeClass('disabled'); 8024 }else{ 8025 $(".pagNext").addClass('disabled'); 8026 } 8027 8028} 8029 8030function registerHandleBarHelpers(){ 8031 Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { 8032 8033 switch (operator) { 8034 case '==': 8035 return (v1 == v2) ? options.fn(this) : options.inverse(this); 8036 case '===': 8037 return (v1 === v2) ? options.fn(this) : options.inverse(this); 8038 case '!=': 8039 return (v1 != v2) ? options.fn(this) : options.inverse(this); 8040 case '!==': 8041 return (v1 !== v2) ? options.fn(this) : options.inverse(this); 8042 case '<': 8043 return (v1 < v2) ? options.fn(this) : options.inverse(this); 8044 case '<=': 8045 return (v1 <= v2) ? options.fn(this) : options.inverse(this); 8046 case '>': 8047 return (v1 > v2) ? options.fn(this) : options.inverse(this); 8048 case '>=': 8049 return (v1 >= v2) ? options.fn(this) : options.inverse(this); 8050 case '&&': 8051 return (v1 && v2) ? options.fn(this) : options.inverse(this); 8052 case '||': 8053 return (v1 || v2) ? options.fn(this) : options.inverse(this); 8054 default: 8055 return options.inverse(this); 8056 } 8057 }); 8058} 8059 8060 8061function registerAppenOriginHelper(){ 8062 Handlebars.registerHelper("appendOrigin", function(options) { 8063 return new Handlebars.SafeString(window.location.origin+ options.fn(this)); 8064 }); 8065} 8066 8067function registerHandleBarTranslation(){ 8068 Handlebars.registerHelper('I18n',function(str){ 8069 8070 var dataKey = str.replaceAll(' ' ,'').toLowerCase(); 8071 var dataVal = $(".mainSearchResult").data(dataKey); 8072 8073 return dataVal; 8074 } 8075 ); 8076} 8077 8078$(".mainSearchResult").on('click',".btn_view_detail", function () { 8079 updateModal(this); 8080}); 8081 8082function updateModal(that){ 8083 8084 var url = $(that).data("path"); 8085 8086 if(url){ 8087 url = url + ".html"; 8088 $.get( url, function( data ) { 8089 var modalElem = $('#directoryModal') 8090 modalElem.addClass('bgThemeWhite'); 8091 modalElem.html(data); 8092 $('.ui.modal.modalDirectoryDetail').modal('show'); 8093 }); 8094 } 8095 8096} 8097$(document).ready(function () { 8098 var sectionmainContentMediaDetailSec = document.getElementsByClassName('mainContentMediaDetailSec'); 8099 if (sectionmainContentMediaDetailSec && sectionmainContentMediaDetailSec.length > 0) { 8100 fixSpaceMainContentMediaDetailSec(); 8101 } 8102 8103 $('.mainContentMediaDetailSec .headlineShop .btn_calender_add').on('click', function (event) { 8104 event.stopPropagation(); 8105 var $boxCalendar = $('.mainContentMediaDetailSec .headlineShop .boxCalendar'); 8106 if ($boxCalendar.hasClass('show')) { 8107 $boxCalendar.removeClass('show'); 8108 } else { 8109 $boxCalendar.addClass('show'); 8110 } 8111 }); 8112 8113 $(document).on('click', function (event) { 8114 var $boxCalendar = $('.mainContentMediaDetailSec .headlineShop .boxCalendar'); 8115 if ($boxCalendar.hasClass('show') && !$(event.target).closest('.mainContentMediaDetailSec .headlineShop .boxCalendar').length) { 8116 $boxCalendar.removeClass('show'); 8117 } 8118 }); 8119 8120 $('.mainContentMediaDetailSec .headlineShop .boxCalendar .itemCalendar .btn-add-item').on('click', function (event) { 8121 var $boxCalendar = $('.mainContentMediaDetailSec .headlineShop .boxCalendar'); 8122 if ($boxCalendar.hasClass('show')) { 8123 $boxCalendar.removeClass('show'); 8124 } 8125 }); 8126 8127 function isIOS() { 8128 return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 8129 } 8130 8131 if (isIOS()) { 8132 $('.mainContentMediaDetailSec .headlineShop .boxCalendar .itemCalendar .btn-add-item.addApple').addClass('show'); 8133 } else { 8134 $('.mainContentMediaDetailSec .headlineShop .boxCalendar .itemCalendar .btn-add-item').removeClass('show'); 8135 } 8136 8137 $('#add-to-calendar-outlook').on('click', function () { 8138 const eventName = $(this).attr('name'); 8139 const eventDescription = $(this).attr('description'); 8140 const startDate = $(this).attr('startDate'); 8141 const startTime = $(this).attr('startTime'); 8142 const endDate = $(this).attr('endDate'); 8143 const endTime = $(this).attr('endTime'); 8144 const timeZone = $(this).attr('timeZone'); 8145 const eventLocation = $(this).attr('location'); 8146 8147 const startDateTime = new Date(`${startDate}T${startTime}:00`).toISOString(); 8148 const endDateTime = new Date(`${endDate}T${endTime}:00`).toISOString(); 8149 8150 const outlookUrl = `https://outlook.live.com/calendar/0/deeplink/compose?subject=${encodeURIComponent(eventName)}&body=${encodeURIComponent(eventDescription)}&location=${encodeURIComponent(eventLocation)}&startdt=${encodeURIComponent(startDateTime)}&enddt=${encodeURIComponent(endDateTime)}&allday=false&timezone=${encodeURIComponent(timeZone)}`; 8151 8152 window.open(outlookUrl, '_blank'); 8153 }); 8154 8155 $('#add-to-calendar-google').on('click', function () { 8156 const eventName = $(this).attr('name'); 8157 const eventDescription = $(this).attr('description'); 8158 const startDate = $(this).attr('startDate'); 8159 const startTime = $(this).attr('startTime'); 8160 const endDate = $(this).attr('endDate'); 8161 const endTime = $(this).attr('endTime'); 8162 const timeZone = $(this).attr('timeZone'); 8163 const eventLocation = $(this).attr('location'); 8164 8165 const startDateTime = `${startDate}T${startTime}:00`; 8166 const endDateTime = `${endDate}T${endTime}:00`; 8167 8168 const googleCalendarUrl = `https://www.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(eventName)}&details=${encodeURIComponent(eventDescription)}&location=${encodeURIComponent(eventLocation)}&dates=${startDateTime.replace(/-|:|\.\d+/g, '')}/${endDateTime.replace(/-|:|\.\d+/g, '')}&ctz=${encodeURIComponent(timeZone)}`; 8169 8170 window.open(googleCalendarUrl, '_blank'); 8171 }); 8172 8173 $('#add-to-calendar-yahoo').on('click', function () { 8174 const eventName = $(this).attr('name'); 8175 const eventDescription = $(this).attr('description'); 8176 const startDate = $(this).attr('startDate'); 8177 const startTime = $(this).attr('startTime'); 8178 const endDate = $(this).attr('endDate'); 8179 const endTime = $(this).attr('endTime'); 8180 const timeZone = $(this).attr('timeZone'); 8181 const eventLocation = $(this).attr('location'); 8182 8183 const yahooStartDate = startDate.replace(/-/g, '').replace(/:/g, '').replace(/\.\d+/g, ''); 8184 const yahooEndDate = endDate.replace(/-/g, '').replace(/:/g, '').replace(/\.\d+/g, ''); 8185 8186 const yahooCalendarUrl = `https://calendar.yahoo.com/?v=60&title=${encodeURIComponent(eventName)}&desc=${encodeURIComponent(eventDescription)}&in_loc=${encodeURIComponent(eventLocation)}
8186&st=${yahooStartDate}T${startTime.replace(/-|:|\.\d+/g, '')}&et=${yahooEndDate}T${endTime.replace(/-|:|\.\d+/g, '')}&tz=${encodeURIComponent(timeZone)}`; 8187 8188 window.open(yahooCalendarUrl, '_blank'); 8189 }); 8190 8191 $('#add-to-calendar-apple').on('click', function () { 8192 var name = $(this).attr('name'); 8193 var description = $(this).attr('description'); 8194 var startDate = $(this).attr('startDate'); 8195 var startTime = $(this).attr('startTime'); 8196 var endDate = $(this).attr('endDate'); 8197 var endTime = $(this).attr('endTime'); 8198 var timeZone = $(this).attr('timeZone'); 8199 var location = $(this).attr('location'); 8200 8201 var startDateTime = startDate.replace(/-/g, '') + 'T' + startTime.replace(/:/g, '') + '00'; 8202 var endDateTime = endDate.replace(/-/g, '') + 'T' + endTime.replace(/:/g, '') + '00'; 8203 var icsContent = [ 8204 'BEGIN:VCALENDAR', 8205 'VERSION:2.0', 8206 'BEGIN:VEVENT', 8207 'SUMMARY:' + name, 8208 'DESCRIPTION:' + description, 8209 'DTSTART;TZID=' + timeZone + ':' + startDateTime, 8210 'DTEND;TZID=' + timeZone + ':' + endDateTime, 8211 'LOCATION:' + location, 8212 'END:VEVENT', 8213 'END:VCALENDAR' 8214 ].join('\n'); 8215 8216 var blob = new Blob([icsContent], { type: 'text/calendar' }); 8217 var url = URL.createObjectURL(blob); 8218 8219 var a = document.createElement('a'); 8220 a.href = url; 8221 a.download = 'event.ics'; 8222 document.body.appendChild(a); 8223 a.click(); 8224 document.body.removeChild(a); 8225 URL.revokeObjectURL(url); 8226 }); 8227}); 8228 8229$(window).on("load resize", function () { 8230 fixSpaceMainContentMediaDetailSec(); 8231 $(".mainContentMediaDetailSec .listContent .itemList .topic").css('width', 'auto'); 8232 adjustTopicWidths(); 8233}); 8234var eventGallery = document.getElementsByClassName('event-gallery'); 8235var press = document.getElementsByClassName('press-gallery'); 8236function fixSpaceMainContentMediaDetailSec() { 8237if(eventGallery && eventGallery.length > 0 || press && press.length) { 8238 setTimeout(() => { 8239 $(".mainContentMediaDetailSec .gallerSwiper").css("margin-left", $(".mainContentMediaDetailSec .detailContentSec").offset().left + 0); 8240 $(".mainContentMediaDetailSec .gallerSwiper").css("padding-right", $(".mainContentMediaDetailSec .detailContentSec").offset().left + 0); 8241 $(".mainContentMediaDetailSec .gallerySlide .subText").css("margin-left", $(".mainContentMediaDetailSec .detailContentSec").offset().left + 0); 8242 // Recalculate Swiper layout after CSS changes 8243 $(".mainContentMediaDetailSec .gallerSwiper").each(function () { 8244 if (this.swiper) { 8245 this.swiper.update(); 8246 } 8247 }); 8248 }, 50); 8249} 8250} 8251 8252function adjustTopicWidths() { 8253 let WidthTopic = 0; 8254 $(".mainContentMediaDetailSec .listContent .itemList .topic").each(function () { 8255 let currentWidth = $(this).width(); 8256 WidthTopic = Math.max(WidthTopic, currentWidth); 8257 }); 8258 let WidthTopicLatest = WidthTopic + 1 ; 8259 $(".mainContentMediaDetailSec .listContent .itemList .topic").width(WidthTopicLatest); 8260} 8261 8262var mainContentMediaDetailSec = document.getElementsByClassName('mainContentMediaDetailSec'); 8263if(mainContentMediaDetailSec && mainContentMediaDetailSec.length > 0) { 8264 $(".mainContentMediaDetailSec .formContactContent .boxDropdown .ui.inline.dropdown").dropdown({ 8265 forceSelection: false, //***** 8266 direction: "downward", 8267 delay: { 8268 touch: 2000, 8269 }, 8270 }); 8271} 8272 8273if(eventGallery && eventGallery.length > 0 || press && press.length) { 8274$('.mainContentMediaDetailSec .gallerSwiper').each(function () { 8275 var $el = $(this); 8276 if (!$el.hasClass('swiper-initialized')) { 8277 new Swiper($el[0], { 8278 slidesPerView: 2, 8279 spaceBetween: 20, 8280 slidesPerGroup: 2, 8281 resizeObserver:!($("body").data('custom-mode') == "edit"), 8282 speed: 500, 8283 pagination: { 8284 el: $el.find('.swiper-pagination')[0], 8285 type: "fraction", 8286 }, 8287 navigation: { 8288 nextEl: $el.find('.swiper-button-next')[0], 8289 prevEl: $el.find('.swiper-button-prev')[0], 8290 }, 8291 breakpoints: { 8292 992: { 8293 slidesPerView: 2, 8294 spaceBetween: 20, 8295 slidesPerGroup: 2, 8296 centeredSlides: false, 8297 }, 8298 768: { 8299 slidesPerView: 1.5, 8300 spaceBetween: 20, 8301 slidesPerGroup: 1, 8302 centeredSlides: false, 8303 }, 8304 250: { 8305 slidesPerView: 1.1, 8306 spaceBetween: 10, 8307 centeredSlides: true, 8308 slidesPerGroup: 1, 8309 } 8310 } 8311 }); 8312 } 8313}); 8314} 8315 8316$('.mainContentMediaDetailSec').each(function () { 8317 var $section = $(this); 8318 var $items = $section.find('.itemMedia .boxImg'); 8319 // Cache modal reference before Semantic UI moves it out of $section on first show. 8320 var $modal = $section.find('.ui.modal.modalGallerSlide').first(); 8321 var $modalSwiperEl = $modal.find('.modalGallerSwiper'); 8322 var pendingIndex = 0; 8323 8324 $items.each(function (index) { 8325 $(this).data('index', index); 8326 }); 8327 8328 // Configure modal ONCE with callbacks to re-init Swiper each time 8329 if ($modal.length > 0) { 8330 var $modalContent = $modal.find('.contentModal'); 8331 8332 $modal.modal({ 8333 duration: 200, 8334 onShow: function () { 8335 // Hide content during modal open animation to prevent flash of old slide 8336 $modalContent.css('opacity', '0'); 8337 }, 8338 onVisible: function () { 8339 if ($modalSwiperEl.length) { 8340 // Destroy existing Swiper if any 8341 if ($modalSwiperEl[0].swiper) { 8342 $modalSwiperEl[0].swiper.destroy(true, true); 8343 } 8344 // Re-create Swiper at the correct slide 8345 new Swiper($modalSwiperEl[0], { 8346 slidesPerView: 1, 8347 spaceBetween: 0, 8348 initialSlide: pendingIndex, 8349 resizeObserver: !($("body").data('custom-mode') == "edit"), 8350 speed: 500, 8351 effect: "fade", 8352 pagination: { el: $modalSwiperEl.find('.swiper-pagination')[0], type: "fraction" }, 8353 navigation: { 8354 nextEl: $modalSwiperEl.find('.swiper-button-next')[0], 8355 prevEl: $modalSwiperEl.find('.swiper-button-prev')[0] 8356 } 8357 }); 8358 // Show content immediately after Swiper is
8358initialized at correct slide 8359 $modalContent.css('opacity', ''); 8360 } 8361 } 8362 }); 8363 } 8364 8365 // Use namespaced handlers so re-initialization does not stack duplicate clicks. 8366 $items.off('click.mainContentMediaDetailSec').on('click.mainContentMediaDetailSec', function () { 8367 pendingIndex = $(this).data('index') || 0; 8368 $modal.modal('show'); 8369 }); 8370}); 8371 8372$('.ui.modal.modalGallerSlide .slideImg img').each(function() { 8373 var $img = $(this); 8374 $img.on('error', function() { 8375 $(this).removeAttr('src').addClass('broken-image'); 8376 }); 8377 if ($img[0].complete && $img[0].naturalWidth === 0) { 8378 $img.trigger('error'); 8379 } 8380}); 8381$(document).ready(function () { 8382var retailselect = document.getElementsByClassName('retailselect'); 8383if(retailselect && retailselect.length > 0) { 8384 TapsFloorMainRetails(); 8385 TapsBrowseTypeRetail(); 8386 TabsSelectFloorRelated(); 8387 AccordionFloorPlanRelated(); 8388 addActiveClassRetail(); 8389 } 8390}); 8391 8392 8393function addActiveClassRetail() { 8394 const element = document.querySelector('.mainDirectoryBrowseSec.RetaledFloor .mainTitleTabs .itemTitleTab .tab'); 8395 const subelement = document.querySelector('.mainDirectoryBrowseSec.RetaledFloor .floorTitleTabs .itemFloorTitle'); 8396 if (element) { 8397 element.click(); 8398 if(subelement){ 8399 subelement.click(); 8400 } 8401 } 8402} 8403 8404$(window).scroll(function(){ 8405 8406 var element = $(".mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs"); 8407 8408 if (element.length) { 8409 var offsetTop = element.offset().top; 8410 if ($(this).scrollTop() > (offsetTop + 100)) { 8411 $('.mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs .itemBrowseBody .filterBrowse').addClass('sticky'); 8412 } else { 8413 $('.mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs .itemBrowseBody .filterBrowse').removeClass('sticky'); 8414 } 8415 } 8416 8417}); 8418 8419$(".mainDirectoryBrowseSec.RetaledFloor .btn_view_detail").click(function () { 8420 $('.ui.modal.modalDirectoryDetail').modal('show'); 8421}); 8422 8423 8424 8425function TapsFloorMainRetails() { 8426 $(".mainDirectoryBrowseSec.RetaledFloor .mainTitleTabs .itemTitleTab .tab").click(function () { 8427 $(".mainDirectoryBrowseSec.RetaledFloor .mainTitleTabs .itemTitleTab").removeClass("active"); 8428 $(this).parent().addClass("active"); 8429 var clickedTabIndex = $(this).parent().index(); 8430 $(".mainDirectoryBrowseSec.RetaledFloor .mainBodyTabs .itemBodyTabs").removeClass("active"); 8431 $(".mainDirectoryBrowseSec.RetaledFloor .mainBodyTabs .itemBodyTabs:eq(" + clickedTabIndex + ")").addClass("active"); 8432 $(".mainDirectoryBrowseSec.RetaledFloor .mainBodyTabs .itemBodyTabs:eq(" + clickedTabIndex + ") .itemFloorTitle:first").click(); 8433 }); 8434} 8435 8436function TapsBrowseTypeRetail() { 8437 $(".mainDirectoryBrowseSec.RetaledFloor .browseTitleTabs .itemBrowseTitle .tab").click(function () { 8438 $(".mainDirectoryBrowseSec.RetaledFloor .browseTitleTabs .itemBrowseTitle").removeClass("active"); 8439 $(this).parent().addClass("active"); 8440 var clickedTabIndex = $(this).parent().index(); 8441 $(".mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs .itemBrowseBody").removeClass("active"); 8442 $(".mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs .itemBrowseBody:eq(" + clickedTabIndex + ")").addClass("active"); 8443 }); 8444 8445 $(".mainDirectoryBrowseSec.RetaledFloor .browseTitleTabs .ui.inline.dropdown").dropdown({ 8446 forceSelection: false, //***** 8447 direction: "downward", 8448 delay: { 8449 touch: 2000, 8450 }, 8451 onChange: function (value, text, $selectedItem) { 8452 var $item = $('.mainDirectoryBrowseSec.RetaledFloor .menu .item[data-text="' + text + '"]'); 8453 var selectedIndex = $item.data('index') 8454 $(".mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs .itemBrowseBody").removeClass("active"); 8455 $(".mainDirectoryBrowseSec.RetaledFloor .browseBodyTabs .itemBrowseBody:eq(" + selectedIndex + ")").addClass("active"); 8456 } 8457 }); 8458} 8459 8460 8461 8462function AccordionFloorPlanRelated() { 8463 var accordions = $('.mainDirectoryBrowseSec.RetaledFloor .itemFloorBody .ui.accordion'); 8464 $(accordions).accordion(); 8465} 8466 8467function TabsSelectFloorRelated() { 8468 $(".mainDirectoryBrowseSec.RetaledFloor .floorTitleTabs .itemFloorTitle").click(function () { 8469 $(".mainDirectoryBrowseSec.RetaledFloor .floorTitleTabs .itemFloorTitle").removeClass("active"); 8470 $(this).addClass("active"); 8471 var url = $(this).data("path"); 8472 8473 if (url) { 8474 url = url + ".html"; 8475 var loader = $('#customLoader'); 8476 loader.show(); 8477 $.get(url) 8478 .done(function(data) { 8479 var modalElem = $('.itemBodyTabs.active .floorBodyTabs'); 8480 var modaldata = $('.ui.modal.modalFloorZoom .custom-container'); 8481 var itemFloorBodyContent = $(data).find('.itemFloorBody'); 8482 modalElem.html(itemFloorBodyContent); 8483 var modalContent = $(data).find('.itemFloorBody .boxImg .container-custom-container .zoomist-container'); 8484 modaldata.html(modalContent); 8485 AccordionFloorPlanRelated(); 8486 firstAccordionOpen(); 8487 loader.hide(); 8488 }) 8489 .fail(function() { 8490 console.error("Failed to fetch data "); 8491 }); 8492 } 8493 8494 var clickedTabIndex = $(this).index(); 8495 $(".mainDirectoryBrowseSec.RetaledFloor .floorBodyTabs .itemFloorBody").removeClass("active"); 8496 $(".mainDirectoryBrowseSec.RetaledFloor .floorBodyTabs .itemFloorBody:eq(" + clickedTabIndex + ")").addClass("active"); 8497 8498 }); 8499} 8500 8501function firstAccordionOpen(){ 8502 $(".mainDirectoryBrowseSec.RetaledFloor .floorBodyTabs .itemFloorBody.active .ui.accordion").each(function() { 8503 $(this).find(".title:eq(0)").addClass("active"); 8504 $(this).find(".content:eq(0)").addClass("active"); 8505 }); 8506} 8507 8508function attachZoomFunctionality() { 8509 $('.ui.modal.modalFloorZoom').modal('show'); 8510 new Zoomist('.modalFloorZoom .zoomist-container', { 8511 maxScale: 4, 8512 bounds: true, 8513 slider: true, 8514 zoomer: true 8515 }); 8516} 8517 8518 8519var nameBrowseTitleSwiper = new Swiper(".nameBrowseTitleSwiper", { 8520 slidesPerView: "auto", 8521 spaceBetween: 0, 8522 resizeObserver:!($("body").data('custom-mode') == "edit"), 8523 slidesPerGroup: 1, 8524 speed: 500, 8525 breakpoints: { 8526 1200: { 8527 slidesPerView: "auto", 8528 spaceBetween: 0, 8529 slidesPerGroup: 1, 8530 navigation: { 8531 nextEl: ".swiper-button-search-next", 8532 prevEl: ".swiper-button-search-prev", 8533 }, 8534 }, 8535 992: { 8536 slidesPerView: 20, 8537 spaceBetween: 0, 8538 slidesPerGroup: 3, 8539 navigation: { 8540 nextEl: ".swiper-button-search-next", 8541 prevEl: ".swiper-button-search-prev", 8542 }, 8543 }, 8544 768: { 8545 slidesPerView: 15, 8546 spaceBetween: 0, 8547 slidesPerGroup: 3, 8548 navigation: { 8549 nextEl: ".swiper-button-search-next", 8550 prevEl: ".swiper-button-search-prev", 8551 }, 8552 }, 8553 250: { 8554 slidesPerView: "auto", 8555 spaceBetween: 0, 8556 slidesPerGroup: 3, 8557 navigation: { 8558 nextEl: ".swiper-button-search-next", 8559 prevEl: ".swiper-button-search-prev", 8560 }, 8561 } 8562 } 8563}); 8564 8565var floorTitleSwiper = new Swiper(".floorTitleSwiper", { 8566 slidesPerView: "auto", 8567 spaceBetween: 0, 8568 slidesPerGroup: 1, 8569 speed: 500, 8570 direction: "vertical", 8571 breakpoints: { 8572 1200: { 8573 slidesPerView: "auto", 8574 spaceBetween: 0, 8575 slidesPerGroup: 1, 8576 direction: "vertical", 8577 navigation: { 8578 nextEl: ".swiper-button-floor-next", 8579 prevEl: ".swiper-button-floor-prev", 8580 }, 8581 }, 8582 992: { 8583 slidesPerView: "auto", 8584 spaceBetween: 0, 8585 slidesPerGroup: 1, 8586 direction: "vertical", 8587 navigation: { 8588 nextEl: ".swiper-button-floor-next", 8589 prevEl: ".swiper-button-floor-prev", 8590 }, 8591 }, 8592 768: { 8593 slidesPerView: "auto", 8594 spaceBetween: 0, 8595 slidesPerGroup: 1, 8596 direction: 'horizontal', 8597 navigation: { 8598 nextEl: ".swiper-button-floor-next", 8599 prevEl: ".swiper-button-floor-prev", 8600 }, 8601 }, 8602 250: { 8603 slidesPerView: "auto", 8604 spaceBetween: 0, 8605 slidesPerGroup: 1, 8606 direction: 'horizontal', 8607 navigation: { 8608 nextEl: ".swiper-button-floor-next", 8609 prevEl: ".swiper-button-floor-prev", 8610 }, 8611 } 8612 } 8613}); 8614$(document).ready(function () { 8615 var mainPromotionSection = document.getElementsByClassName('mainPromotionSec'); 8616 if (mainPromotionSection && mainPromotionSection.length > 0) { 8617 fixSpaceMainPromotionSec(); 8618 initializePromotionSwiper(); 8619 } 8620}); 8621 8622var mainPromotionSection = document.getElementsByClassName('mainPromotionSec'); 8623if (mainPromotionSection && mainPromotionSection.length > 0) { 8624 $(window).on("load resize", function () { 8625 fixSpaceMainPromotionSec(); 8626 }); 8627} 8628 8629function fixSpaceMainPromotionSec() { 8630 8631 $(".mainPromotionSec .promotionSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 8632 $(".mainPromotionSec .promotionSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 8633 $(".mainPromotionSec .promotionSwiper .spaceLeft").css("width", $(".container.custom-container").offset().left + 15); 8634 $(".mainPromotionSec .promotionSwiper .spaceRight").css("width", $(".container.custom-container").offset().left + 15); 8635 8636 setTimeout(() => { 8637 var item = $(".mainPromotionSec .promotionSwiper .slideImg img").innerHeight(); 8638 $(".mainPromotionSec .promotionSwiper .slideContent").css('min-height', item - 60); 8639 }, 1000); 8640 8641 var offsetContainer = $(".container.custom-container").offset().left; 8642 8643 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 8644 var arrowPo1 = 75; 8645 var arrowPo2 = 10; 8646 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 8647 var arrowPo1 = 65; 8648 var arrowPo2 = 5; 8649 } 8650 8651 if (offsetContainer < 85) { 8652 $(".mainPromotionSec .promotionSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo2); 8653 $(".mainPromotionSec .promotionSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo2); 8654 } else { 8655 $(".mainPromotionSec .promotionSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo1); 8656 $(".mainPromotionSec .promotionSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo1); 8657 } 8658 8659} 8660 8661 8662 8663function initializePromotionSwiper() { 8664 const swipers = document.querySelectorAll('.promotionSwiper');
8665 swipers.forEach(swiper => { 8666 new Swiper(swiper, { 8667 slidesPerView: 1, 8668 spaceBetween: 20, 8669 slidesPerGroup: 1, 8670 resizeObserver:!($("body").data('custom-mode') == "edit"), 8671 speed: 500, 8672 pagination: { 8673 el: '.swiper-pagination', 8674 clickable: true, 8675 }, 8676 navigation: { 8677 nextEl: ".swiper-button-next", 8678 prevEl: ".swiper-button-prev", 8679 }, 8680 }); 8681 }); 8682} 8683$(document).ready(function () { 8684 var programSchedule = document.getElementsByClassName('programSchedule'); 8685 if(programSchedule && programSchedule.length > 0) { 8686 setActiveTab(); 8687 initializeScheduleTabs(); 8688 } 8689}); 8690 8691function setActiveTab() { 8692 document.querySelectorAll('.mainScheduleSec').forEach(section => { 8693 const tabList = section.querySelectorAll('.innerTitleTabs .itemTitleTab'); 8694 const firstTab = tabList[0]; 8695 firstTab.classList.add("active"); 8696 updateProgramSchedule(section, firstTab.querySelectorAll(".tab")[0].attributes.getNamedItem("data-tag").value); 8697 }); 8698} 8699 8700function getPageName() { 8701 var index = window.location.pathname.lastIndexOf("/") + 1, 8702 filenameWithExtension = window.location.pathname.substr(index), 8703 filename = filenameWithExtension.split(".")[0], 8704 currentPath = window.location.pathname.split(filename)[0]; 8705 return currentPath+filename; 8706} 8707 8708function updateProgramSchedule(section, updateType) { 8709 const detailPagePath = section.querySelectorAll("#detailPagePath")[0].value; 8710 const uri = section.querySelectorAll(".custom-container")[0].attributes.getNamedItem('data-path').value; 8711 const currentPagePath = getPageName(); 8712 $.ajax 8713 ({ 8714 url: uri+ '.getProgramSchedule.json?updateType=' + updateType + '&detailPagePath=' + detailPagePath + '¤tPagePath=' + currentPagePath, 8715 contentType: "application/json; charset=utf-8", 8716 crossDomain: true, 8717 dataType: "json", 8718 type: 'get', 8719 success: function (result) { 8720 console.log(result); 8721 updateProgramScheduleList(section, result); 8722 } 8723 }); 8724} 8725 8726function updateProgramScheduleList(section, tags) { 8727 var boxNotFoundDivs = section.querySelectorAll('div.boxNotFound'); 8728 const listBodyDetail = section.querySelectorAll(".listBodyDetail"); 8729 if (tags.data.length === 0) { 8730 boxNotFoundDivs.forEach(function (div) { 8731 div.classList.remove("hidden"); 8732 div.style.display = 'block'; 8733 }); 8734 section.querySelector(".action").classList.add("hidden"); 8735 listBodyDetail[0].classList.add("hidden"); 8736 } 8737 else { 8738 listBodyDetail[0].classList.remove("hidden"); 8739 boxNotFoundDivs.forEach(function (div) { 8740 div.classList.add("hidden"); 8741 div.style.display = 'none'; 8742 let items = tags.data.map(tag => ` 8743 <a class="itemList" href=${tag.pagePath+".html"}> 8744 <div class="listDate"> 8745 <div class="textLive"> 8746 <p> 8747 LIVE 8748 </p> 8749 </div> 8750 <p class="descText date"> 8751 ${tag.endDate!= undefined ? tag.startDate + " - " + tag.endDate: tag.startDate} 8752 </p> 8753 <p class="descText time"> 8754 ${tag.timeFrom!= undefined && tag.timeTo!= undefined ? tag.timeFrom + " - " + tag.timeTo : ""} 8755 </p> 8756 <p class="textOnAir"> 8757 On Air Now 8758 </p> 8759 </div> 8760 <div class="listImg"> 8761 <img src="${tag.newsImage}" alt="${tag.newsImgAltText}"> 8762 </div> 8763 <div class="listDetail"> 8764 <div class="detail"> 8765 <p class="subText"> 8766 ${tag.newsHeading} 8767 </p> 8768 <p class="descText"> 8769 ${tag.description!= undefined ? tag.description : ""} 8770 </p> 8771 </div> 8772 <object> 8773 <a class="location" href="${tag.locationPath}"> 8774 <i class="icon-ic-location"></i>${tag.locationText} 8775 </a> 8776 </object> 8777 </div> 8778 </a> 8779 `).join(''); 8780 items = '<div class="programList">' + items + ' </div>' 8781 section.querySelector('.listBodyDetail').innerHTML= items; 8782 }); 8783 if (section.querySelector('.programList').clientHeight < section.querySelector('.listBodyDetail').clientHeight) { 8784 section.querySelector(".action").classList.add("hidden"); 8785 } else { 8786 section.querySelector(".action").classList.remove("hidden"); 8787 } 8788 } 8789} 8790 8791function initializeScheduleTabs() { 8792 document.querySelectorAll('.mainScheduleSec').forEach(section => { 8793 const tabItems = section.querySelectorAll('.boxTitleTabsSchedule .itemTitleTab .tab'); 8794 const bodyTabs = section.querySelectorAll('.boxBodyTabsSchedule .itemBodyTab'); 8795
8796 tabItems.forEach((tab, index) => { 8797 tab.addEventListener('click', function () { 8798 section.querySelectorAll('.boxTitleTabsSchedule .itemTitleTab').forEach(item => item.classList.remove('active')); 8799 // bodyTabs.forEach(body => body.classList.remove('active')); 8800 8801 tab.parentElement.classList.add('active'); 8802 // bodyTabs[index].classList.add('active'); 8803 console.log($(this).data("tag")); 8804 updateProgramSchedule(section, $(this).data("tag")); 8805 }); 8806 }); 8807 8808 const btnPlusMore = section.querySelectorAll('.boxBodyTabsSchedule .itemBodyTab .action .btn_plus_more'); 8809 btnPlusMore.forEach(btn => { 8810 btn.addEventListener('click', function () { 8811 btn.classList.add('hide'); 8812 btn.closest('.itemBodyTab').classList.add('loadMore'); 8813 }); 8814 }); 8815 8816 window.addEventListener('load', scrollToTop); 8817 window.addEventListener('resize', scrollToTop); 8818 8819 function scrollToTop() { 8820 const listBodyDetail = section.querySelector('.boxBodyTabsSchedule .listBodyDetail'); 8821 if (listBodyDetail) { 8822 listBodyDetail.scrollTop = 0; 8823 } 8824 } 8825 }); 8826} 8827 8828 8829$(document).ready(function () { 8830 var sectionmainOutTeamSec = document.getElementsByClassName('mainOutTeamSec'); 8831 if (sectionmainOutTeamSec && sectionmainOutTeamSec.length > 0) { 8832 fixSpacMainOutTeamSec(); 8833 8834 var numberOfSlides = $('.ourTeamMobile .ourTeamSwiper .swiper-slide').length; 8835 8836 if (numberOfSlides == 1) { 8837 $('.mainOutTeamSec .headlineSec .titleText').addClass('w100'); 8838 $('.mainOutTeamSec .ourTeamSwiper .swiper-number').addClass('d-none'); 8839 } else { 8840 $('.mainOutTeamSec .headlineSec .titleText').addClass('w60'); 8841 } 8842 8843 initializeOurTeamItemClicks(); 8844 initializeOurTeamSwiper(); 8845 } 8846}); 8847 8848$(window).on("load resize", function () { 8849 fixSpacMainOutTeamSec(); 8850}); 8851 8852function fixSpacMainOutTeamSec() { 8853 setTimeout(() => { 8854 $(".mainOutTeamSec .ourTeamSlide .ourTeamSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 8855 $(".mainOutTeamSec .ourTeamSlide .ourTeamSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 8856 $(".mainOutTeamSec .ourTeamSlide .ourTeamSwiper .swiper-number").css("margin-right", $(".container.custom-container").offset().left + 15); 8857 }, 50); 8858} 8859 8860function initializeOurTeamSwiper() { 8861 const swipers = document.querySelectorAll('.ourTeamSwiper'); 8862 swipers.forEach(swiper => { 8863 new Swiper(swiper, { 8864 slidesPerView: "auto", 8865 speed: 500, 8866 slidesPerGroup: 3, 8867 resizeObserver:!($("body").data('custom-mode') == "edit"), 8868 pagination: { 8869 el: '.swiper-pagination', 8870 type: "fraction", 8871 }, 8872 navigation: { 8873 nextEl: ".swiper-button-next", 8874 prevEl: ".swiper-button-prev", 8875 }, 8876 breakpoints: { 8877 992: { 8878 slidesPerView: "auto", 8879 centeredSlides: false, 8880 spaceBetween: 0, 8881 slidesPerGroup: 3, 8882 }, 8883 768: { 8884 slidesPerView: "auto", 8885 centeredSlides: false, 8886 spaceBetween: 0, 8887 slidesPerGroup: 2, 8888 }, 8889 250: { 8890 slidesPerView: 1.1, 8891 spaceBetween: 10, 8892 centeredSlides: true, 8893 slidesPerGroup: 1, 8894 } 8895 } 8896 }); 8897 }); 8898} 8899 8900function initializeOurTeamItemClicks() { 8901 const sections = document.querySelectorAll('.mainOutTeamSec'); 8902 8903 sections.forEach(section => { 8904 const itemMediaElements = section.querySelectorAll('.slideItem'); 8905 const modal = section.querySelector('.ui.modal.modalOurTeam'); 8906
8907 itemMediaElements.forEach(item => { 8908 item.addEventListener('click', function () { 8909 if (modal) { 8910 const content = this.querySelector(".innerModal-content").innerHTML; 8911 modal.querySelector('.contentModal .innerModal').innerHTML = content; 8912 8913 // Save the current scroll position 8914 const scrollPos = window.scrollY; 8915 8916 // Open the modal 8917 $(modal).modal({ 8918 onHidden: function () { 8919 // Restore the scroll position when the modal is closed 8920 window.scrollTo(0, scrollPos); 8921 } 8922 }).modal('show'); 8923 } 8924 }); 8925 }); 8926 }); 8927} 8928 8929$(document).ready(function () { 8930 var sectionmainMediaSec = document.getElementsByClassName('mainMediaSec'); 8931 if (sectionmainMediaSec && sectionmainMediaSec.length > 0) { 8932 initializeMediaSwiper(); 8933 // fixSpaceMainMediaSec(); 8934 TagMoreMediaFunction(); 8935 8936 var numberOfSlides = $('.mediaSwiper .swiper-slide').length; 8937 8938 if (numberOfSlides == 1) { 8939 $('.mainMediaSec .headlineSec .titleText').addClass('w100'); 8940 $('.mainMediaSec .mediaSwiper .swiper-number').addClass('d-none'); 8941 } else { 8942 $('.mainMediaSec .headlineSec .titleText').addClass('w60'); 8943 } 8944 } 8945}); 8946 8947var resizeTimer; 8948 8949$(window).on("load resize", function () { 8950 fixSpaceMainMediaSec(); 8951 clearTimeout(resizeTimer); 8952 resizeTimer = setTimeout(function () { 8953 TagMoreMediaFunction(); 8954 }, 250); 8955}); 8956 8957function TagMoreMediaFunction() { 8958 var itemMediaDefault = $('.mainMediaSec .itemMedia').width() - 40; 8959 $('.mainMediaSec .itemMedia').each(function () { 8960 var totalItemTagWidth = 0; 8961 $(this).find('.tags .itemTag').each(function () { 8962 var itemTagWidth = $(this).innerWidth(); 8963 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 8964 totalItemTagWidth += itemTagWidth; 8965 } else { 8966 $(this).addClass('d-none'); 8967 $(this).siblings(".itemTagMore").addClass('d-block'); 8968 } 8969 }); 8970 }); 8971 // console.log(itemMediaDefault) 8972} 8973 8974function fixSpaceMainMediaSec() { 8975var mainMediaSec = document.getElementsByClassName('mainMediaSec'); 8976if(mainMediaSec && mainMediaSec.length > 0) { 8977 setTimeout(() => { 8978 $(".mainMediaSec .headlineSec").css("padding-left", $(".container.custom-container").offset().left + 15); 8979 $(".mainMediaSec .mediaSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 8980 $(".mainMediaSec .mediaSwiper .swiper-number").css("padding-left", $(".container.custom-container").offset().left + 15); 8981 }, 50); 8982 } 8983} 8984 8985 8986function initializeMediaSwiper() { 8987 const swipers = document.querySelectorAll('.mediaSwiper'); 8988 swipers.forEach(swiper => { 8989 new Swiper(swiper, { 8990 slidesPerView: 3, 8991 spaceBetween: 20, 8992 speed: 500, 8993 resizeObserver:!($("body").data('custom-mode') == "edit"), 8994 centeredSlides: false, 8995 pagination: { 8996 el: '.swiper-pagination', 8997 type: "fraction", 8998 }, 8999 navigation: { 9000 nextEl: ".swiper-button-next", 9001 prevEl: ".swiper-button-prev", 9002 }, 9003 breakpoints: { 9004 1480: { 9005 slidesPerView: 3, 9006 spaceBetween: 20, 9007 centeredSlides: false, 9008 slidesPerGroup: 3, 9009 }, 9010 992: { 9011 slidesPerView: 2.3, 9012 spaceBetween: 20, 9013 centeredSlides: false, 9014 slidesPerGroup: 2, 9015 }, 9016 768: { 9017 slidesPerView: 1.5, 9018 spaceBetween: 20, 9019 centeredSlides: false, 9020 slidesPerGroup: 1, 9021 }, 9022 540: { 9023 slidesPerView: 1.5, 9024 spaceBetween: 10, 9025 centeredSlides: false, 9026 slidesPerGroup: 1, 9027 }, 9028 250: { 9029 slidesPerView: 1.1, 9030 spaceBetween: 10, 9031 centeredSlides: true, 9032 slidesPerGroup: 1, 9033 } 9034 } 9035 }); 9036 }); 9037} 9038$(document).ready(function () { 9039 var sectionmainLoopSecone = document.getElementsByClassName('mainLoopSec'); 9040 if (sectionmainLoopSecone && sectionmainLoopSecone.length > 0) { 9041 fixSpaceMainLoopSec(); 9042 initializeLoopSwiper(); 9043 initializeLoopItem4Swiper(); 9044 } 9045}); 9046 9047$(window).on("load resize", function () { 9048 fixSpaceMainLoopSec(); 9049}); 9050 9051function fixSpaceMainLoopSec() { 9052 setTimeout(() => {
9053 $(".mainLoopSec .loopSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 9054 $(".mainLoopSec .loopSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 9055 $(".mainLoopSec .loopItem4Swiper").css("padding-left", $(".container.custom-container").offset().left + 15); 9056 $(".mainLoopSec .loopItem4Swiper").css("padding-right", $(".container.custom-container").offset().left + 15); 9057 }, 50); 9058} 9059 9060$(".mainLoopSec .loopSwiper .slideItem").click(function () { 9061 $(this).toggleClass('show'); 9062 9063 if ($(this).hasClass('show')) { 9064 var heightText = $(this).find('.descText').outerHeight(); 9065 $(this).find(".detail").css('height', heightText); 9066 } else { 9067 $(this).find(".detail").removeAttr('style'); 9068 } 9069}); 9070 9071$(".mainLoopSec .loopItem4Swiper .slideItem").click(function () { 9072 $(this).toggleClass('show'); 9073 9074 if ($(this).hasClass('show')) { 9075 var heightText = $(this).find('.descText').outerHeight(); 9076 $(this).find(".detail").css('height', heightText); 9077 } else { 9078 $(this).find(".detail").removeAttr('style'); 9079 } 9080}); 9081 9082function initializeLoopSwiper() { 9083 const swipers = document.querySelectorAll('.loopSwiper'); 9084 swipers.forEach(swiper => { 9085 new Swiper(swiper, { 9086 slidesPerView: 3, 9087 slidesPerGroup: 3, 9088 spaceBetween: 20, 9089 speed: 500, 9090 resizeObserver:!($("body").data('custom-mode') == "edit"), 9091 pagination: { 9092 el: ".swiper-pagination", 9093 clickable: true, 9094 }, 9095 breakpoints: { 9096 992: { 9097 slidesPerView: 3, 9098 slidesPerGroup: 3, 9099 spaceBetween: 20, 9100 centeredSlides: false, 9101 }, 9102 768: { 9103 slidesPerView: 2, 9104 slidesPerGroup: 2, 9105 spaceBetween: 20, 9106 centeredSlides: false, 9107 }, 9108 540: { 9109 slidesPerView: 2, 9110 slidesPerGroup: 2, 9111 spaceBetween: 15, 9112 centeredSlides: false, 9113 }, 9114 250: { 9115 slidesPerView: 1.1, 9116 spaceBetween: 10, 9117 slidesPerGroup: 1, 9118 centeredSlides: true, 9119 } 9120 } 9121 }); 9122 }); 9123} 9124 9125function initializeLoopItem4Swiper() { 9126 const swipers = document.querySelectorAll('.loopItem4Swiper'); 9127 swipers.forEach(swiper => { 9128 new Swiper(swiper, { 9129 slidesPerView: 4, 9130 slidesPerGroup: 4, 9131 spaceBetween: 20, 9132 speed: 500, 9133 resizeObserver:!($("body").data('custom-mode') == "edit"), 9134 pagination: { 9135 el: ".swiper-pagination", 9136 clickable: true, 9137 }, 9138 breakpoints: { 9139 1200: { 9140 slidesPerView: 4, 9141 slidesPerGroup: 4, 9142 spaceBetween: 20, 9143 centeredSlides: false, 9144 }, 9145 992: { 9146 slidesPerView: 3, 9147 slidesPerGroup: 3, 9148 spaceBetween: 20, 9149 centeredSlides: false, 9150 }, 9151 768: { 9152 slidesPerView: 2, 9153 slidesPerGroup: 2, 9154 spaceBetween: 20, 9155 centeredSlides: false, 9156 }, 9157 540: { 9158 slidesPerView: 2, 9159 slidesPerGroup: 2, 9160 spaceBetween: 15, 9161 centeredSlides: false, 9162 }, 9163 250: { 9164 slidesPerView: 1.1, 9165 spaceBetween: 10, 9166 slidesPerGroup: 1, 9167 centeredSlides: true, 9168 } 9169 } 9170 }); 9171 }); 9172} 9173var $popdetails = $('.popup-details'); 9174var popUpPagePath = $popdetails.data('popuppagepath'); 9175var isEditMode = $popdetails.data('author') == 'author'; 9176 9177function splashRedirect() { 9178 var user = sessionStorage.getItem("userInfo"); 9179 if (user == null) { 9180 if(window.location.hostname.includes("author") || window.location.hostname.includes("localhost")){ 9181 location.href = popUpPagePath + ".html"; 9182 } 9183 else 9184 { 9185 location.href = popUpPagePath + "/" ; 9186 } 9187 storeSessionInfo(userInfo); 9188 } else { 9189 handleUserActivity(); 9190 //handlePageUnload() 9191 } 9192} 9193 9194$(document).ready(function () { 9195 if($('meta[content="base-page"]').length == 1 && popUpPagePath && !isEditMode){ 9196 splashRedirect(); 9197 } 9198}); 9199 9200// Function to store session information 9201function storeSessionInfo(userInfo) { 9202 sessionStorage.setItem('userInfo', JSON.stringify(userInfo)); 9203} 9204 9205// Function to remove session information 9206function removeSessionInfo() { 9207 sessionStorage.removeItem('userInfo'); 9208} 9209 9210// Function to handle user activity 9211function handleUserActivity() { 9212 // Reset session expiration timer on user activity 9213 clearTimeout(sessionTimeout); 9214 // Set a new session expiration timer 9215 sessionTimeout = setTimeout(removeSessionInfo, sessionDuration); 9216} 9217 9218// Function to handle page unload (e.g., when all tabs are closed) 9219function handlePageUnload() { 9220 // Remove the session information 9221 removeSessionInfo(); 9222} 9223 9224// Define session duration (e.g., 30 minutes) 9225var sessionDuration = 24 * 60 * 60 * 1000; // 30 minutes in milliseconds 9226 9227// Initialize session expiration timer 9228var sessionTimeout; 9229 9230// Event listener for user activity 9231document.addEventListener('mousemove', handleUserActivity); 9232document.addEventListener('keydown', handleUserActivity); 9233 9234// Event listener for page unload 9235//window.addEventListener('beforeunload', handlePageUnload); 9236 9237// Example: Store session information when user logs in 9238var currentTimestamp = Date.now(); 9239var userInfo = { userId: currentTimestamp}; 9240//storeSessionInfo(userInfo); 9241$(document).ready(function () { 9242 var playlistCarouselEl = document.getElementsByClassName('mainPlaylistSec'); 9243 if (playlistCarouselEl && playlistCarouselEl.length > 0) { 9244 9245 fixSpaceMainPlaylistSec(); 9246 9247 var maxCharsTitle = 35; 9248 var maxCharsDesc = 85; 9249 9250 $('.mainPlaylistSec .playlistSlide .slideItem .slideContent .subText').each(function () { 9251 var textTitle = $(this).text(); 9252 if (textTitle.length > maxCharsTitle) { 9253 var truncatedText = textTitle.substring(0, maxCharsTitle); 9254 $(this).text(truncatedText); 9255 } 9256 }); 9257 9258 $('.mainPlaylistSec .playlistSlide .slideItem .slideContent .descText').each(function () { 9259 var textDetail = $(this).text(); 9260 if (textDetail.length > maxCharsDesc) { 9261 var truncatedText = textDetail.substring(0, maxCharsDesc); 9262 $(this).text(truncatedText); 9263 } 9264 }); 9265 9266 $(window).on("load resize", function () { 9267 fixSpaceMainPlaylistSec(); 9268 }); 9269 9270 initializePlaylistSwiper(); 9271 9272 } 9273}); 9274 9275function fixSpaceMainPlaylistSec() { 9276 9277 $(".mainPlaylistSec .playlistSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 9278 $(".mainPlaylistSec .playlistSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 9279 $(".mainPlaylistSec .playlistSwiper .spaceLeft").css("width", $(".container.custom-container").offset().left + 15); 9280 $(".mainPlaylistSec .playlistSwiper .spaceRight").css("width", $(".container.custom-container").offset().left + 15); 9281 9282 var offsetContainer = $(".container.custom-container").offset().left; 9283 9284 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 9285 var arrowPo1 = 75; 9286 var arrowPo2 = 10; 9287 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 9288 var arrowPo1 = 65; 9289 var arrowPo2 = 5; 9290 } 9291 9292 if (offsetContainer < 85) { 9293 $(".mainPlaylistSec .playlistSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo2); 9294 $(".mainPlaylistSec .playlistSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo2); 9295 } else { 9296 $(".mainPlaylistSec .playlistSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo1); 9297 $(".mainPlaylistSec .playlistSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo1); 9298 } 9299 9300} 9301 9302function initializePlaylistSwiper() { 9303 const swipers = document.querySelectorAll('.playlistSwiper');
9304 swipers.forEach(swiper => { 9305 new Swiper(swiper, { 9306 slidesPerView: 3, 9307 spaceBetween: 20, 9308 slidesPerGroup: 3, 9309 speed: 500, 9310 resizeObserver:!($("body").data('custom-mode') == "edit"), 9311 pagination: { 9312 el: '.swiper-pagination', 9313 clickable: true, 9314 }, 9315 navigation: { 9316 nextEl: ".swiper-button-next", 9317 prevEl: ".swiper-button-prev", 9318 }, 9319 breakpoints: { 9320 1025: { 9321 slidesPerView: 3, 9322 spaceBetween: 20, 9323 slidesPerGroup: 3, 9324 }, 9325 768: { 9326 slidesPerView: 2, 9327 spaceBetween: 20, 9328 slidesPerGroup: 2, 9329 }, 9330 540: { 9331 slidesPerView: 2, 9332 spaceBetween: 10, 9333 slidesPerGroup: 2, 9334 }, 9335 250: { 9336 slidesPerView: 1, 9337 spaceBetween: 10, 9338 slidesPerGroup: 1, 9339 } 9340 } 9341 }); 9342 }); 9343} 9344 9345 9346'use strict' 9347var plantmap = document.getElementsByClassName('plantmap'); 9348if(plantmap && plantmap.length > 0) { 9349$(".plantmap .mainPlantsMapSec .filterType1 .ui.inline.dropdown").dropdown({ 9350 forceSelection: false, //***** 9351 direction: "downward", 9352 delay: { 9353 touch: 0, 9354 }, 9355 onShow: function () { 9356 $(".ui.inline.dropdown").not(this).dropdown('hide'); 9357 } 9358 }); 9359 9360$(".plantmap .mainPlantsMapSec .filterType2 .ui.inline.dropdown").dropdown({ 9361 forceSelection: false, //***** 9362 direction: "downward", 9363 delay: { 9364 touch: 0, 9365 }, 9366 onShow: function () { 9367 $(".ui.inline.dropdown").not(this).dropdown('hide'); 9368 } 9369 }); 9370 9371$(".plantmap .mainPlantsMapSec .filterType3 .ui.inline.dropdown").dropdown({ 9372 forceSelection: false, //***** 9373 direction: "downward", 9374 delay: { 9375 touch: 0, 9376 }, 9377 onShow: function () { 9378 $(".ui.inline.dropdown").not(this).dropdown('hide'); 9379 } 9380 }); 9381} 9382 9383var plantMapSwiper = new Swiper(".plantMapSwiper", { 9384 speed: 500, 9385 loop: 'true', 9386 resizeObserver:!($("body").data('custom-mode') == "edit"), 9387 breakpoints: { 9388 768: { 9389 slidesPerView: 2, 9390 spaceBetween: 20, 9391 slidesPerGroup: 1, 9392 }, 9393 250: { 9394 slidesPerView: 1, 9395 spaceBetween: 0, 9396 slidesPerGroup: 1, 9397 } 9398 } 9399}); 9400 9401var detailtranslation 9402var directiontranslation 9403var map 9404var infowindow 9405var contentString = 9406 '<div id="content">' + 9407 '<div id="siteNotice">' + 9408 "</div>" + 9409 '<h1 id="firstHeading" class="firstHeading">Uluru</h1>' + 9410 '<div id="bodyContent">' + 9411 "<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large " + 9412 "sandstone rock formation in the southern part of the " + 9413 "Northern Territory, central Australia. It lies 335 km (208 mi) " + 9414 "south west of the nearest large town, Alice Springs; 450 km " + 9415 "(280 mi) by road. Kata Tjuta and Uluru are the two major " + 9416 "features of the Uluru - Kata Tjuta National Park. Uluru is " + 9417 "sacred to the Pitjantjatjara and Yankunytjatjara, the " + 9418 "Aboriginal people of the area. It has many springs, waterholes, " + 9419 "rock caves and ancient paintings. Uluru is listed as a World " + 9420 "Heritage Site.</p>" + 9421 '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">' + 9422 "https://en.wikipedia.org/w/index.php?title=Uluru</a> " + 9423 "(last visited June 22, 2009).</p>" + 9424 "</div>" + 9425 "</div>"; 9426 9427var apiResponse = []; // Define apiResponse globally 9428 9429var NewResponse = []; // Define apiResponse globally 9430 9431function isMobile() { 9432 return window.innerWidth <= 768; 9433} 9434 9435var currentIndex = 0; 9436var itemsPerPage = isMobile() ? 5 : 10; 9437 9438function initMap() { 9439 9440 var styledMapType = new google.maps.StyledMapType( 9441 [ 9442 { 9443 "elementType": "geometry", 9444 "stylers": [ 9445 { "color": "#e9e9e9" } 9446 ] 9447 }, 9448 { 9449 "elementType": "labels.text.fill", 9450 "stylers": [ 9451 { "color": "#333333" } 9452 ] 9453 }, 9454 { 9455 "elementType": "labels.text.stroke", 9456 "stylers": [ 9457 { "color": "#ffffff" } 9458 ] 9459 }, 9460 { 9461 "featureType": "administrative", 9462 "elementType": "geometry", 9463 "stylers": [ 9464 { "visibility": "off" } 9465 ] 9466 }, 9467 { 9468 "featureType": "landscape", 9469 "elementType": "geometry", 9470 "stylers": [ 9471 { "color": "#f0f0f0" } 9472 ] 9473 }, 9474 { 9475 "featureType": "poi", 9476 "elementType": "geometry", 9477 "stylers": [ 9478 { "color": "#cfe7f3" } 9479 ] 9480 }, 9481 { 9482 "featureType": "road", 9483 "elementType": "geometry", 9484 "stylers": [ 9485 { "color": "#b3b3b3" } 9486 ] 9487 }, 9488 { 9489 "featureType": "road", 9490 "elementType": "labels.text.fill", 9491 "stylers": [ 9492 { "color": "#808080" } 9493 ] 9494 }, 9495 { 9496 "featureType": "road", 9497 "elementType": "labels.text.stroke", 9498 "stylers": [ 9499 { "color": "#ffffff" } 9500 ] 9501 }, 9502 { 9503 "featureType": "water", 9504 "elementType": "geometry", 9505 "stylers": [ 9506 { "color": "#a0d3d3" } 9507 ] 9508 }, 9509 { 9510 "featureType": "water", 9511 "elementType": "labels.text.fill", 9512 "stylers": [ 9513 { "color": "#737373" } 9514 ] 9515 } 9516 ], 9517 { name: 'Blue Styled Map' } 9518 ); 9519 9520 map = new google.maps.Map(document.getElementById('map'), { 9521 center: { lat: 13.75, lng: 100.5 }, 9522 mapTypeControl: false, 9523 fullscreenControl: false, 9524 zoom: 11, 9525 mapTypeControlOptions: { 9526 mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain', 'styled_map'] 9527 } 9528 }); 9529 9530 map.mapTypes.set('styled_map', styledMapType); 9531 map.setMapTypeId('styled_map'); 9532} 9533 9534function addplantMarker(plant, index) { 9535 var plantmapMarkerValue = document.querySelector('.plantmap .mainPlantsMapSec .container') 9536 ? document.querySelector('.plantmap .mainPlantsMapSec .container').getAttribute('data-mapmarker') || '/content/dam/onebangkok_v2/mark_point.png' 9537 : '/content/dam/onebangkok_v2/mark_point.png'; 9538 var icon = { 9539 url: plantmapMarkerValue, 9540 scaledSize: new google.maps.Size(25, 25), // scaled size 9541 origin: new google.maps.Point(0, 0), // origin 9542 anchor: new google.maps.Point(0, 0) // anchor 9543 }; 9544 9545 var marker = new google.maps.Marker({ 9546 position: { lat: plant.lat, lng: plant.lng }, 9547 map: map, 9548 title: plant.name, 9549 icon: icon, 9550 }); 9551 9552 apiResponse[plant.id - 1]['marker'] = marker; 9553 9554 marker.addListener('click', function () { 9555 moveMap(plant.id - 1) 9556 9557 $(".mainPlantsMapSec .listItem .item").removeClass("active"); 9558 $(".mainPlantsMapSec .listItem .item").eq(plant.id - 1).addClass("active"); 9559 9560 var scrollableDiv = $('.mainPlantsMapSec .listItem'); 9561 var activeItem = $('.mainPlantsMapSec .listItem .item.active'); 9562 if (activeItem.length) { 9563 scrollableDiv.animate({ 9564 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 9565 }, 500); 9566 } 9567 9568 }); 9569 9570} 9571 9572function searchtermmap() { 9573 var searchvalue = document.getElementById('searchtermmap').value 9574 let NewResponse = searchPlantmaps(apiResponse, searchvalue) 9575 currentIndex = 0; // Reset pagination 9576 displayPlants(NewResponse) 9577} 9578 9579function searchPlantmaps(apiResponse, keyword) { 9580 const filteredResponse = apiResponse.filter(plant => { 9581 return plant.sub_name.toLowerCase().includes(keyword.toLowerCase()) || 9582 plant.name.toLowerCase().includes(keyword.toLowerCase()); 9583 }); 9584 if (filteredResponse.length == 0) { 9585 toggleLoopClass(document.querySelector('.boxNotFound'), 'hidden', false); 9586 toggleLoopClass(document.querySelector('.inner.pmap'), 'hidden', true); 9587 return; 9588 } 9589 toggleLoopClass(document.querySelector('.boxNotFound'), 'hidden', true); 9590 toggleLoopClass(document.querySelector('.inner.pmap'), 'hidden', false); 9591 9592 return filteredResponse; 9593} 9594 9595 9596function displayPlants(plants = undefined, isLoadMore = false) { 9597 let dataToDisplay; 9598 9599 if (plants == undefined) { 9600 9601 dataToDisplay = apiResponse.slice(currentIndex, currentIndex + itemsPerPage); 9602 } else { 9603 9604 dataToDisplay = plants.slice(currentIndex, currentIndex + itemsPerPage); 9605 } 9606 9607 var $plantsList = $('#plants-list'); 9608 9609 if (!isLoadMore) { 9610 9611 $plantsList.empty(); 9612 currentIndex = 0; 9613 } 9614 9615 9616 $.each(dataToDisplay, function (index, plant) { 9617 var plantHtml = ` 9618 <div class="item" id="${plant.id}" onClick='moveMap(${plant.id - 1})'> 9619 <div class="boxImg"> 9620 <img src="${plant.image}" alt=""> 9621 </div> 9622 <div class="boxContent"> 9623 <div class="top"> 9624 <p class="descText">${plant.name}</p> 9625 <p class="sub">${plant.sub_name}</p> 9626 </div> 9627 <div class="bottom"> 9628 <p class="sub"> 9629 <i class="icon-ic-location"></i>${plant.LocationTitle} 9630 </p> 9631 </div> 9632 </div> 9633 </div> 9634 `; 9635 $plantsList.append(plantHtml); 9636 addplantMarker(plant, currentIndex + index); 9637 }); 9638 9639 // Check if more items are available to show 9640 if (plants == undefined) { 9641 if (currentIndex + itemsPerPage >= apiResponse.length) { 9642 $('.plantmap .mainPlantsMapSec .viewMore').hide(); 9643 } else { 9644 $('.plantmap .mainPlantsMapSec .viewMore').show(); 9645 } 9646 } else { 9647 if (currentIndex + itemsPerPage >= plants.length) { 9648 $('.plantmap .mainPlantsMapSec .viewMore').hide(); 9649 } else { 9650 $('.plantmap .mainPlantsMapSec .viewMore').show(); 9651 } 9652 } 9653 9654 currentIndex += itemsPerPage; 9655 clickOnPlantActiveItem(); 9656} 9657 9658function clickOnPlantActiveItem() { 9659 // Find the element with the class "item active" 9660 const activeItem = document.querySelector('.plantmap .mainPlantsMapSec #plants-list .item'); 9661 if (activeItem) { 9662 activeItem.click(); 9663 } else { 9664 console.error("No element with class 'item active' found."); 9665 } 9666} 9667 9668 9669function moveMap(index) { 9670 var item = apiResponse[index] 9671 var pos = { 9672 lat: parseFloat(item['lat']), 9673 lng: parseFloat(item['lng']) 9674 }; 9675 9676 var detailText = detailtranslation; 9677 var directionText = directiontranslation; 9678 9679 contentString = 9680 '<div class="boxMarkMap">' + 9681 '<div class="itemMarkMap">' + 9682 '<div class="boxImg">
9682' + 9683 '<img src=' + item['image'] + '>' + 9684 '</div>' + 9685 '<div class="boxContent">' + 9686 '<p class="descText">' + item['name'] + '</p>' + 9687 '<p class="sub">' + item['sub_name'] + '</p>' + 9688 '<div class="bottom">' + 9689 '<p class="sub">' + '<i class="icon-ic-location"></i>' + item['LocationTitle'] + '</p>' + 9690 '</div>' + 9691 '<div class="action">' + 9692 '<button class="btn-default">' + 9693 '<span class="buttonContainer">' + 9694 '<a target="_blank" href="' + item['ctaUrl'] + '">' + 9695 '<span class="buttonText">' + 9696 '<span>' + detailText + '</span>' + 9697 '<span>' + detailText + '</span>' + 9698 '</span>' + 9699 '</span>' + 9700 '</a>' + 9701 '</button>' + 9702 '<button class="btn-link">' + 9703 '<a target="_blank" href="https://www.google.com/maps/dir/?api=1&destination=' + item['lat'] + ',' + item['lng'] + '">' + 9704 '<i class="icon-ic-curve-arrow"></i>' + 9705 '<span>' + directionText + '</span>' + 9706 '</a>' + 9707 '</button>' + 9708 '</div>' 9709 "</div>" + 9710 "</div>" + 9711 "</div>"; 9712 if (infowindow) { 9713 infowindow.close(); 9714 } 9715 infowindow = new google.maps.InfoWindow({ 9716 content: contentString, 9717 }); 9718 9719 map.setCenter(pos); 9720 // map.setZoom(11) 9721 infowindow.open(map, item.marker); 9722 9723 setTimeout(() => { 9724 var heightButton = $('.mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 9725 9726 if (heightButton > 120) { 9727 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 9728 } else { 9729 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 9730 } 9731 }, 50); 9732 /* 9733 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 9734 $([document.documentElement, document.body]).animate({ 9735 scrollTop: $("#map").offset().top - 150 9736 }, 500); 9737 } 9738 */ 9739 9740} 9741 9742 9743 9744 9745 9746function filterPlantAPIResponse(apiResponse, planttype, plantorigin, LocationTitle) { 9747 9748 let filteredData = apiResponse; 9749 9750 // Primary filter for planttype 9751 if (planttype !== null && planttype !== "All Plants") { 9752 filteredData = _.filter(filteredData, item => item.planttype === planttype); 9753 } 9754 9755 // Secondary filter for plantorigin 9756 if (plantorigin !== null && plantorigin !== "All Place of origin") { 9757 filteredData = _.filter(filteredData, item => item.plantorigin === plantorigin); 9758 } 9759 9760 // Tertiary filter for LocationTitle 9761 if (LocationTitle !== null && LocationTitle !== "All Location") { 9762 filteredData = _.filter(filteredData, item => item.LocationTitle === LocationTitle); 9763 } 9764 9765 if (filteredData.length == 0) { 9766 toggleLoopClass(document.querySelector('.boxNotFound'), 'hidden', false); 9767 toggleLoopClass(document.querySelector('.inner.pmap'), 'hidden', true); 9768 return; 9769 } 9770 toggleLoopClass(document.querySelector('.boxNotFound'), 'hidden', true); 9771 toggleLoopClass(document.querySelector('.inner.pmap'), 'hidden', false); 9772 9773 return filteredData; 9774} 9775 9776function toggleLoopClass(element, className, shouldAdd) { 9777 if (element) { 9778 element.classList.toggle(className, shouldAdd); 9779 } 9780} 9781 9782 9783function generatePlantDivs(apiResponse, property, parentId) { 9784 // Extract unique values for the specified property 9785 const uniqueValues = [...new Set(apiResponse.map(item => item[property]))]; 9786 9787 // Create an array to store div elements 9788 const divs = []; 9789 9790 // Create div elements for each unique value 9791 uniqueValues.forEach((value, index) => { 9792 const div = document.createElement('div'); 9793 div.classList.add('item'); 9794 div.setAttribute('data-text', value); 9795 div.setAttribute('data-option-value', value); 9796 div.setAttribute('data-index', index + 1); // Adding 1 to make index 1-based 9797 div.textContent = value; 9798 divs.push(div); 9799 }); 9800
9801 // Append the generated divs to the specified parent element 9802 const parentElement = document.getElementById(parentId); 9803 if (parentElement) { 9804 divs.forEach(div => { 9805 parentElement.appendChild(div); 9806 }); 9807 } else { 9808 console.error(`Parent element with ID ${parentId} not found.`); 9809 } 9810 9811 return divs; 9812} 9813 9814function addPlantevent() { 9815 document.querySelector('.custom-drop__opt').addEventListener('click', updateContentMap); 9816 document.querySelector('.custom-drop__opt-month').addEventListener('click', updateContentMap); 9817 document.querySelector('.custom-drop__opt-tag').addEventListener('click', updateContentMap); 9818} 9819 9820// Function to capture dropdown values and call reRenderPageContentPlant 9821function updateContentMap() { 9822 const filterValue = document.querySelector(' .custom-drop__opt .item.active').getAttribute('data-option-value') 9823 const filterMonthValue = document.querySelector(' .custom-drop__opt-month .item.active').getAttribute('data-option-value') 9824 const filterTagsValue = document.querySelector(' .custom-drop__opt-tag .item.active').getAttribute('data-option-value') 9825 const searchvalue = document.getElementById('searchtermmap').value 9826 9827 NewResponse = filterPlantAPIResponse(apiResponse, filterValue, filterMonthValue, filterTagsValue); 9828 currentIndex = 0; // Reset pagination 9829 displayPlants(NewResponse); 9830} 9831 9832 9833const initPageListingMap = (url) => { 9834 const reqUrl = `${url}` 9835 9836 9837 axios.get(reqUrl).then((res) => { 9838 apiResponse = JSON.parse(res.data.newsDetails); 9839 detailtranslation = res.data.detailText; 9840 directiontranslation = res.data.directionText; 9841 initMap(); 9842 // setTimeout(displayPlants, 500); 9843 displayPlants(); 9844 if (apiResponse) { 9845 moveMap(0); 9846 } 9847 // moveMap(0); 9848 generatePlantDivs(apiResponse, 'planttype', 'planttypee'); 9849 generatePlantDivs(apiResponse, 'plantorigin', 'plantorigin'); 9850 generatePlantDivs(apiResponse, 'LocationTitle', 'plantlocation'); 9851 addPlantevent(); 9852 $(".mainPlantsMapSec .listItem .item:first").addClass("active"); 9853 9854 setTimeout(() => { 9855 var heightButton = $('.mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 9856 9857 if (heightButton > 120) { 9858 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 9859 } else { 9860 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 9861 } 9862 }, 400); 9863 9864 $(".mainPlantsMapSec .listItem").on("click", ".item", function () { 9865 $(".mainPlantsMapSec .listItem .item").removeClass("active"); 9866 $(this).addClass("active"); 9867 }); 9868 9869 $('.mainPlantsMapSec .viewMore .btn-default').on('click', function () { 9870 9871 displayPlants(NewResponse.length > 0 ? NewResponse : undefined, true); 9872 // updateContentMap(); 9873 9874 // displayPlants(); 9875 if (currentIndex > itemsPerPage) { 9876 moveMap(currentIndex - itemsPerPage); 9877 $(".mainPlantsMapSec .listItem .item").removeClass("active"); 9878 $(".mainPlantsMapSec .listItem .item").eq(currentIndex - itemsPerPage).addClass("active"); 9879 var scrollableDiv = $('.mainPlantsMapSec .listItem'); 9880 var activeItem = $('.mainPlantsMapSec .listItem .item.active'); 9881 if (activeItem.length) { 9882 scrollableDiv.animate({ 9883 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 9884 }, 500); 9885 } 9886 } 9887 var plants = apiResponse 9888 if (currentIndex >= plants.length) { 9889 $('.mainPlantsMapSec .viewMore').hide(); 9890 } 9891 }); 9892 }) 9893} 9894 9895 9896function getPageTypeInSection() { 9897 var sectionElements = document.querySelectorAll('section'); 9898 for (var i = 0; i < sectionElements.length; i++) { 9899 var sectionElement = sectionElements[i]; 9900 if (sectionElement.hasAttribute('data-page-type')) { 9901 var pageType = sectionElement.getAttribute('data-page-type'); 9902 // Return the value of the attribute 9903 return pageType; 9904 } 9905 } 9906} 9907 9908const __initContentListingPlantMap = () => { 9909 var plantmapMarkerValue = document.querySelector('.plantmap .mainPlantsMapSec .container').getAttribute('data-mapmarker'); 9910 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 9911 9912 var current_page = window.location.href; 9913 9914 var current_page_split = current_page.split(".html"); 9915 9916 _.forEach(dataContentRenderingContainer, (contentRender) => { 9917 9918 if (contentRender.dataset.contentRender === 'page') { 9919 9920 var pagetype = getPageTypeInSection(); 9921 9922 initPageListingMap(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 9923 9924 // initPageListingMap('https://xieranmaya.github.io/images/cats/cats.json') 9925 } 9926 }) 9927}; 9928 9929(function () { 9930 let stateCheck = setInterval(() => { 9931 if (document.readyState === 'complete' && getPageTypeInSection() == "plantmap") { 9932 clearInterval(stateCheck) 9933 __initContentListingPlantMap() 9934 console.log('Plant Map script imported') 9935 } 9936 }, 100) 9937})() 9938'use strict' 9939 9940 var scientificNameText; 9941 var familyNameText; 9942 9943function sortFilterMonthPlants(filterMonth) { 9944 const monthOrder = { 9945 'January': 1, 'February': 2, 'March': 3, 'April': 4, 9946 'May': 5, 'June': 6, 'July': 7, 'August': 8, 9947 'September': 9, 'October': 10, 'November': 11, 'December': 12 9948 }; 9949 9950 return _.sortBy(filterMonth, obj => monthOrder[obj.name]); 9951} 9952 9953const onListingFilterChangedPlant = new Event('onFilterChanged') 9954 9955const onPageChangedGoToTopPlant = true 9956 9957const CONTENT_CONFIG_Plant = { 9958 maximumItemPerPage: 9, 9959} 9960 9961let CONTENT_LISTING_Plant = { 9962 page: { 9963 yearfilter: null, 9964 monthfilter: null, 9965 tagfilter: null, 9966 searchString: null, 9967 sorteddate: null, 9968 currentFilter: null, 9969 filterKey: null, 9970 currentPage: 0, 9971 offset: 0, 9972 data: [], 9973 showing: { 9974 start: 0, 9975 end: CONTENT_CONFIG_Plant.maximumItemPerPage - 1, 9976 }, 9977 }, 9978} 9979 9980let FILTERED_CONTENT_LISTING_PLANT = { 9981 page: { 9982 yearfilter: null, 9983 monthfilter: null, 9984 tagfilter: null, 9985 searchString: null, 9986 currentFilter: null, 9987 filterKey: null, 9988 currentPage: 0, 9989 offset: 0, 9990 data: [], 9991 showing: { 9992 start: 0, 9993 end: CONTENT_CONFIG_Plant.maximumItemPerPage - 1, 9994 }, 9995 }, 9996} 9997 9998function updateDivStylesPlants() { 9999 var innerDivs = document.querySelectorAll('div.inner'); 10000 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 10001 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 10002
10003 innerDivs.forEach(function (div) { 10004 div.style.display = 'none'; 10005 }); 10006 10007 paginationMediaDivs.forEach(function (div) { 10008 div.style.display = 'none'; 10009 }); 10010 10011 boxNotFoundDivs.forEach(function (div) { 10012 div.classList.remove("hidden"); 10013 div.style.display = 'block'; 10014 }); 10015} 10016function plantreverseDivStyles() { 10017 var innerDivs = document.querySelectorAll('div.inner'); 10018 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 10019 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 10020 10021 innerDivs.forEach(function (div) { 10022 div.style.display = 'flex'; 10023 }); 10024 10025 paginationMediaDivs.forEach(function (div) { 10026 div.style.display = 'block'; 10027 }); 10028 10029 boxNotFoundDivs.forEach(function (div) { 10030 div.style.display = 'none'; 10031 }); 10032} 10033 10034 10035 10036 10037function sortPlantByDate(data, order) { 10038 const getDate = (item) => { 10039 if (order === "Popular") { 10040 return new Date(item.sortedFormattedDate); 10041 } else { 10042 return new Date(item.date); 10043 } 10044 }; 10045 10046 return data.sort((a, b) => { 10047 const dateA = getDate(a); 10048 const dateB = getDate(b); 10049 10050 if (order === "asc") { 10051 return dateA - dateB; 10052 } else if (order === "dsc") { 10053 return dateB - dateA; 10054 } else if (order === "Popular") { 10055 return dateA - dateB; 10056 } 10057 }); 10058} 10059 10060const generateMonthDropdownFilterPlant = (name, value, formattedFilteredMonth, active = false) => { 10061 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 10062 ${formattedFilteredMonth} 10063 </div>` 10064 return htmlToElement(item) 10065} 10066 10067const generateDropdownFilterPlant = (name, value, active = false) => { 10068 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 10069 ${name} 10070 </div>` 10071 return htmlToElement(item) 10072} 10073 10074const resetPagePaginationPlant = (activePage = null) => { 10075 if (activePage !== null) { 10076 FILTERED_CONTENT_LISTING_PLANT.page.currentPage = activePage 10077 } 10078 10079 const paginationDots = document.querySelector('.pagination--dots') 10080 const config = FILTERED_CONTENT_LISTING_PLANT.page 10081 10082var teststrings = document.getElementById('searchterm').value; 10083 10084const filteredDataYear = _.filter(config.data, (item) => { 10085 if (config.currentFilter === null || config.currentFilter === 'All Plants') { 10086 return true 10087 } else { 10088 return item.planttype == config.currentFilter 10089 } 10090 }) 10091 10092 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 10093 if (config.monthfilter === null || config.monthfilter === 'All Place of origin') { 10094 return true 10095 } else { 10096 10097 return item.plantorigin == config.monthfilter 10098 } 10099 }) 10100 10101 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 10102 if (config.tagfilter === null || config.tagfilter === 'All Location') { 10103 return true 10104 } else { 10105 return item.LocationTitle.includes(config.tagfilter); 10106 } 10107 }) 10108 10109 const filteredDataSearch = teststrings ? _.filter(filteredDataTag, (item) => { 10110 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(teststrings.toLowerCase())); 10111 }) : filteredDataTag; 10112 10113 const filteredData = sortPlantByDate(filteredDataSearch, CONTENT_LISTING_Plant.page.sorteddate); 10114 10115 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Plant.maximumItemPerPage) 10116 10117 const fragment = document.createDocumentFragment() 10118 10119 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 10120 10121 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 10122 10123 let currentActiveDot = null 10124 _.forEach(getChildNodes(paginationDots), (item, index) => { 10125 if (item.classList.contains('active')) { 10126 currentActiveDot = index 10127 } 10128 item.remove() 10129 }) 10130 10131 let newActiveDot = null 10132 10133 _.times(_.size(dataChunk), (index) => { 10134 if (_.size(dataChunk) > 1) { 10135 const node = document.createElement('a'); 10136 node.innerText = index + 1; // Adding 1 to index since index starts from 0 10137 if (index === config.currentPage) { 10138 node.classList.add('active'); 10139 newActiveDot = index; 10140 } 10141 node.addEventListener('click', () => {
10142 reRenderPageContentPlant({ page: index }); 10143 onPageChangedGoToTopPlant && window.scrollTo({ top: 0, behavior: 'smooth' }); 10144 }); 10145 fragment.appendChild(node); 10146 10147 } else { 10148 document.querySelector(".paginationMedia").style.display = "none"; 10149 } 10150 }); 10151 10152 10153 paginationDots.appendChild(fragment) 10154 normalizePagination(currentActiveDot, newActiveDot) 10155 10156 if (config.currentPage > 0) { 10157 prevBtn.classList.remove('disabled') 10158 } else { 10159 prevBtn.classList.add('disabled') 10160 } 10161 10162 if (config.currentPage < _.size(dataChunk) - 1) { 10163 nextBtn.classList.remove('disabled') 10164 } else { 10165 nextBtn.classList.add('disabled') 10166 } 10167 let requestUpdatePagination = new Event('requestUpdatePagination') 10168 document.dispatchEvent(requestUpdatePagination) 10169 updatePagination(); 10170} 10171 10172const setPagePaginationPlant = (activePage = null) => { 10173 if (activePage !== null) { 10174 10175 CONTENT_LISTING_Plant.page.currentPage = activePage 10176 } 10177 10178 const paginationDots = document.querySelector('.pagination--dots') 10179 const config = CONTENT_LISTING_Plant.page 10180 10181 10182 var teststrings = document.getElementById('searchterm').value; 10183 10184 const filteredDataYear = _.filter(config.data, (item) => { 10185 if (config.currentFilter === null || config.currentFilter === 'All Plants') { 10186 return true 10187 } else { 10188 return item.planttype == config.currentFilter 10189 } 10190 }) 10191 10192 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 10193 if (config.monthfilter === null || config.monthfilter === 'All Place of origin') { 10194 return true 10195 } else { 10196 10197 return item.plantorigin == config.monthfilter 10198 } 10199 }) 10200 10201 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 10202 if (config.tagfilter === null || config.tagfilter === 'All Location') { 10203 return true 10204 } else { 10205 return item.LocationTitle.includes(config.tagfilter); 10206 } 10207 }) 10208 10209 const filteredDataSearch = teststrings ? _.filter(filteredDataTag, (item) => { 10210 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(teststrings.toLowerCase())); 10211 }) : filteredDataTag; 10212 10213 const filteredData = sortPlantByDate(filteredDataSearch, CONTENT_LISTING_Plant.page.sorteddate); 10214 10215 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Plant.maximumItemPerPage) 10216 10217 const fragment = document.createDocumentFragment() 10218 10219 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 10220 10221 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 10222 10223 let currentActiveDot = null 10224 _.forEach(getChildNodes(paginationDots), (item, index) => { 10225 if (item.classList.contains('active')) { 10226 currentActiveDot = index 10227 } 10228 item.remove() 10229 }) 10230 10231 let newActiveDot = null 10232 10233 _.times(_.size(dataChunk), (index) => { 10234 if (_.size(dataChunk) > 1) { 10235 const node = document.createElement('a'); 10236 node.innerText = index + 1; // Adding 1 to index since index starts from 0 10237 if (index === config.currentPage) { 10238 node.classList.add('active'); 10239 newActiveDot = index; 10240 } 10241 node.addEventListener('click', () => { 10242 reRenderPageContentPlant({ page: index }); 10243 onPageChangedGoToTopPlant && window.scrollTo({ top: 0, behavior: 'smooth' }); 10244 }); 10245 fragment.appendChild(node); 10246 10247 } else { 10248 document.querySelector(".paginationMedia").style.display = "none"; 10249 } 10250 }); 10251 10252 10253 paginationDots.appendChild(fragment) 10254 normalizePagination(currentActiveDot, newActiveDot) 10255 10256 if (config.currentPage > 0) { 10257 prevBtn.classList.remove('disabled') 10258 } else { 10259 prevBtn.classList.add('disabled') 10260 } 10261 10262 if (config.currentPage < _.size(dataChunk) - 1) { 10263 nextBtn.classList.remove('disabled') 10264 } else { 10265 nextBtn.classList.add('disabled') 10266 } 10267 let requestUpdatePagination = new Event('requestUpdatePagination') 10268 document.dispatchEvent(requestUpdatePagination) 10269 updatePagination(); 10270} 10271 10272// Function to capture dropdown values and call reRenderPageContentPlant 10273function updateContentPlant() { 10274 const filterValue = document.querySelector(' .custom-dropdown__opt .item.active').getAttribute('data-option-value') 10275 const filterMonthValue = document.querySelector(' .custom-dropdown__opt-month .item.active').getAttribute('data-option-value') 10276 const filterTagsValue = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value')
10277 const filterSortValue = document.querySelector(' .custom-dropdown__opt-sort .item.active').getAttribute('data-option-value') 10278 var searchvalue = document.getElementById('searchterm').value 10279 10280 reRenderPageContentPlant({ 10281 filter: filterValue, 10282 filtermonth: filterMonthValue, 10283 searchString: searchvalue, 10284 filterTags: filterTagsValue, 10285 sortdate: filterSortValue 10286 }); 10287} 10288 10289 10290 10291const reRenderPageContentPlant = ({ page = 0, filter = null, filtermonth = null, filterTags = null, loadmore = false, searchString = null, sortdate = null }) => { 10292 10293 10294 if (typeof page !== 'undefined') { 10295 setPagePaginationPlant(page) 10296 } 10297 10298 if (filter || filtermonth || filterTags || searchString || sortdate) { 10299 setPagePaginationPlant(0) 10300 CONTENT_LISTING_Plant.page.offset = 0 10301 CONTENT_LISTING_Plant.page.currentFilter = filter 10302 CONTENT_LISTING_Plant.page.yearfilter = filter 10303 CONTENT_LISTING_Plant.page.monthfilter = filtermonth 10304 CONTENT_LISTING_Plant.page.tagfilter = filterTags 10305 CONTENT_LISTING_Plant.page.searchString = searchString 10306 10307 resetPagePaginationPlant(0) 10308 CONTENT_LISTING_Plant.page.sorteddate = sortdate 10309 FILTERED_CONTENT_LISTING_PLANT.page.offset = 0 10310 FILTERED_CONTENT_LISTING_PLANT.page.currentFilter = filter 10311 FILTERED_CONTENT_LISTING_PLANT.page.yearfilter = filter 10312 FILTERED_CONTENT_LISTING_PLANT.page.monthfilter = filtermonth 10313 FILTERED_CONTENT_LISTING_PLANT.page.tagfilter = filterTags 10314 FILTERED_CONTENT_LISTING_PLANT.page.searchString = searchString; 10315 } 10316 10317 const config = CONTENT_LISTING_Plant.page 10318 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 10319 const filteredDataYear = _.filter(config.data, (item) => { 10320 if (config.currentFilter === null || config.currentFilter === 'All Plants') { 10321 return true 10322 } else { 10323 return item.planttype == config.currentFilter 10324 } 10325 }) 10326 10327 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 10328 if (config.monthfilter === null || config.monthfilter === 'All Place of origin') { 10329 return true 10330 } else { 10331 10332 return item.plantorigin == config.monthfilter 10333 } 10334 }) 10335 10336 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 10337 if (config.tagfilter === null || config.tagfilter === 'All Location') { 10338 return true 10339 } else { 10340 return item.LocationTitle.includes(config.tagfilter); 10341 } 10342 }) 10343 10344 const filteredDataSearch = searchString ? _.filter(filteredDataTag, (item) => { 10345 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(searchString.toLowerCase())); 10346 }) : filteredDataTag; 10347 10348 const filteredData = sortPlantByDate(filteredDataSearch, CONTENT_LISTING_Plant.page.sorteddate); 10349 10350 10351 if (filteredData.length > 0) { 10352 plantreverseDivStyles(); 10353 10354 10355 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Plant.maximumItemPerPage + config.offset) 10356 10357 if (contentWrapperEl) { 10358 let dataToShown 10359 10360 if (!loadmore) { 10361 contentWrapperEl.innerHTML = '' 10362 dataToShown = dataChunk[config.currentPage] 10363 } else { 10364 dataToShown = _.slice(dataChunk[config.currentPage], config.offset) 10365 10366 } 10367 10368 _.forEach(dataToShown, (item) => { 10369 let el = generateArticleThumbnailPlant({ 10370 head: item.heading, 10371 tags: item.LocationTitle, 10372 scientific: item.scientific, 10373 family: item.family, 10374 locationtitle : item.LocationTitle, 10375 locationurl : item.LocationURL, 10376 summary: item.summary, 10377 planttype : item.planttype, 10378 plantorigin : item.plantorigin, 10379 sortedFormattedDate: item.sortedFormattedDate, 10380 ctaUrl: item.ctaUrl, 10381 imgAlt: item.thumbnailalttext, 10382 imgUrl: item.url, 10383 ctaLabel: item.ctaLabel, 10384 }) 10385 contentWrapperEl.appendChild(el) 10386 }) 10387 10388 CONTENT_LISTING_Plant.page = { 10389 ...CONTENT_LISTING_Plant.page, 10390 showing: { 10391 start: config.currentPage * CONTENT_CONFIG_Plant.maximumItemPerPage, 10392 end: config.currentPage * CONTENT_CONFIG_Plant.maximumItemPerPage + _.size(dataToShown) - 1, 10393 }, 10394 } 10395 10396 if (filter || filtermonth || filterTags || searchString || sortdate) { 10397 10398 FILTERED_CONTENT_LISTING_PLANT.page.data = filteredData 10399 FILTERED_CONTENT_LISTING_PLANT.page.filterKey = ['year', 'month', 'tag'] 10400 resetPagePaginationPlant(page) 10401 } else { 10402 setPagePaginationPlant(page) 10403 } 10404 10405
10406 const loadMoreBtn = document.querySelector('[data-content-loadmore=page]') 10407 if (loadMoreBtn) { 10408 if (CONTENT_LISTING_Plant.page.offset + CONTENT_CONFIG_Plant.maximumItemPerPage >= _.size(filteredData)) { 10409 loadMoreBtn.style.display = 'none' 10410 } else { 10411 loadMoreBtn.style.display = '' 10412 } 10413 } 10414 } 10415 } else { 10416 10417 updateDivStylesPlants(); 10418 } 10419} 10420 10421const renderPageContentPlant = ({ els = [], filter = [], filtermonth = [], filterTags = [] }) => { 10422 10423 10424 const config = CONTENT_LISTING_Plant.page 10425 10426 10427 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 10428 10429 const contentFilterEl = document.querySelector(`[data-content-filter=page]`) 10430 10431 10432 const pagination = document.querySelector('.pagination') 10433 10434 const emptyResult = contentWrapperEl?.nextElementSibling 10435 10436 if (_.size(els) == 0) { 10437 // pagination.classList.add('hidden') 10438 emptyResult?.classList.remove('hidden') 10439 return false 10440 } else { 10441 pagination.classList.remove('hidden') 10442 emptyResult?.classList.add('hidden') 10443 } 10444 10445 const dataChunk = _.chunk(els, CONTENT_CONFIG_Plant.maximumItemPerPage) 10446 10447 10448 if (contentWrapperEl) { 10449 const dataToShown = dataChunk[0] 10450 10451 _.forEach(dataToShown, (item) => { 10452 contentWrapperEl.appendChild(item) 10453 10454 }) 10455 } 10456 10457 if (contentFilterEl) { 10458 const optionsWrapperEl = document.querySelector('.custom-dropdown__opt') 10459 const optionsWrapperElMonth = document.querySelector('.custom-dropdown__opt-month') 10460 const optionsWrapperElTag = document.querySelector('.custom-dropdown__opt-tag') 10461 10462 // Adding click event listeners to dropdowns 10463 document.querySelector('.custom-dropdown__opt').addEventListener('click', updateContentPlant); 10464 document.querySelector('.custom-dropdown__opt-month').addEventListener('click', updateContentPlant); 10465 document.querySelector('.custom-dropdown__opt-tag').addEventListener('click', updateContentPlant); 10466 document.querySelector('.custom-dropdown__opt-sort').addEventListener('click', updateContentPlant); 10467 10468 const filterOptionEl = _.map(_.orderBy(filter, 'value', 'desc'), (item) => { 10469 let el = generateDropdownFilterPlant(item.name, item.value) 10470 10471 return el 10472 }) 10473 10474 const filterOptionElMonth = _.map(sortFilterMonthPlants(filtermonth), (item) => { 10475 let el = generateMonthDropdownFilterPlant(item.name, item.value, item.formattedFilteredMonth) 10476 10477 return el 10478 }) 10479 10480 const filterOptionElTag = _.map(_.orderBy(filterTags, 'value', 'desc'), (item) => { 10481 let el = generateDropdownFilterPlant(item.name, item.value) 10482 10483 return el 10484 }) 10485 10486 const filterEls = filterOptionEl 10487 10488 const filterElsmonth = filterOptionElMonth 10489 10490 const filterElsTag = filterOptionElTag 10491 10492 10493 _.forEach(filterEls, (item) => { 10494 10495 optionsWrapperEl.appendChild(item) 10496 }) 10497 10498 _.forEach(filterOptionElMonth, (item) => { 10499 10500 optionsWrapperElMonth.appendChild(item) 10501 }) 10502 10503 _.forEach(filterOptionElTag, (item) => { 10504 10505 optionsWrapperElTag.appendChild(item) 10506 }) 10507 10508 document.dispatchEvent(onListingFilterChangedPlant) 10509 10510 setPagePaginationPlant() 10511 10512 const prevBtn = pagination.querySelector('.pagPrev') 10513 10514 const nextBtn = pagination.querySelector('.pagNext') 10515 10516 const filteredData = _.filter(config.data, (item) => { 10517 if (config.currentFilter === null || config.currentFilter === 'all') { 10518 10519 return true 10520 } else { 10521 10522 return item[config.filterKey[0]] == config.currentFilter 10523 } 10524 }) 10525 10526 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Plant.maximumItemPerPage) 10527 10528 prevBtn.addEventListener('click', () => { 10529 const config = CONTENT_LISTING_Plant.page 10530 if (config.currentPage > 0) { 10531 reRenderPageContentPlant({ page: config.currentPage - 1 }) 10532 onPageChangedGoToTopPlant && window.scrollTo({ top: 0, behavior: 'smooth' }) 10533 } 10534 }) 10535 10536 nextBtn.addEventListener('click', () => { 10537 const config = CONTENT_LISTING_Plant.page 10538 if (config.currentPage < _.size(dataChunk) - 1) {
10539 reRenderPageContentPlant({ page: config.currentPage + 1 }) 10540 onPageChangedGoToTopPlant && window.scrollTo({ top: 0, behavior: 'smooth' }) 10541 } 10542 }) 10543 10544 } 10545 let requestUpdatePagination = new Event('requestUpdatePagination') 10546 document.dispatchEvent(requestUpdatePagination); 10547 setTimeout( function() { updatePagination(); },50); 10548} 10549 10550const generateArticleThumbnailPlant = ({ head, tags, scientific, family, locationtitle, locationurl, summary, planttype, plantorigin, date, ctaUrl, imgAlt, year, imgUrl, ctaLabel }) => { 10551 10552 // Construct the HTML for the article thumbnail 10553 let item = ` 10554 <div class="itemMedia"> 10555 <div class="boxImg"> 10556 <a href="${ctaUrl}"> 10557 <img src="${imgUrl}" alt="${imgAlt}"> 10558 </a> 10559 </div> 10560 <div class="boxContent"> 10561 <a href="${ctaUrl}"> 10562 <p class="subText">${head}</p> 10563 </a> 10564 <div class="list"> 10565 <p class="descText"> 10566 ${scientificNameText} : 10567 </p> 10568 <p class="descText"> 10569 ${scientific} 10570 </p> 10571 </div> 10572 <div class="list"> 10573 <p class="descText"> 10574 ${familyNameText} : 10575 </p> 10576 <p class="descText"> 10577 ${family} 10578 </p> 10579 </div> 10580 <div class="detail"> 10581 <a href="${locationurl}"> 10582 <p> 10583 <i class="icon-ic-location"></i> 10584 ${locationtitle} 10585 </p> 10586 </a> 10587 </div> 10588 </div> 10589 </div>`; 10590 10591 return htmlToElement(item); 10592} 10593 10594 10595const initPageListingPlant = (url) => { 10596 const reqUrl = `${url}` 10597 let els = [] 10598 let filter = [] 10599 let filtermonth = [] 10600 let filterYear = [] 10601 let filterTags = [] 10602 10603 axios.get(reqUrl).then((res) => { 10604 const responseData = JSON.parse(res.data.newsDetails); 10605 scientificNameText = res.data.scientifictranslation; 10606 familyNameText = res.data.familytranslation; 10607 10608 // const responseData = res.data 10609 _.forEach( 10610 _.filter(responseData, (item) => true), 10611 (item) => { 10612 10613 els.push( 10614 generateArticleThumbnailPlant({ 10615 head: item.heading, 10616 tags: item.LocationTitle, 10617 scientific: item.scientific, 10618 family: item.family, 10619 locationtitle : item.LocationTitle, 10620 locationurl : item.LocationURL, 10621 summary: item.summary, 10622 planttype : item.planttype, 10623 plantorigin : item.plantorigin, 10624 sortedFormattedDate: item.sortedFormattedDate, 10625 ctaUrl: item.ctaUrl, 10626 imgAlt: item.thumbnailalttext, 10627 imgUrl: item.url, 10628 ctaLabel: item.ctaLabel, 10629 }) 10630 ) 10631 10632 filter.push({ name: item.planttype, value: item.planttype }) 10633 10634 filterYear.push({ name: item.planttype, value: item.planttype }) 10635 10636 filtermonth.push({ name: item.plantorigin, value: item.plantorigin, formattedFilteredMonth: item.plantorigin }) 10637 10638 filterTags.push({ name: item.LocationTitle, value: item.LocationTitle }) 10639 10640 10641 CONTENT_LISTING_Plant.page = { ...CONTENT_LISTING_Plant.page, currentPage: 0, data: responseData, filterKey: ['year', 'month', 'tag'] } 10642 10643 } 10644 ) 10645 renderPageContentPlant({ 10646 els, 10647 filter: _.uniqBy(filter, 'value'), 10648 filtermonth: _.uniqBy(filtermonth, 'value'), 10649 filterYear: _.uniqBy(filterYear, 'value'), 10650 filterTags: _.uniqBy(filterTags, 'value') 10651 }) 10652 }) 10653} 10654 10655 10656function getPageTypeInSection() { 10657 var sectionElements = document.querySelectorAll('section'); 10658 for (var i = 0; i < sectionElements.length; i++) { 10659 var sectionElement = sectionElements[i]; 10660 if (sectionElement.hasAttribute('data-page-type')) { 10661 var pageType = sectionElement.getAttribute('data-page-type'); 10662 // Return the value of the attribute 10663 return pageType; 10664 } 10665 } 10666} 10667 10668const __initContentListingPlant = () => { 10669 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 10670 10671 var current_page = window.location.href; 10672 var current_page_split = current_page.split(".html"); 10673 10674 _.forEach(dataContentRenderingContainer, (contentRender) => { 10675 10676 if (contentRender.dataset.contentRender === 'page') { 10677 10678 var pagetype = getPageTypeInSection(); 10679 10680 initPageListingPlant(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 10681 10682 } 10683 }) 10684}; 10685(function () { 10686 let stateCheck = setInterval(() => { 10687 if (document.readyState === 'complete' && getPageTypeInSection() == "plantlist" ) { 10688 clearInterval(stateCheck) 10689 __initContentListingPlant() 10690 console.log('Plant List page listing script imported') 10691 } 10692 }, 100) 10693 })() 10694 10695$(document).ready(function () { 10696 var listplant = document.getElementsByClassName('plantlist'); 10697 if (listplant && listplant.length > 0) { 10698 PagNext(); 10699 PagPrev(); 10700 updatePagination(); 10701 PagActive(); 10702 } 10703}); 10704 10705/* 10706The pagenation functions listed below are written in Newslist components JavaScript. 10707 PagNext(); 10708 PagPrev(); 10709 updatePagination(); 10710 PagActive(); 10711*/ 10712var plantlist = document.getElementsByClassName('plantlist'); 10713if(plantlist && plantlist.length > 0) { 10714$(".plantlist .mainListMediaSec .filterYear .ui.inline.dropdown").dropdown({ 10715 forceSelection: false, //***** 10716 direction: "downward", 10717 delay: { 10718 touch: 0, 10719 }, onShow: function () { 10720 $(".ui.inline.dropdown").not(this).dropdown('hide'); 10721 } 10722}); 10723 10724$(".plantlist .mainListMediaSec .filterMonths .ui.inline.dropdown").dropdown({ 10725 forceSelection: false, //***** 10726 direction: "downward", 10727 delay: { 10728 touch: 0, 10729 }, onShow: function () { 10730 $(".ui.inline.dropdown").not(this).dropdown('hide'); 10731 } 10732}); 10733 10734$(".plantlist .mainListMediaSec .filterSegments .ui.inline.dropdown").dropdown({ 10735 forceSelection: false, //***** 10736 direction: "downward", 10737 delay: { 10738 touch: 0, 10739 }, onShow: function () { 10740 $(".ui.inline.dropdown").not(this).dropdown('hide'); 10741 } 10742}); 10743 10744$(".plantlist .mainListMediaSec .filterSoft .ui.inline.dropdown").dropdown({ 10745 forceSelection: false, //***** 10746 direction: "downward", 10747 delay: { 10748 touch: 0, 10749 }, onShow: function () { 10750 $(".ui.inline.dropdown").not(this).dropdown('hide'); 10751 } 10752}); 10753} 10754 10755'use strict' 10756 10757$(document).ready(function(){ 10758 init3D(); 10759}); 10760function init3D(){ 10761 10762 $(".box3DIframe .popUp3D .btn-default").click(function(){ 10763 10764 $(".full-screen-banner__content--iframe").addClass("active"); 10765 $(".box3DIframe").hide(); 10766 $(".full-screen-banner__content--iframe").show(); 10767 }); 10768 10769 $(".main3Dsec .btn-close-modal").click(function(){ 10770 $(".full-screen-banner__content--iframe").removeClass("active"); 10771 $(".full-screen-banner__content--iframe").hide(); 10772 $(".box3DIframe").show(); 10773 }) 10774} 10775 10776$(document).ready(function () { 10777 var sectionmainSmartSec = document.getElementsByClassName('mainSmartSec'); 10778 if (sectionmainSmartSec && sectionmainSmartSec.length > 0) { 10779 fixSpaceMainSmartSec(); 10780 initializeSmartSwiper(); 10781 initializeSmartSlideClicks(); 10782 } 10783}); 10784 10785$(window).on("load resize", function () { 10786 fixSpaceMainSmartSec(); 10787}); 10788 10789function fixSpaceMainSmartSec() { 10790 $(".mainSmartSec .smartSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 10791 $(".mainSmartSec .smartSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 10792} 10793 10794function initializeSmartSwiper() { 10795 const swipers = document.querySelectorAll('.smartSwiper');
10796 swipers.forEach(swiper => { 10797 new Swiper(swiper, { 10798 slidesPerView: "auto", 10799 spaceBetween: 20, 10800 speed: 500, 10801 slidesPerGroup: 1, 10802 resizeObserver: !($("body").data('custom-mode') == "edit"), 10803 pagination: { 10804 el: '.swiper-pagination', 10805 type: "fraction", 10806 }, 10807 navigation: { 10808 nextEl: ".swiper-button-next", 10809 prevEl: ".swiper-button-prev", 10810 }, 10811 breakpoints: { 10812 992: { 10813 spaceBetween: 20, 10814 slidesPerGroup: 1, 10815 }, 10816 400: { 10817 spaceBetween: 20, 10818 slidesPerGroup: 1, 10819 }, 10820 250: { 10821 spaceBetween: 0, 10822 slidesPerGroup: 1, 10823 } 10824 } 10825 }); 10826 }); 10827} 10828 10829function initializeSmartSlideClicks() { 10830 const sections = document.querySelectorAll('.mainSmartSec'); 10831 10832 sections.forEach(section => { 10833 const slideItems = section.querySelectorAll('.slideItem .slideImg .default'); 10834 const modal = section.querySelector('.ui.modal.modalSmartSlide'); 10835 const swiperContainer = modal.querySelector('.modalSmartSwiper'); 10836 10837 let modalSwiper; 10838 10839 slideItems.forEach((slide, index) => { 10840 slide.dataset.index = index + 1; 10841 10842 slide.addEventListener('click', function () { 10843 if (modal) { 10844 $(modal).modal('show'); 10845 10846 if (!modalSwiper) { 10847 modalSwiper = new Swiper(swiperContainer, { 10848 slidesPerView: 1, 10849 spaceBetween: 0, 10850 speed: 500, 10851 effect: "fade", 10852 pagination: { 10853 el: '.swiper-pagination', 10854 type: "fraction", 10855 }, 10856 navigation: { 10857 nextEl: ".swiper-button-next", 10858 prevEl: ".swiper-button-prev", 10859 }, 10860 }); 10861 } 10862 10863 modalSwiper.slideTo(index, 0, false); 10864 10865 setTimeout(function () { 10866 modalSwiper.pagination.update(); 10867 }, 50); 10868 } 10869 }); 10870 }); 10871 }); 10872} 10873 10874$(document).ready(function () { 10875 var sectionmainFuturisticSec = document.getElementsByClassName('mainFuturisticSec'); 10876 if (sectionmainFuturisticSec && sectionmainFuturisticSec.length > 0) { 10877 fixSpaceMainFuturisticSec(); 10878 initializeFuturisticSwiper(); 10879 } 10880}); 10881 10882$(window).on("load resize", function () { 10883 fixSpaceMainFuturisticSec(); 10884}); 10885 10886function fixSpaceMainFuturisticSec() { 10887 setTimeout(() => { 10888 $(".mainFuturisticSec .futuristicSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 10889 $(".mainFuturisticSec .futuristicSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 10890 }, 50); 10891} 10892 10893function initializeFuturisticSwiper() { 10894 const swipers = document.querySelectorAll('.futuristicSwiper'); 10895 swipers.forEach(swiper => { 10896 new Swiper(swiper, { 10897 slidesPerView: 4, 10898 spaceBetween: 20, 10899 resizeObserver:!($("body").data('custom-mode') == "edit"), 10900 slidesPerGroup: 3, 10901 centeredSlides: false, 10902 speed: 500, 10903 pagination: { 10904 el: '.swiper-pagination', 10905 clickable: true, 10906 }, 10907 breakpoints: { 10908 1200: { 10909 slidesPerView: 4, 10910 spaceBetween: 20, 10911 slidesPerGroup: 4, 10912 centeredSlides: false, 10913 }, 10914 992: { 10915 slidesPerView: 3, 10916 spaceBetween: 20, 10917 slidesPerGroup: 3, 10918 centeredSlides: false, 10919 }, 10920 768: { 10921 slidesPerView: 3, 10922 spaceBetween: 20, 10923 slidesPerGroup: 3, 10924 centeredSlides: false, 10925 }, 10926 540: { 10927 slidesPerView: 2, 10928 spaceBetween: 10, 10929 slidesPerGroup: 2, 10930 centeredSlides: false, 10931 }, 10932 250: { 10933 slidesPerView: 1.1, 10934 spaceBetween: 10, 10935 slidesPerGroup: 1, 10936 centeredSlides: true, 10937 } 10938 } 10939 }); 10940 }); 10941} 10942'use strict' 10943 10944// import { htmlToElement, getChildNodes, normalizePagination, getCounterText } from './core.js' 10945 10946function sortFilterMonth(filterMonth) { 10947 const monthOrder = { 10948 'January': 1, 'February': 2, 'March': 3, 'April': 4, 10949 'May': 5, 'June': 6, 'July': 7, 'August': 8, 10950 'September': 9, 'October': 10, 'November': 11, 'December': 12 10951 }; 10952 10953 return _.sortBy(filterMonth, obj => monthOrder[obj.name]); 10954} 10955function TagMore() { 10956 var itemMediaDefault = $('.mainListMediaSec .itemMedia').width() - 40; 10957 $('.mainListMediaSec .itemMedia').each(function () { 10958 var totalItemTagWidth = 0; 10959 $(this).find('.tags .itemTag').each(function () { 10960 var itemTagWidth = $(this).innerWidth(); 10961 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 10962 totalItemTagWidth += itemTagWidth; 10963 } else { 10964 $(this).addClass('d-none'); 10965 $(this).siblings(".itemTagMore").addClass('d-block'); 10966 } 10967 }); 10968 }); 10969 // console.log(itemMediaDefault) 10970} 10971const onListingFilterChanged = new Event('onFilterChanged') 10972 10973const onPageChangedGoToTop = true 10974 10975const CONTENT_CONFIG = { 10976 maximumItemPerPage: 9, 10977} 10978 10979let CONTENT_LISTING = { 10980 page: { 10981 yearfilter: null, 10982 monthfilter: null, 10983 tagfilter: null, 10984 searchString: null, 10985 sorteddate: null, 10986 currentFilter: null, 10987 filterKey: null, 10988 currentPage: 0, 10989 offset: 0, 10990 data: [], 10991 showing: { 10992 start: 0, 10993 end: CONTENT_CONFIG.maximumItemPerPage - 1, 10994 }, 10995 }, 10996} 10997 10998let FILTERED_CONTENT_LISTING = { 10999 page: { 11000 yearfilter: null, 11001 monthfilter: null, 11002 tagfilter: null, 11003 searchString: null, 11004 currentFilter: null, 11005 filterKey: null, 11006 currentPage: 0, 11007 offset: 0, 11008 data: [], 11009 showing: { 11010 start: 0, 11011 end: CONTENT_CONFIG.maximumItemPerPage - 1, 11012 }, 11013 }, 11014} 11015 11016function updateNewsDivStyles() { 11017 var innerDivs = document.querySelectorAll('div.inner'); 11018 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 11019 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 11020
11021 innerDivs.forEach(function (div) { 11022 div.style.display = 'none'; 11023 }); 11024 11025 paginationMediaDivs.forEach(function (div) { 11026 div.style.display = 'none'; 11027 }); 11028 11029 boxNotFoundDivs.forEach(function (div) { 11030 div.classList.remove("hidden"); 11031 div.style.display = 'block'; 11032 }); 11033} 11034function reverseNewsDivStyles() { 11035 var innerDivs = document.querySelectorAll('div.inner'); 11036 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 11037 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 11038 11039 innerDivs.forEach(function (div) { 11040 div.style.display = 'flex'; 11041 }); 11042 11043 paginationMediaDivs.forEach(function (div) { 11044 div.style.display = 'block'; 11045 }); 11046 11047 boxNotFoundDivs.forEach(function (div) { 11048 div.style.display = 'none'; 11049 }); 11050} 11051 11052// Sort function 11053function sortByDate(data, order) { 11054 return data.sort((a, b) => { 11055 const dateA = new Date(a.sortedFormattedDate); 11056 const dateB = new Date(b.sortedFormattedDate); 11057 if (order === "asc") { 11058 return dateA - dateB; 11059 } else if (order === "dsc") { 11060 return dateB - dateA; 11061 } 11062 }); 11063} 11064 11065 11066const generateMonthDropdownFilter = (name, value, formattedFilteredMonth, active = false) => { 11067 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 11068 ${formattedFilteredMonth} 11069 </div>` 11070 return htmlToElement(item) 11071} 11072 11073const generateDropdownFilter = (name, value, active = false) => { 11074 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 11075 ${name} 11076 </div>` 11077 return htmlToElement(item) 11078} 11079 11080const resetPagePagination = (activePage = null) => { 11081 if (activePage !== null) { 11082 FILTERED_CONTENT_LISTING.page.currentPage = activePage 11083 } 11084 11085 const paginationDots = document.querySelector('.pagination--dots') 11086 const config = FILTERED_CONTENT_LISTING.page 11087 11088 var teststring = document.getElementById('searchterm').value; 11089 11090 const filteredDataYear = _.filter(config.data, (item) => { 11091 if (config.currentFilter === null || config.currentFilter === 'Years') { 11092 11093 return true 11094 } else { 11095 11096 return item[config.filterKey[0]] == config.currentFilter 11097 } 11098 }) 11099 11100 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 11101 if (config.monthfilter === null || config.monthfilter === 'Months') { 11102 11103 return true 11104 } else { 11105 11106 return item[config.filterKey[1]] == config.monthfilter 11107 } 11108 }) 11109 11110 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 11111 if (config.tagfilter === null || config.tagfilter === 'Categories') { 11112 11113 return true 11114 } else { 11115 11116 return item.tags.includes(config.tagfilter); 11117 } 11118 }) 11119 11120 const filteredDataSearch = teststring ? _.filter(filteredDataTag, (item) => { 11121 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(teststring.toLowerCase())); 11122 }) : filteredDataTag; 11123 11124 const filteredData = sortByDate(filteredDataSearch, CONTENT_LISTING.page.sorteddate); 11125 11126 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG.maximumItemPerPage) 11127 11128 const fragment = document.createDocumentFragment() 11129 11130 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 11131 11132 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 11133 11134 let currentActiveDot = null 11135 _.forEach(getChildNodes(paginationDots), (item, index) => { 11136 if (item.classList.contains('active')) { 11137 currentActiveDot = index 11138 } 11139 item.remove() 11140 }) 11141 11142 let newActiveDot = null 11143 11144 _.times(_.size(dataChunk), (index) => { 11145 if (_.size(dataChunk) > 1) { 11146 const node = document.createElement('a'); 11147 node.innerText = index + 1; // Adding 1 to index since index starts from 0 11148 if (index === config.currentPage) { 11149 node.classList.add('active'); 11150 newActiveDot = index; 11151 } 11152 node.addEventListener('click', () => {
11153 reRenderPageContent({ page: index }); 11154 onPageChangedGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }); 11155 }); 11156 fragment.appendChild(node); 11157 11158 } else { 11159 document.querySelector(".paginationMedia").style.display = "none"; 11160 } 11161 }); 11162 11163 11164 paginationDots.appendChild(fragment) 11165 normalizePagination(currentActiveDot, newActiveDot) 11166 11167 if (config.currentPage > 0) { 11168 prevBtn.classList.remove('disabled') 11169 } else { 11170 prevBtn.classList.add('disabled') 11171 } 11172 11173 if (config.currentPage < _.size(dataChunk) - 1) { 11174 nextBtn.classList.remove('disabled') 11175 } else { 11176 nextBtn.classList.add('disabled') 11177 } 11178 let requestUpdatePagination = new Event('requestUpdatePagination') 11179 document.dispatchEvent(requestUpdatePagination) 11180 updatePagination(); 11181} 11182 11183const setPagePagination = (activePage = null) => { 11184 if (activePage !== null) { 11185 11186 CONTENT_LISTING.page.currentPage = activePage 11187 } 11188 11189 const paginationDots = document.querySelector('.pagination--dots') 11190 const config = CONTENT_LISTING.page 11191 var teststrings = document.getElementById('searchterm').value; 11192 const filteredDataYear = _.filter(config.data, (item) => { 11193 if (config.currentFilter === null || config.currentFilter === 'Years') { 11194 11195 return true 11196 } else { 11197 11198 return item[config.filterKey[0]] == config.currentFilter 11199 } 11200 }) 11201 11202 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 11203 if (config.monthfilter === null || config.monthfilter === 'Months') { 11204 11205 return true 11206 } else { 11207 11208 return item[config.filterKey[1]] == config.monthfilter 11209 } 11210 }) 11211 11212 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 11213 if (config.tagfilter === null || config.tagfilter === 'Categories') { 11214 11215 return true 11216 } else { 11217 11218 return item.tags.includes(config.tagfilter); 11219 } 11220 }) 11221 11222 const filteredDataSearch = teststrings ? _.filter(filteredDataTag, (item) => { 11223 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(teststrings.toLowerCase())); 11224 }) : filteredDataTag; 11225 11226 const filteredData = sortByDate(filteredDataSearch, CONTENT_LISTING.page.sorteddate); 11227 11228 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG.maximumItemPerPage) 11229 11230 const fragment = document.createDocumentFragment() 11231 11232 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 11233 11234 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 11235 11236 let currentActiveDot = null 11237 _.forEach(getChildNodes(paginationDots), (item, index) => { 11238 if (item.classList.contains('active')) { 11239 currentActiveDot = index 11240 } 11241 item.remove() 11242 }) 11243 11244 let newActiveDot = null 11245 11246 _.times(_.size(dataChunk), (index) => { 11247 if (_.size(dataChunk) > 1) { 11248 const node = document.createElement('a'); 11249 node.innerText = index + 1; // Adding 1 to index since index starts from 0 11250 if (index === config.currentPage) { 11251 node.classList.add('active'); 11252 newActiveDot = index; 11253 } 11254 node.addEventListener('click', () => { 11255 reRenderPageContent({ page: index }); 11256 onPageChangedGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }); 11257 }); 11258 fragment.appendChild(node); 11259 11260 } else { 11261 document.querySelector(".paginationMedia").style.display = "none"; 11262 } 11263 }); 11264 11265 11266 paginationDots.appendChild(fragment) 11267 normalizePagination(currentActiveDot, newActiveDot) 11268 11269 if (config.currentPage > 0) { 11270 prevBtn.classList.remove('disabled') 11271 } else { 11272 prevBtn.classList.add('disabled') 11273 } 11274 11275 if (config.currentPage < _.size(dataChunk) - 1) { 11276 nextBtn.classList.remove('disabled') 11277 } else { 11278 nextBtn.classList.add('disabled') 11279 } 11280 let requestUpdatePagination = new Event('requestUpdatePagination') 11281 document.dispatchEvent(requestUpdatePagination) 11282 updatePagination(); 11283} 11284 11285// Function to capture dropdown values and call reRenderPageContent 11286function updateContent() { 11287 const filterValue = document.querySelector(' .custom-dropdown__opt .item.active').getAttribute('data-option-value') 11288 const filterMonthValue = document.querySelector(' .custom-dropdown__opt-month .item.active').getAttribute('data-option-value') 11289 const filterTagsValue = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value')
11290 const filterSortValue = document.querySelector(' .custom-dropdown__opt-sort .item.active').getAttribute('data-option-value') 11291 var searchvalue = document.getElementById('searchterm').value 11292 11293 reRenderPageContent({ 11294 filter: filterValue, 11295 filtermonth: filterMonthValue, 11296 filterTags: filterTagsValue, 11297 searchString: searchvalue, 11298 sortdate: filterSortValue 11299 }); 11300} 11301 11302 11303 11304const reRenderPageContent = ({ page = 0, filter = null, filtermonth = null, filterTags = null, loadmore = false, searchString = null, sortdate = null }) => { 11305 11306 if (typeof page !== 'undefined') { 11307 setPagePagination(page) 11308 } 11309 11310 if (filter || filtermonth || filterTags || searchString || sortdate) { 11311 setPagePagination(0) 11312 CONTENT_LISTING.page.offset = 0 11313 CONTENT_LISTING.page.currentFilter = filter 11314 CONTENT_LISTING.page.yearfilter = filter 11315 CONTENT_LISTING.page.monthfilter = filtermonth 11316 CONTENT_LISTING.page.tagfilter = filterTags 11317 CONTENT_LISTING.page.searchString = searchString 11318 11319 resetPagePagination(0) 11320 CONTENT_LISTING.page.sorteddate = sortdate 11321 FILTERED_CONTENT_LISTING.page.offset = 0 11322 FILTERED_CONTENT_LISTING.page.currentFilter = filter 11323 FILTERED_CONTENT_LISTING.page.yearfilter = filter 11324 FILTERED_CONTENT_LISTING.page.monthfilter = filtermonth 11325 FILTERED_CONTENT_LISTING.page.tagfilter = filterTags 11326 FILTERED_CONTENT_LISTING.page.searchString = searchString; 11327 } 11328 11329 const config = CONTENT_LISTING.page 11330 11331 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 11332 11333 11334 const filteredDataYear = _.filter(config.data, (item) => { 11335 if (config.currentFilter === null || config.currentFilter === 'Years') { 11336 11337 return true 11338 } else { 11339 11340 return item[config.filterKey[0]] == config.currentFilter 11341 } 11342 }) 11343 11344 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 11345 if (config.monthfilter === null || config.monthfilter === 'Months') { 11346 11347 return true 11348 } else { 11349 11350 return item[config.filterKey[1]] == config.monthfilter 11351 } 11352 }) 11353 11354 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 11355 if (config.tagfilter === null || config.tagfilter === 'Categories') { 11356 11357 return true 11358 } else { 11359 11360 return item.tags.includes(config.tagfilter); 11361 } 11362 }) 11363 11364 const filteredDataSearch = searchString ? _.filter(filteredDataTag, (item) => { 11365 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(searchString.toLowerCase())); 11366 }) : filteredDataTag; 11367 11368 const filteredData = sortByDate(filteredDataSearch, CONTENT_LISTING.page.sorteddate); 11369 11370 if (filteredData.length > 0) { 11371 reverseNewsDivStyles(); 11372 11373 11374 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG.maximumItemPerPage + config.offset) 11375 11376 if (contentWrapperEl) { 11377 let dataToShown 11378 11379 if (!loadmore) { 11380 contentWrapperEl.innerHTML = '' 11381 dataToShown = dataChunk[config.currentPage] 11382 } else { 11383 dataToShown = _.slice(dataChunk[config.currentPage], config.offset) 11384 11385 } 11386 11387 _.forEach(dataToShown, (item) => { 11388 let el = generateArticleThumbnail({ 11389 head: item.heading, 11390 tags: item.tags, 11391 summary: item.summary, 11392 date: item.date, 11393 month: item.month, 11394 ctaUrl: item.ctaUrl, 11395 imgAlt: item.thumbnailalttext, 11396 year: item.year, 11397 imgUrl: item.url, 11398 ctaLabel: item.ctaLabel, 11399 }) 11400 contentWrapperEl.appendChild(el) 11401 }) 11402 11403 CONTENT_LISTING.page = { 11404 ...CONTENT_LISTING.page, 11405 showing: { 11406 start: config.currentPage * CONTENT_CONFIG.maximumItemPerPage, 11407 end: config.currentPage * CONTENT_CONFIG.maximumItemPerPage + _.size(dataToShown) - 1, 11408 }, 11409 } 11410 11411 if (filter || filtermonth || filterTags || searchString || sortdate) { 11412 11413 FILTERED_CONTENT_LISTING.page.data = filteredData 11414 FILTERED_CONTENT_LISTING.page.filterKey = ['year', 'month', 'tag'] 11415 11416 resetPagePagination(page) 11417 } else { 11418 setPagePagination(page) 11419 } 11420 } 11421 } else { 11422 updateNewsDivStyles(); 11423 } 11424 11425 $('#searchterm')[0].click(); 11426} 11427 11428const renderPageContent = ({ els = [], filter = [], filtermonth = [], filterTags = [] }) => { 11429 11430 const config = CONTENT_LISTING.page 11431 11432 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 11433 11434 const contentFilterEl = document.querySelector(`[data-content-filter=page]`) 11435 11436 11437 const pagination = document.querySelector('.pagination') 11438 11439 const emptyResult = contentWrapperEl?.nextElementSibling 11440 11441 if (_.size(els) == 0) { 11442 // pagination.classList.add('hidden') 11443 emptyResult?.classList.remove('hidden') 11444 return false 11445 } else { 11446 pagination.classList.remove('hidden') 11447 emptyResult?.classList.add('hidden') 11448 } 11449 11450 const dataChunk = _.chunk(els, CONTENT_CONFIG.maximumItemPerPage) 11451 11452 11453 if (contentWrapperEl) { 11454 const dataToShown = dataChunk[0] 11455 11456 _.forEach(dataToShown, (item) => { 11457 contentWrapperEl.appendChild(item) 11458 11459 }) 11460 } 11461 11462 if (contentFilterEl) { 11463 const optionsWrapperEl = document.querySelector('.custom-dropdown__opt') 11464 const optionsWrapperElMonth = document.querySelector('.custom-dropdown__opt-month') 11465 const optionsWrapperElTag = document.querySelector('.custom-dropdown__opt-tag') 11466 11467 // Adding click event listeners to dropdowns 11468 document.querySelector('.custom-dropdown__opt').addEventListener('click', updateContent); 11469 document.querySelector('.custom-dropdown__opt-month').addEventListener('click', updateContent); 11470 document.querySelector('.custom-dropdown__opt-tag').addEventListener('click', updateContent); 11471 document.querySelector('.custom-dropdown__opt-sort').addEventListener('click', updateContent); 11472 11473 const filterOptionEl = _.map(_.orderBy(filter, 'value', 'desc'), (item) => { 11474 let el = generateDropdownFilter(item.name, item.value) 11475 11476 return el 11477 }) 11478 11479 const filterOptionElMonth = _.map(sortFilterMonth(filtermonth), (item) => { 11480 let el = generateMonthDropdownFilter(item.name, item.value, item.formattedFilteredMonth) 11481 11482 return el 11483 }) 11484 11485 const filterOptionElTag = _.map(_.orderBy(filterTags, 'value', 'desc'), (item) => { 11486 let el = generateDropdownFilter(item.name, item.value) 11487 11488 return el 11489 }) 11490 11491 11492 const filterEls = filterOptionEl 11493 11494 const filterElsmonth = filterOptionElMonth 11495 11496 const filterElsTag = filterOptionElTag 11497 11498 11499 _.forEach(filterEls, (item) => { 11500 11501 optionsWrapperEl.appendChild(item) 11502 }) 11503 11504 _.forEach(filterOptionElMonth, (item) => { 11505 11506 optionsWrapperElMonth.appendChild(item) 11507 }) 11508 11509 _.forEach(filterOptionElTag, (item) => { 11510 11511 optionsWrapperElTag.appendChild(item) 11512 }) 11513 11514 document.dispatchEvent(onListingFilterChanged) 11515 11516 setPagePagination() 11517 11518 const prevBtn = pagination.querySelector('.pagPrev') 11519 11520 const nextBtn = pagination.querySelector('.pagNext') 11521 11522 const filteredData = _.filter(config.data, (item) => { 11523 if (config.currentFilter === null || config.currentFilter === 'all') { 11524 11525 return true 11526 } else { 11527 11528 return item[config.filterKey[0]] == config.currentFilter 11529 } 11530 }) 11531 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG.maximumItemPerPage) 11532 11533 prevBtn.addEventListener('click', () => { 11534 const config = CONTENT_LISTING.page 11535 if (config.currentPage > 0) {
11536 reRenderPageContent({ page: config.currentPage - 1 }) 11537 onPageChangedGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }) 11538 } 11539 }) 11540 11541 nextBtn.addEventListener('click', () => { 11542 const config = CONTENT_LISTING.page 11543 if (config.currentPage < _.size(dataChunk) - 1) { 11544 reRenderPageContent({ page: config.currentPage + 1 }) 11545 onPageChangedGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }) 11546 } 11547 }) 11548 11549 } 11550 let requestUpdatePagination = new Event('requestUpdatePagination') 11551 document.dispatchEvent(requestUpdatePagination); 11552 setTimeout( function() { TagMore(); updatePagination(); },50); 11553} 11554 11555const generateArticleThumbnail = ({ head, tags, summary, date, ctaUrl, imgAlt, year, imgUrl, ctaLabel }) => { 11556 // Generate HTML for the first two tags 11557 let visibleTagsHTML = tags.slice(0, 7).map(tag => ` 11558 <div class="itemTag"> 11559 <div class="tag"> 11560 <a href="${ctaUrl}"> 11561 <span>${tag}</span> 11562 </a> 11563 </div> 11564 </div> 11565 `).join(''); 11566 11567 // Generate HTML for additional tags, if any 11568 let hiddenTagsHTML = ''; 11569 if (tags.length > 1) { 11570 hiddenTagsHTML = ` 11571 <div class="itemTagMore"> 11572 <div class="tag"> 11573 <span>...</span> 11574 </div> 11575 </div> 11576 `; 11577 } 11578 11579 // Construct the HTML for the article thumbnail 11580 let item = ` 11581 <div class="itemMedia"> 11582 <div class="boxImg"> 11583 <a href="${ctaUrl}"> 11584 <img src="${imgUrl}" alt="${imgAlt}"> 11585 </a> 11586 </div> 11587 <div class="boxContent"> 11588 <div class="tags"> 11589 ${visibleTagsHTML} 11590 ${hiddenTagsHTML} 11591 </div> 11592 <a href="${ctaUrl}"> 11593 <p class="subText">${head}</p> 11594 </a> 11595 <div class="detail"> 11596 <p>${date}</p> 11597 </div> 11598 </div> 11599 </div>`; 11600 11601 return htmlToElement(item); 11602} 11603 11604 11605const initPageListing = (url) => { 11606 const reqUrl = `${url}` 11607 11608 11609 let els = [] 11610 let filter = [] 11611 let filtermonth = [] 11612 let filterYear = [] 11613 let filterTags = [] 11614 11615 axios.get(reqUrl).then((res) => { 11616 const responseData = JSON.parse(res.data.newsDetails) 11617 11618 // const responseData = res.data 11619 _.forEach( 11620 _.filter(responseData, (item) => true), 11621 (item) => { 11622 11623 els.push( 11624 generateArticleThumbnail({ 11625 head: item.heading, 11626 tags: item.tags, 11627 summary: item.summary, 11628 date: item.date, 11629 month: item.month, 11630 formattedFilteredMonth: item.formattedFilteredMonth, 11631 ctaUrl: item.ctaUrl, 11632 imgAlt: item.thumbnailalttext, 11633 year: item.year, 11634 imgUrl: item.url, 11635 ctaLabel: item.ctaLabel, 11636 }) 11637 ) 11638 11639 filter.push({ name: item.year, value: item.year }) 11640 11641 filterYear.push({ name: item.year, value: item.year }) 11642 11643 filtermonth.push({ name: item.month, value: item.month, formattedFilteredMonth: item.formattedFilteredMonth }) 11644 11645 // Assuming 'item.tags' is an array of tags 11646 filterTags.push(...item.tags.map(tag => ({ name: tag, value: tag }))) 11647 11648 CONTENT_LISTING.page = { ...CONTENT_LISTING.page, currentPage: 0, data: responseData, filterKey: ['year', 'month', 'tag'] } 11649 } 11650 ) 11651 11652 renderPageContent({ 11653 els, 11654 filter: _.uniqBy(filter, 'value'), 11655 filtermonth: _.uniqBy(filtermonth, 'value'), 11656 filterYear: _.uniqBy(filterYear, 'value'), 11657 filterTags: _.uniqBy(filterTags, 'value') 11658 }) 11659 }) 11660} 11661 11662 11663function getPageTypeInSection() { 11664 var sectionElements = document.querySelectorAll('section'); 11665 for (var i = 0; i < sectionElements.length; i++) { 11666 var sectionElement = sectionElements[i]; 11667 if (sectionElement.hasAttribute('data-page-type')) { 11668 var pageType = sectionElement.getAttribute('data-page-type'); 11669 // Return the value of the attribute 11670 return pageType; 11671 } 11672 } 11673} 11674 11675const __initContentListing = () => { 11676 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 11677 11678 var current_page = window.location.href; 11679 11680 var current_page_split = current_page.split(".html"); 11681 11682 _.forEach(dataContentRenderingContainer, (contentRender) => { 11683 11684 if (contentRender.dataset.contentRender === 'page') { 11685 11686 var pagetype = getPageTypeInSection(); 11687 11688 initPageListing(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 11689 11690 // initPageListing('https://xieranmaya.github.io/images/cats/cats.json') 11691 } 11692 }) 11693}; 11694(function () { 11695 let stateCheck = setInterval(() => { 11696 if (document.readyState === 'complete' && getPageTypeInSection() == "newslist" ) { 11697 clearInterval(stateCheck)
11698 __initContentListing() 11699 console.log('Init page listing script imported') 11700 } 11701 }, 100) 11702 })() 11703$(document).ready(function () { 11704 // TagMore(); 11705 var listnews = document.getElementsByClassName('newslist'); 11706 if (listnews && listnews.length > 0) { 11707 $('.newslist').click(TagMore); 11708 PagNext(); 11709 PagPrev(); 11710 updatePagination(); 11711 PagActive(); 11712 } 11713}); 11714 11715var resizeTimer; 11716 11717$(window).on('resize', function () { 11718 clearTimeout(resizeTimer); 11719 resizeTimer = setTimeout(function () { 11720 TagMore(); 11721 }, 250); 11722}); 11723 11724function TagMore() { 11725 var itemMediaDefault = $('.mainListMediaSec .itemMedia').width() - 40; 11726 $('.mainListMediaSec .itemMedia').each(function () { 11727 var totalItemTagWidth = 0; 11728 $(this).find('.tags .itemTag').each(function () { 11729 var itemTagWidth = $(this).innerWidth(); 11730 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 11731 totalItemTagWidth += itemTagWidth; 11732 } else { 11733 $(this).addClass('d-none'); 11734 $(this).siblings(".itemTagMore").addClass('d-block'); 11735 } 11736 }); 11737 }); 11738} 11739 11740var newslist = document.getElementsByClassName('newslist'); 11741if(newslist && newslist.length > 0) { 11742$(".newslist .mainListMediaSec .filterYear .ui.inline.dropdown").dropdown({ 11743 forceSelection: false, //***** 11744 direction: "downward", 11745 delay: { 11746 touch: 0, 11747 }, 11748 onShow: function () { 11749 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11750 } 11751}); 11752 11753$(".newslist .mainListMediaSec .filterMonths .ui.inline.dropdown").dropdown({ 11754 forceSelection: false, //***** 11755 direction: "downward", 11756 delay: { 11757 touch: 0, 11758 }, 11759 onShow: function () { 11760 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11761 } 11762}); 11763 11764$(".newslist .mainListMediaSec .filterSegments .ui.inline.dropdown").dropdown({ 11765 forceSelection: false, //***** 11766 direction: "downward", 11767 delay: { 11768 touch: 0, 11769 }, 11770 onShow: function () { 11771 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11772 } 11773}); 11774 11775$(".newslist .mainListMediaSec .filterSoft .ui.inline.dropdown").dropdown({ 11776 forceSelection: false, //***** 11777 direction: "downward", 11778 delay: { 11779 touch: 0, 11780 }, 11781 onShow: function () { 11782 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11783 } 11784}); 11785} 11786 11787 11788function updatePagination() { 11789 var items = document.querySelectorAll('.paginationMedia .ui.pagination.menu .item'); 11790 var activeItem = document.querySelector('.paginationMedia .ui.pagination.menu .active'); 11791 var activeIndex = Array.from(items).indexOf(activeItem); 11792 11793 if (activeIndex === 0) { 11794 document.querySelector('.paginationMedia .pagPrev').classList.add('disabled'); 11795 } else { 11796 document.querySelector('.paginationMedia .pagPrev').classList.remove('disabled'); 11797 } 11798 11799 if (activeIndex === items.length - 1) { 11800 document.querySelector('.paginationMedia .pagNext').classList.add('disabled'); 11801 } else { 11802 document.querySelector('.paginationMedia .pagNext').classList.remove('disabled'); 11803 } 11804 11805 if (items.length < 6) { 11806 document.querySelector('.paginationMedia .innerPag').classList.add('maxWidth'); 11807 } else { 11808 document.querySelector('.paginationMedia .innerPag').classList.remove('maxWidth'); 11809 } 11810} 11811 11812 11813function PagActive() { 11814 $('.paginationMedia .ui.pagination.menu .item').click(function() { 11815 $('.paginationMedia .ui.pagination.menu .item').removeClass('active'); 11816 $(this).addClass('active'); 11817 updatePagination(); 11818 $('html, body').animate({ 11819 scrollTop: $(".mainListMediaSec").offset().top - 100 11820 }, 1000); 11821 }); 11822} 11823 11824function PagNext() { 11825 document.querySelectorAll('.paginationMedia.pagediv .pagNext').forEach(function(nextButton) { 11826 nextButton.addEventListener('click', function() { 11827 var activeItem = document.querySelector('.paginationMedia .ui.pagination.menu .active'); 11828 var nextItem = activeItem ? activeItem.nextElementSibling : null; 11829 11830 if (nextItem && nextItem.classList.contains('item')) { 11831 activeItem.classList.remove('active'); 11832 nextItem.classList.add('active'); 11833 updatePagination(); 11834 11835 var items = document.querySelectorAll('.paginationMedia .ui.pagination.menu .item'); 11836 var activeIndex = Array.from(items).indexOf(nextItem) + 1; 11837 11838 if (activeIndex > 6 && (activeIndex - 1) % 6 === 0) { 11839 var scrollValue = 360; 11840 setTimeout(() => { 11841 document.querySelector(".paginationMedia .innerPag").scrollBy({ left: scrollValue, behavior: 'smooth' }); 11842 }, 30); 11843 } 11844 11845 window.scrollTo({ 11846 top: document.querySelector(".mainListMediaSec").offsetTop - 100, 11847 behavior: 'smooth' 11848 }); 11849 } 11850 }); 11851 }); 11852} 11853 11854 11855function PagPrev() { 11856 document.querySelectorAll('.paginationMedia.pagediv .pagPrev').forEach(function(prevButton) { 11857 prevButton.addEventListener('click', function() { 11858 var activeItem = document.querySelector('.paginationMedia .ui.pagination.menu .active'); 11859 var prevItem = activeItem ? activeItem.previousElementSibling : null; 11860 11861 if (prevItem && prevItem.classList.contains('item')) { 11862 activeItem.classList.remove('active'); 11863 prevItem.classList.add('active'); 11864 updatePagination(); 11865 11866 var items = document.querySelectorAll('.paginationMedia .ui.pagination.menu .item'); 11867 var activeIndex = Array.from(items).indexOf(prevItem) + 1; 11868 11869 if (activeIndex % 6 === 0 || activeIndex < 5) { 11870 var scrollValue = 360; 11871 setTimeout(() => { 11872 document.querySelector(".paginationMedia .innerPag").scrollBy({ left: -scrollValue, behavior: 'smooth' }); 11873 }, 30); 11874 } 11875 11876 window.scrollTo({ 11877 top: document.querySelector(".mainListMediaSec").offsetTop - 100, 11878 behavior: 'smooth' 11879 }); 11880 } 11881 }); 11882 }); 11883} 11884 11885 11886 11887 11888 11889 11890 11891$(document).ready(function () { 11892 var sectionmainExploreSec = document.getElementsByClassName('mainExploreSec'); 11893 if (sectionmainExploreSec && sectionmainExploreSec.length > 0) { 11894 fixSpaceMainExploreSec(); 11895 initializeExploreSwiper(); 11896 } 11897}); 11898 11899$(window).on("load resize", function () { 11900 fixSpaceMainExploreSec(); 11901}); 11902 11903function fixSpaceMainExploreSec() { 11904 setTimeout(() => { 11905 $(".mainExploreSec .exploreSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 11906 $(".mainExploreSec .exploreSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 11907 }, 50); 11908} 11909 11910function initializeExploreSwiper() { 11911 const swipers = document.querySelectorAll('.exploreSwiper');
11912 swipers.forEach(swiper => { 11913 new Swiper(swiper, { 11914 slidesPerView: 4.9, 11915 spaceBetween: 20, 11916 resizeObserver:!($("body").data('custom-mode') == "edit"), 11917 speed: 500, 11918 breakpoints: { 11919 1480: { 11920 slidesPerView: 4.9, 11921 spaceBetween: 20, 11922 }, 11923 1200: { 11924 slidesPerView: 3.9, 11925 spaceBetween: 20, 11926 }, 11927 992: { 11928 slidesPerView: 3.5, 11929 spaceBetween: 20, 11930 }, 11931 768: { 11932 slidesPerView: 3.2, 11933 spaceBetween: 20, 11934 }, 11935 250: { 11936 slidesPerView: 2, 11937 spaceBetween: 10, 11938 } 11939 } 11940 }); 11941 }); 11942} 11943'use strict' 11944 11945var loopmap = document.getElementsByClassName('loopmap'); 11946if(loopmap && loopmap.length > 0) { 11947$(".loopmap .mainPlantsMapSec .filterType1 .ui.inline.dropdown").dropdown({ 11948 forceSelection: false, //***** 11949 direction: "downward", 11950 delay: { 11951 touch: 0, 11952 }, 11953 onShow: function () { 11954 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11955 } 11956}); 11957 11958$(".loopmap .mainPlantsMapSec .filterType2 .ui.inline.dropdown").dropdown({ 11959 forceSelection: false, //***** 11960 direction: "downward", 11961 delay: { 11962 touch: 0, 11963 }, 11964 onShow: function () { 11965 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11966 } 11967}); 11968 11969$(".loopmap .mainPlantsMapSec .filterType3 .ui.inline.dropdown").dropdown({ 11970 forceSelection: false, //***** 11971 direction: "downward", 11972 delay: { 11973 touch: 0, 11974 }, 11975 onShow: function () { 11976 $(".ui.inline.dropdown").not(this).dropdown('hide'); 11977 } 11978}); 11979} 11980 11981var plantMapSwiper = new Swiper(".plantMapSwiper", { 11982 speed: 500, 11983 loop: 'true', 11984 resizeObserver:!($("body").data('custom-mode') == "edit"), 11985 breakpoints: { 11986 768: { 11987 slidesPerView: 2, 11988 spaceBetween: 20, 11989 slidesPerGroup: 1, 11990 }, 11991 250: { 11992 slidesPerView: 1, 11993 spaceBetween: 0, 11994 slidesPerGroup: 1, 11995 } 11996 } 11997}); 11998 11999var detailtranslation 12000var directiontranslation 12001var map 12002var infowindow 12003var contentString = 12004 '<div id="content">' + 12005 '<div id="siteNotice">' + 12006 "</div>" + 12007 '<h1 id="firstHeading" class="firstHeading">Uluru</h1>' + 12008 '<div id="bodyContent">' + 12009 "<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large " + 12010 "sandstone rock formation in the southern part of the " + 12011 "Northern Territory, central Australia. It lies 335 km (208 mi) " + 12012 "south west of the nearest large town, Alice Springs; 450 km " + 12013 "(280 mi) by road. Kata Tjuta and Uluru are the two major " + 12014 "features of the Uluru - Kata Tjuta National Park. Uluru is " + 12015 "sacred to the Pitjantjatjara and Yankunytjatjara, the " + 12016 "Aboriginal people of the area. It has many springs, waterholes, " + 12017 "rock caves and ancient paintings. Uluru is listed as a World " + 12018 "Heritage Site.</p>" + 12019 '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">' + 12020 "https://en.wikipedia.org/w/index.php?title=Uluru</a> " + 12021 "(last visited June 22, 2009).</p>" + 12022 "</div>" + 12023 "</div>"; 12024 12025var apiResponse = []; // Define apiResponse globally 12026 12027var NewResponse = []; // Define apiResponse globally 12028 12029function isMobile() { 12030 return window.innerWidth <= 768; 12031} 12032 12033var currentIndex = 0; 12034var itemsPerPage = isMobile() ? 5 : 10; 12035 12036function initMap() { 12037 12038 var styledMapType = new google.maps.StyledMapType( 12039 [ 12040 { 12041 "elementType": "geometry", 12042 "stylers": [ 12043 { "color": "#e9e9e9" } 12044 ] 12045 }, 12046 { 12047 "elementType": "labels.text.fill", 12048 "stylers": [ 12049 { "color": "#333333" } 12050 ] 12051 }, 12052 { 12053 "elementType": "labels.text.stroke", 12054 "stylers": [ 12055 { "color": "#ffffff" } 12056 ] 12057 }, 12058 { 12059 "featureType": "administrative", 12060 "elementType": "geometry", 12061 "stylers": [ 12062 { "visibility": "off" } 12063 ] 12064 }, 12065 { 12066 "featureType": "landscape", 12067 "elementType": "geometry", 12068 "stylers": [ 12069 { "color": "#f0f0f0" } 12070 ] 12071 }, 12072 { 12073 "featureType": "poi", 12074 "elementType": "geometry", 12075 "stylers": [ 12076 { "color": "#cfe7f3" } 12077 ] 12078 }, 12079 { 12080 "featureType": "road", 12081 "elementType": "geometry", 12082 "stylers": [ 12083 { "color": "#b3b3b3" } 12084 ] 12085 }, 12086 { 12087 "featureType": "road", 12088 "elementType": "labels.text.fill", 12089 "stylers": [ 12090 { "color": "#808080" } 12091 ] 12092 }, 12093 { 12094 "featureType": "road", 12095 "elementType": "labels.text.stroke", 12096 "stylers": [ 12097 { "color": "#ffffff" } 12098 ] 12099 }, 12100 { 12101 "featureType": "water", 12102 "elementType": "geometry", 12103 "stylers": [ 12104 { "color": "#a0d3d3" } 12105 ] 12106 }, 12107 { 12108 "featureType": "water", 12109 "elementType": "labels.text.fill", 12110 "stylers": [ 12111 { "color": "#737373" } 12112 ] 12113 } 12114 ], 12115 { name: 'Blue Styled Map' } 12116 ); 12117 12118 map = new google.maps.Map(document.getElementById('map'), { 12119 center: { lat: 13.75, lng: 100.5 }, 12120 mapTypeControl: false, 12121 fullscreenControl: false, 12122 zoom: 11, 12123 mapTypeControlOptions: { 12124 mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain', 'styled_map'] 12125 } 12126 }); 12127 12128 map.mapTypes.set('styled_map', styledMapType); 12129 map.setMapTypeId('styled_map'); 12130} 12131 12132function addMarker(plant, index) { 12133 var mapMarkerValue = document.querySelector('.loopmap .mainPlantsMapSec .container') 12134 ? document.querySelector('.loopmap .mainPlantsMapSec .container').getAttribute('data-mapmarker') || '/content/dam/onebangkok_v2/mark_point.png' 12135 : '/content/dam/onebangkok_v2/mark_point.png'; 12136 var icon = { 12137 url: mapMarkerValue, 12138 scaledSize: new google.maps.Size(25, 25), // scaled size 12139 origin: new google.maps.Point(0, 0), // origin 12140 anchor: new google.maps.Point(0, 0) // anchor 12141 }; 12142 12143 var marker = new google.maps.Marker({ 12144 position: { lat: plant.lat, lng: plant.lng }, 12145 map: map, 12146 title: plant.name, 12147 icon: icon, 12148 }); 12149 12150 apiResponse[plant.id - 1]['marker'] = marker; 12151 12152 marker.addListener('click', function () { 12153 moveLoopMap(plant.id - 1) 12154 12155 $(".mainPlantsMapSec .listItem .item").removeClass("active"); 12156 $(".mainPlantsMapSec .listItem .item").eq(plant.id - 1).addClass("active"); 12157 12158 var scrollableDiv = $('.mainPlantsMapSec .listItem'); 12159 var activeItem = $('.mainPlantsMapSec .listItem .item.active'); 12160 if (activeItem.length) { 12161 scrollableDiv.animate({ 12162 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 12163 }, 500); 12164 } 12165 12166 }); 12167 12168} 12169 12170function searchtermLoop() { 12171 var searchvalue = document.getElementById('searchtermLoopmap').value 12172 let NewResponse = searchLoop(apiResponse, searchvalue) 12173 currentIndex = 0; // Reset pagination 12174 displayLoopArt(NewResponse) 12175} 12176 12177function searchLoop(apiResponse, keyword) { 12178 const filteredResponse = apiResponse.filter(plant => { 12179 return plant.sub_name.toLowerCase().includes(keyword.toLowerCase()) || 12180 plant.name.toLowerCase().includes(keyword.toLowerCase()); 12181 }); 12182 12183 if (filteredResponse.length == 0) { 12184 toggleMapClass(document.querySelector('.boxNotFound'), 'hidden', false); 12185 toggleMapClass(document.querySelector('.inner'), 'hidden', true); 12186 return; 12187 } 12188 toggleMapClass(document.querySelector('.boxNotFound'), 'hidden', true); 12189 toggleMapClass(document.querySelector('.inner'), 'hidden', false); 12190 12191 return filteredResponse; 12192} 12193 12194function displayLoopArt(plants = undefined, isLoadMore = false) { 12195 12196 let dataToDisplay; 12197 12198 if (plants == undefined) { 12199 dataToDisplay = apiResponse.slice(currentIndex, currentIndex + itemsPerPage); 12200 } else { 12201 12202 dataToDisplay = plants.slice(currentIndex, currentIndex + itemsPerPage); 12203 } 12204 12205 var $plantsList = $('#plants-list'); 12206 12207 if (!isLoadMore) { 12208 12209 $plantsList.empty(); 12210 currentIndex = 0; 12211 } 12212 12213 12214 $.each(dataToDisplay, function (index, plant) { 12215 var plantHtml = ` 12216 <div class="item" id="${plant.id}" onClick='moveLoopMap(${plant.id - 1})'> 12217 <div class="boxImg"> 12218 <img src="${plant.image}" alt=""> 12219 </div> 12220 <div class="boxContent"> 12221 <div class="top"> 12222 <p class="descText">${plant.name}</p> 12223 <p class="sub">${plant.plantorigin}</p> 12224 </div> 12225 <div class="bottom"> 12226 <p class="sub"> 12227 <i class="icon-ic-location"></i>${plant.LocationTitle} 12228 </p> 12229 </div> 12230 </div> 12231 </div> 12232 `; 12233 $plantsList.append(plantHtml); 12234 addMarker(plant, currentIndex + index); 12235 }); 12236 12237 // Check if more items are available to show 12238 if (plants == undefined) { 12239 if (currentIndex + itemsPerPage >= apiResponse.length) { 12240 $('.loopmap .mainPlantsMapSec .viewMore').hide(); 12241 } else { 12242 $('.loopmap .mainPlantsMapSec .viewMore').show(); 12243 } 12244 } else { 12245 if (currentIndex + itemsPerPage >= plants.length) { 12246 $('.loopmap .mainPlantsMapSec .viewMore').hide(); 12247 } else { 12248 $('.loopmap .mainPlantsMapSec .viewMore').show(); 12249 } 12250 } 12251 12252 currentIndex += itemsPerPage; // Update index for the next batch 12253 clickOnLoopActiveItem(); 12254} 12255 12256function clickOnLoopActiveItem() { 12257 const activeItem = document.querySelector('.loopmap .mainPlantsMapSec #plants-list .item'); 12258 12259 if (activeItem) { 12260 activeItem.click(); 12261 } else { 12262 console.log("No element with class 'item active' found."); 12263 } 12264} 12265 12266 12267 12268function moveLoopMap(index) { 12269 var item = apiResponse[index] 12270 var detailText = detailtranslation; 12271 var directionText = directiontranslation; 12272 var pos = { 12273 lat: parseFloat(item['lat']), 12274 lng: parseFloat(item['lng']) 12275 }; 12276 12277 contentString = 12278 '<div class="boxMarkMap">' + 12279 '<div class="itemMarkMap">' + 12280 '<div class="boxImg">
12280' + 12281 '<img src=' + item['image'] + '>' + 12282 '</div>' + 12283 '<div class="boxContent">' + 12284 '<p class="descText">' + item['name'] + '</p>' + 12285 '<p class="sub">' + item['plantorigin'] + '</p>' + 12286 '<div class="bottom">' + 12287 '<p class="sub">' + '<i class="icon-ic-location"></i>' + item['LocationTitle'] + '</p>' + 12288 '</div>' + 12289 '<div class="action">' + 12290 '<button class="btn-default">' + 12291 '<span class="buttonContainer">' + 12292 '<a target="_blank" href="' + item['ctaUrl'] + '">' + 12293 '<span class="buttonText">' + 12294 '<span>' + detailText + '</span>' + 12295 '<span>' + detailText + '</span>' + 12296 '</span>' + 12297 '</span>' + 12298 '</a>' + 12299 '</button>' + 12300 '<button class="btn-link">' + 12301 '<a target="_blank" href="https://www.google.com/maps/dir/?api=1&destination=' + item['lat'] + ',' + item['lng'] + '">' + 12302 '<i class="icon-ic-curve-arrow"></i>' + 12303 '<span>' + directionText + '</span>' + 12304 '</a>' + 12305 '</button>' + 12306 '</div>' 12307 "</div>" + 12308 "</div>" + 12309 "</div>"; 12310 if (infowindow) { 12311 infowindow.close(); 12312 } 12313 infowindow = new google.maps.InfoWindow({ 12314 content: contentString, 12315 }); 12316 12317 map.setCenter(pos); 12318 // map.setZoom(11) 12319 infowindow.open(map, item.marker); 12320 12321 setTimeout(() => { 12322 var heightButton = $('.mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 12323 12324 12325 if (heightButton > 120) { 12326 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 12327 } else { 12328 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 12329 } 12330 }, 50); 12331 /* 12332 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 12333 $([document.documentElement, document.body]).animate({ 12334 scrollTop: $("#map").offset().top - 150 12335 }, 500); 12336 } 12337 */ 12338} 12339 12340function filterLoopAPIResponse(apiResponse, planttype, plantorigin, LocationTitle, arttype) { 12341 12342 let filteredData = apiResponse; 12343 12344 // Loop type Filter 12345 if (arttype !== null && arttype.trim() !== "Select Art Loop") { 12346 filteredData = _.filter(filteredData, item => item.looptype.trim() === arttype.trim()); 12347 } 12348 12349 // Primary filter for planttype 12350 if (planttype !== null && planttype.trim() !== "Type of artwork") { 12351 filteredData = _.filter(filteredData, item => item.planttype.trim() === planttype.trim()); 12352 } 12353 12354 12355 // Secondary filter for plantorigin (now using artist batches) 12356 if (plantorigin !== null && plantorigin !== "Artist name") { 12357 filteredData = _.filter(filteredData, item => { 12358 const artistBatch = getArtistBatch(item.plantorigin); 12359 return artistBatch === plantorigin; 12360 }); 12361 } 12362 12363 // Tertiary filter for LocationTitle 12364 if (LocationTitle !== null && LocationTitle !== "Location") { 12365 filteredData = _.filter(filteredData, item => item.LocationTitle === LocationTitle); 12366 } 12367 if (filteredData.length == 0) { 12368 toggleMapClass(document.querySelector('.boxNotFound'), 'hidden', false); 12369 toggleMapClass(document.querySelector('.inner'), 'hidden', true); 12370 return; 12371 } 12372 toggleMapClass(document.querySelector('.boxNotFound'), 'hidden', true); 12373 toggleMapClass(document.querySelector('.inner'), 'hidden', false); 12374 12375 return filteredData; 12376 12377} 12378 12379function getArtistBatch(artistName) { 12380 const firstChar = artistName.trim().charAt(0).toUpperCase(); 12381 12382 // English alphabet batches 12383 if (firstChar >= 'A' && firstChar <= 'E') { 12384 return 'A - E'; 12385 } else if (firstChar >= 'F' && firstChar <= 'L') { 12386 return 'F - L'; 12387 } else if (firstChar >= 'M' && firstChar <= 'S') { 12388 return 'M - S'; 12389 } else if (firstChar >= 'T' && firstChar <= 'Z') { 12390 return 'T - Z'; 12391 } 12392 12393 // Thai alphabet batches 12394 const thaiCharCode = firstChar.charCodeAt(0); 12395 if (thaiCharCode >= 3585 && thaiCharCode <= 3591) { // ภ- ภ12396 return 'ภ- à¸'; 12397 } else if (thaiCharCode >
12397= 3592 && thaiCharCode <= 3601) { // ภ- ภ12398 return 'ภ- à¸'; 12399 } else if (thaiCharCode >= 3602 && thaiCharCode <= 3620) { // ภ- ม 12400 return 'ภ- ม'; 12401 } else if (thaiCharCode >= 3621 && thaiCharCode <= 3641) { // ม - ฮ 12402 return 'ม - ฮ'; 12403 } else { 12404 return 'Other'; 12405 } 12406} 12407 12408 12409 12410function toggleMapClass(element, className, shouldAdd) { 12411 if (element) { 12412 element.classList.toggle(className, shouldAdd); 12413 } 12414} 12415 12416 12417function generateDivs(apiResponse, property, parentId) { 12418 // Extract unique values for the specified property 12419 const uniqueValues = [...new Set(apiResponse.map(item => item[property]))]; 12420 12421 // Create an array to store div elements 12422 const divs = []; 12423 12424 // Create div elements for each unique value 12425 uniqueValues.forEach((value, index) => { 12426 const div = document.createElement('div'); 12427 div.classList.add('item'); 12428 div.setAttribute('data-text', value); 12429 div.setAttribute('data-option-value', value); 12430 div.setAttribute('data-index', index + 1); // Adding 1 to make index 1-based 12431 div.textContent = value; 12432 divs.push(div); 12433 }); 12434 12435 // Append the generated divs to the specified parent element 12436 const parentElement = document.getElementById(parentId); 12437 if (parentElement) { 12438 divs.forEach(div => { 12439 parentElement.appendChild(div); 12440 }); 12441 } else { 12442 console.error(`Parent element with ID ${parentId} not found.`); 12443 } 12444 12445 return divs; 12446} 12447 12448function addevent() { 12449 document.querySelector('.custom-dropdown__opt-looptype').addEventListener('click', updateContentLoopMap); 12450 document.querySelector('.custom-dropdown__opt').addEventListener('click', updateContentLoopMap); 12451 document.querySelector('.custom-dropdown__opt-month').addEventListener('click', updateContentLoopMap); 12452 document.querySelector('.custom-dropdown__opt-tag').addEventListener('click', updateContentLoopMap); 12453} 12454 12455// Function to capture dropdown values and call reRenderPageContentPlant 12456function updateContentLoopMap() { 12457 const filterValue = document.querySelector(' .custom-dropdown__opt .item.active').getAttribute('data-option-value') 12458 const filterMonthValue = document.querySelector(' .custom-dropdown__opt-month .item.active').getAttribute('data-option-name') 12459 const filterTagsValue = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value') 12460 const filterLoopTypeValue = document.querySelector(' .custom-dropdown__opt-looptype .item.active').getAttribute('data-option-value') 12461 const searchvalue = document.getElementById('searchtermLoopmap').value; 12462 12463 console.log(" Loop Type : " + filterLoopTypeValue); 12464 console.log(" Artist : " + filterMonthValue); 12465 12466 NewResponse = filterLoopAPIResponse(apiResponse, filterValue, filterMonthValue, filterTagsValue, filterLoopTypeValue); 12467 currentIndex = 0; // Reset pagination 12468 displayLoopArt(NewResponse); 12469} 12470 12471 12472const initPageListingLoopMap = (url) => { 12473 const reqUrl = `${url}` 12474 12475 12476 axios.get(reqUrl).then((res) => { 12477 apiResponse = JSON.parse(res.data.newsDetails); 12478 detailtranslation = res.data.detailText; 12479 directiontranslation = res.data.directionText; 12480 initMap(); 12481 // setTimeout(displayLoopArt, 500); 12482 displayLoopArt(); 12483 if (apiResponse) { 12484 moveLoopMap(0); 12485 } 12486 // moveLoopMap(0); 12487 generateDivs(apiResponse, 'planttype', 'planttypee'); 12488 // generateDivs(apiResponse, 'plantorigin', 'plantorigin'); 12489 generateDivs(apiResponse, 'LocationTitle', 'plantlocation'); 12490 addevent(); 12491 $(".mainPlantsMapSec .listItem .item:first").addClass("active"); 12492 12493 setTimeout(() => { 12494 var heightButton = $('.mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 12495 12496 if (heightButton > 120) { 12497 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 12498 } else { 12499 $(".mainPlantsMapSec .inner .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 12500 } 12501 }, 400); 12502 12503 $(".mainPlantsMapSec .listItem").on("click", ".item", function () { 12504 $(".mainPlantsMapSec .listItem .item").removeClass("active"); 12505 $(this).addClass("active"); 12506 }); 12507 12508 $('.mainPlantsMapSec .viewMore .btn-default').on('click', function () { 12509 12510 displayLoopArt(NewResponse.length > 0 ? NewResponse : undefined, true); 12511 12512 if (currentIndex > itemsPerPage) { 12513 moveLoopMap(currentIndex - itemsPerPage); 12514 $(".mainPlantsMapSec .listItem .item").removeClass("active"); 12515 $(".mainPlantsMapSec .listItem .item").eq(currentIndex - itemsPerPage).addClass("active"); 12516 var scrollableDiv = $('.mainPlantsMapSec .listItem'); 12517 var activeItem = $('.mainPlantsMapSec .listItem .item.active'); 12518 if (activeItem.length) { 12519 scrollableDiv.animate({ 12520 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 12521 }, 500); 12522 } 12523 } 12524 var plants = apiResponse 12525 if (currentIndex >= plants.length) { 12526 $('.mainPlantsMapSec .viewMore').hide(); 12527 } 12528 }); 12529 }) 12530} 12531 12532 12533function getLoopPageTypeInSection() { 12534 var sectionElements = document.querySelectorAll('section'); 12535 for (var i = 0; i < sectionElements.length; i++) { 12536 var sectionElement = sectionElements[i]; 12537 if (sectionElement.hasAttribute('data-page-type')) { 12538 var pageType = sectionElement.getAttribute('data-page-type'); 12539 // Return the value of the attribute 12540 return pageType; 12541 } 12542 } 12543} 12544 12545const __initContentListingLoopMap = () => { 12546 var mapMarkerValue = document.querySelector('.loopmap .mainPlantsMapSec .container').getAttribute('data-mapmarker'); 12547 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 12548 12549 var current_page = window.location.href; 12550 12551 var current_page_split = current_page.split(".html"); 12552 _.forEach(dataContentRenderingContainer, (contentRender) => { 12553 if (contentRender.dataset.contentRender === 'page') { 12554 var pagetype = getLoopPageTypeInSection(); 12555 initPageListingLoopMap(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 12556 } 12557 }) 12558}; 12559 12560(function () { 12561 let stateCheck = setInterval(() => { 12562 if (document.readyState === 'complete' && getLoopPageTypeInSection() == "loopmap") { 12563 clearInterval(stateCheck) 12564 __initContentListingLoopMap()
12565 console.log('Loop Art Map script imported') 12566 } 12567 }, 100) 12568})() 12569$(document).ready(function () { 12570 var numberOfSlides = $('.relateMediaSwiper .swiper-slide').length; 12571 12572 if (numberOfSlides == 1) { 12573 $('.mainRelateMediaSec .headlineSec .titleText').addClass('w100'); 12574 $('.mainRelateMediaSec .relateMediaSwiper .swiper-number').addClass('d-none'); 12575 } else { 12576 $('.mainRelateMediaSec .headlineSec .titleText').addClass('w60'); 12577 12578 } 12579 12580 TagMoreRelatedNews(); 12581}); 12582 12583var resizeTimer; 12584 12585$(window).on("load resize", function () { 12586 resizeTimer = setTimeout(function () { 12587 TagMoreRelatedNews(); 12588 }, 1000); 12589}); 12590 12591function TagMoreRelatedNews() { 12592 var itemMediaDefault = $('.mainRelateMediaSec .itemMedia').width() - 40; 12593 $('.mainRelateMediaSec .itemMedia').each(function () { 12594 var totalItemTagWidth = 0; 12595 $(this).find('.tags .itemTag').each(function () { 12596 var itemTagWidth = $(this).innerWidth(); 12597 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 12598 totalItemTagWidth += itemTagWidth; 12599 } else { 12600 $(this).addClass('d-none'); 12601 $(this).siblings(".itemTagMore").addClass('d-block'); 12602 } 12603 }); 12604 }); 12605 // console.log(itemMediaDefault) 12606} 12607 12608var relatedMedia = document.getElementsByClassName('mainRelateMediaSec'); 12609if(relatedMedia && relatedMedia.length > 0) { 12610var relateMediaSwiper = new Swiper(".relateMediaSwiper", { 12611 slidesPerView: 3, 12612 resizeObserver:!($("body").data('custom-mode') == "edit"), 12613 spaceBetween: 20, 12614 slidesPerGroup: 3, 12615 speed: 500, 12616 pagination: { 12617 el: '.swiper-pagination', 12618 type: "fraction", 12619 }, 12620 navigation: { 12621 nextEl: ".swiper-button-next", 12622 prevEl: ".swiper-button-prev", 12623 }, 12624 breakpoints: { 12625 992: { 12626 slidesPerView: 3, 12627 spaceBetween: 20, 12628 slidesPerGroup: 3, 12629 centeredSlides: false, 12630 }, 12631 768: { 12632 slidesPerView: 2, 12633 spaceBetween: 20, 12634 slidesPerGroup: 2, 12635 centeredSlides: false, 12636 }, 12637 250: { 12638 slidesPerView: 1.1, 12639 spaceBetween: 10, 12640 centeredSlides: true, 12641 slidesPerGroup: 1, 12642 } 12643 } 12644}); 12645} 12646$(document).ready(function () { 12647 var sectionmainBlogSec = document.getElementsByClassName('mainBlogSec'); 12648 if (sectionmainBlogSec && sectionmainBlogSec.length > 0) { 12649 fixSpaceMainBlogSec(); 12650 TagMoreBlog(); 12651 } 12652}); 12653 12654$(window).on("load resize", function () { 12655 fixSpaceMainBlogSec(); 12656 resizeTimer = setTimeout(function () { 12657 TagMoreBlog(); 12658 }, 1000); 12659}); 12660 12661function fixSpaceMainBlogSec() { 12662var mainBlogSec = document.getElementsByClassName('mainBlogSec'); 12663if(mainBlogSec && mainBlogSec.length > 0) { 12664 setTimeout(() => { 12665 $(".mainBlogSec .blogSlide .blogSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 12666 $(".mainBlogSec .blogSlide .blogSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 12667 }, 50); 12668} 12669} 12670 12671function TagMoreBlog() { 12672 var itemMediaDefault = $('.mainBlogSec .blogSlide .slideItem').width() - 20; 12673 $('.mainBlogSec .blogSlide .slideItem').each(function () { 12674 var totalItemTagWidth = 0; 12675 $(this).find('.tags .itemTag').each(function () { 12676 var itemTagWidth = $(this).innerWidth(); 12677 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 12678 totalItemTagWidth += itemTagWidth; 12679 } else { 12680 $(this).addClass('d-none'); 12681 $(this).siblings(".itemTagMore").addClass('d-block'); 12682 } 12683 }); 12684 }); 12685} 12686 12687var mainBlogSec = document.getElementsByClassName('mainBlogSec'); 12688if(mainBlogSec && mainBlogSec.length > 0) { 12689 initializeBlogSwiper(); 12690} 12691 12692function initializeBlogSwiper() { 12693 const swipers = document.querySelectorAll('.blogSwiper'); 12694 swipers.forEach(swiper => { 12695 new Swiper(swiper, { 12696 slidesPerView: 2, 12697 spaceBetween: 20, 12698 resizeObserver:!($("body").data('custom-mode') == "edit"), 12699 speed: 500, 12700 pagination: { 12701 el: ".swiper-pagination", 12702 clickable: true, 12703 }, 12704 breakpoints: { 12705 992: { 12706 slidesPerView: 2, 12707 slidesPerGroup: 2, 12708 spaceBetween: 20, 12709 centeredSlides: false, 12710 }, 12711 768: { 12712 slidesPerView: 1, 12713 slidesPerGroup: 1, 12714 spaceBetween: 20, 12715 centeredSlides: false, 12716 }, 12717 250: { 12718 slidesPerView: 1.1, 12719 slidesPerGroup: 1, 12720 spaceBetween: 10, 12721 centeredSlides: true, 12722 } 12723 } 12724 }); 12725 }); 12726} 12727$(document).ready(function () { 12728 var sectionmainStorySec = document.getElementsByClassName('mainStorySec'); 12729 if (sectionmainStorySec && sectionmainStorySec.length > 0) { 12730 fixSpaceMainStorySec(); 12731 initializeStorySwiper(); 12732 } 12733}); 12734 12735$(window).on("load resize", function () { 12736 fixSpaceMainStorySec(); 12737}); 12738 12739function fixSpaceMainStorySec() { 12740 $(".mainStorySec .storySwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 12741 $(".mainStorySec .storySwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 12742} 12743 12744function initializeStorySwiper() { 12745 const swipers = document.querySelectorAll('.storySwiper');
12746 swipers.forEach(swiper => { 12747 new Swiper(swiper, { 12748 spaceBetween: 20, 12749 speed: 500, 12750 resizeObserver:!($("body").data('custom-mode') == "edit"), 12751 pagination: { 12752 el: ".swiper-pagination", 12753 clickable: true, 12754 }, 12755 breakpoints: { 12756 1480: { 12757 slidesPerView: 1.4, 12758 spaceBetween: 20, 12759 slidesPerGroup: 1, 12760 centeredSlides: false, 12761 }, 12762 12763 768: { 12764 slidesPerView: 1, 12765 spaceBetween: 20, 12766 slidesPerGroup: 1, 12767 centeredSlides: false, 12768 }, 12769 250: { 12770 slidesPerView: 1.1, 12771 spaceBetween: 10, 12772 slidesPerGroup: 1, 12773 centeredSlides: true, 12774 } 12775 } 12776 }); 12777 }); 12778} 12779$(document).ready(function () { 12780 var maxCharsTitleDes = 127; 12781 var maxCharsIconDesc = 65; 12782 12783 $('.mainPrivilegesCardSec .headlineSec .descText').each(function () { 12784 var textTitle = $(this).text(); 12785 if (textTitle.length > maxCharsTitleDes) { 12786 var truncatedText = textTitle.substring(0, maxCharsTitleDes); 12787 $(this).text(truncatedText); 12788 } 12789 }); 12790 12791 $('.mainPrivilegesCardSec .boxContent .listContent .item .descText').each(function () { 12792 var textDetail = $(this).text(); 12793 if (textDetail.length > maxCharsIconDesc) { 12794 var truncatedText = textDetail.substring(0, maxCharsIconDesc); 12795 $(this).text(truncatedText); 12796 } 12797 }); 12798}); 12799$(document).ready(function () { 12800 var numberOfSlides = $('.happeningSwiper .swiper-slide').length; 12801 12802 if (numberOfSlides == 1) { 12803 $('.mainHappeningSec .headlineSec .titleText').addClass('w100'); 12804 $('.mainHappeningSec .happeningSwiper .swiper-number').addClass('d-none'); 12805 } else { 12806 $('.mainHappeningSec .headlineSec .titleText').addClass('w60'); 12807 } 12808 12809 initializeHappeningSwiper(); 12810 12811 $('.mainHappeningSec .tag span').each(function() { 12812 var text = $(this).text(); 12813 if (text.endsWith(':')) { 12814 text = text.slice(0, -1); 12815 } else { 12816 var lastIndex = text.lastIndexOf('/'); 12817 if (lastIndex === -1) { 12818 lastIndex = text.lastIndexOf(':'); 12819 } 12820 if (lastIndex !== -1) { 12821 text = text.slice(lastIndex + 1); 12822 } 12823 } 12824 12825 text = text.replace(/-/g, ' ').replace(/\b\w/g, function(char) { 12826 return char.toUpperCase(); 12827 }); 12828 12829 $(this).text(text); 12830 }); 12831 12832}); 12833 12834function initializeHappeningSwiper() { 12835 const swipers = document.querySelectorAll('.happeningSwiper'); 12836 swipers.forEach(swiper => { 12837 new Swiper(swiper, { 12838 slidesPerView: 3, 12839 spaceBetween: 20, 12840 slidesPerGroup: 3, 12841 resizeObserver:!($("body").data('custom-mode') == "edit"), 12842 speed: 500, 12843 pagination: { 12844 el: '.swiper-pagination', 12845 type: "fraction", 12846 }, 12847 navigation: { 12848 nextEl: ".swiper-button-next", 12849 prevEl: ".swiper-button-prev", 12850 }, 12851 breakpoints: { 12852 992: { 12853 slidesPerView: 3, 12854 spaceBetween: 20, 12855 slidesPerGroup: 3, 12856 centeredSlides: false, 12857 }, 12858 768: { 12859 slidesPerView: 2, 12860 spaceBetween: 20, 12861 slidesPerGroup: 2, 12862 centeredSlides: false, 12863 }, 12864 540: { 12865 slidesPerView: 2, 12866 spaceBetween: 10, 12867 slidesPerGroup: 2, 12868 centeredSlides: false, 12869 }, 12870 250: { 12871 slidesPerView: 1.1, 12872 spaceBetween: 10, 12873 centeredSlides: true, 12874 slidesPerGroup: 1, 12875 } 12876 } 12877 }); 12878 }); 12879} 12880 12881 12882$(document).ready(function () { 12883 12884 var mainRelateMediaSecCarousel = document.getElementsByClassName('mainRelateMediaSec'); 12885 if(mainRelateMediaSecCarousel && mainRelateMediaSecCarousel.length > 0) { 12886 12887 var numberOfSlides = $('.relateMediaSwiper .swiper-slide').length; 12888 if (numberOfSlides == 1) { 12889 $('.mainRelateMediaSec .headlineSec .titleText').addClass('w100'); 12890 $('.mainRelateMediaSec .relateMediaSwiper .swiper-number').addClass('d-none'); 12891 } else { 12892 $('.mainRelateMediaSec .headlineSec .titleText').addClass('w60'); 12893 } 12894 initializeRelateMediaSwiper(); 12895 } 12896}); 12897 12898function initializeRelateMediaSwiper() { 12899 const swipers = document.querySelectorAll('.relateMediaSwiper');
12900 swipers.forEach(swiper => { 12901 new Swiper(swiper, { 12902 slidesPerView: 3, 12903 spaceBetween: 20, 12904 slidesPerGroup: 3, 12905 resizeObserver:!($("body").data('custom-mode') == "edit"), 12906 speed: 500, 12907 pagination: { 12908 el: '.swiper-pagination', 12909 type: "fraction", 12910 }, 12911 navigation: { 12912 nextEl: ".swiper-button-next", 12913 prevEl: ".swiper-button-prev", 12914 }, 12915 breakpoints: { 12916 992: { 12917 slidesPerView: 3, 12918 spaceBetween: 20, 12919 slidesPerGroup: 3, 12920 centeredSlides: false, 12921 }, 12922 768: { 12923 slidesPerView: 2, 12924 spaceBetween: 20, 12925 slidesPerGroup: 2, 12926 centeredSlides: false, 12927 }, 12928 540: { 12929 slidesPerView: 2, 12930 spaceBetween: 10, 12931 slidesPerGroup: 2, 12932 centeredSlides: false, 12933 }, 12934 250: { 12935 slidesPerView: 1.1, 12936 spaceBetween: 10, 12937 centeredSlides: true, 12938 slidesPerGroup: 1, 12939 } 12940 } 12941 }); 12942 }); 12943} 12944 12945$(document).ready(function () { 12946 var sectionGalleryHero = document.getElementsByClassName('mainBannerSlideSec'); 12947 if (sectionGalleryHero && sectionGalleryHero.length > 0) { 12948 initializeBannerSwiper(); 12949 heroautoPlayVideo(); 12950 } 12951}); 12952 12953$(window).on("scroll", function () { 12954 var sectionGalleryHero = document.getElementsByClassName('mainBannerSlideSec'); 12955 if (sectionGalleryHero && sectionGalleryHero.length > 0) { 12956 handleVideoVisibility(); 12957 } 12958}); 12959 12960function initializeBannerSwiper() { 12961 document.querySelectorAll('.mainBannerSlideSec').forEach(section => { 12962 const swipers = section.querySelectorAll('.bannerSwiper'); 12963 12964 swipers.forEach(swiperElement => { 12965 // Avoid reinitializing if already exists 12966 if (swiperElement.swiper) { 12967 return; 12968 } 12969 12970 const HerotransitionTime = swiperElement.getAttribute('data-transition-time') || 5000; 12971 const Heroautoplayvalue = swiperElement.getAttribute('data-autoplay') === 'true'; 12972 12973 const autoplayConfig = Heroautoplayvalue ? { 12974 delay: parseInt(HerotransitionTime), 12975 disableOnInteraction: Heroautoplayvalue, 12976 } : false; 12977 12978 console.log("Heroautoplayvalue:", Heroautoplayvalue); 12979 12980 const swiper = new Swiper(swiperElement, { 12981 loop: true, 12982 effect: "fade", 12983 speed: 1000, 12984 resizeObserver:!($("body").data('custom-mode') == "edit"), 12985 pagination: { 12986 el: '.swiper-pagination', 12987 clickable: true, 12988 renderBullet: function (index, className) { 12989 return '<div class="' + className + '">' + 12990 '<div class="c-progress c-progress-' + (index + 1) + '">' + 12991 '<div class="c-in"></div></div>' + 12992 "</div>"; 12993 }, 12994 }, 12995 autoplay: autoplayConfig, 12996 navigation: { 12997 nextEl: ".swiper-button-next", 12998 prevEl: ".swiper-button-prev", 12999 }, 13000 }); 13001 13002 swiper.on('slideChangeTransitionEnd', function () { 13003 heroautoPlayVideo(swiper, section); 13004 if (!Heroautoplayvalue) { 13005 swiper.autoplay.stop(); 13006 } 13007 }); 13008 }); 13009 }); 13010} 13011 13012function heroautoPlayVideo(swiper, section) { 13013 if (swiper && swiper.slides && swiper.slides.length > 0 && swiper.activeIndex !== undefined) { 13014 const currentSlide = swiper.slides[swiper.activeIndex]; 13015 13016 // Pause and reset all videos on other slides 13017 const allVideos = section.querySelectorAll('video'); 13018 allVideos.forEach(video => { 13019 video.pause(); 13020 video.currentTime = 0; 13021 }); 13022 13023 // Handle the video on the active slide 13024 const activeVideo = currentSlide.querySelector('video'); 13025 if (activeVideo) { 13026 swiper.autoplay.stop(); // Stop Swiper autoplay when a video is present 13027 activeVideo.play(); 13028 13029 activeVideo.addEventListener('play', function () { 13030 swiper.autoplay.stop(); // Ensure autoplay remains stopped while the video is playing 13031 }); 13032 13033 activeVideo.addEventListener('ended', function () { 13034 if (swiper.params.autoplay.enabled) { 13035 swiper.autoplay.start(); // Resume Swiper autoplay if it's enabled 13036 swiper.slideNext(); // Move to the next slide 13037 } 13038 }); 13039 13040 activeVideo.addEventListener('pause', function () { 13041 if (!activeVideo.ended) { 13042 swiper.autoplay.stop(); // Keep Swiper autoplay stopped if video is paused 13043 } 13044 }); 13045 } else { 13046 if (swiper.params.autoplay.enabled) { 13047 swiper.autoplay.start(); // Resume autoplay if there is no video on the current slide 13048 } 13049 } 13050 } 13051} 13052 13053 13054function handleVideoVisibility() { 13055 document.querySelectorAll('.mainBannerSlideSec').forEach(section => { 13056 const allVideos = section.getElementsByTagName("video"); 13057 13058 for (let i = 0; i < allVideos.length; i++) { 13059 const videoElement = allVideos[i]; 13060 if (isVideoInViewPort(videoElement)) { 13061 videoElement.play().catch(error => { 13062 console.log(error); 13063 }); 13064 } else { 13065 videoElement.pause(); 13066 } 13067 } 13068 }); 13069} 13070 13071function isVideoInViewPort(videoElement) { 13072 const elementTop = videoElement.getBoundingClientRect().top; 13073 const elementBottom = elementTop + videoElement.clientHeight; 13074 const viewportTop = 0; 13075 const viewportBottom = window.innerHeight; 13076 13077 return elementBottom > viewportTop && elementTop < viewportBottom; 13078} 13079 13080function PauseVideo() { 13081 document.querySelectorAll('.mainBannerSlideSec').forEach(section => { 13082 const mainBanner = section; 13083 const allVideos = mainBanner.getElementsByTagName("video"); 13084 const offsetTop = mainBanner.offsetTop; 13085 const scrollPosition = window.pageYOffset; 13086 const elementHeight = mainBanner.offsetHeight - 150; 13087 13088 for (let i = 0; i < allVideos.length; i++) { 13089 if (scrollPosition > (offsetTop - 100) && scrollPosition < offsetTop + elementHeight) { 13090 allVideos[i].play().catch(error => { 13091 console.log(error); 13092 }); 13093 } else { 13094 allVideos[i].pause(); 13095 } 13096 } 13097 }); 13098} 13099 13100var headerSearchCheck = document.getElementsByClassName('header-search-check'); 13101if(headerSearchCheck && headerSearchCheck.length > 0) { 13102var recentSearches = loadRecentSearches(); // create an empty javascript array 13103let container = document.querySelector(".recentInner"); 13104 13105$(document).ready(function(){ 13106 13107if(recentSearches.length){
13108 recentSearches.forEach(function(value) { 13109 13110 let itemRecent = document.createElement("div"); 13111 itemRecent.className = "itemRecent"; 13112 13113 let textRecent = document.createElement("div"); 13114 textRecent.className = "textRecent bgThemeWhite"; 13115 13116 let link = document.createElement("a"); 13117 link.href = "#"; 13118 13119 let span = document.createElement("span"); 13120 span.textContent = `${value}`; 13121 13122 // Assemble elements 13123 link.appendChild(span); 13124 textRecent.appendChild(link); 13125 itemRecent.appendChild(textRecent); 13126 container.appendChild(itemRecent); 13127 }); 13128} 13129$(".blockSearch").on("click", ".itemRecent .textRecent a",function(e){ 13130 e.preventDefault(); 13131 $("#searchBox").val($(this).text()); 13132 }); 13133 13134//this function is called using the search buttons "onclick" 13135function searchFunction(data) { 13136 13137 recentSearches.push($('#searchBox').val()); // This line puts the value from the text box in an array 13138 $('#searchBox').val(""); // clear the text box after search 13139 $('#searchHistory').text(""); //clear the seach history window then repopulate with the new array 13140 13141 // the function below loops through the array and adds each item in the array 13142 // to the span element within the Search history arear 13143 $.each(recentSearches, function(index, value) { 13144 $('#searchHistory').append("<li class='historyItem' onclick='addtotextbox(" + index + ")'>" + value + '</li>'); 13145 }); 13146} 13147 13148function addtotextbox(id) { 13149 $('#searchBox').val(recentSearches[id]); 13150} 13151 13152 activateEnterButton("searchBox", "headerSearchButton"); 13153}); 13154 13155function goToSearch(that) { 13156 var searchText = $('#searchBox').val(); 13157 if(searchText.trim()!="") 13158 { 13159 var path = $(that).data("path"); 13160 window.location.href = path + "?keywords="+searchText; 13161 } 13162} 13163 13164function createItem(item) { 13165 const searchResult = document.getElementById("searchBox").value.toLowerCase().trim(); 13166 console.log("createItem", searchResult) 13167 if (searchResult && !recentSearches.includes(searchResult)) { 13168 recentSearches.unshift(searchResult); 13169 if (recentSearches.length > 5) { 13170 recentSearches.pop(); 13171 } 13172 } 13173 13174 13175 container.innerHTML = ''; 13176 13177 if(recentSearches.length){ 13178 recentSearches.forEach(function(value) { 13179 13180 let itemRecent = document.createElement("div"); 13181 itemRecent.className = "itemRecent"; 13182 13183 let textRecent = document.createElement("div"); 13184 textRecent.className = "textRecent bgThemeWhite"; 13185 13186 let link = document.createElement("a"); 13187 link.href = "#"; 13188 13189 let span = document.createElement("span"); 13190 span.textContent = `${value}`; 13191 13192 // Assemble elements 13193 link.appendChild(span); 13194 textRecent.appendChild(link); 13195 itemRecent.appendChild(textRecent); 13196 container.appendChild(itemRecent); 13197 }); 13198 } 13199 console.log(recentSearches,"recent") 13200} 13201 13202 13203$("#headerSearchButton").click(function(){ 13204 createItem(this); 13205 saveRecentSearches() 13206 goToSearch(this); 13207}); 13208 13209//function setLInk(){ 13210 $(".slideShop .shopSearchMenuSwiper a.itemSearchShop").click(function(e){ 13211 e.preventDefault(); 13212 var tag = $(this).data("tag"); 13213 var path = $(".slideShop").data("path"); 13214 var goto= path+".html?cat="+encodeURIComponent(tag); 13215 window.location.href = goto; 13216 }); 13217//} 13218 13219 13220function saveRecentSearches(){ 13221 localStorage.setItem("recentSearches", JSON.stringify(recentSearches)); 13222} 13223 13224function loadRecentSearches(){ 13225 const recentSearchesJSON = localStorage.getItem("recentSearches"); 13226 if(recentSearchesJSON == null) return [] 13227 return JSON.parse(recentSearchesJSON); 13228} 13229} 13230 13231$(document).ready(function () { 13232 let reqUrl; 13233 let localeLang=$('.localeLanguage').val(); 13234 let filteredMediaData = { 13235 page: { 13236 innerDateFilter:null, 13237 pageSize:null, 13238 dateRangePickerFilter:null, 13239 freeEntry:false, 13240 subcategory:null, 13241 yearfilter: null, 13242 monthfilter: null, 13243 searchTerm: null, 13244 event:null, 13245 eventType:null, 13246 cmpType:null, 13247 location:null, 13248 currentFilter: null, 13249 subFilterTagData: null, 13250 currentPage: 0, 13251 data: [], 13252 rootpath:null, 13253 defaultFilter: null, 13254 filterTiles: null 13255 } 13256 } 13257 13258 const monthMap = { 13259 "January": "มà¸à¸£à¸²à¸à¸¡", 13260 "February": "à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹", 13261 "March": "มีà¸à¸²à¸à¸¡", 13262 "April": "à¹à¸¡à¸©à¸²à¸¢à¸", 13263 "May": "à¸à¸¤à¸©à¸ าà¸à¸¡", 13264 "June": "มิà¸à¸¸à¸à¸²à¸¢à¸", 13265 "July": "à¸à¸£à¸à¸à¸²à¸à¸¡", 13266 "August": "สิà¸à¸«à¸²à¸à¸¡", 13267 "September": "à¸à¸±à¸à¸¢à¸²à¸¢à¸", 13268 "October": "à¸à¸¸à¸¥à¸²à¸à¸¡", 13269 "November": "à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸", 13270 "December": "à¸à¸±à¸à¸§à¸²à¸à¸¡" 13271 }; 13272 13273 function getThaiMonth(englishMonth) { 13274 return monthMap[englishMonth] || "Invalid month"; 13275 } 13276 13277 const thaiToEnglishMonths = { 13278 "มà¸à¸£à¸²à¸à¸¡": "January", 13279 "à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹": "February", 13280 "มีà¸à¸²à¸à¸¡": "March", 13281 "à¹à¸¡à¸©à¸²à¸¢à¸": "April", 13282 "à¸à¸¤à¸©à¸ าà¸à¸¡": "May", 13283 "มิà¸à¸¸à¸à¸²à¸¢à¸": "June", 13284 "à¸à¸£à¸à¸à¸²à¸à¸¡": "July", 13285 "สิà¸à¸«à¸²à¸à¸¡": "August", 13286 "à¸à¸±à¸à¸¢à¸²à¸¢à¸": "September", 13287 "à¸à¸¸à¸¥à¸²à¸à¸¡": "October", 13288 "à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸": "November", 13289 "à¸à¸±à¸à¸§à¸²à¸à¸¡": "December" 13290 }; 13291 13292 function getEnglishMonth(thaiMonth) { 13293 return thaiToEnglishMonths[thaiMonth] || "Invalid month"; 13294 } 13295 13296 function convertThaiDateToGregorian(thaiDateStr) { 13297 const thaiMonths = { 13298 'ม.à¸.': 'Jan', 13299 'à¸.à¸.': 'Feb', 13300 'มี.à¸.': 'Mar', 13301 'à¹à¸¡.ย.': 'Apr', 13302 'à¸.à¸.': 'May', 13303 'มิ.ย.': 'Jun', 13304 'à¸.à¸.': 'Jul', 13305 'ส.à¸.': 'Aug', 13306 'à¸.ย.': 'Sep', 13307 'à¸.à¸.': 'Oct', 13308 'à¸.ย.': 'Nov', 13309 'à¸.à¸.': 'Dec' 13310 }; 13311 13312 const datePattern = /(\d{1,2})\s+(\S+)\s+(\d{2})/; 13313 const match = thaiDateStr.match(datePattern); 13314 13315 if (match) { 13316 const day = parseInt(match[1], 10); 13317 const thaiMonth = match[2]; 13318 const thaiYear = parseInt(match[3], 10); 13319 const gregorianYear = 2500 + thaiYear - 543; 13320 const gregorianMonth = thaiMonths[thaiMonth]; 13321 13322 return `${day} ${gregorianMonth} ${gregorianYear-2000}`; 13323 } else { 13324 throw new Error('Invalid Thai date format'); 13325 } 13326 } 13327 13328 function sortMonthInChronologicalOrder(monthObjects) { 13329 const calendarOrder = [ 13330 "January", "February", "March", "April", "May", "June",
13331 "July", "August", "September", "October", "November", "December" 13332 ]; 13333 13334 const monthIndex = calendarOrder.reduce((map, month, index) => { 13335 map[month] = index; 13336 return map; 13337 }, {}); 13338 13339 return monthObjects.sort((a, b) => monthIndex[a.name] - monthIndex[b.name]); 13340 } 13341 13342 13343 const generateMediaThumbnail = ({ heading, tags, ctaUrl, imgAlt, imgUrl, formattedDateRange,locationUrl,locationTitle, startTime, endTime, element}) => { 13344 // Generate HTML for the first n tags 13345 let visibleTagsHTML = tags.slice(0, 7).map(tag => ` 13346 <div class="itemTag"> 13347 <div class="tag"> 13348 <a href="${ctaUrl}"> 13349 <span>${tag}</span> 13350 </a> 13351 </div> 13352 </div> 13353 `).join(''); 13354 13355 // Generate HTML for additional tags, if any 13356 let hiddenTagsHTML = ''; 13357 if (tags.length > 1) { 13358 hiddenTagsHTML = ` 13359 <div class="itemTagMore"> 13360 <div class="tag"> 13361 <span>...</span> 13362 </div> 13363 </div> 13364 `; 13365 } 13366 let locationHTML=null; 13367 if($('.mainListMediaSec',element).data('islocationattr')?.length>0){ 13368 locationHTML=` 13369 <a href="${locationUrl!=null?locationUrl:''}"> 13370 <p> 13371 <i class="icon-ic-location"></i> 13372 ${locationTitle!=null?locationTitle:''} 13373 </p> 13374 </a> 13375 `; 13376 } 13377 13378 let timeHTML=null; 13379 if(startTime!=null || endTime!=null){ 13380 timeHTML=`<p><i class="icon-ic-time"></i>${startTime!=null?startTime:''}- ${endTime!=null?endTime:''}</p>`; 13381 } 13382 // Construct the HTML for the article thumbnail 13383 13384 let item = `<div class="itemMedia"> 13385 <div class="boxImg"> 13386 <a href="${ctaUrl}"> 13387 <img src="${imgUrl}" alt="${imgAlt}"> 13388 </a> 13389 </div> 13390 <div class="boxContent"> 13391 <div class="tags"> 13392 ${visibleTagsHTML} 13393 ${hiddenTagsHTML} 13394 </div> 13395 <a href="${ctaUrl}"> 13396 <p class="subText">${heading}</p> 13397 </a> 13398 <div class="detail"> 13399 <p> 13400 <i class="icon-ic-calendar"></i> 13401 ${formattedDateRange} 13402 </p> 13403 ${((filteredMediaData.page.cmpType==='archive' && timeHTML!=null)?timeHTML:'')} 13404 ${(locationHTML!=null&& (locationUrl!=null || locationTitle!=null))?locationHTML:''} 13405 </div> 13406 </div> 13407 </div>`; 13408 13409 return htmlToElement(item); 13410 } 13411 13412 function renderMediaThumbnail(element) { 13413 if(filteredMediaData.page.totalCount==0){ 13414 $("div.mediaThumbnailContainer", element).removeClass("active"); 13415 $("div.boxNotFoundContainer", element).addClass("active"); 13416 }else{ 13417 $("div.mediaThumbnailContainer", element).addClass("active"); 13418 $("div.boxNotFoundContainer", element).removeClass("active"); 13419 13420 let contentWrapperEl=$("div.thumbnailItems", element);//element to namespace 13421 $(contentWrapperEl).html(''); 13422 let dataToShown = filteredMediaData.page.data; 13423 _.forEach(dataToShown, (item) => { 13424 let el = generateMediaThumbnail({ 13425 heading: item.heading, 13426 tags: item.tags, 13427 date: item.endDate, 13428 month: item.month, 13429 ctaUrl: item.pagePath, 13430 imgAlt: item.imgAltText, 13431 year: item.year, 13432 imgUrl: item.image, 13433 ctaLabel: item.ctaLabel, 13434 formattedDateRange:item.formattedDateRange, 13435 locationTitle: item.locationTitle, 13436 locationUrl:item.locationPath, 13437 startTime:item.startTime, 13438 endTime:item.endTime, 13439 element:element 13440 }); 13441 contentWrapperEl.append(el); 13442 }); 13443 } 13444 setTimeout( function() { 13445 TagMore(); 13446 },50); 13447 } 13448 13449 function renderMediaPaginationAndAttachEvents(element) { 13450 let numberOfDots = (filteredMediaData.page.totalCount / filteredMediaData.page.pageSize); 13451 if (numberOfDots <= 1) { 13452 $("div.paginationMedia", element).css("display", "none"); 13453 } else { 13454 $("div.paginationMedia", element).css("display", "block"); 13455 $("a.pagPrev", element).addClass("disabled"); 13456 $("a.pagNext", element).removeClass("disabled"); 13457 13458 const paginationDotsEl = []; 13459 paginationDotsEl.push(htmlToElement(`<a class="item pagination-dot active">1</a>`)); 13460 for (let i = 1; i < numberOfDots; i++) { 13461 let item = `<a class="item pagination-dot">${i + 1}</a>`; 13462 paginationDotsEl.push(htmlToElement(item)); 13463 } 13464 13465 $("div.innerPag", element).html(''); 13466 _.forEach(paginationDotsEl, (item) => { 13467 $("div.innerPag", element).append(item); 13468 }); 13469 13470 $("a.pagination-dot", element).off('click'); 13471 $("a.pagPrev", element).off('click'); 13472 $("a.pagNext", element).off('click'); 13473 13474 $("a.pagination-dot", element).click( 13475 function (event) { 13476 if(!($(this).hasClass("active"))){ 13477 $("a.pagination-dot", element).removeClass('active'); 13478 $(this).addClass('active'); 13479 let currentDotNumber= parseInt($(this).text()) - 1; 13480 if(currentDotNumber==0){ 13481 $("a.pagPrev ", element).addClass('disabled'); 13482 13483 $("a.pagNext", element).removeClass('disabled'); 13484 }else{ 13485 13486 $("a.pagPrev", element).removeClass('disabled'); 13487 $("a.pagNext", element).removeClass('disabled'); 13488 if(currentDotNumber==(numberOfDots-1)){ 13489 13490 $("a.pagNext", element).addClass('disabled'); 13491 } 13492 } 13493 13494 axios.get(reqUrl+formQueryStringBasedOnCurrentFilter()+"&pageNumber="+currentDotNumber).then((res) => { 13495 let responseData = res.data.items; 13496 filteredMediaData.page = { ...filteredMediaData.page, currentPage: currentDotNumber, data: responseData,totalCount:res.data.totalCount, filterKey: ['year', 'month', 'tag'] }; 13497 renderMediaThumbnail(element); 13498 }); 13499 updatePagination(); 13500 $('html, body').animate({ 13501 scrollTop: $(".mainListMediaSec").offset().top - 100 13502 }, 1000); 13503 } 13504 } 13505 ); 13506 /* 13507 * PAGINATION ARROW BUTTONS â SPLIT RESPONSIBILITY 13508 * 13509 * The .pagPrev and .pagNext buttons have TWO separate event listeners attached: 13510 * 13511 * 1. DOM / UI layer â handled by PagPrev() and PagNext() in: 13512 * newslist/clientlib-newslist/newslist.js (functions PagPrev, PagNext, updatePagination) 13513 * Those functions move the active class between pagination dots, enable/disable the 13514 * arrow buttons, animate the innerPag scroll rail, and scroll the page to the top of 13515 * the list section. They are registered with native addEventListener on page load 13516 * (called from genericlistcmp.js â PagPrev() / PagNext()). 13517 * 13518 * 2. Data layer â handled by the jQuery .click() handlers below (this file). 13519 * These handlers are responsible ONLY for updating the internal page-state counter 13520 * and fetching the correct page of results from the server. 13521 * 13522 * DO NOT add active-class toggling, updatePagination(), or scroll animations here. 13523 * Doing so causes the dot to advance twice per click (once per listener), which was 13524 * the original bug where clicking an arrow jumped two pages instead of one. 13525 */ 13526 $("a.pagPrev", element).click( 13527 function (event) { 13528 let currentPage = filteredMediaData.page.currentPage; 13529 if (currentPage != 0) { 13530 currentPage = currentPage - 1; 13531 filteredMediaData.page.currentPage = currentPage; 13532 axios.get(reqUrl + formQueryStringBasedOnCurrentFilter() + "&pageNumber=" + currentPage).then((res) => { 13533 let responseData = res.data.items; 13534 filteredMediaData.page = { ...filteredMediaData.page, currentPage: currentPage, data: responseData, totalCount: res.data.totalCount, filterKey: ['year', 'month', 'tag'] }; 13535 renderMediaThumbnail(element); 13536 }); 13537 } 13538 } 13539 ); 13540 $("a.pagNext", element).click( 13541 function (event) { 13542 let currentPage = filteredMediaData.page.currentPage; 13543 if (currentPage != (numberOfDots - 1)) { 13544 currentPage = currentPage + 1; 13545 filteredMediaData.page.currentPage = currentPage; 13546 axios.get(reqUrl + formQueryStringBasedOnCurrentFilter() + "&pageNumber=" + currentPage).then((res) => { 13547 let responseData = res.data.items; 13548 filteredMediaData.page = { ...filteredMediaData.page, currentPage: currentPage, data: responseData, totalCount: res.data.totalCount, filterKey: ['year', 'month', 'tag'] }; 13549 renderMediaThumbnail(element); 13550 }); 13551 } 13552 } 13553 ); 13554 updatePagination(); 13555 } 13556 13557 } 13558 function renderContentBasedOnFiltersAndPagination(element) { 13559 renderMediaThumbnail(); 13560 renderMediaPaginationAndAttachEvents(); 13561 setTimeout( function() { 13562 TagMore(); 13563 },50); 13564 } 13565 13566 function formQueryStringBasedOnCurrentFilter(){ 13567 let currentFilterParams = new URLSearchParams(); 13568 13569 if (filteredMediaData.page.event) { 13570 currentFilterParams.append('event', filteredMediaData.page.event); 13571 } 13572 if (filteredMediaData.page.eventType) { 13573 currentFilterParams.append('eventType', filteredMediaData.page.eventType); 13574 } 13575 13576 if (filteredMediaData.page.searchTerm) { 13577 currentFilterParams.append('searchTerm', filteredMediaData.page.searchTerm?.trim()); 13578 } 13579 13580 if(filteredMediaData.page.pageSize){ 13581 currentFilterParams.append('pageSize', filteredMediaData.page.pageSize); 13582 } 13583 13584 if (filteredMediaData.page.event && filteredMediaData.page.event.includes("past")) { 13585 if(filteredMediaData.page.monthfilter){ 13586 currentFilterParams.append('month', filteredMediaData.page.monthfilter); 13587 } 13588 if(filteredMediaData.page.yearfilter){ 13589 currentFilterParams.append('year', filteredMediaData.page.yearfilter); 13590 } 13591 13592 }else{ 13593 if(filteredMediaData.page.location){ 13594 currentFilterParams.append('location', filteredMediaData.page.location); 13595 } 13596 13597 if(filteredMediaData.page.dateRangePickerFilter){ 13598 currentFilterParams.append('dateRange', filteredMediaData.page.dateRangePickerFilter); 13599 }else{ 13600 if(filteredMediaData.page.innerDateFilter){ 13601 currentFilterParams.append('innerDateFilter', filteredMediaData.page.innerDateFilter); 13602 } 13603 } 13604 if(filteredMediaData.page.freeEntry){ 13605 currentFilterParams.append('freeEntry', true); 13606 } 13607 if(filteredMediaData.page.subcategory && filteredMediaData.page.cmpType && filteredMediaData.page.cmpType==='whathappening'){ 13608 currentFilterParams.append('subCategory',filteredMediaData.page.subcategory); 13609 } 13610 13611 } 13612 if(filteredMediaData.page.cmpType){ 13613 currentFilterParams.append('cmpType',filteredMediaData.page.cmpType); 13614 } 13615 13616 if (filteredMediaData.page.filterTiles) { 13617 currentFilterParams.append('filterTiles', filteredMediaData.page.filterTiles); 13618 } 13619 if (filteredMediaData.page.defaultFilter) { 13620 currentFilterParams.append( 13621 'defaultFilter', 13622 filteredMediaData.page.defaultFilter 13623 ); 13624 } 13625 13626 currentFilterParams.append("rootPath",filteredMediaData.page.rootpath); 13627 13628 let queryString = currentFilterParams.toString(); 13629 return (queryString ? `?${queryString}` : ''); 13630 13631 } 13632 function renderMonthAndYearFilters( element, filterMonths, filterYears) { 13633 const filterOptionElMonths = _.map(sortMonthInChronologicalOrder(filterMonths), (item) => { 13634 let el = ''; 13635 if (localeLang === 'Thai') { 13636 el = generateDropdownFilter("filter-events-month-option", getThaiMonth(item.name), item.value); 13637 } else { 13638 el = generateDropdownFilter("filter-events-month-option", item.name, item.value); 13639 } 13640 return el; 13641 }); 13642 $("div.filter-events-month-menu", element).html(''); 13643 $('div.filterMonths .ui.inline.dropdown .text', element).text($('.mainListMediaSec',element).data("allmonthstext")); 13644 $("div.filter-events-month-menu", element).append('<div class="active item filter-events-month-option" data-text="' +$('.mainListMediaSec',element).data("allmonthstext") + '" data-index="1">' +$('.mainListMediaSec',element).data("allmonthstext")+ '</div>'); 13645 _.forEach(filterOptionElMonths, (item) => { 13646 $("div.filter-events-month-menu", element).append(item); 13647 }); 13648 13649 const filterOptionElYears = _.map(_.orderBy(filterYears, 'value', 'desc'), (item) => { 13650 let el = generateDropdownFilter("filter-events-year-option", item.name, item.value); 13651 return el; 13652 }); 13653 13654 $("div.filter-events-year-menu", element).html(''); 13655 13656 $('div.filterYear .ui.inline.dropdown .text', element).text($('.mainListMediaSec',element).data("allyearstext")); 13657 13658 $("div.filter-events-year-menu", element).append('<div class="active item filter-events-year-option" data-text="' + $('.mainListMediaSec',element).data("allyearstext") + '" data-index="1">' + $('.mainListMediaSec',element).data("allyearstext") + '</div>'); 13659 _.forEach(filterOptionElYears, (item) => { 13660 $("div.filter-events-year-menu", element).append(item); 13661 }); 13662 13663 $(".filter-events-month-option", element).click(function () { 13664 let currentFilterMonth = $(this).data('option-value'); 13665 if (filteredMediaData.page.monthfilter != currentFilterMonth) { 13666 filteredMediaData.page = { ...filteredMediaData.page, monthfilter: currentFilterMonth }; 13667 fetchAndrenderContentBasedOnFiltersAndPagination(element); 13668 } 13669 }); 13670 13671 $(".filter-events-year-option", element).click(function () { 13672 let currentFilterYear = $(this).data('option-value'); 13673 if (filteredMediaData.page.yearfilter != currentFilterYear) { 13674 filteredMediaData.page = { ...filteredMediaData.page, yearfilter: currentFilterYear }; 13675 fetchAndrenderContentBasedOnFiltersAndPagination(element); 13676 } 13677 }); 13678 } 13679 13680 function fetchAndrenderContentBasedOnFiltersAndPagination(element,flag) { 13681 let dateRangePicker=$("input.genericListDatePicker", element).val(); 13682 13683 if(((dateRangePicker?.split('-')[0].length>3)&&(dateRangePicker?.split('-')[1]?.length<9))||((dateRangePicker?.split('-')[0].length>3)&& (dateRangePicker?.split('-').length==1))){ 13684 dateRangePick
13684er=dateRangePicker.split('-')[0]+' - '+dateRangePicker.split('-')[0]; 13685 } 13686 if(dateRangePicker?.length>20 && localeLang==='Thai'){ 13687 dateRangePicker= convertThaiDateToGregorian(dateRangePicker.split('-')[0]) +' - '+ convertThaiDateToGregorian(dateRangePicker.split('-')[1]); 13688 } 13689 13690 if(flag===false && filteredMediaData.page.cmpType==='whathappening' && filteredMediaData.page.eventType!=null){ 13691 13692 let subFilters=checkIfSubFilterTagPresent(filteredMediaData.page.eventType.toLowerCase()); 13693 if(subFilters!=null && subFilters.length>0){ 13694 $(".itemCat", element).removeClass('d-none'); 13695 let subFiltersItems=[]; 13696 _.forEach(subFilters,(item)=>{ 13697 subFiltersItems.push({ name: item, value: item }); 13698 }); 13699 const filterOptionElSubCategory = _.map(_.orderBy(subFiltersItems, 'value', 'asc'), (item) => { 13700 let el = generateDropdownFilter("filter-events-subcategory-option", item.name, item.value); 13701 return el; 13702 }); 13703 13704 $("div.filter-events-subcategory-menu", element).html(''); 13705 $('.filterCat .ui.inline.dropdown .text', element).text($('.mainListMediaSec',element).data("subcategorytext")); 13706 $("div.filter-events-subcategory-menu", element).append('<div class="filter-events-subcategory-option active item" data-option-value="Sub Category" data-index="1">'+$('.mainListMediaSec',element).data("subcategorytext")+'</div>'); 13707 _.forEach(filterOptionElSubCategory, (item) => { 13708 $("div.filter-events-subcategory-menu", element).append(item); 13709 }); 13710 13711 $(".filter-events-subcategory-option", element).click(function () { 13712 let currentFilterSubCat = $(this).data('option-value'); 13713 if(filteredMediaData.page.subcategory!=currentFilterSubCat){ 13714 filteredMediaData.page={...filteredMediaData.page, subcategory:currentFilterSubCat}; 13715 fetchAndrenderContentBasedOnFiltersAndPagination(element); 13716 } 13717 }); 13718 13719 }else{ 13720 $(".itemCat", element).addClass('d-none'); 13721 filteredMediaData.page={...filteredMediaData.page, subcategory:null}; 13722 } 13723 } 13724 13725 if(flag==true){ 13726 $(".itemCat", element).addClass('d-none'); 13727 filteredMediaData.page={...filteredMediaData.page, subcategory:null}; 13728 } 13729 13730 filteredMediaData.page={...filteredMediaData.page,dateRangePickerFilter:dateRangePicker}; 13731 axios.get(reqUrl+formQueryStringBasedOnCurrentFilter()).then((res) => { 13732 let responseData = res.data.items; 13733 filteredMediaData.page = { ...filteredMediaData.page, currentPage: 0, data: responseData,totalCount:res.data.totalCount, filterKey: ['year', 'month', 'tag'] }; 13734 13735 if(flag==true){ 13736 13737 let filterMonths = []; 13738 let filterYears = []; 13739 let filterTags = []; 13740 let filterLocations = []; 13741 13742 _.forEach(res.data.years,(item)=>{ 13743 filterYears.push({ name: item, value: item }); 13744 }); 13745 13746 _.forEach(res.data.months,(item)=>{ 13747 filterMonths.push({ name: item, value: item }); 13748 }); 13749 13750 _.forEach(res.data.eventTypes,(item)=>{ 13751 filterTags.push({ name: capitalizeFirstChar(item), value: capitalizeFirstChar(item) }); 13752 }); 13753 13754 _.forEach(res.data.location,(item)=>{ 13755 filterLocations.push({ name: capitalizeFirstChar(item), value: capitalizeFirstChar(item) }); 13756 }); 13757 const filterOptionElLocation = _.map(_.orderBy(filterLocations, 'value', 'asc'), (item) => { 13758 let el = generateDropdownFilter("filter-events-location-option", item.name, item.value); 13759 return el; 13760 }); 13761 13762 $("div.filter-events-location-menu", element).html(''); 13763 $('.filterLocation .ui.inline.dropdown .text', element).text($('.mainListMediaSec',element).data("alllocationtext")); 13764 $("div.filter-events-location-menu", element).append('<div class="filter-events-location-option active item" data-option-value="All Location" data-index="1">
13764'+$('.mainListMediaSec',element).data("alllocationtext")+'</div>'); 13765 _.forEach(filterOptionElLocation, (item) => { 13766 $("div.filter-events-location-menu", element).append(item); 13767 }); 13768 13769 $(".filter-events-location-option", element).click(function () { 13770 let currentFilterLocation = $(this).data('option-value'); 13771 if(filteredMediaData.page.location!=currentFilterLocation){ 13772 filteredMediaData.page={...filteredMediaData.page, location:currentFilterLocation}; 13773 fetchAndrenderContentBasedOnFiltersAndPagination(element); 13774 } 13775 }); 13776 13777 const filterOptionElTag = _.map(_.orderBy(filterTags, 'value', 'asc'), (item) => { 13778 let active=false; 13779 let el = generateDropdownFilter("filter-events-type-option", item.name, item.value, active); 13780 return el; 13781 }); 13782 13783 $("div.filter-events-type-menu", element).html(''); 13784 $('.filterType .ui.inline.dropdown .text', element).text($('.allEventTypeText').val()); 13785 $("div.filter-events-type-menu", element).append('<div class="active item filter-events-type-option" data-option-value="All" data-index="1">'+$('.allEventTypeText').val()+'</div>'); 13786 _.forEach(filterOptionElTag, (item) => { 13787 $("div.filter-events-type-menu", element).append(item); 13788 }); 13789 13790 $(".filter-events-type-option", element).click(function () { 13791 let currentFilterEventType = $(this).data('option-value'); 13792 if(filteredMediaData.page.eventType!=currentFilterEventType){ 13793 filteredMediaData.page={...filteredMediaData.page, eventType:currentFilterEventType,subcategory:null}; 13794 fetchAndrenderContentBasedOnFiltersAndPagination(element,false); 13795 } 13796 }); 13797 13798 renderMonthAndYearFilters(element, filterMonths, filterYears); 13799 } 13800 13801 renderContentBasedOnFiltersAndPagination(element); 13802 }); 13803 } 13804 13805 const generateDropdownFilter = (classname, name, value, active = false) => { 13806 let item = `<div class="${classname} item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${value}"> 13807 ${name} 13808 </div>` 13809 return htmlToElement(item); 13810 } 13811 13812 function checkIfSubFilterTagPresent(key){ 13813 if (filteredMediaData.page.subFilterTagData.hasOwnProperty(key)) { 13814 return filteredMediaData.page.subFilterTagData[key]; 13815 } else { 13816 return null; 13817 } 13818 } 13819 13820 function capitalizeFirstChar(str) { 13821 if (!str || str.length === 0) { 13822 return str; 13823 } 13824 return str.charAt(0).toUpperCase() + str.slice(1); 13825 } 13826 const fetchInitialDataFromRootPath = ( element) => { 13827 13828 let filterMonths = []; 13829 let filterYears = []; 13830 let filterTags = []; 13831 let filterLocations = []; 13832 let params = new URL(document.location.toString()).searchParams; 13833 13834 //key case sensitive 13835 //value are case in-sensitive 13836 //if duplicate keys first key will be applied 13837 13838 let event =params.get("event")?.toLowerCase() || "all"; 13839 if(params.get("program")){ 13840 event=params.get("program")?.toLocaleLowerCase(); 13841 }else if(params.get("activity")){ 13842 event=params.get("activity")?.toLocaleLowerCase() 13843 }else if(params.get("exhibition")){ 13844 event=params.get("exhibition")?.toLocaleLowerCase() 13845 } 13846 13847 let eventType=params.get("eventType")?.toLocaleLowerCase(); 13848 if(params.get("category")){ 13849 eventType=params.get("category")?.toLocaleLowerCase(); 13850 }else if(params.get("topic")){ 13851 eventType=params.get("topic")?.toLocaleLowerCase(); 13852 } else if(params.get("activityType")){ 13853 eventType=params.get("activityType")?.toLocaleLowerCase(); 13854 } else if(params.get("type")){ 13855 eventType=params.get("type")?.toLocaleLowerCase(); 13856 } 13857 13858 let location=params.get("location")?.toLocaleLowerCase(); 13859 let year=params.get("year"); 13860 13861 let month=params.get("month")?.toLocaleLowerCase(); 13862 let thaiConvertedYear; 13863 let thaiConvertedMonth; 13864 thaiConvertedYear=year; 13865 if(localeLang==='Thai'){ 13866 if(month){ 13867 thaiConvertedMonth=getEnglishMonth(month); 13868 } 13869 }else{ 13870 thaiConvertedMonth=month; 13871 }
13872 let freeEntry=params.get("freeEntry"); 13873 let innerDateFilter=params.get("filterDate")?.toLocaleLowerCase(); 13874 13875 let subFilterTagData = JSON.parse($('.generic-list-subfilters',element).val()); 13876 13877 subFilterTagData=Object.keys(subFilterTagData).reduce((acc, key) => { 13878 acc[key.toLowerCase()] = subFilterTagData[key]; 13879 return acc; 13880 }, {}); 13881 13882 filteredMediaData.page={...filteredMediaData.page,subFilterTagData:subFilterTagData,event:event,eventType:eventType,location:location,yearfilter:thaiConvertedYear,monthfilter:thaiConvertedMonth,freeEntry:freeEntry,innerDateFilter:innerDateFilter}; 13883 13884 axios.get(reqUrl+formQueryStringBasedOnCurrentFilter()).then((res) => { 13885 13886 let responseData = res.data.items; 13887 13888 _.forEach(res.data.location,(item)=>{ 13889 filterLocations.push({ name: capitalizeFirstChar(item), value: capitalizeFirstChar(item) }); 13890 }); 13891 13892 _.forEach(res.data.eventTypes,(item)=>{ 13893 filterTags.push({ name: capitalizeFirstChar(item), value: capitalizeFirstChar(item) }); 13894 }); 13895 13896 _.forEach(res.data.years,(item)=>{ 13897 filterYears.push({ name: item, value: item }); 13898 }); 13899 13900 _.forEach(res.data.months,(item)=>{ 13901 filterMonths.push({ name: item, value: item }); 13902 }); 13903 13904 filteredMediaData.page = { ...filteredMediaData.page, currentPage: 0, data: responseData,totalCount:res.data.totalCount, filterKey: ['year', 'month', 'tag'] }; 13905 13906 /** 13907 * Generates the Event Type dropdown and applies the initial selection. 13908 * 13909 * If an active filter tile is present, the matching Event Type is selected. 13910 * "All Event Types" is shown based on the component configuration 13911 * (same behavior as the corresponding HTL logic). When no filter is active, 13912 * "All Event Types" is selected by default. 13913 */ 13914 13915 const activeFilterValue = res.data.activeFilterValue ?? ""; 13916 const hasFilterTiles = filteredMediaData.page.filterTiles != null; 13917 const hasDefaultFilter = filteredMediaData.page.defaultFilter != null; 13918 const hasActiveFilter = !!activeFilterValue; 13919 13920 13921 const showAllEventTypes = !hasFilterTiles || hasDefaultFilter; 13922 13923 const filterOptionElTag = _.map( 13924 _.orderBy(filterTags, 'value', 'asc'), 13925 (item) => { 13926 const isActive = 13927 hasFilterTiles && 13928 hasActiveFilter && 13929 activeFilterValue === item.name; 13930 13931 if (isActive) { 13932 filteredMediaData.page.eventType = activeFilterValue; 13933 $(".mainListMediaSec .filterType .ui.inline.dropdown .text") 13934 .text(activeFilterValue); 13935 } 13936 13937 return generateDropdownFilter( 13938 isActive 13939 ? "filter-events-type-option selected" 13940 : "filter-events-type-option", 13941 item.name, 13942 item.value, 13943 isActive 13944 ); 13945 } 13946 ); 13947 13948 // Clear the menu before rebuilding to avoid duplicating the static HTML item 13949 $("div.filter-events-type-menu", element).html(''); 13950 13951 // Add "All Event Types" option if required 13952 if (showAllEventTypes) { 13953 const allEventTypeText = $('.allEventTypeText').val(); 13954 13955 if (!hasActiveFilter) { 13956 $('.filterType .ui.inline.dropdown .text', element) 13957 .text(allEventTypeText); 13958 } 13959 13960 $("div.filter-events-type-menu", element).prepend(` 13961 <div class="${!hasActiveFilter ? 'active ' : ''}item filter-events-type-option" 13962 data-option-value="All" 13963 data-index="1"> 13964 ${allEventTypeText} 13965 </div> 13966 `); 13967 } 13968 13969 // Append remaining options 13970 _.forEach(filterOptionElTag, (item) => { 13971 $("div.filter-events-type-menu", element).append(item); 13972 }); 13973 13974 const filterOptionElLocation = _.map(_.orderBy(filterLocations, 'value', 'asc'), (item) => { 13975 let el = generateDropdownFilter("filter-events-location-option", item.name, item.value); 13976 return el; 13977 }); 13978 _.forEach(filterOptionElLocation, (item) => { 13979 $("div.filter-events-location-menu", element).append(item); 13980 }); 13981 13982 renderMonthAndYearFilters( element, filterMonths, filterYears) 13983 13984 $(".filter-events-option", element).click(function () { 13985 let currentFilterAll = $(this).data('option-value'); 13986 if(currentFilterAll.includes('Past')){ 13987 filteredMediaData.page={...filteredMediaData.page, event:"past"}; 13988 } 13989 else if(currentFilterAll.includes('All')){ 13990 filteredMediaData.page={...filteredMediaData.page, event:"all"}; 13991 } 13992 else{ 13993 filteredMediaData.page={...filteredMediaData.page, event:null}; 13994 } 13995 filteredMediaData.page={...filteredMediaData.page, yearfilter:null, monthfilter:null, eventType:null,location:null}; 13996 fetchAndrenderContentBasedOnFiltersAndPagination(element,true); 13997 }); 13998 13999 $(".filter-events-type-option", element).click(function () { 14000 let currentFilterEventType = $(this).data('option-value'); 14001 if(filteredMediaData.page.eventType!=currentFilterEventType){ 14002 filteredMediaData.page={...filteredMediaData.page, eventType:currentFilterEventType,subcategory:null}; 14003 fetchAndrenderContentBasedOnFiltersAndPagination(element,false); 14004 } 14005 }); 14006 14007 $(".filter-events-location-option", element).click(function () { 14008 let currentFilterLocation = $(this).data('option-value'); 14009 if(filteredMediaData.page.location!=currentFilterLocation){ 14010 filteredMediaData.page={...filteredMediaData.page, location:currentFilterLocation}; 14011 fetchAndrenderContentBasedOnFiltersAndPagination(element); 14012 } 14013 }); 14014 $("input.eventFilterSearch", element).change(function () { 14015 let searchValue=$(this).val(); 14016 if(filteredMediaData.page.searchTerm!=searchValue){ 14017 filteredMediaData.page={...filteredMediaData.page, searchTerm:searchValue}; 14018 fetchAndrenderContentBasedOnFiltersAndPagination(element); 14019 } 14020 }); 14021 14022 $('div.boxDate',element).click(function () { 14023 let boxDate=$('span', this).data('value'); 14024 if($(this).hasClass('active')){ 14025 filteredMediaData.page={...filteredMediaData.page, innerDateFilter:boxDate}; 14026 fetchAndrenderContentBasedOnFiltersAndPagination(element); 14027 }else{ 14028 filteredMediaData.page={...filteredMediaData.page, innerDateFilter:null}; 14029 fetchAndrenderContentBasedOnFiltersAndPagination(element); 14030 } 14031 14032 }); 14033 14034 document.addEventListener('genericListDatePicker', function() { 14035 fetchAndrenderContentBasedOnFiltersAndPagination(element); 14036 }); 14037 14038 $('div.itemTitleTab',element).click(function () { 14039 let freeEntry=false; 14040 if($('p.descText',this).data('value')==='Free Entry'){ 14041 freeEntry=true; 14042 } 14043 if(filteredMediaData.page.freeEntry!=freeEntry){ 14044 filteredMediaData.page={...filteredMediaData.page, freeEntry:freeEntry}; 14045 fetchAndrenderContentBasedOnFiltersAndPagination(element); 14046 } 14047 }); 14048 14049 renderContentBasedOnFiltersAndPagination(element); 14050 14051 if(filteredMediaData.page.event!=null && filteredMediaData.page.event.includes('past')){ 14052 let $dropdown = $(".mainListMediaSec .filterAllEvent .ui.inline.dropdown",element); 14053 let $item = $dropdown.find('.menu .item').eq(1); 14054 let value = $item.data('text'); 14055 $dropdown.dropdown('set selected', value); 14056 14057 if(filteredMediaData.page.totalCount==0){ 14058 $("div.mediaThumbnailContainer", element).removeClass("active"); 14059 $("div.boxNotFoundContainer", element).addClass("active"); 14060 } 14061 setTimeout(function selectMonthAndYearFilter(){ 14062 if(filteredMediaData.page.yearfilter){ 14063 $(".mainListMediaSec .filterYear .ui.inline.dropdown",element).dropdown('set selected',year); 14064 } 14065 if(filteredMediaData.page.monthfilter){ 14066 $(".mainListMediaSec .filterMonths .ui.inline.dropdown",element).dropdown('set selected',month); 14067 } 14068 14069 }, 200); 14070 }else{ 14071 setTimeout(function selectLocationDateAndFreeEntry(){ 14072 if(filteredMediaData.page.location){ 14073 $(".mainListMediaSec .filterLocation .ui.inline.dropdown",element).dropdown('set selected',filteredMediaData.page.location); 14074 } 14075 14076 if(filteredMediaData.page.innerDateFilter){ 14077 14078 if(filteredMediaData.page.innerDateFilter==='today'){ 14079 $('.today',element).addClass('active'); 14080 }else 14081 { 14082 if(filteredMediaData.page.innerDateFilter==='this month'){ 14083 $('.thisMonth',element).addClass('active'); 14084 }else if(filteredMediaData.page.innerDateFilter==='this week'){ 14085 $('.thisWeek',element).addClass('active'); 14086 }else if(filteredMediaData.page.innerDateFilter==='this weekend'){ 14087 $('.thisWeekend',element).addClass('active'); 14088 } 14089 } 14090 } 14091 14092 if(filteredMediaData.page.freeEntry && filteredMediaData.page.freeEntry=='true'){ 14093 $(".mainListMediaSec .mediaList .titleMediaTabs .itemTitleTab", element).removeClass('active'); 14094 $(".mainListMediaSec .mediaList .titleMediaTabs .itemTitleTab",element).eq(1).addClass('active'); 14095 } 14096 }, 200); 14097 } 14098 setTimeout(function selectEventType(){ 14099 if(filteredMediaData.page.eventType){ 14100 $(".mainListMediaSec .filterType .ui.inline.dropdown",element).dropdown('set selected',filteredMediaData.page.eventType); 14101 } 14102 }, 200); 14103 14104 }); 14105 } 14106 14107 (function () { 14108 let stateCheck = setInterval(() => { 14109 if (document.readyState === 'complete') { 14110 clearInterval(stateCheck) 14111 $('.genericlistcmp').each(element => { 14112 let rootpath=$('.mainListMediaSec',element).data("root-path"); 14113 if(rootpath?.length>0){ 14114 reqUrl= $('.mainListMediaSec',element).data("cmp-path")+'.filter-and-search.json'; 14115 let pageSize = $('.mainListMediaSec',element).data("cmp-page-size"); 14116 let defaultFilter = $('.mainListMediaSec',element).data("defaulttilestag"); 14117 console.log("defaultFilter " + defaultFilter); 14118 let cmpType = $('.mainListMediaSec',element).data("cmp-type"); 14119 let filterTiles = $('.mainListMediaSec', element).data("filtertilestag"); 14120 filteredMediaData.page={...filteredMediaData.page,rootpath:rootpath,pageSize:pageSize,cmpType:cmpType,filterTiles: filterTiles,defaultFilter: defaultFilter}; 14121 fetchInitialDataFromRootPath(element); 14122 } 14123 }); 14124 } 14125 }, 100) 14126 })(); 14127 14128}); 14129 14130$(document).ready(function () { 14131 var sectiongenericlist = document.getElementsByClassName('genericlistcmp'); 14132 (function () { 14133 let stateCheck = setInterval(() => { 14134 if (document.readyState === 'complete') { 14135 clearInterval(stateCheck) 14136 if (sectiongenericlist && sectiongenericlist.length > 0) { 14137 TagMore(); 14138 SwitchTags(); 14139 /*below four methods are declared and defined in newslist component js*/ 14140 PagNext(); 14141 PagPrev(); 14142 updatePagination(); 14143 PagActive(); 14144 14145 var resizeTimer; 14146 14147 $(window).on('resize', function () { 14148 clearTimeout(resizeTimer); 14149 resizeTimer = setTimeout(function () { 14150 TagMore(); 14151 }, 250); 14152 }); 14153 14154 function SwitchTags() { 14155 $(".genericlistcmp .mainListMediaSec .titleMediaTabs .itemTitleTab").click(function () { 14156 $(".mainListMediaSec .titleMediaTabs .itemTitleTab").removeClass("active"); 14157 $(this).addClass("active"); 14158 var clickedTabIndex = $(this).index(); 14159 if(!$(this).hasClass('generic-list-TitleTab')){ 14160 $(".mainListMediaSec .tabsMedia .itemBodyTab").removeClass("active"); 14161 $(".mainListMediaSec .tabsMedia .itemBodyTab:eq(" + clickedTabIndex + ")").addClass("active"); 14162 } 14163 if (clickedTabIndex == 1) { 14164 $(".mainListMediaSec .filterSoft").addClass("d-none"); 14165 }else { 14166 $(".mainListMediaSec .filterSoft").removeClass("d-none"); 14167 } 14168 14169 setTimeout(() => { 14170 var heightButton = $('.mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 14171 14172 if (heightButton > 120) { 14173 $(".mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 14174 } else { 14175 $(".mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 14176 } 14177 }, 100); 14178 }); 14179 } 14180 14181 $(".genericlistcmp .mainListMediaSec .filterYear .ui.inline.dropdown").dropdown({ 14182 forceSelection: false, //***** 14183 direction: "downward", 14184 delay: { 14185 touch: 0, 14186 }, 14187 onShow: function () { 14188 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14189 } 14190 }); 14191 14192 $(".genericlistcmp .mainListMediaSec .filterMonths .ui.inline.dropdown").dropdown({ 14193 forceSelection: false, //***** 14194 direction: "downward", 14195 delay: { 14196 touch: 0, 14197 }, 14198 onShow: function () { 14199 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14200 } 14201 }); 14202 14203 $(".genericlistcmp .mainListMediaSec .filterSoft .ui.inline.dropdown").dropdown({ 14204 forceSelection: false, //***** 14205 direction: "downward", 14206 delay: { 14207 touch: 0, 14208 }, 14209 onShow: function () { 14210 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14211 } 14212 }); 14213 14214 $(".genericlistcmp .mainListMediaSec .filterCat .ui.inline.dropdown").dropdown({ 14215 forceSelection: false, //***** 14216 direction: "downward", 14217 delay: { 14218 touch: 0, 14219 }, 14220 onShow: function () { 14221 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14222 } 14223 }); 14224 14225 $(".genericlistcmp .mainListMediaSec .filterAllEvent .ui.inline.dropdown").dropdown({ 14226 forceSelection: false, //***** 14227 direction: "downward", 14228 delay: { 14229 touch: 0,
14229 14230 }, 14231 onChange: function (value, text, $selectedItem) { 14232 var $item = $('.mainListMediaSec .filterAllEvent .menu .item[data-text="' + text + '"]'); 14233 var selectedIndex = $item.data('index'); 14234 14235 if (selectedIndex == 3) { 14236 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemYear").removeClass('d-none'); 14237 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemMonth").removeClass('d-none'); 14238 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemCalender").addClass('d-none'); 14239 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemLocation").addClass('d-none'); 14240 $(".mainListMediaSec .mediaList .filterMedia .innerFilter").addClass('showPast'); 14241 $(".mainListMediaSec .mediaList .filterMedia .innerBetween").addClass('d-none'); 14242 $(".mainListMediaSec .mediaList .tabsMedia .itemBodyTab").removeClass('active'); 14243 $(".mainListMediaSec .mediaList .tabsMedia .itemBodyTab").first().addClass('active'); 14244 if(!$($selectedItem).hasClass('filter-events-option')){ 14245 $(".mainListMediaSec .mediaList .titleMediaTabs .itemTitleTab").removeClass('active'); 14246 $(".mainListMediaSec .mediaList .titleMediaTabs .itemTitleTab").first().addClass('active'); 14247 } 14248 } else { 14249 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemYear").addClass('d-none'); 14250 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemMonth").addClass('d-none'); 14251 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemCalender").removeClass('d-none'); 14252 $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemLocation").removeClass('d-none'); 14253 $(".mainListMediaSec .mediaList .filterMedia .innerFilter").removeClass('showPast'); 14254 $(".mainListMediaSec .mediaList .filterMedia .innerBetween").removeClass('d-none'); 14255 } 14256 }, 14257 onShow: function () { 14258 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14259 } 14260 }); 14261 14262 $(".genericlistcmp .mainListMediaSec .filterType .ui.inline.dropdown").dropdown({ 14263 forceSelection: false, //***** 14264 direction: "downward", 14265 delay: { 14266 touch: 0, 14267 }, 14268 onChange: function (value, text, $selectedItem) { 14269 var $item = $('.mainListMediaSec #typeWhatHappening .filterType .menu .item[data-text="' + text + '"]'); 14270 var selectedIndex = $item.data('index'); 14271 14272 // if (selectedIndex == 2) { 14273 // $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemCat").removeClass('d-none'); 14274 // }else { 14275 // $(".mainListMediaSec .mediaList .filterMedia .itemFilter.itemCat").addClass('d-none'); 14276 // } 14277 }, 14278 onShow: function () { 14279 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14280 } 14281 }); 14282 14283 $(".genericlistcmp .mainListMediaSec .filterLocation .ui.inline.dropdown").dropdown({ 14284 forceSelection: false, //***** 14285 direction: "downward", 14286 delay: { 14287 touch: 0, 14288 }, 14289 onShow: function () { 14290 $(".ui.inline.dropdown").not(this).dropdown('hide'); 14291 } 14292 }); 14293 14294 14295 var dateRangeInput = $(".mainListMediaSec .filterCalendar #daterangepicker_1"); 14296 var dateRangeInputTh = $(".mainListMediaSec .filterCalendar #daterangepicker_1_th"); 14297 14298 14299/// Date Range Th 14300 14301 if (dateRangeInputTh.length > 0) { 14302 14303 var thisMonth = new Date().getMonth() + 1 14304 var thisYear = new Date().getFullYear(); 14305 var thisMonthAndYear = thisYear * 100 + thisMonth; 14306 function ShowDate () { 14307 var textMonth = $(".lightpick__select.lightpick__select-months option:selected").text(); 14308 var textYear = parseInt($(".lightpick__select.lightpick__select-years option:selected").text()) + 543; 14309 var displayedMonth = parseInt($('.lightpick__select.lightpick__select-months option:selected').val()) + 1; 14310 var displayedYear = parseInt($('.lightpick__select.lightpick__select-years option:selected').val()); 14311 var displayedMonthAndYear = displayedYear * 100 + displayedMonth; 14312 $(".lightpick__month-title-bar .lightpick__month-title").html('<span>' + textMonth + '</span>' + ' ' + textYear); 14313 if (displayedMonthAndYear <= thisMonthAndYear) { 14314 $(".lightpick__previous-action").addClass('disable'); 14315 } else { 14316 $(".lightpick__previous-action").removeClass('disable'); 14317 } 14318 } 14319 14320 var picker = new Lightpick({ 14321 field: document.getElementById('daterangepicker_1_th'), 14322 singleDate: false, 14323 lang: 'th', 14324 firstDay: 0, 14325 format: 'DD MMM YY', 14326 selectForward: true, 14327 minDate: new Date(), 14328 footer: true, 14329 locale: { 14330 buttons: { 14331 prev: '<i class="icon-ic-left"></i>', 14332 next: '<i class="icon-ic-right"></i>', 14333 reset: 'รีà¹à¸à¹à¸', 14334 }, 14335 tooltip: { 14336 one: 'วัà¸', 14337 other: 'วัà¸' 14338 }, 14339 }, 14340 onSelect: function (start, end) { 14341 if (start) { 14342 let startYearBE = parseInt(start.format('YYYY')) + 543; // Convert year to Buddhist Era 14343 let startDateFormatted = start.format('DD ') + convertMonth(start.format('MM')) + ' ' + startYearBE.toString().slice(-2); 14344 if (end) { 14345 let endYearBE = parseInt(end.format('YYYY')) + 543; 14346 let endDateFormatted = end.format('DD ') + convertMonth(end.format('MM')) + ' ' + endYearBE.toString().slice(-2); 14347 setTimeout(() => { 14348 document.getElementById('daterangepicker_1_th').value = startDateFormatted + ' - ' + endDateFormatted; 14349 }, "0"); 14350 } else { 14351 setTimeout(() => { 14352 document.getElementById('daterangepicker_1_th').value = startDateFormatted; 14353 }, "0"); 14354 } 14355 } 14356 $(".mainListMediaSec .filterDate .itemDate .boxDate").removeClass("active"); 14357 }, 14358 onOpen: function () { 14359 $(".mainListMediaSec .filterCalendar .arrow").addClass("show"); 14360 ShowDate(); 14361 }, 14362 onClose: function () { 14363 $(".mainListMediaSec .filterCalendar .arrow").removeClass("show"); 14364 isDatePickerOpen = false;
14365 document.dispatchEvent(new Event('genericListDatePicker')); 14366 }, 14367 }); 14368 14369 function convertMonth(month) { 14370 const thaiMonths = [ 14371 "ม.à¸.", "à¸.à¸.", "มี.à¸.", "à¹à¸¡.ย.", "à¸.à¸.", "มิ.ย.", 14372 "à¸.à¸.", "ส.à¸.", "à¸.ย.", "à¸.à¸.", "à¸.ย.", "à¸.à¸." 14373 ]; 14374 return thaiMonths[parseInt(month, 10) - 1]; 14375 } 14376 14377 picker._onMouseDown = function (e) { 14378 var target = e.target; 14379 if (target.classList.contains('lightpick__previous-action')) { 14380 ShowDate(); 14381 } else if (target.classList.contains('lightpick__next-action')) { 14382 ShowDate(); 14383 } 14384 }; 14385 picker.el.addEventListener('mousedown', picker._onMouseDown, true); 14386 picker.el.addEventListener('touchend', picker._onMouseDown, true); 14387 } 14388 14389 14390/// Date Range En 14391 14392 if (dateRangeInput.length > 0) { 14393 14394 14395 var thisMonth = new Date().getMonth() + 1 14396 var thisYear = new Date().getFullYear(); 14397 var thisMonthAndYear = thisYear * 100 + thisMonth; 14398 function ShowDate() { 14399 var textMonth = $(".lightpick__select.lightpick__select-months option:selected").text(); 14400 var textYear = parseInt($(".lightpick__select.lightpick__select-years option:selected").text()); 14401 var displayedMonth = parseInt($('.lightpick__select.lightpick__select-months option:selected').val()) + 1; 14402 var displayedYear = parseInt($('.lightpick__select.lightpick__select-years option:selected').val()); 14403 var displayedMonthAndYear = displayedYear * 100 + displayedMonth; 14404 $(".lightpick__month-title-bar .lightpick__month-title").html('<span>' + textMonth + '</span>' + ' ' + textYear); 14405 if (displayedMonthAndYear <= thisMonthAndYear) { 14406 $(".lightpick__previous-action").addClass('disable'); 14407 } else { 14408 $(".lightpick__previous-action").removeClass('disable'); 14409 } 14410 } 14411 var picker = new Lightpick({ 14412 field: document.getElementById('daterangepicker_1'), 14413 singleDate: false, 14414 lang: 'en', 14415 firstDay: 0, 14416 format: 'DD MMM YY', 14417 selectForward: true, 14418 minDate: new Date(), 14419 footer: true, 14420 locale: { 14421 buttons: { 14422 prev: '<i class="icon-ic-left"></i>', 14423 next: '<i class="icon-ic-right"></i>', 14424 reset: 'Reset', 14425 }, 14426 }, 14427 onSelect: function (start, end) { 14428 $(".mainListMediaSec .filterDate .itemDate .boxDate").removeClass("active"); 14429 }, 14430 onOpen: function () { 14431 $(".mainListMediaSec .filterCalendar .arrow").addClass("show"); 14432 ShowDate(); 14433 }, 14434 onClose: function () { 14435 $(".mainListMediaSec .filterCalendar .arrow").removeClass("show"); 14436 isDatePickerOpen = false; 14437 document.dispatchEvent(new Event('genericListDatePicker')); 14438 }, 14439 }); 14440 14441 14442 picker._onMouseDown = function (e) { 14443 var target = e.target; 14444 if (target.classList.contains('lightpick__previous-action')) { 14445 ShowDate(); 14446 } else if (target.classList.contains('lightpick__next-action')) { 14447 ShowDate(); 14448 } 14449 14450 }; 14451 picker.el.addEventListener('mousedown', picker._onMouseDown, true); 14452 picker.el.addEventListener('touchend', picker._onMouseDown, true); 14453 } 14454 14455 var isDatePickerOpen = false; 14456 14457 $(".genericlistcmp .mainListMediaSec .mediaList .filterCalendar input").click(function(){ 14458 if (isDatePickerOpen) { 14459 picker.hide(); 14460 isDatePickerOpen = false; 14461 } else { 14462 picker.show(); 14463 isDatePickerOpen = true; 14464 } 14465 }); 14466 14467 14468 $(".genericlistcmp .mainListMediaSec .filterDate .itemDate .boxDate").click(function () { 14469 if ($(this).hasClass("active")) { 14470 $(this).removeClass("active"); 14471 } else { 14472 $(".mainListMediaSec .filterDate .itemDate .boxDate").removeClass("active"); 14473 picker.setStartDate(null); 14474 picker.setEndDate(null); 14475 $(this).addClass("active"); 14476 } 14477 }); 14478 14479 } 14480 } 14481 }, 100) 14482 })(); 14483}); 14484$(document).ready(function () { 14485 var sectionmainDidYouKnowSec = document.getElementsByClassName('mainDidYouKnowSec'); 14486 if (sectionmainDidYouKnowSec && sectionmainDidYouKnowSec.length > 0) { 14487 fixSpaceMainDidYouKnowSec(); 14488 } 14489}); 14490 14491$(window).on("load resize", function () { 14492 fixSpaceMainDidYouKnowSec(); 14493}); 14494 14495function fixSpaceMainDidYouKnowSec() { 14496 setTimeout(() => { 14497 $(".mainDidYouKnowSec .didYouNowSlide .didYouNowSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 14498 $(".mainDidYouKnowSec .didYouNowSlide .didYouNowSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 14499 }, 50); 14500} 14501 14502var didYouNowSwiper = new Swiper(".didYouNowSwiper", { 14503 slidesPerView: 4, 14504 spaceBetween: 20, 14505 //resizeObserver:!($("body").data('custom-mode') == "edit"), 14506 speed: 500, 14507 breakpoints: { 14508 992: { 14509 slidesPerView: 4, 14510 spaceBetween: 20, 14511 centeredSlides: false, 14512 }, 14513 768: { 14514 slidesPerView: 2, 14515 spaceBetween: 20, 14516 centeredSlides: false, 14517 }, 14518 250: { 14519 slidesPerView: 1.2, 14520 spaceBetween: 10, 14521 centeredSlides: true, 14522 } 14523 } 14524}); 14525$(document).ready(function () { 14526 initializeGuidesSwiper(); 14527 var sectionmainGuidesSec = document.getElementsByClassName('mainGuidesSec'); 14528 if (sectionmainGuidesSec && sectionmainGuidesSec.length > 0) { 14529 fixSpaceMainGuidesSec(); 14530 } 14531}); 14532 14533$(window).on("load resize", function () { 14534 fixSpaceMainGuidesSec(); 14535}); 14536 14537 var autoplayvalue = true; 14538 var autoplayvariable; 14539 var sectionGallery = document.getElementsByClassName('mainGuidesSec'); 14540 if (sectionGallery && sectionGallery.length > 0) { 14541 var sectionElement = sectionGallery[0]; 14542 if(sectionElement){ 14543 var transitionTime = sectionElement.getAttribute('data-transition-time'); 14544 autoplayvalue = sectionElement.getAttribute('data-autoplay'); 14545 } 14546 } 14547if (autoplayvalue == "true") { 14548 autoplayvariable = { 14549 delay: transitionTime, disableOnInteraction: false, 14550 }} 14551else { 14552 autoplayvariable = false;} 14553 14554function fixSpaceMainGuidesSec() { 14555 14556 $(".mainGuidesSec .GuidesGalleryThumb .guidesSwiperThumb").css("padding-left", $(".container.custom-container").offset().left + 7.5); 14557 $(".mainGuidesSec .GuidesGalleryThumb .guidesSwiperThumb").css("padding-right", $(".container.custom-container").offset().left + 130.5); 14558 14559 var offsetContainer = $(".container.custom-container").offset().left; 14560 14561 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 14562 var arrowPo1 = 75; 14563 var arrowPo2 = 10; 14564 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 14565 var arrowPo1 = 65; 14566 var arrowPo2 = 5; 14567 } 14568 14569 if (offsetContainer < 85) { 14570 $(".mainGuidesSec .guidesSwiperImage .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo2); 14571 $(".mainGuidesSec .guidesSwiperImage .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo2); 14572 } else { 14573 $(".mainGuidesSec .guidesSwiperImage .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo1); 14574 $(".mainGuidesSec .guidesSwiperImage .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo1); 14575 } 14576} 14577 14578function initializeGuidesSwiper() { 14579 const sections = document.querySelectorAll('.mainGuidesSec'); 14580 14581 sections.forEach(section => { 14582 const guidethumbs = new Swiper(section.querySelector('.guidesSwiperThumb'), { 14583 slidesPerView: 4, 14584 spaceBetween: 0, 14585 slidesPerGroup: 4, 14586 resizeObserver:!($("body").data('custom-mode') == "edit"), 14587 effect: 'slide', 14588 slideToClickedSlide: true, 14589 speed: 1000, 14590 breakpoints: { 14591 992: { 14592 slidesPerView: 4, 14593 slidesPerGroup: 4, 14594 effect: 'slide', 14595 }, 14596 768: { 14597 slidesPerView: 2, 14598 slidesPerGroup: 2, 14599 effect: 'slide', 14600 }, 14601 250: { 14602 slidesPerView: 1, 14603 slidesPerGroup: 1, 14604 effect: "fade", 14605 } 14606 } 14607 }); 14608 14609 const guideSlider = new Swiper(section.querySelector('.guidesSwiperImage'), {
14610 slidesPerView: 1, 14611 loop: true, 14612 effect: "fade", 14613 resizeObserver:!($("body").data('custom-mode') == "edit"), 14614 speed: 1000, 14615 autoplay: autoplayvariable, 14616 navigation: { 14617 nextEl: section.querySelector('.swiper-button-next'), 14618 prevEl: section.querySelector('.swiper-button-prev'), 14619 }, 14620 pagination: { 14621 el: section.querySelector(".swiper-pagination"), 14622 clickable: true, 14623 }, 14624 thumbs: { 14625 swiper: guidethumbs, 14626 }, 14627 }); 14628 }); 14629} 14630$(document).ready(function () { 14631 $("body").kidkarnmaiPreloader({ 14632 setPercent: setPercent, 14633 setPercentComplete: setPercentComplete, 14634 }); 14635 14636 (async () => { 14637 await includeHTML(); 14638 heightTop = calculateHeightTop(); 14639 HeaderFunction(); 14640 //FoterFunction(); 14641 ScrollPrev(); 14642 ScrollNext(); 14643 ScrollToSec(); 14644 CheckScroll(); 14645 HeightItemShopSearch(); 14646 fixSpace(); 14647 removeOrphanDivider(); 14648 })() 14649 14650}); 14651 14652$(window).on("load resize", function () { 14653 setTimeout(() => { 14654 HeightItemShopSearch(); 14655 }, 300); 14656 CheckScroll(); 14657 fixSpace(); 14658 heightTop = calculateHeightTop(); 14659}); 14660 14661function HeaderFunction() { 14662 14663 var menuSwiper = new Swiper(".menuSwiper", { 14664 loop: true, 14665 resizeObserver:!($("body").data('custom-mode') == "edit"), 14666 speed: 1000, 14667 slidesPerView: 1, 14668 spaceBetween: 20, 14669 centeredSlides: false, 14670 autoplay: { 14671 delay: 3500, 14672 disableOnInteraction: false, 14673 }, 14674 breakpoints: { 14675 768: { 14676 slidesPerView: 1.1, 14677 spaceBetween: 20, 14678 centeredSlides: true, 14679 }, 14680 250: { 14681 slidesPerView: 1.1, 14682 spaceBetween: 10, 14683 centeredSlides: true, 14684 } 14685 } 14686 }); 14687 14688 menuSwiper.autoplay.stop(); 14689 14690 $(".blockHeader .btnNevToggle").click(function () { 14691 if ($(".blockHeader .headerSearch").hasClass('show')) { 14692 $(".blockHeader .headerSearch").removeClass('show'); 14693 $("body").removeClass('lockScreen'); 14694 } 14695 $(this).toggleClass('openMenu'); 14696 $(".blockHeader .headerSection.headerSectionBottom").toggleClass('show'); 14697 $("body").toggleClass('lockScreen'); 14698 if (menuSwiper.autoplay.running) { 14699 menuSwiper.autoplay.stop(); 14700 } else { 14701 menuSwiper.autoplay.start(); 14702 } 14703 }); 14704 14705 $(".blockHeader .subHeaderMenu li").hover( 14706 function () { 14707 var index = $(this).index(); 14708 $(this).addClass("hover"); 14709 $(".blockHeader .subHeaderMenu li").addClass("default"); 14710 $(".blockHeader .subHeaderMenu li .subImg").eq(index).addClass("show"); 14711 }, function () { 14712 $(this).removeClass("hover"); 14713 $(".blockHeader .subHeaderMenu li").removeClass("default"); 14714 $(".blockHeader .subHeaderMenu li").removeClass("active"); 14715 $(".blockHeader .subHeaderMenu li .subImg").removeClass("show"); 14716 } 14717 ); 14718var functionLanguage = document.getElementsByClassName('functionLanguage'); 14719if(functionLanguage && functionLanguage.length > 0) { 14720 $(".functionLanguage .ui.inline.dropdown").dropdown({ 14721 forceSelection: false, //***** 14722 direction: "downward", 14723 delay: { 14724 touch: 2000, 14725 }, 14726 }); 14727 } 14728 14729 var shopSearchMenuSwiper = new Swiper(".shopSearchMenuSwiper", { 14730 slidesPerView: 9, 14731 spaceBetween: 20, 14732 slidesPerGroup: 1, 14733 speed: 500, 14734 resizeObserver:!($("body").data('custom-mode') == "edit"), 14735 pagination: { 14736 el: '.swiper-pagination', 14737 type: "fraction", 14738 }, 14739 navigation: { 14740 nextEl: ".swiper-button-next", 14741 prevEl: ".swiper-button-prev", 14742 }, 14743 breakpoints: { 14744 1479: { 14745 slidesPerView: 9, 14746 spaceBetween: 20, 14747 slidesPerGroup: 1, 14748 centeredSlides: false, 14749 }, 14750 1200: { 14751 slidesPerView: 7, 14752 spaceBetween: 20, 14753 slidesPerGroup: 1, 14754 centeredSlides: false, 14755 }, 14756 992: { 14757 slidesPerView: 6, 14758 spaceBetween: 20, 14759 slidesPerGroup: 2, 14760 centeredSlides: false, 14761 }, 14762 768: { 14763 slidesPerView: 5, 14764 spaceBetween: 10, 14765 slidesPerGroup: 2, 14766 centeredSlides: false, 14767 }, 14768 250: { 14769 slidesPerView: 2.5, 14770 spaceBetween: 10, 14771 centeredSlides: false, 14772 slidesPerGroup: 1, 14773 } 14774 } 14775 }); 14776 14777 $(".blockHeader .headerNavFunction .btnSearch").click(function () { 14778 if ($(".blockHeader .btnNevToggle").hasClass('openMenu')) { 14779 $(".blockHeader .btnNevToggle").removeClass('openMenu'); 14780 $(".blockHeader .headerSection.headerSectionBottom").removeClass('show'); 14781 $("body").removeClass('lockScreen'); 14782 } 14783 $(".blockHeader .headerSearch").toggleClass("show"); 14784 $("body").toggleClass('lockScreen'); 14785 }); 14786 14787 $(".blockHeader .headerSearch .btnCloseSearch ").click(function () { 14788 $(".blockHeader .headerSearch").removeClass("show"); 14789 $("body").removeClass('lockScreen'); 14790 }); 14791} 14792 14793function HeightItemShopSearch() { 14794 var itemShop = $(".blockHeader .headerSearch .shopSearchMenuSwiper .itemSearchShop").innerWidth(); 14795 $(".blockHeader .headerSearch .shopSearchMenuSwiper .itemSearchShop").css('height', itemShop) 14796} 14797 14798function FoterFunction() { 14799 $("#btn_signUp").click(function () { 14800 $('.ui.modal.modalSubscribeFooter').modal('show'); 14801 }); 14802 14803 $("#btn_Subscribe").click(function () { 14804 $('.ui.modal.modalAcknowledge.footerModal').modal('show'); 14805 }); 14806} 14807 14808function CheckScroll() { 14809 WidthScroll();
14810 var widthScreen = $(".mainMenuScroll .container.custom-container").innerWidth(); 14811 if (widthScreen > WidthScroll()) { 14812 $(".mainMenuScroll .scroll .prevScroll").addClass("d-none"); 14813 $(".mainMenuScroll .scroll .nextScroll").addClass("d-none"); 14814 $(".mainMenuScroll .scroll").css({ "margin-bottom": "0", "overflow": "hidden" }); 14815 $(".mainMenuScroll .menuScrollPage ._inner").css("width", "100%"); 14816 } 14817} 14818 14819function WidthScroll() { 14820 var totalWidth = 0; 14821 $(".mainMenuScroll .itemSec").each(function () { 14822 totalWidth += $(this).innerWidth(); 14823 $(".mainMenuScroll .menuScrollPage ._inner").css("width", totalWidth + 150); 14824 }); 14825 return totalWidth + 150; 14826} 14827 14828function ScrollPrev() { 14829 var currentScroll = $(".mainMenuScroll .scroll").scrollLeft(); 14830 if (currentScroll === 0) { 14831 $(".mainMenuScroll .scroll .prevScroll").addClass("disable"); 14832 } 14833 $(".mainMenuScroll .scroll .prevScroll").on("click", function () { 14834 if (currentScroll === 0) { 14835 $(".mainMenuScroll .scroll").animate({ scrollLeft: -1000 }, 800); 14836 $(".mainMenuScroll .scroll .prevScroll").addClass("disable"); 14837 $(".mainMenuScroll .scroll .nextScroll").removeClass("disable"); 14838 } 14839 }); 14840} 14841 14842function ScrollNext() { 14843 var currentScroll = $(".mainMenuScroll .scroll").scrollLeft(); 14844 $(".mainMenuScroll .scroll .nextScroll").on("click", function () { 14845 if (currentScroll === 0) { 14846 $(".mainMenuScroll .scroll").animate({ scrollLeft: 1000 }, 800); 14847 $(".mainMenuScroll .scroll .prevScroll").removeClass("disable"); 14848 $(".mainMenuScroll .scroll .nextScroll").addClass("disable"); 14849 } 14850 }); 14851} 14852 14853function calculateHeightTop() { 14854 return $(".blockHeader").innerHeight() + $(".mainMenuScroll").innerHeight() - 1; 14855} 14856 14857function ScrollToSec() { 14858 14859 14860 $('.mainMenuScroll .itemSec').each(function (index) { 14861 $(this).data('index', index + 1); 14862 var link=$(this).data('link'); 14863 var redirectUrl=$(this).data('redirect-url'); 14864 var target=$(this).data('target-url'); 14865 $(this).click(function () { 14866 if (document.getElementById(link)) { 14867 $('html, body').animate({ 14868 scrollTop: $("#" + link).offset().top - heightTop 14869 }, 800); 14870 } else if (redirectUrl != undefined) { 14871 window.open(redirectUrl, target); 14872 } 14873 14874 }); 14875 14876 }); 14877 14878 $(".functionScrollPage .ui.inline.dropdown").dropdown({ 14879 forceSelection: false, 14880 direction: "downward", 14881 delay: { 14882 touch: 2000, 14883 }, 14884 onChange: function (value, text, $selectedItem) { 14885 var $item = $('.mainMenuScroll .menu .item[data-text="' + text + '"]'); 14886 var selectedIndex = $item.data('link'); 14887 var redirectUrl=$item.data('redirect-url'); 14888 if ($('#' + selectedIndex) && $('#' + selectedIndex).length > 0) { 14889 $('html, body').animate({ 14890 scrollTop: $('#' + selectedIndex).offset().top - heightTop 14891 }, 1000); 14892 } else if (redirectUrl != undefined) { 14893 window.location.href = redirectUrl; 14894 } 14895 } 14896 }); 14897 14898 $(".mainMenuScroll .functionScrollPage .ui .text").text($(".mainMenuScroll .functionScrollPage .menu .item").first().text()); 14899} 14900 14901function fixSpace() { 14902 $(".mainMenuScroll .menuScrollPage .scroll .prevScroll").css("margin-left", $(".container.custom-container").offset().left + 15); 14903 $(".mainMenuScroll .menuScrollPage .scroll .nextScroll").css("margin-right", $(".container.custom-container").offset().left + 15); 14904 14905 $(".main-head .blockHeader .headerSection.headerSectionBottom .subHeaderTop").css("margin-right", $(".container.custom-container").offset().left + 15); 14906 $(".main-head .blockHeader .headerSection.headerSectionBottom .subHeaderTop").css("margin-left", $(".container.custom-container").offset().left + 15); 14907 14908 $(".main-head .blockHeader .headerSection.headerSectionBottom ._inner .subHeaderMenu").css("margin-right", $(".container.custom-container").offset().left + 15); 14909 $(".main-head .blockHeader .headerSection.headerSectionBottom ._inner .subHeaderMenu").css("margin-left", $(".container.custom-container").offset().left + 15); 14910 14911} 14912 14913 14914function setPercent(num) { 14915 $(".loader").addClass("workingLoad"); 14916 // console.log("setPercent : " + num); 14917} 14918 14919function setPercentComplete() { 14920 console.log("setPercentComplete"); 14921 setTimeout(function () { 14922 $(".loader").removeClass("workingLoad"); 14923 AOS.init({ 14924 once: true,
14925 duration: 800, 14926 }); 14927 }, 500); 14928} 14929 14930async function loadFunc(file) { 14931 console.log(file) 14932 let resp = await fetch(file) 14933 let body = await resp.text() 14934 $("[w3-include-html]").each((index, el) => { 14935 if ($(el).attr("w3-include-html") == file) { 14936 console.log(el, file) 14937 $(el).replaceWith(body) 14938 } 14939 }) 14940} 14941 14942async function includeHTML() { 14943 let promList = [] 14944 14945 $("[w3-include-html]").each(function () { 14946 elmnt = $(this) 14947 file = elmnt.attr("w3-include-html"); 14948 promList.push(loadFunc(file)) 14949 }) 14950 14951 return Promise.all(promList) 14952} 14953function removeOrphanDivider(){ 14954 if($(".breadcrumb .divider")&& $(".breadcrumb .divider").length >0 14955 && !$(".breadcrumb .divider").last().next().hasClass("active")){ 14956 $(".breadcrumb .divider").last().remove(); 14957 } 14958 14959} 14960$(document).ready(function () { 14961 var mainRelateMediaSecExplore = document.getElementsByClassName('mainRelateMediaSec'); 14962 if (mainRelateMediaSecExplore && mainRelateMediaSecExplore.length > 0) { 14963 var numberOfSlides = $('.relateMediaSwiper .swiper-slide').length; 14964 14965 if (numberOfSlides == 1) { 14966 $('.mainRelateMediaSec .headlineSec .titleText').addClass('w100'); 14967 $('.mainRelateMediaSec .relateMediaSwiper .swiper-number').addClass('d-none'); 14968 } else { 14969 $('.mainRelateMediaSec .headlineSec .titleText').addClass('w60'); 14970 } 14971 14972 TagMoreRelateMedia(); 14973 var resizeTimerRelateMedia; 14974 14975 $(window).on("load resize", function () { 14976 clearTimeout(resizeTimerRelateMedia); 14977 resizeTimerRelateMedia = setTimeout(function () { 14978 TagMoreRelateMedia(); 14979 }, 250); 14980 }); 14981 14982 var relateMediaSwiper = new Swiper(".relateMediaSwiper", { 14983 slidesPerView: 3, 14984 spaceBetween: 20, 14985 slidesPerGroup: 3, 14986 resizeObserver:!($("body").data('custom-mode') == "edit"), 14987 speed: 500, 14988 pagination: { 14989 el: '.swiper-pagination', 14990 type: "fraction", 14991 }, 14992 navigation: { 14993 nextEl: ".swiper-button-next", 14994 prevEl: ".swiper-button-prev", 14995 }, 14996 breakpoints: { 14997 992: { 14998 slidesPerView: 3, 14999 spaceBetween: 20, 15000 slidesPerGroup: 3, 15001 centeredSlides: false, 15002 }, 15003 768: { 15004 slidesPerView: 2, 15005 spaceBetween: 20, 15006 slidesPerGroup: 2, 15007 centeredSlides: false, 15008 }, 15009 540: { 15010 slidesPerView: 2, 15011 spaceBetween: 10, 15012 slidesPerGroup: 2, 15013 centeredSlides: false, 15014 }, 15015 250: { 15016 slidesPerView: 1.1, 15017 spaceBetween: 10, 15018 centeredSlides: true, 15019 slidesPerGroup: 1, 15020 } 15021 } 15022 }); 15023 } 15024}); 15025 15026function TagMoreRelateMedia() { 15027 var itemMediaDefault = $('.mainRelateMediaSec .itemMedia').width() - 40; 15028 $('.mainRelateMediaSec .itemMedia').each(function () { 15029 var totalItemTagWidth = 0; 15030 $(this).find('.tags .itemTag').each(function () { 15031 var itemTagWidth = $(this).innerWidth(); 15032 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 15033 totalItemTagWidth += itemTagWidth; 15034 } else { 15035 $(this).addClass('d-none'); 15036 $(this).siblings(".itemTagMore").addClass('d-block'); 15037 } 15038 }); 15039 }); 15040} 15041$(document).ready(function () { 15042 var mainRelateEventSec = document.getElementsByClassName('mainRelateEventSec'); 15043 if (mainRelateEventSec && mainRelateEventSec.length > 0) { 15044 var numberOfSlides = $('.relateEventSwiper .swiper-slide').length; 15045 if (numberOfSlides == 1) { 15046 $('.mainRelateEventSec .headlineSec .titleText').addClass('w100'); 15047 $('.mainRelateEventSec .relateEventSwiper .swiper-number').addClass('d-none'); 15048 } else { 15049 $('.mainRelateEventSec .headlineSec .titleText').addClass('w60'); 15050 } 15051 TagMoreRelateEvent(); 15052 initializeRelateEventSwiper(); 15053 15054 15055 var resizeTimer; 15056 15057 $(window).on("load resize", function () { 15058 clearTimeout(resizeTimer); 15059 resizeTimer = setTimeout(function () { 15060 TagMoreRelateEvent(); 15061 }, 250); 15062 }); 15063 15064 } 15065}); 15066 15067function TagMoreRelateEvent() { 15068 var itemMediaDefault = $('.mainRelateEventSec .itemMedia').width() - 30; 15069 $('.mainRelateEventSec .itemMedia').each(function () { 15070 var totalItemTagWidth = 0; 15071 $(this).find('.tags .itemTag').each(function () { 15072 var itemTagWidth = $(this).innerWidth(); 15073 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 15074 totalItemTagWidth += itemTagWidth; 15075 } else { 15076 $(this).addClass('d-none'); 15077 $(this).siblings(".itemTagMore").addClass('d-block'); 15078 } 15079 }); 15080 }); 15081} 15082 15083 15084 15085 15086function initializeRelateEventSwiper() { 15087 const swipers = document.querySelectorAll('.relateEventSwiper');
15088 swipers.forEach(swiper => { 15089 new Swiper(swiper, { 15090 slidesPerView: 4, 15091 resizeObserver:!($("body").data('custom-mode') == "edit"), 15092 spaceBetween: 20, 15093 slidesPerGroup: 4, 15094 speed: 500, 15095 pagination: { 15096 el: '.swiper-pagination', 15097 type: "fraction", 15098 }, 15099 navigation: { 15100 nextEl: ".swiper-button-next", 15101 prevEl: ".swiper-button-prev", 15102 }, 15103 breakpoints: { 15104 1200: { 15105 slidesPerView: 4, 15106 spaceBetween: 20, 15107 slidesPerGroup: 4, 15108 centeredSlides: false, 15109 }, 15110 992: { 15111 slidesPerView: 3, 15112 spaceBetween: 20, 15113 slidesPerGroup: 3, 15114 centeredSlides: false, 15115 }, 15116 768: { 15117 slidesPerView: 3, 15118 spaceBetween: 20, 15119 slidesPerGroup: 3, 15120 centeredSlides: false, 15121 }, 15122 540: { 15123 slidesPerView: 2, 15124 spaceBetween: 10, 15125 slidesPerGroup: 2, 15126 centeredSlides: false, 15127 }, 15128 250: { 15129 slidesPerView: 2, 15130 spaceBetween: 10, 15131 centeredSlides: false, 15132 slidesPerGroup: 2, 15133 } 15134 } 15135 }); 15136 }); 15137} 15138 15139'use strict' 15140 15141var sectiondistrictmap = document.getElementsByClassName('districtmap'); 15142if (sectiondistrictmap && sectiondistrictmap.length > 0) { 15143 $(".districtmap .mainDistrictMap .filterType1 .ui.inline.dropdown").dropdown({ 15144 forceSelection: false, //***** 15145 direction: "downward", 15146 delay: { 15147 touch: 0, 15148 }, 15149 onChange: function () { 15150 $(".ui.inline.dropdown").not(this).dropdown('hide'); 15151 } 15152 }); 15153 15154 $(".districtmap .mainDistrictMap .filterType2 .ui.inline.dropdown").dropdown({ 15155 forceSelection: false, //***** 15156 direction: "downward", 15157 delay: { 15158 touch: 0, 15159 }, 15160 onShow: function () { 15161 $(".ui.inline.dropdown").not(this).dropdown('hide'); 15162 } 15163 }); 15164 15165 $(".districtmap .mainDistrictMap .filterType3 .ui.inline.dropdown").dropdown({ 15166 forceSelection: false, //***** 15167 direction: "downward", 15168 delay: { 15169 touch: 0, 15170 }, 15171 onShow: function () { 15172 $(".ui.inline.dropdown").not(this).dropdown('hide'); 15173 } 15174 }); 15175} 15176 15177function toggleServiceMarkers() { 15178 servicesVisible = !servicesVisible; 15179 serviceMarkers.forEach(function (marker) { 15180 marker.setMap(servicesVisible ? map : null); 15181 }); 15182 $(".districtmap .container .inner .btnToggleService").toggleClass('hideEye'); 15183 15184} 15185 15186var map 15187var infowindow 15188var contentString = 15189 '<div id="content">' + 15190 '<div id="siteNotice">' + 15191 "</div>" + 15192 '<h1 id="firstHeading" class="firstHeading">Uluru</h1>' + 15193 '<div id="bodyContent">' + 15194 "<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large " + 15195 "sandstone rock formation in the southern part of the " + 15196 "Northern Territory, central Australia. It lies 335 km (208 mi) " + 15197 "south west of the nearest large town, Alice Springs; 450 km " + 15198 "(280 mi) by road. Kata Tjuta and Uluru are the two major " + 15199 "features of the Uluru - Kata Tjuta National Park. Uluru is " + 15200 "sacred to the Pitjantjatjara and Yankunytjatjara, the " + 15201 "Aboriginal people of the area. It has many springs, waterholes, " + 15202 "rock caves and ancient paintings. Uluru is listed as a World " + 15203 "Heritage Site.</p>" + 15204 '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">' + 15205 "https://en.wikipedia.org/w/index.php?title=Uluru</a> " + 15206 "(last visited June 22, 2009).</p>" + 15207 "</div>" + 15208 "</div>"; 15209 15210var apiResponse = []; // Define apiResponse globally 15211 15212var NewResponse = []; // Define apiResponse globally 15213 15214var detailtranslation; 15215var directiontranslation; 15216var subplaceholder; 15217var subplacefilter; 15218 15219function isMobile() { 15220 return window.innerWidth <= 768; 15221} 15222 15223var apiServices = []; 15224var subFilters; 15225var currentIndex = 0; 15226var itemsPerPage = isMobile() ? 5 : 10; 15227var serviceMarkers = []; 15228var servicesVisible = true; 15229 15230function initDistrictMap() { 15231 15232 var styledMapType = new google.maps.StyledMapType( 15233 [ 15234 { 15235 "elementType": "geometry", 15236 "stylers": [ 15237 { "color": "#e9e9e9" } 15238 ] 15239 }, 15240 { 15241 "elementType": "labels.text.fill", 15242 "stylers": [ 15243 { "color": "#333333" } 15244 ] 15245 }, 15246 { 15247 "elementType": "labels.text.stroke", 15248 "stylers": [ 15249 { "color": "#ffffff" } 15250 ] 15251 }, 15252 { 15253 "featureType": "administrative", 15254 "elementType": "geometry", 15255 "stylers": [ 15256 { "visibility": "off" } 15257 ] 15258 }, 15259 { 15260 "featureType": "landscape", 15261 "elementType": "geometry", 15262 "stylers": [ 15263 { "color": "#f0f0f0" } 15264 ] 15265 }, 15266 { 15267 "featureType": "poi", 15268 "elementType": "geometry", 15269 "stylers": [ 15270 { "color": "#cfe7f3" } 15271 ] 15272 }, 15273 { 15274 "featureType": "road", 15275 "elementType": "geometry", 15276 "stylers": [ 15277 { "color": "#b3b3b3" } 15278 ] 15279 }, 15280 { 15281 "featureType": "road", 15282 "elementType": "labels.text.fill", 15283 "stylers": [ 15284 { "color": "#808080" } 15285 ] 15286 }, 15287 { 15288 "featureType": "road", 15289 "elementType": "labels.text.stroke", 15290 "stylers": [ 15291 { "color": "#ffffff" } 15292 ] 15293 }, 15294 { 15295 "featureType": "water", 15296 "elementType": "geometry", 15297 "stylers": [ 15298 { "color": "#a0d3d3" } 15299 ] 15300 }, 15301 { 15302 "featureType": "water", 15303 "elementType": "labels.text.fill", 15304 "stylers": [ 15305 { "color": "#737373" } 15306 ] 15307 } 15308 ], 15309 { name: 'Blue Styled Map' } 15310 ); 15311 15312 map = new google.maps.Map(document.getElementById('map'), { 15313 center: { lat: 13.75, lng: 100.5 }, 15314 mapTypeControl: false, 15315 fullscreenControl: false, 15316 zoom: 11, 15317 mapTypeControlOptions: { 15318 mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain', 'styled_map'] 15319 } 15320 }); 15321 15322 map.mapTypes.set('styled_map', styledMapType); 15323 map.setMapTypeId('styled_map'); 15324 displayServices(apiServices); 15325} 15326 15327function adddistrictMarker(plant, index) { 15328 var plantmapMarkerValue = document.querySelector('.districtmap .mainDistrictMap .boxFilter') 15329 ? document.querySelector('.districtmap .mainDistrictMap .boxFilter').getAttribute('data-mapmarker') || '/content/dam/onebangkok_v2/mark_point.png' 15330 : '/content/dam/onebangkok_v2/mark_point.png'; 15331 var icon = { 15332 url: plantmapMarkerValue, 15333 scaledSize: new google.maps.Size(25, 25), // scaled size 15334 origin: new google.maps.Point(0, 0), // origin 15335 anchor: new google.maps.Point(0, 0) // anchor 15336 }; 15337 15338 var marker = new google.maps.Marker({ 15339 position: { lat: plant.lat, lng: plant.lng }, 15340 map: map, 15341 title: plant.name, 15342 icon: icon, 15343 }); 15344 15345 apiResponse[plant.id - 1]['marker'] = marker; 15346 15347 marker.addListener('click', function () { 15348 moveDistrictMap(plant.id - 1) 15349 15350 $(".mainDistrictMap .listItem .item").removeClass("active"); 15351 $(".mainDistrictMap .listItem .item").eq(plant.id - 1).addClass("active"); 15352 15353 var scrollableDiv = $('.mainDistrictMap .listItem'); 15354 var activeItem = $('.mainDistrictMap .listItem .item.active'); 15355 if (activeItem.length) { 15356 scrollableDiv.animate({ 15357 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 15358 }, 500); 15359 } 15360 15361 }); 15362 15363} 15364 15365function searchDistfun(){ 15366 $('.boxFilter .filterMonths .text').text(subplaceholder); 15367 $('.boxFilter .filterYear .text').text(subplaceholder); 15368 $('#secondArtFilter').addClass('d-none'); 15369 updateItemClasses("planttypee"); 15370 var searchvalue = document.getElementById('searchtermmap').value; 15371 NewResponse = filterdistrictAPIResponse(apiResponse, "All", "All", searchvalue); 15372 currentIndex = 0; // Reset pagination 15373 displayDistrictPlants(NewResponse); 15374} 15375 15376function displayDistrictPlants(plants = undefined, isLoadMore = false) { 15377 let dataToDisplay; 15378 15379 if (plants == undefined) { 15380 15381 dataToDisplay = apiResponse.slice(currentIndex, currentIndex + itemsPerPage); 15382 } else { 15383 15384 dataToDisplay = plants.slice(currentIndex, currentIndex + itemsPerPage); 15385 } 15386 15387 var $plantsList = $('#district_list_item'); 15388 15389 if (!isLoadMore) { 15390 15391 $plantsList.empty(); 15392 currentIndex = 0; 15393 } 15394 15395 15396 $.each(dataToDisplay, function (index, plant) { 15397 var plantHtml = ` 15398 <div class="item" id="${plant.id}" onClick='moveDistrictMap(${plant.id - 1})'> 15399 <div class="boxImg"> 15400 <img src="${plant.image}" alt=""> 15401 </div> 15402 <div class="boxContent"> 15403 <div class="top"> 15404 <p class="descText">${plant.name}</p> 15405 <p class="sub">${plant.operataingHour}</p> 15406 </div> 15407 <div class="bottom"> 15408 <p class="sub"> 15409 <i class="icon-ic-location"></i>${plant.locationtext} 15410 </p> 15411 </div> 15412 </div> 15413 </div> 15414 `; 15415 $plantsList.append(plantHtml); 15416 adddistrictMarker(plant, currentIndex + index); 15417 }); 15418 15419 // Check if more items are available to show 15420 if (plants == undefined) { 15421 if (currentIndex + itemsPerPage >= apiResponse.length) { 15422 $('.districtmap .mainDistrictMap .viewMore').hide(); 15423 } else { 15424 $('.districtmap .mainDistrictMap .viewMore').show(); 15425 } 15426 } else { 15427 if (currentIndex + itemsPerPage >= plants.length) { 15428 $('.districtmap .mainDistrictMap .viewMore').hide(); 15429 } else { 15430 $('.districtmap .mainDistrictMap .viewMore').show(); 15431 } 15432 } 15433 15434 currentIndex += itemsPerPage; 15435 clickOndistrictActiveItem(); 15436} 15437 15438function clickOndistrictActiveItem() { 15439 // Find the element with the class "item active" 15440 const activeItem = document.querySelector('.districtmap .mainDistrictMap #district_list_item .item'); 15441 if (activeItem) { 15442 activeItem.click(); 15443 } else { 15444 console.error("No element with class 'item active' found."); 15445 } 15446} 15447 15448 15449function moveDistrictMap(index) { 15450 var item = apiResponse[index] 15451 var pos = { 15452 lat: parseFloat(item['lat']), 15453 lng: parseFloat(item['lng']) 15454 }; 15455 15456 var detailText = detailtranslation; 15457 var directionText = directiontranslation; 15458 15459 contentString = 15460 '<div class="boxMarkMap">' + 15461 '<div class="itemMarkMap">' + 15462 '<div class="boxImg">
15462' + 15463 '<img src=' + item['image'] + '>' + 15464 '</div>' + 15465 '<div class="boxContent">' + 15466 '<p class="descText">' + item['name'] + '</p>' + 15467 '<p class="sub">' + item['operataingHour'] + '</p>' + 15468 '<div class="bottom">' + 15469 '<p class="sub">' + '<i class="icon-ic-location"></i>' + item['locationtext'] + '</p>' + 15470 '</div>' + 15471 '<div class="action">' + 15472 '<button class="btn-default">' + 15473 '<span class="buttonContainer">' + 15474 '<a class="xfpath" onclick="modalclick(\'' + item['xfpage'] + '\')">' + 15475 '<span class="buttonText">' + 15476 '<span>' + detailText + '</span>' + 15477 '<span>' + detailText + '</span>' + 15478 '</span>' + 15479 '</span>' + 15480 '</a>' + 15481 '</button>' + 15482 '<button class="btn-link">' + 15483 '<a target="_blank" href="https://www.google.com/maps/dir/?api=1&destination=' + item['lat'] + ',' + item['lng'] + '">' + 15484 '<i class="icon-ic-curve-arrow"></i>' + 15485 '<span>' + directionText + '</span>' + 15486 '</a>' + 15487 '</button>' + 15488 '</div>' 15489 "</div>" + 15490 "</div>" + 15491 "</div>"; 15492 if (infowindow) { 15493 infowindow.close(); 15494 } 15495 infowindow = new google.maps.InfoWindow({ 15496 content: contentString, 15497 }); 15498 15499 map.setCenter(pos); 15500 // map.setZoom(11) 15501 infowindow.open(map, item.marker); 15502 15503 setTimeout(() => { 15504 var heightButton = $('.mainDistrictMap .inner .districtmap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 15505 15506 if (heightButton > 120) { 15507 $(".mainDistrictMap .inner .districtmap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 15508 } else { 15509 $(".mainDistrictMap .inner .districtmap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 15510 } 15511 }, 50); 15512 15513 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 15514 $([document.documentElement, document.body]).animate({ 15515 scrollTop: $("#map").offset().top - 150 15516 }, 500); 15517 } 15518 15519} 15520 15521function displayServices(services) { 15522 services.forEach(function (service) { 15523 addServiceMarker(service); 15524 }); 15525} 15526 15527function addServiceMarker(service) { 15528 var icon = { 15529 url: service.image, 15530 scaledSize: new google.maps.Size(25, 25), 15531 origin: new google.maps.Point(0, 0), 15532 anchor: new google.maps.Point(0, 0) 15533 }; 15534 15535 var marker = new google.maps.Marker({ 15536 position: { lat: service.lat, lng: service.lng }, 15537 map: map, 15538 title: service.name, 15539 icon: icon, 15540 }); 15541 15542 service.marker = marker; 15543 serviceMarkers.push(marker); 15544 15545 marker.addListener('click', function () { 15546 showServiceInfo(service); 15547 }); 15548 15549 marker.addListener('mouseover', function () { 15550 showServiceInfo(service); 15551 }); 15552 15553 marker.addListener('mouseout', function () { 15554 if (infowindow) { 15555 infowindow.close(); 15556 } 15557 }); 15558} 15559 15560function showServiceInfo(service) { 15561 var contentString = 15562 '<div class="boxServiceMap">' + 15563 '<div class="boxContent">' + 15564 '<p class="descText">' + service.name + '</p>' + 15565 '<p class="sub">' + service.description + '</p>' + 15566 '<p class="sub">'+ service.time + '</p>' + 15567 '</div>' + 15568 '</div>'; 15569 15570 if (infowindow) { 15571 infowindow.close(); 15572 } 15573 infowindow = new google.maps.InfoWindow({ 15574 content: contentString 15575 }); 15576 15577 infowindow.open(map, service.marker); 15578} 15579 15580 15581 15582function filterdistrictAPIResponse(apiResponse, planttype, plantorigin, searchvalue) { 15583 15584 let filteredData = apiResponse; 15585 15586 if (searchvalue) { 15587 filteredData = apiResponse.filter(plant => { 15588 return plant.name.toLowerCase().includes(searchvalue.toLowerCase()); 15589 }); 15590 } 15591 15592 // Primary filter for planttype 15593 if (planttype !== null && planttype !== "All") { 15594 filteredData = _.filter(filteredData, item => Array.isArray(item.tags) && item.tags.includes(planttype)); 15595 } 15596 15597 // Secondary filter for plantorigin 15598 if (plantorigin !== null && plantorigin !== "All") { 15599 filteredData = _.filter(filteredData, item => Array.isArray(item.tags) && item.tags.includes(plantorigin)); 15600 } 15601 15602 if (filteredData.length == 0) { 15603 toggleLoopClass(document.querySelector('.boxNotFound'), 'hidden', false); 15604 toggleLoopClass(document.querySelector('.inner.pmap'), 'hidden', true); 15605 return; 15606 } 15607 toggleLoopClass(document.querySelector('.boxNotFound'), 'hidden', true); 15608 toggleLoopClass(document.querySelector('.inner.pmap'), 'hidden', false); 15609 15610 return filteredData; 15611} 15612 15613function toggleLoopClass(element, className, shouldAdd) { 15614 if (element) { 15615 element.classList.toggle(className, shouldAdd); 15616 } 15617} 15618 15619function extractUniqueTags() {
15620 // Parse the subtagFilters and newsDetails from the API response 15621 const subtagFilters = subplacefilter; 15622 15623 15624 // Initialize a Set to store unique tags 15625 const uniqueTags = new Set(); 15626 15627 subtagFilters.forEach(tag => uniqueTags.add(tag)); 15628 15629 // Iterate through newsDetails and add tags to the Set 15630 apiResponse.forEach(item => { 15631 if (item.tags && Array.isArray(item.tags)) { 15632 item.tags.forEach(tag => uniqueTags.add(tag)); 15633 } 15634 }); 15635 // Convert the Set to an array and sort it 15636 const sortedTags = Array.from(uniqueTags).sort(); 15637 generateFistDivs(sortedTags, 'tags', 'planttypee'); 15638} 15639 15640 15641function generateFistDivs(apiRes, property, parentId) { 15642 // Extract unique tags across all items 15643 const uniqueValues = apiRes; 15644 15645 // Create an array to store div elements 15646 const divs = []; 15647 15648 // Create div elements for each unique tag 15649 uniqueValues.forEach((value, index) => { 15650 const div = document.createElement('div'); 15651 div.classList.add('item'); 15652 div.setAttribute('data-text', value); 15653 div.setAttribute('data-option-value', value); 15654 div.setAttribute('data-index', index + 1); // Adding 1 to make index 1-based 15655 div.textContent = value; 15656 divs.push(div); 15657 }); 15658 15659 // Append the generated divs to the specified parent element 15660 const parentElement = document.getElementById(parentId); 15661 if (parentElement) { 15662 divs.forEach(div => { 15663 parentElement.appendChild(div); 15664 }); 15665 } else { 15666 console.error(`Parent element with ID ${parentId} not found.`); 15667 } 15668 15669 return divs; 15670} 15671 15672 15673function adddistrictevent() { 15674 document.querySelector('.custom-drop__opt').addEventListener('click', updateContentDistrictMap); 15675 document.querySelector('.custom-drop__opt-month').addEventListener('click', updateContentDistrictSUBMap); 15676} 15677 15678function updateContentDistrictSUBMap(){ 15679 15680 const filterValue = document.querySelector(' .custom-drop__opt .item.active').getAttribute('data-option-value') 15681 // const searchvalue = document.getElementById('searchtermmap').value; 15682 const filtersubValue = document.querySelector(' .custom-drop__opt-month .item.active').getAttribute('data-option-value') 15683 $('#searchtermmap').val(''); 15684 15685 NewResponse = filterdistrictAPIResponse(apiResponse, filterValue, filtersubValue, ''); 15686 currentIndex = 0; // Reset pagination 15687 displayDistrictPlants(NewResponse); 15688} 15689 15690function updateItemClasses(parentId) { 15691 // Get the parent div by its ID 15692 const parentDiv = document.getElementById(parentId); 15693 15694 // Check if the parent div exists 15695 if (!parentDiv) { 15696 console.error(`Parent div with ID "${parentId}" not found.`); 15697 return; 15698 } 15699 15700 // Get all child divs with the class 'item' 15701 const items = parentDiv.querySelectorAll('.item'); 15702 15703 // Check if there are items 15704 if (items.length > 0) { 15705 // Add 'active' and 'selected' classes to the first child 15706 items[0].classList.add('active', 'selected'); 15707 15708 // Remove 'active' and 'selected' classes from all other children 15709 for (let i = 1; i < items.length; i++) { 15710 items[i].classList.remove('active', 'selected'); 15711 } 15712 } 15713} 15714 15715 15716// Function to capture dropdown values and call reRenderPageContentPlant 15717function updateContentDistrictMap() { 15718 const filterValue = document.querySelector(' .custom-drop__opt .item.active').getAttribute('data-option-value') 15719 15720 $('#searchtermmap').val(''); 15721 15722 if(subFilters !=null){ 15723 if(searchKeyword(subFilters, filterValue)){ 15724 var subvalues= getChildByKeyword(subFilters, filterValue); 15725 if(subvalues != null){ 15726 updateHtml('plantorigin', subvalues); 15727 $('.boxFilter .filterMonths .text').text(subplaceholder); 15728 $('#secondArtFilter').removeClass('d-none'); 15729 NewResponse = filterdistrictAPIResponse(apiResponse, filterValue, "All", ""); 15730 } 15731 } else{ 15732 $('#secondArtFilter').addClass('d-none'); 15733 } 15734 } 15735 15736 NewResponse = filterdistrictAPIResponse(apiResponse, filterValue, "All", ""); 15737 currentIndex = 0; // Reset pagination 15738 displayDistrictPlants(NewResponse); 15739} 15740 15741function getChildByKeyword(data, keyword) { 15742 if (data.hasOwnProperty(keyword)) { 15743 return data[keyword]; 15744 } else { 15745 return null; 15746 } 15747} 15748 15749function searchKeyword(data, keyword) { 15750 // Check if the keyword exists in the data object 15751 return data.hasOwnProperty(keyword); 15752} 15753 15754function updateHtml(targetId, data) { 15755 // Get the target element by its ID 15756 const targetElement = document.getElementById(targetId); 15757 if (!targetElement) { 15758 console.error(`Element with ID ${targetId} not found.`); 15759 return; 15760 } 15761 15762 // Clear the existing HTML content of the target element 15763 targetElement.innerHTML = ''; 15764 15765 // Create a document fragment 15766 const fragment = document.createDocumentFragment(); 15767 15768 // Add the "All" option as the first item 15769 const allLoopsDiv = document.createElement('div'); 15770 allLoopsDiv.className = 'item'; 15771 allLoopsDiv.dataset.optionValue = 'All'; 15772 allLoopsDiv.dataset.text = subplaceholder; 15773 allLoopsDiv.dataset.index = 0; // Set data-index to 0 for the first option 15774 allLoopsDiv.textContent = subplaceholder; 15775 fragment.appendChild(allLoopsDiv); 15776 15777 // Iterate over the data to generate the other HTML options 15778 data.forEach((item, index) => { 15779 // Create a new div element for each item 15780 const div = document.createElement('div'); 15781 div.className = 'item'; 15782 div.dataset.optionValue = item; // Set data-option-value 15783 div.dataset.text = item; // Set data-text 15784 div.dataset.index = index + 1; // Set data-index starting from 1 after "All" 15785 div.textContent = item; // Set the text content of the div 15786 15787 // Append the new div to the document fragment 15788 fragment.appendChild(div); 15789 }); 15790 15791 // Append the fragment to the target element in one go 15792 targetElement.appendChild(fragment); 15793} 15794 15795 15796const initPageDistrictMap = (url) => { 15797 const reqUrl = `${url}` 15798 15799 axios.get(reqUrl).then((res) => {
15800 apiResponse = JSON.parse(res.data.newsDetails); 15801 apiServices = JSON.parse(res.data.servicees); 15802 subFilters = JSON.parse(res.data.subFilters); 15803 detailtranslation = res.data.detailText; 15804 directiontranslation = res.data.directionText; 15805 subplaceholder = res.data.subtranslation; 15806 subplacefilter = JSON.parse(res.data.subtagFilters); 15807 15808 initDistrictMap(); 15809 displayDistrictPlants(); 15810 if (apiResponse) { 15811 moveDistrictMap(0); 15812 } 15813 15814 extractUniqueTags(); 15815 adddistrictevent(); 15816 $(".mainDistrictMap .listItem .item:first").addClass("active"); 15817 toggleServiceMarkers(); 15818 setTimeout(() => { 15819 var heightButton = $('.mainDistrictMap .inner .districtmap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 15820 15821 if (heightButton > 120) { 15822 $(".mainDistrictMap .inner .districtmap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 15823 } else { 15824 $(".mainDistrictMap .inner .districtmap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 15825 } 15826 }, 400); 15827 15828 $(".mainDistrictMap .listItem").on("click", ".item", function () { 15829 $(".mainDistrictMap .listItem .item").removeClass("active"); 15830 $(this).addClass("active"); 15831 }); 15832 15833 $('.mainDistrictMap .viewMore .btn-default').on('click', function () { 15834 15835 displayDistrictPlants(NewResponse.length > 0 ? NewResponse : undefined, true); 15836 // updateContentDistrictMap(); 15837 15838 // displayPlants(); 15839 if (currentIndex > itemsPerPage) { 15840 moveDistrictMap(currentIndex - itemsPerPage); 15841 $(".mainDistrictMap .listItem .item").removeClass("active"); 15842 $(".mainDistrictMap .listItem .item").eq(currentIndex - itemsPerPage).addClass("active"); 15843 var scrollableDiv = $('.mainDistrictMap .listItem'); 15844 var activeItem = $('.mainDistrictMap .listItem .item.active'); 15845 if (activeItem.length) { 15846 scrollableDiv.animate({ 15847 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 15848 }, 500); 15849 } 15850 } 15851 var plants = apiResponse 15852 if (currentIndex >= plants.length) { 15853 $('.mainDistrictMap .viewMore').hide(); 15854 } 15855 }); 15856 }) 15857} 15858 15859 15860const __initContentListingDistrictMap = () => { 15861 var plantmapMarkerValue = document.querySelector('.districtmap .mainDistrictMap .boxFilter').getAttribute('data-mapmarker'); 15862 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 15863 15864 var current_page = window.location.href; 15865 15866 var current_page_split = current_page.split(".html"); 15867 15868 _.forEach(dataContentRenderingContainer, (contentRender) => { 15869 15870 if (contentRender.dataset.contentRender === 'page') { 15871 15872 var pagetype = getPageTypeInSection(); 15873 15874 initPageDistrictMap(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 15875 15876 // initPageDistrictMap('https://xieranmaya.github.io/images/cats/cats.json') 15877 } 15878 }) 15879}; 15880 15881 15882function modalclick(url){ 15883 if(url) { 15884 $.get(url, function (data) { 15885 var modalElem = $('.ui.modal.modalDiningDetail') 15886 modalElem.addClass('bgThemeWhite'); 15887 modalElem.html(data); 15888 modalElem.modal('show'); 15889 }); 15890 } 15891} 15892 15893$(document).on("click", ".btn-close-modal", function () { 15894 var modalElem = $('.ui.modal.modalDiningDetail'); 15895 modalElem.modal('hide'); 15896}); 15897 15898(function () { 15899 let stateCheck = setInterval(() => { 15900 if (document.readyState === 'complete' && getPageTypeInSection() == "districtmap") { 15901 clearInterval(stateCheck) 15902 __initContentListingDistrictMap() 15903 console.log('District Map script imported') 15904 } 15905 }, 100) 15906})() 15907 15908 15909 15910 15911$(document).ready(function () { 15912 var sectionmainHighlightSec = document.getElementsByClassName('mainHighlightSec'); 15913 if (sectionmainHighlightSec && sectionmainHighlightSec.length > 0) { 15914 fixSpaceMainHighlightSec(); 15915 initializeHighlightSwiper(); 15916 } 15917}); 15918 15919$(window).on("load resize", function () { 15920 fixSpaceMainHighlightSec(); 15921}); 15922
15923$(".mainHighlightSec .highlightSlide .slideItem").click(function () { 15924 var url = $(this).data("path"); 15925 if(url){ 15926 $.get( url, function( data ) { 15927 var modalElem = $('.ui.modal.modalHighlightDetail') 15928 modalElem.addClass('bgThemeWhite'); 15929 modalElem.html(data); 15930 setTimeout(function(){ 15931 modalElem.modal('show'); 15932 }, 500); 15933 }); 15934 }else{ 15935 $(this).attr('disabled', true); 15936 } 15937}); 15938 $(document).on("click",".btn-close-modal",function(){ 15939 var modalElem = $('.ui.modal.modalHighlightDetail'); 15940 modalElem.modal('hide'); 15941 }); 15942 15943function fixSpaceMainHighlightSec() { 15944 15945 $(".mainHighlightSec .highlightSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 15946 $(".mainHighlightSec .highlightSwiper").css("padding-right", $(".container.custom-container").offset().left + 15
15946); 15947 $(".mainHighlightSec .highlightSwiper .spaceLeft").css("width", $(".container.custom-container").offset().left + 15); 15948 $(".mainHighlightSec .highlightSwiper .spaceRight").css("width", $(".container.custom-container").offset().left + 15); 15949 $(".mainHighlightSec .highlightSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - 75); 15950 $(".mainHighlightSec .highlightSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - 75); 15951 15952 var offsetContainer = $(".container.custom-container").offset().left; 15953 15954 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 15955 var arrowPo1 = 75; 15956 var arrowPo2 = 10; 15957 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 15958 var arrowPo1 = 65; 15959 var arrowPo2 = 5; 15960 } 15961 15962 if (offsetContainer < 85) { 15963 $(".mainHighlightSec .highlightSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo2); 15964 $(".mainHighlightSec .highlightSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo2); 15965 } else { 15966 $(".mainHighlightSec .highlightSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo1); 15967 $(".mainHighlightSec .highlightSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo1); 15968 } 15969 15970} 15971 15972 15973function initializeHighlightSwiper() { 15974 const swipers = document.querySelectorAll('.highlightSwiper'); 15975 swipers.forEach(swiper => { 15976 new Swiper(swiper, { 15977 slidesPerView: 4, 15978 resizeObserver:!($("body").data('custom-mode') == "edit"), 15979 spaceBetween: 20, 15980 slidesPerGroup: 4, 15981 speed: 700, 15982 navigation: { 15983 nextEl: ".swiper-button-next", 15984 prevEl: ".swiper-button-prev", 15985 }, 15986 pagination: { 15987 el: ".swiper-pagination", 15988 clickable: true, 15989 type: "bullets", 15990 }, 15991 breakpoints: { 15992 1200: { 15993 slidesPerView: 4, 15994 spaceBetween: 20, 15995 slidesPerGroup: 4, 15996 centeredSlides: false, 15997 pagination: { 15998 el: ".swiper-pagination", 15999 clickable: true, 16000 type: "bullets", 16001 }, 16002 }, 16003 992: { 16004 slidesPerView: 3, 16005 spaceBetween: 20, 16006 slidesPerGroup: 3, 16007 centeredSlides: false, 16008 pagination: { 16009 el: ".swiper-pagination", 16010 clickable: true, 16011 type: "bullets", 16012 }, 16013 }, 16014 768: { 16015 slidesPerView: 2, 16016 spaceBetween: 20, 16017 slidesPerGroup: 2, 16018 centeredSlides: false, 16019 pagination: { 16020 el: ".swiper-pagination", 16021 clickable: true, 16022 type: "bullets", 16023 }, 16024 }, 16025 540: { 16026 slidesPerView: 1.8, 16027 spaceBetween: 10, 16028 centeredSlides: true, 16029 slidesPerGroup: 1, 16030 pagination: { 16031 el: '.swiper-pagination', 16032 type: "fraction", 16033 }, 16034 }, 16035 250: { 16036 slidesPerView: 1.1, 16037 spaceBetween: 10, 16038 centeredSlides: true, 16039 slidesPerGroup: 1, 16040 pagination: { 16041 el: '.swiper-pagination', 16042 type: "fraction", 16043 }, 16044 } 16045 } 16046 }); 16047 }); 16048} 16049/**! 16050 16051 @license 16052 handlebars v4.7.8 16053 16054Copyright (C) 2011-2019 by Yehuda Katz 16055 16056Permission is hereby granted, free of charge, to any person obtaining a copy 16057of this software and associated documentation files (the "Software"), to deal 16058in the Software without restriction, including without limitation the rights 16059to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16060copies of the Software, and to permit persons to whom the Software is 16061furnished to do so, subject to the following conditions: 16062 16063The above copyright notice and this permission notice shall be included in 16064all copies or substantial portions of the Software. 16065 16066THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16067IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16068FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16069AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16070LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16071OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 16072THE SOFTWARE. 16073 16074*/ 16075(function webpackUniversalModuleDefinition(root, factory) { 16076 if(typeof exports === 'object' && typeof module === 'object') 16077 module.exports = factory(); 16078 else if(typeof define === 'function' && define.amd) 16079 define([], factory); 16080 else if(typeof exports === 'object') 16081 exports["Handlebars"] = factory(); 16082 else 16083 root["Handlebars"] = factory(); 16084})(this, function() { 16085return /******/ (function(modules) { // webpackBootstrap 16086/******/ // The module cache 16087/******/ var installedModules = {}; 16088 16089/******/ // The require function 16090/******/ function __webpack_require__(moduleId) { 16091 16092/******/ // Check if module is in cache 16093/******/ if(installedModules[moduleId]) 16094/******/ return installedModules[moduleId].exports; 16095 16096/******/ // Create a new module (and put it into the cache) 16097/******/ var module = installedModules[moduleId] = { 16098/******/ exports: {}, 16099/******/ id: moduleId, 16100/******/ loaded: false 16101/******/ }; 16102 16103/******/ // Execute the module function 16104/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 16105 16106/******/ // Flag the module as loaded
vendor: 15,937 bytes, lines 16107-16706
16107/******/ module.loaded = true; 16108 16109/******/ // Return the exports of the module 16110/******/ return module.exports; 16111/******/ } 16112 16113 16114/******/ // expose the modules object (__webpack_modules__) 16115/******/ __webpack_require__.m = modules; 16116 16117/******/ // expose the module cache 16118/******/ __webpack_require__.c = installedModules; 16119 16120/******/ // __webpack_public_path__ 16121/******/ __webpack_require__.p = ""; 16122 16123/******/ // Load entry module and return exports 16124/******/ return __webpack_require__(0); 16125/******/ }) 16126/************************************************************************/ 16127/******/ ([ 16128/* 0 */ 16129/***/ (function(module, exports, __webpack_require__) { 16130 16131 'use strict'; 16132 16133 var _interopRequireDefault = __webpack_require__(1)['default']; 16134 16135 exports.__esModule = true; 16136 16137 var _handlebarsRuntime = __webpack_require__(2); 16138 16139 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 16140 16141 // Compiler imports 16142 16143 var _handlebarsCompilerAst = __webpack_require__(84); 16144 16145 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 16146 16147 var _handlebarsCompilerBase = __webpack_require__(85); 16148 16149 var _handlebarsCompilerCompiler = __webpack_require__(90); 16150 16151 var _handlebarsCompilerJavascriptCompiler = __webpack_require__(91); 16152 16153 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 16154 16155 var _handlebarsCompilerVisitor = __webpack_require__(88); 16156 16157 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 16158 16159 var _handlebarsNoConflict = __webpack_require__(83); 16160 16161 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 16162 16163 var _create = _handlebarsRuntime2['default'].create; 16164 function create() { 16165 var hb = _create(); 16166 16167 hb.compile = function (input, options) { 16168 return _handlebarsCompilerCompiler.compile(input, options, hb); 16169 }; 16170 hb.precompile = function (input, options) { 16171 return _handlebarsCompilerCompiler.precompile(input, options, hb); 16172 }; 16173 16174 hb.AST = _handlebarsCompilerAst2['default']; 16175 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 16176 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 16177 hb.Parser = _handlebarsCompilerBase.parser; 16178 hb.parse = _handlebarsCompilerBase.parse; 16179 hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; 16180 16181 return hb; 16182 } 16183 16184 var inst = create(); 16185 inst.create = create; 16186 16187 _handlebarsNoConflict2['default'](inst); 16188 16189 inst.Visitor = _handlebarsCompilerVisitor2['default']; 16190 16191 inst['default'] = inst; 16192 16193 exports['default'] = inst; 16194 module.exports = exports['default']; 16195 16196/***/ }), 16197/* 1 */ 16198/***/ (function(module, exports) { 16199 16200 "use strict"; 16201 16202 exports["default"] = function (obj) { 16203 return obj && obj.__esModule ? obj : { 16204 "default": obj 16205 }; 16206 }; 16207 16208 exports.__esModule = true; 16209 16210/***/ }), 16211/* 2 */ 16212/***/ (function(module, exports, __webpack_require__) { 16213 16214 'use strict'; 16215 16216 var _interopRequireWildcard = __webpack_require__(3)['default']; 16217 16218 var _interopRequireDefault = __webpack_require__(1)['default']; 16219 16220 exports.__esModule = true; 16221 16222 var _handlebarsBase = __webpack_require__(4); 16223 16224 var base = _interopRequireWildcard(_handlebarsBase); 16225 16226 // Each of these augment the Handlebars object. No need to setup here. 16227 // (This is done to easily share code between commonjs and browse envs) 16228 16229 var _handlebarsSafeString = __webpack_require__(77); 16230 16231 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 16232 16233 var _handlebarsException = __webpack_require__(6); 16234 16235 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 16236 16237 var _handlebarsUtils = __webpack_require__(5); 16238 16239 var Utils = _interopRequireWildcard(_handlebarsUtils); 16240 16241 var _handlebarsRuntime = __webpack_require__(78); 16242 16243 var runtime = _interopRequireWildcard(_handlebarsRuntime); 16244 16245 var _handlebarsNoConflict = __webpack_require__(83); 16246 16247 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 16248 16249 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 16250 function create() { 16251 var hb = new base.HandlebarsEnvironment(); 16252 16253 Utils.extend(hb, base); 16254 hb.SafeString = _handlebarsSafeString2['default']; 16255 hb.Exception = _handlebarsException2['default']; 16256 hb.Utils = Utils; 16257 hb.escapeExpression = Utils.escapeExpression; 16258 16259 hb.VM = runtime; 16260 hb.template = function (spec) { 16261 return runtime.template(spec, hb); 16262 }; 16263 16264 return hb; 16265 } 16266 16267 var inst = create(); 16268 inst.create = create; 16269 16270 _handlebarsNoConflict2['default'](inst); 16271 16272 inst['default'] = inst; 16273 16274 exports['default'] = inst; 16275 module.exports = exports['default']; 16276 16277/***/ }), 16278/* 3 */ 16279/***/ (function(module, exports) { 16280 16281 "use strict"; 16282 16283 exports["default"] = function (obj) { 16284 if (obj && obj.__esModule) { 16285 return obj; 16286 } else { 16287 var newObj = {}; 16288 16289 if (obj != null) { 16290 for (var key in obj) { 16291 if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; 16292 } 16293 } 16294 16295 newObj["default"] = obj; 16296 return newObj; 16297 } 16298 }; 16299 16300 exports.__esModule = true; 16301 16302/***/ }), 16303/* 4 */ 16304/***/ (function(module, exports, __webpack_require__) { 16305 16306 'use strict'; 16307 16308 var _interopRequireDefault = __webpack_require__(1)['default']; 16309 16310 exports.__esModule = true; 16311 exports.HandlebarsEnvironment = HandlebarsEnvironment; 16312 16313 var _utils = __webpack_require__(5); 16314 16315 var _exception = __webpack_require__(6); 16316 16317 var _exception2 = _interopRequireDefault(_exception); 16318 16319 var _helpers = __webpack_require__(10); 16320 16321 var _decorators = __webpack_require__(70); 16322 16323 var _logger = __webpack_require__(72); 16324 16325 var _logger2 = _interopRequireDefault(_logger); 16326 16327 var _internalProtoAccess = __webpack_require__(73); 16328 16329 var VERSION = '4.7.8'; 16330 exports.VERSION = VERSION; 16331 var COMPILER_REVISION = 8; 16332 exports.COMPILER_REVISION = COMPILER_REVISION; 16333 var LAST_COMPATIBLE_COMPILER_REVISION = 7; 16334 16335 exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; 16336 var REVISION_CHANGES = { 16337 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 16338 2: '== 1.0.0-rc.3', 16339 3: '== 1.0.0-rc.4', 16340 4: '== 1.x.x', 16341 5: '== 2.0.0-alpha.x', 16342 6: '>= 2.0.0-beta.1', 16343 7: '>= 4.0.0 <4.3.0', 16344 8: '>= 4.3.0' 16345 }; 16346 16347 exports.REVISION_CHANGES = REVISION_CHANGES; 16348 var objectType = '[object Object]'; 16349 16350 function HandlebarsEnvironment(helpers, partials, decorators) { 16351 this.helpers = helpers || {}; 16352 this.partials = partials || {}; 16353 this.decorators = decorators || {}; 16354 16355 _helpers.registerDefaultHelpers(this); 16356 _decorators.registerDefaultDecorators(this); 16357 } 16358 16359 HandlebarsEnvironment.prototype = { 16360 constructor: HandlebarsEnvironment, 16361 16362 logger: _logger2['default'], 16363 log: _logger2['default'].log, 16364 16365 registerHelper: function registerHelper(name, fn) { 16366 if (_utils.toString.call(name) === objectType) { 16367 if (fn) { 16368 throw new _exception2['default']('Arg not supported with multiple helpers'); 16369 } 16370 _utils.extend(this.helpers, name); 16371 } else { 16372 this.helpers[name] = fn; 16373 } 16374 }, 16375 unregisterHelper: function unregisterHelper(name) { 16376 delete this.helpers[name]; 16377 }, 16378 16379 registerPartial: function registerPartial(name, partial) { 16380 if (_utils.toString.call(name) === objectType) { 16381 _utils.extend(this.partials, name); 16382 } else { 16383 if (typeof partial === 'undefined') { 16384 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 16385 } 16386 this.partials[name] = partial; 16387 } 16388 }, 16389 unregisterPartial: function unregisterPartial(name) { 16390 delete this.partials[name]; 16391 }, 16392 16393 registerDecorator: function registerDecorator(name, fn) { 16394 if (_utils.toString.call(name) === objectType) { 16395 if (fn) { 16396 throw new _exception2['default']('Arg not supported with multiple decorators'); 16397 } 16398 _utils.extend(this.decorators, name); 16399 } else { 16400 this.decorators[name] = fn; 16401 } 16402 }, 16403 unregisterDecorator: function unregisterDecorator(name) { 16404 delete this.decorators[name]; 16405 }, 16406 /** 16407 * Reset the memory of illegal property accesses that have already been logged. 16408 * @deprecated should only be used in handlebars test-cases 16409 */ 16410 resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { 16411 _internalProtoAccess.resetLoggedProperties(); 16412 } 16413 }; 16414 16415 var log = _logger2['default'].log; 16416 16417 exports.log = log; 16418 exports.createFrame = _utils.createFrame; 16419 exports.logger = _logger2['default']; 16420 16421/***/ }), 16422/* 5 */ 16423/***/ (function(module, exports) { 16424 16425 'use strict'; 16426 16427 exports.__esModule = true; 16428 exports.extend = extend; 16429 exports.indexOf = indexOf; 16430 exports.escapeExpression = escapeExpression; 16431 exports.isEmpty = isEmpty; 16432 exports.createFrame = createFrame; 16433 exports.blockParams = blockParams; 16434 exports.appendContextPath = appendContextPath; 16435 var escape = { 16436 '&': '&', 16437 '<': '<', 16438 '>': '>', 16439 '"': '"', 16440 "'": ''', 16441 '`': '`', 16442 '=': '=' 16443 }; 16444 16445 var badChars = /[&<>"'`=]/g, 16446 possible = /[&<>"'`=]/; 16447 16448 function escapeChar(chr) { 16449 return escape[chr]; 16450 } 16451 16452 function extend(obj /* , ...source */) { 16453 for (var i = 1; i < arguments.length; i++) { 16454 for (var key in arguments[i]) { 16455 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 16456 obj[key] = arguments[i][key]; 16457 } 16458 } 16459 } 16460 16461 return obj; 16462 } 16463 16464 var toString = Object.prototype.toString; 16465 16466 exports.toString = toString; 16467 // Sourced from lodash 16468 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 16469 /* eslint-disable func-style */ 16470 var isFunction = function isFunction(value) { 16471 return typeof value === 'function'; 16472 }; 16473 // fallback for older versions of Chrome and Safari 16474 /* istanbul ignore next */ 16475 if (isFunction(/x/)) { 16476 exports.isFunction = isFunction = function (value) { 16477 return typeof value === 'function' && toString.call(value) === '[object Function]'; 16478 }; 16479 } 16480 exports.isFunction = isFunction; 16481 16482 /* eslint-enable func-style */ 16483 16484 /* istanbul ignore next */ 16485 var isArray = Array.isArray || function (value) { 16486 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 16487 }; 16488 16489 exports.isArray = isArray; 16490 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 16491 16492 function indexOf(array, value) { 16493 for (var i = 0, len = array.length; i < len; i++) { 16494 if (array[i] === value) { 16495 return i; 16496 } 16497 } 16498 return -1; 16499 } 16500 16501 function escapeExpression(string) { 16502 if (typeof string !== 'string') { 16503 // don't escape SafeStrings, since they're already safe 16504 if (string && string.toHTML) { 16505 return string.toHTML(); 16506 } else if (string == null) { 16507 return ''; 16508 } else if (!string) { 16509 return string + ''; 16510 } 16511 16512 // Force a string conversion as this will be done by the append regardless and 16513 // the regex test will do this transparently behind the scenes, causing issues if 16514 // an object's to string has escaped characters in it. 16515 string = '' + string; 16516 } 16517 16518 if (!possible.test(string)) { 16519 return string; 16520 } 16521 return string.replace(badChars, escapeChar); 16522 } 16523 16524 function isEmpty(value) { 16525 if (!value && value !== 0) { 16526 return true; 16527 } else if (isArray(value) && value.length === 0) { 16528 return true; 16529 } else { 16530 return false; 16531 } 16532 } 16533 16534 function createFrame(object) { 16535 var frame = extend({}, object); 16536 frame._parent = object; 16537 return frame; 16538 } 16539 16540 function blockParams(params, ids) { 16541 params.path = ids; 16542 return params; 16543 } 16544 16545 function appendContextPath(contextPath, id) { 16546 return (contextPath ? contextPath + '.' : '') + id; 16547 } 16548 16549/***/ }), 16550/* 6 */ 16551/***/ (function(module, exports, __webpack_require__) { 16552 16553 'use strict'; 16554 16555 var _Object$defineProperty = __webpack_require__(7)['default']; 16556 16557 exports.__esModule = true; 16558 var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; 16559 16560 function Exception(message, node) { 16561 var loc = node && node.loc, 16562 line = undefined, 16563 endLineNumber = undefined, 16564 column = undefined, 16565 endColumn = undefined; 16566 16567 if (loc) { 16568 line = loc.start.line; 16569 endLineNumber = loc.end.line; 16570 column = loc.start.column; 16571 endColumn = loc.end.column; 16572 16573 message += ' - ' + line + ':' + column; 16574 } 16575 16576 var tmp = Error.prototype.constructor.call(this, message); 16577 16578 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 16579 for (var idx = 0; idx < errorProps.length; idx++) { 16580 this[errorProps[idx]] = tmp[errorProps[idx]]; 16581 } 16582 16583 /* istanbul ignore else */ 16584 if (Error.captureStackTrace) { 16585 Error.captureStackTrace(this, Exception); 16586 } 16587 16588 try { 16589 if (loc) { 16590 this.lineNumber = line; 16591 this.endLineNumber = endLineNumber; 16592 16593 // Work around issue under safari where we can't directly set the column value 16594 /* istanbul ignore next */ 16595 if (_Object$defineProperty) { 16596 Object.defineProperty(this, 'column', { 16597 value: column, 16598 enumerable: true 16599 }); 16600 Object.defineProperty(this, 'endColumn', { 16601 value: endColumn, 16602 enumerable: true 16603 }); 16604 } else { 16605 this.column = column; 16606 this.endColumn = endColumn; 16607 } 16608 } 16609 } catch (nop) { 16610 /* Ignore if the browser is very particular */ 16611 } 16612 } 16613 16614 Exception.prototype = new Error(); 16615 16616 exports['default'] = Exception; 16617 module.exports = exports['default']; 16618 16619/***/ }), 16620/* 7 */ 16621/***/ (function(module, exports, __webpack_require__) { 16622 16623 module.exports = { "default": __webpack_require__(8), __esModule: true }; 16624 16625/***/ }), 16626/* 8 */ 16627/***/ (function(module, exports, __webpack_require__) { 16628 16629 var $ = __webpack_require__(9); 16630 module.exports = function defineProperty(it, key, desc){ 16631 return $.setDesc(it, key, desc); 16632 }; 16633 16634/***/ }), 16635/* 9 */ 16636/***/ (function(module, exports) { 16637 16638 var $Object = Object; 16639 module.exports = { 16640 create: $Object.create, 16641 getProto: $Object.getPrototypeOf, 16642 isEnum: {}.propertyIsEnumerable, 16643 getDesc: $Object.getOwnPropertyDescriptor, 16644 setDesc: $Object.defineProperty, 16645 setDescs: $Object.defineProperties, 16646 getKeys: $Object.keys, 16647 getNames: $Object.getOwnPropertyNames, 16648 getSymbols: $Object.getOwnPropertySymbols, 16649 each: [].forEach 16650 }; 16651 16652/***/ }), 16653/* 10 */ 16654/***/ (function(module, exports, __webpack_require__) { 16655 16656 'use strict'; 16657 16658 var _interopRequireDefault = __webpack_require__(1)['default']; 16659 16660 exports.__esModule = true; 16661 exports.registerDefaultHelpers = registerDefaultHelpers; 16662 exports.moveHelperToHooks = moveHelperToHooks; 16663 16664 var _helpersBlockHelperMissing = __webpack_require__(11); 16665 16666 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 16667 16668 var _helpersEach = __webpack_require__(12); 16669 16670 var _helpersEach2 = _interopRequireDefault(_helpersEach); 16671 16672 var _helpersHelperMissing = __webpack_require__(65); 16673 16674 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 16675 16676 var _helpersIf = __webpack_require__(66); 16677 16678 var _helpersIf2 = _interopRequireDefault(_helpersIf); 16679 16680 var _helpersLog = __webpack_require__(67); 16681 16682 var _helpersLog2 = _interopRequireDefault(_helpersLog); 16683 16684 var _helpersLookup = __webpack_require__(68); 16685 16686 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 16687 16688 var _helpersWith = __webpack_require__(69); 16689 16690 var _helpersWith2 = _interopRequireDefault(_helpersWith); 16691 16692 function registerDefaultHelpers(instance) { 16693 _helpersBlockHelperMissing2['default'](instance); 16694 _helpersEach2['default'](instance); 16695 _helpersHelperMissing2['default'](instance); 16696 _helpersIf2['default'](instance); 16697 _helpersLog2['default'](instance); 16698 _helpersLookup2['default'](instance); 16699 _helpersWith2['default'](instance); 16700 } 16701 16702 function moveHelperToHooks(instance, helperName, keepHelper) { 16703 if (instance.helpers[helperName]) { 16704 instance.hooks[helperName] = instance.helpers[helperName]; 16705 if (!keepHelper) { 16706 delete instance.helpers[helperName]
vendor: 39,428 bytes, lines 16706-18092
16706; 16707 } 16708 } 16709 } 16710 16711/***/ }), 16712/* 11 */ 16713/***/ (function(module, exports, __webpack_require__) { 16714 16715 'use strict'; 16716 16717 exports.__esModule = true; 16718 16719 var _utils = __webpack_require__(5); 16720 16721 exports['default'] = function (instance) { 16722 instance.registerHelper('blockHelperMissing', function (context, options) { 16723 var inverse = options.inverse, 16724 fn = options.fn; 16725 16726 if (context === true) { 16727 return fn(this); 16728 } else if (context === false || context == null) { 16729 return inverse(this); 16730 } else if (_utils.isArray(context)) { 16731 if (context.length > 0) { 16732 if (options.ids) { 16733 options.ids = [options.name]; 16734 } 16735 16736 return instance.helpers.each(context, options); 16737 } else { 16738 return inverse(this); 16739 } 16740 } else { 16741 if (options.data && options.ids) { 16742 var data = _utils.createFrame(options.data); 16743 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 16744 options = { data: data }; 16745 } 16746 16747 return fn(context, options); 16748 } 16749 }); 16750 }; 16751 16752 module.exports = exports['default']; 16753 16754/***/ }), 16755/* 12 */ 16756/***/ (function(module, exports, __webpack_require__) { 16757 16758 'use strict'; 16759 16760 var _Symbol = __webpack_require__(13)['default']; 16761 16762 var _Symbol$iterator = __webpack_require__(43)['default']; 16763 16764 var _getIterator = __webpack_require__(55)['default']; 16765 16766 var _Object$keys = __webpack_require__(60)['default']; 16767 16768 var _interopRequireDefault = __webpack_require__(1)['default']; 16769 16770 exports.__esModule = true; 16771 16772 var _utils = __webpack_require__(5); 16773 16774 var _exception = __webpack_require__(6); 16775 16776 var _exception2 = _interopRequireDefault(_exception); 16777 16778 exports['default'] = function (instance) { 16779 instance.registerHelper('each', function (context, options) { 16780 if (!options) { 16781 throw new _exception2['default']('Must pass iterator to #each'); 16782 } 16783 16784 var fn = options.fn, 16785 inverse = options.inverse, 16786 i = 0, 16787 ret = '', 16788 data = undefined, 16789 contextPath = undefined; 16790 16791 if (options.data && options.ids) { 16792 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 16793 } 16794 16795 if (_utils.isFunction(context)) { 16796 context = context.call(this); 16797 } 16798 16799 if (options.data) { 16800 data = _utils.createFrame(options.data); 16801 } 16802 16803 function execIteration(field, index, last) { 16804 if (data) { 16805 data.key = field; 16806 data.index = index; 16807 data.first = index === 0; 16808 data.last = !!last; 16809 16810 if (contextPath) { 16811 data.contextPath = contextPath + field; 16812 } 16813 } 16814 16815 ret = ret + fn(context[field], { 16816 data: data, 16817 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 16818 }); 16819 } 16820 16821 if (context && typeof context === 'object') { 16822 if (_utils.isArray(context)) { 16823 for (var j = context.length; i < j; i++) { 16824 if (i in context) { 16825 execIteration(i, i, i === context.length - 1); 16826 } 16827 } 16828 } else if (typeof _Symbol === 'function' && context[_Symbol$iterator]) { 16829 var newContext = []; 16830 var iterator = _getIterator(context); 16831 for (var it = iterator.next(); !it.done; it = iterator.next()) { 16832 newContext.push(it.value); 16833 } 16834 context = newContext; 16835 for (var j = context.length; i < j; i++) { 16836 execIteration(i, i, i === context.length - 1); 16837 } 16838 } else { 16839 (function () { 16840 var priorKey = undefined; 16841 16842 _Object$keys(context).forEach(function (key) { 16843 // We're running the iterations one step out of sync so we can detect 16844 // the last iteration without have to scan the object twice and create 16845 // an itermediate keys array. 16846 if (priorKey !== undefined) { 16847 execIteration(priorKey, i - 1); 16848 } 16849 priorKey = key; 16850 i++; 16851 }); 16852 if (priorKey !== undefined) { 16853 execIteration(priorKey, i - 1, true); 16854 } 16855 })(); 16856 } 16857 } 16858 16859 if (i === 0) { 16860 ret = inverse(this); 16861 } 16862 16863 return ret; 16864 }); 16865 }; 16866 16867 module.exports = exports['default']; 16868 16869/***/ }), 16870/* 13 */ 16871/***/ (function(module, exports, __webpack_require__) { 16872 16873 module.exports = { "default": __webpack_require__(14), __esModule: true }; 16874 16875/***/ }), 16876/* 14 */ 16877/***/ (function(module, exports, __webpack_require__) { 16878 16879 __webpack_require__(15); 16880 __webpack_require__(42); 16881 module.exports = __webpack_require__(21).Symbol; 16882 16883/***/ }), 16884/* 15 */ 16885/***/ (function(module, exports, __webpack_require__) { 16886 16887 'use strict'; 16888 // ECMAScript 6 symbols shim 16889 var $ = __webpack_require__(9) 16890 , global = __webpack_require__(16) 16891 , has = __webpack_require__(17) 16892 , DESCRIPTORS = __webpack_require__(18) 16893 , $export = __webpack_require__(20) 16894 , redefine = __webpack_require__(24) 16895 , $fails = __webpack_require__(19) 16896 , shared = __webpack_require__(27) 16897 , setToStringTag = __webpack_require__(28) 16898 , uid = __webpack_require__(30) 16899 , wks = __webpack_require__(29) 16900 , keyOf = __webpack_require__(31) 16901 , $names = __webpack_require__(36) 16902 , enumKeys = __webpack_require__(37) 16903 , isArray = __webpack_require__(38) 16904 , anObject = __webpack_require__(39) 16905 , toIObject = __webpack_require__(32) 16906 , createDesc = __webpack_require__(26) 16907 , getDesc = $.getDesc 16908 , setDesc = $.setDesc 16909 , _create = $.create 16910 , getNames = $names.get 16911 , $Symbol = global.Symbol 16912 , $JSON = global.JSON 16913 , _stringify = $JSON && $JSON.stringify 16914 , setter = false 16915 , HIDDEN = wks('_hidden') 16916 , isEnum = $.isEnum 16917 , SymbolRegistry = shared('symbol-registry') 16918 , AllSymbols = shared('symbols') 16919 , useNative = typeof $Symbol == 'function' 16920 , ObjectProto = Object.prototype; 16921 16922 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 16923 var setSymbolDesc = DESCRIPTORS && $fails(function(){ 16924 return _create(setDesc({}, 'a', { 16925 get: function(){ return setDesc(this, 'a', {value: 7}).a; } 16926 })).a != 7; 16927 }) ? function(it, key, D){ 16928 var protoDesc = getDesc(ObjectProto, key); 16929 if(protoDesc)delete ObjectProto[key]; 16930 setDesc(it, key, D); 16931 if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc); 16932 } : setDesc; 16933 16934 var wrap = function(tag){ 16935 var sym = AllSymbols[tag] = _create($Symbol.prototype); 16936 sym._k = tag; 16937 DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, { 16938 configurable: true, 16939 set: function(value){ 16940 if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; 16941 setSymbolDesc(this, tag, createDesc(1, value)); 16942 } 16943 }); 16944 return sym; 16945 }; 16946 16947 var isSymbol = function(it){ 16948 return typeof it == 'symbol'; 16949 }; 16950 16951 var $defineProperty = function defineProperty(it, key, D){ 16952 if(D && has(AllSymbols, key)){ 16953 if(!D.enumerable){ 16954 if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {})); 16955 it[HIDDEN][key] = true; 16956 } else { 16957 if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; 16958 D = _create(D, {enumerable: createDesc(0, false)}); 16959 } return setSymbolDesc(it, key, D); 16960 } return setDesc(it, key, D); 16961 }; 16962 var $defineProperties = function defineProperties(it, P){ 16963 anObject(it); 16964 var keys = enumKeys(P = toIObject(P)) 16965 , i = 0 16966 , l = keys.length 16967 , key; 16968 while(l > i)$defineProperty(it, key = keys[i++], P[key]); 16969 return it; 16970 }; 16971 var $create = function create(it, P){ 16972 return P === undefined ? _create(it) : $defineProperties(_create(it), P); 16973 }; 16974 var $propertyIsEnumerable = function propertyIsEnumerable(key){ 16975 var E = isEnum.call(this, key); 16976 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] 16977 ? E : true; 16978 }; 16979 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ 16980 var D = getDesc(it = toIObject(it), key); 16981 if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; 16982 return D; 16983 }; 16984 var $getOwnPropertyNames = function getOwnPropertyNames(it){ 16985 var names = getNames(toIObject(it)) 16986 , result = [] 16987 , i = 0 16988 , key; 16989 while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key); 16990 return result; 16991 }; 16992 var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ 16993 var names = getNames(toIObject(it)) 16994 , result = [] 16995 , i = 0 16996 , key; 16997 while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]); 16998 return result; 16999 }; 17000 var $stringify = function stringify(it){ 17001 if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined 17002 var args = [it] 17003 , i = 1 17004 , $$ = arguments 17005 , replacer, $replacer; 17006 while($$.length > i)args.push($$[i++]); 17007 replacer = args[1]; 17008 if(typeof replacer == 'function')$replacer = replacer; 17009 if($replacer || !isArray(replacer))replacer = function(key, value){ 17010 if($replacer)value = $replacer.call(this, key, value); 17011 if(!isSymbol(value))return value; 17012 }; 17013 args[1] = replacer; 17014 return _stringify.apply($JSON, args); 17015 }; 17016 var buggyJSON = $fails(function(){ 17017 var S = $Symbol(); 17018 // MS Edge converts symbol values to JSON as {} 17019 // WebKit converts symbol values to JSON as null 17020 // V8 throws on boxed symbols 17021 return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; 17022 }); 17023 17024 // 19.4.1.1 Symbol([description]) 17025 if(!useNative){ 17026 $Symbol = function Symbol(){ 17027 if(isSymbol(this))throw TypeError('Symbol is not a constructor'); 17028 return wrap(uid(arguments.length > 0 ? arguments[0] : undefined)); 17029 }; 17030 redefine($Symbol.prototype, 'toString', function toString(){ 17031 return this._k; 17032 }); 17033 17034 isSymbol = function(it){ 17035 return it instanceof $Symbol; 17036 }; 17037 17038 $.create = $create; 17039 $.isEnum = $propertyIsEnumerable; 17040 $.getDesc = $getOwnPropertyDescriptor; 17041 $.setDesc = $defineProperty; 17042 $.setDescs = $defineProperties; 17043 $.getNames = $names.get = $getOwnPropertyNames; 17044 $.getSymbols = $getOwnPropertySymbols; 17045 17046 if(DESCRIPTORS && !__webpack_require__(41)){ 17047 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); 17048 } 17049 } 17050 17051 var symbolStatics = { 17052 // 19.4.2.1 Symbol.for(key) 17053 'for': function(key){ 17054 return has(SymbolRegistry, key += '') 17055 ? SymbolRegistry[key] 17056 : SymbolRegistry[key] = $Symbol(key); 17057 }, 17058 // 19.4.2.5 Symbol.keyFor(sym) 17059 keyFor: function keyFor(key){ 17060 return keyOf(SymbolRegistry, key); 17061 }, 17062 useSetter: function(){ setter = true; }, 17063 useSimple: function(){ setter = false; } 17064 }; 17065 // 19.4.2.2 Symbol.hasInstance 17066 // 19.4.2.3 Symbol.isConcatSpreadable 17067 // 19.4.2.4 Symbol.iterator 17068 // 19.4.2.6 Symbol.match 17069 // 19.4.2.8 Symbol.replace 17070 // 19.4.2.9 Symbol.search 17071 // 19.4.2.10 Symbol.species 17072 // 19.4.2.11 Symbol.split 17073 // 19.4.2.12 Symbol.toPrimitive 17074 // 19.4.2.13 Symbol.toStringTag 17075 // 19.4.2.14 Symbol.unscopables 17076 $.each.call(( 17077 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' + 17078 'species,split,toPrimitive,toStringTag,unscopables' 17079 ).split(','), function(it){ 17080 var sym = wks(it); 17081 symbolStatics[it] = useNative ? sym : wrap(sym); 17082 }); 17083 17084 setter = true; 17085 17086 $export($export.G + $export.W, {Symbol: $Symbol}); 17087 17088 $export($export.S, 'Symbol', symbolStatics); 17089 17090 $export($export.S + $export.F * !useNative, 'Object', { 17091 // 19.1.2.2 Object.create(O [, Properties]) 17092 create: $create, 17093 // 19.1.2.4 Object.defineProperty(O, P, Attributes) 17094 defineProperty: $defineProperty, 17095 // 19.1.2.3 Object.defineProperties(O, Properties) 17096 defineProperties: $defineProperties, 17097 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) 17098 getOwnPropertyDescriptor: $getOwnPropertyDescriptor, 17099 // 19.1.2.7 Object.getOwnPropertyNames(O) 17100 getOwnPropertyNames: $getOwnPropertyNames, 17101 // 19.1.2.8 Object.getOwnPropertySymbols(O) 17102 getOwnPropertySymbols: $getOwnPropertySymbols 17103 }); 17104 17105 // 24.3.2 JSON.stringify(value [, replacer [, space]]) 17106 $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify}); 17107 17108 // 19.4.3.5 Symbol.prototype[@@toStringTag] 17109 setToStringTag($Symbol, 'Symbol'); 17110 // 20.2.1.9 Math[@@toStringTag] 17111 setToStringTag(Math, 'Math', true); 17112 // 24.3.3 JSON[@@toStringTag] 17113 setToStringTag(global.JSON, 'JSON', true); 17114 17115/***/ }), 17116/* 16 */ 17117/***/ (function(module, exports) { 17118 17119 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 17120 var global = module.exports = typeof window != 'undefined' && window.Math == Math 17121 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); 17122 if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef 17123 17124/***/ }), 17125/* 17 */ 17126/***/ (function(module, exports) { 17127 17128 var hasOwnProperty = {}.hasOwnProperty; 17129 module.exports = function(it, key){ 17130 return hasOwnProperty.call(it, key); 17131 }; 17132 17133/***/ }), 17134/* 18 */ 17135/***/ (function(module, exports, __webpack_require__) { 17136 17137 // Thank's IE8 for his funny defineProperty 17138 module.exports = !__webpack_require__(19)(function(){ 17139 return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; 17140 }); 17141 17142/***/ }), 17143/* 19 */ 17144/***/ (function(module, exports) { 17145 17146 module.exports = function(exec){ 17147 try { 17148 return !!exec(); 17149 } catch(e){ 17150 return true; 17151 } 17152 }; 17153 17154/***/ }), 17155/* 20 */ 17156/***/ (function(module, exports, __webpack_require__) { 17157 17158 var global = __webpack_require__(16) 17159 , core = __webpack_require__(21) 17160 , ctx = __webpack_require__(22) 17161 , PROTOTYPE = 'prototype'; 17162 17163 var $export = function(type, name, source){ 17164 var IS_FORCED = type & $export.F 17165 , IS_GLOBAL = type & $export.G 17166 , IS_STATIC = type & $export.S 17167 , IS_PROTO = type & $export.P 17168 , IS_BIND = type & $export.B 17169 , IS_WRAP = type & $export.W 17170 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) 17171 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] 17172 , key, own, out; 17173 if(IS_GLOBAL)source = name; 17174 for(key in source){ 17175 // contains in native 17176 own = !IS_FORCED && target && key in target; 17177 if(own && key in exports)continue; 17178 // export native or passed 17179 out = own ? target[key] : source[key]; 17180 // prevent global pollution for namespaces 17181 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] 17182 // bind timers to global for call from export context 17183 : IS_BIND && own ? ctx(out, global) 17184 // wrap global constructors for prevent change them in library 17185 : IS_WRAP && target[key] == out ? (function(C){ 17186 var F = function(param){ 17187 return this instanceof C ? new C(param) : C(param); 17188 }; 17189 F[PROTOTYPE] = C[PROTOTYPE]; 17190 return F; 17191 // make static versions for prototype methods 17192 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 17193 if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; 17194 } 17195 }; 17196 // type bitmap 17197 $export.F = 1; // forced 17198 $export.G = 2; // global 17199 $export.S = 4; // static 17200 $export.P = 8; // proto 17201 $export.B = 16; // bind 17202 $export.W = 32; // wrap 17203 module.exports = $export; 17204 17205/***/ }), 17206/* 21 */ 17207/***/ (function(module, exports) { 17208 17209 var core = module.exports = {version: '1.2.6'}; 17210 if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef 17211 17212/***/ }), 17213/* 22 */ 17214/***/ (function(module, exports, __webpack_require__) { 17215 17216 // optional / simple context binding 17217 var aFunction = __webpack_require__(23); 17218 module.exports = function(fn, that, length){ 17219 aFunction(fn); 17220 if(that === undefined)return fn; 17221 switch(length){ 17222 case 1: return function(a){ 17223 return fn.call(that, a); 17224 }; 17225 case 2: return function(a, b){ 17226 return fn.call(that, a, b); 17227 }; 17228 case 3: return function(a, b, c){ 17229 return fn.call(that, a, b, c); 17230 }; 17231 } 17232 return function(/* ...args */){ 17233 return fn.apply(that, arguments); 17234 }; 17235 }; 17236 17237/***/ }), 17238/* 23 */ 17239/***/ (function(module, exports) { 17240 17241 module.exports = function(it){ 17242 if(typeof it != 'function')throw TypeError(it + ' is not a function!'); 17243 return it; 17244 }; 17245 17246/***/ }), 17247/* 24 */ 17248/***/ (function(module, exports, __webpack_require__) { 17249 17250 module.exports = __webpack_require__(25); 17251 17252/***/ }), 17253/* 25 */ 17254/***/ (function(module, exports, __webpack_require__) { 17255 17256 var $ = __webpack_require__(9) 17257 , createDesc = __webpack_require__(26); 17258 module.exports = __webpack_require__(18) ? function(object, key, value){ 17259 return $.setDesc(object, key, createDesc(1, value)); 17260 } : function(object, key, value){ 17261 object[key] = value; 17262 return object; 17263 }; 17264 17265/***/ }), 17266/* 26 */ 17267/***/ (function(module, exports) { 17268 17269 module.exports = function(bitmap, value){ 17270 return { 17271 enumerable : !(bitmap & 1), 17272 configurable: !(bitmap & 2), 17273 writable : !(bitmap & 4), 17274 value : value 17275 }; 17276 }; 17277 17278/***/ }), 17279/* 27 */ 17280/***/ (function(module, exports, __webpack_require__) { 17281 17282 var global = __webpack_require__(16) 17283 , SHARED = '__core-js_shared__' 17284 , store = global[SHARED] || (global[SHARED] = {}); 17285 module.exports = function(key){ 17286 return store[key] || (store[key] = {}); 17287 }; 17288 17289/***/ }), 17290/* 28 */ 17291/***/ (function(module, exports, __webpack_require__) { 17292 17293 var def = __webpack_require__(9).setDesc 17294 , has = __webpack_require__(17) 17295 , TAG = __webpack_require__(29)('toStringTag'); 17296 17297 module.exports = function(it, tag, stat){ 17298 if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); 17299 }; 17300 17301/***/ }), 17302/* 29 */ 17303/***/ (function(module, exports, __webpack_require__) { 17304 17305 var store = __webpack_require__(27)('wks') 17306 , uid = __webpack_require__(30) 17307 , Symbol = __webpack_require__(16).Symbol; 17308 module.exports = function(name){ 17309 return store[name] || (store[name] = 17310 Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); 17311 }; 17312 17313/***/ }), 17314/* 30 */ 17315/***/ (function(module, exports) { 17316 17317 var id = 0 17318 , px = Math.random(); 17319 module.exports = function(key){ 17320 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 17321 }; 17322 17323/***/ }), 17324/* 31 */ 17325/***/ (function(module, exports, __webpack_require__) { 17326 17327 var $ = __webpack_require__(9) 17328 , toIObject = __webpack_require__(32); 17329 module.exports = function(object, el){ 17330 var O = toIObject(object) 17331 , keys = $.getKeys(O) 17332 , length = keys.length 17333 , index = 0 17334 , key; 17335 while(length > index)if(O[key = keys[index++]] === el)return key; 17336 }; 17337 17338/***/ }), 17339/* 32 */ 17340/***/ (function(module, exports, __webpack_require__) { 17341 17342 // to indexed object, toObject with fallback for non-array-like ES3 strings 17343 var IObject = __webpack_require__(33) 17344 , defined = __webpack_require__(35); 17345 module.exports = function(it){ 17346 return IObject(defined(it)); 17347 }; 17348 17349/***/ }), 17350/* 33 */ 17351/***/ (function(module, exports, __webpack_require__) { 17352 17353 // fallback for non-array-like ES3 and non-enumerable old V8 strings 17354 var cof = __webpack_require__(34); 17355 module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ 17356 return cof(it) == 'String' ? it.split('') : Object(it); 17357 }; 17358 17359/***/ }), 17360/* 34 */ 17361/***/ (function(module, exports) { 17362 17363 var toString = {}.toString; 17364 17365 module.exports = function(it){ 17366 return toString.call(it).slice(8, -1); 17367 }; 17368 17369/***/ }), 17370/* 35 */ 17371/***/ (function(module, exports) { 17372 17373 // 7.2.1 RequireObjectCoercible(argument) 17374 module.exports = function(it){ 17375 if(it == undefined)throw TypeError("Can't call method on " + it); 17376 return it; 17377 }; 17378 17379/***/ }), 17380/* 36 */ 17381/***/ (function(module, exports, __webpack_require__) { 17382 17383 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window 17384 var toIObject = __webpack_require__(32) 17385 , getNames = __webpack_require__(9).getNames 17386 , toString = {}.toString; 17387 17388 var windowNames = typeof window == 'object' && Object.getOwnPropertyNames 17389 ? Object.getOwnPropertyNames(window) : []; 17390 17391 var getWindowNames = function(it){ 17392 try { 17393 return getNames(it); 17394 } catch(e){ 17395 return windowNames.slice(); 17396 } 17397 }; 17398 17399 module.exports.get = function getOwnPropertyNames(it){ 17400 if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); 17401 return getNames(toIObject(it)); 17402 }; 17403 17404/***/ }), 17405/* 37 */ 17406/***/ (function(module, exports, __webpack_require__) { 17407 17408 // all enumerable object keys, includes symbols 17409 var $ = __webpack_require__(9); 17410 module.exports = function(it){ 17411 var keys = $.getKeys(it) 17412 , getSymbols = $.getSymbols; 17413 if(getSymbols){ 17414 var symbols = getSymbols(it) 17415 , isEnum = $.isEnum 17416 , i = 0 17417 , key; 17418 while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key); 17419 } 17420 return keys; 17421 }; 17422 17423/***/ }), 17424/* 38 */ 17425/***/ (function(module, exports, __webpack_require__) { 17426 17427 // 7.2.2 IsArray(argument) 17428 var cof = __webpack_require__(34); 17429 module.exports = Array.isArray || function(arg){ 17430 return cof(arg) == 'Array'; 17431 }; 17432 17433/***/ }), 17434/* 39 */ 17435/***/ (function(module, exports, __webpack_require__) { 17436 17437 var isObject = __webpack_require__(40); 17438 module.exports = function(it){ 17439 if(!isObject(it))throw TypeError(it + ' is not an object!'); 17440 return it; 17441 }; 17442 17443/***/ }), 17444/* 40 */ 17445/***/ (function(module, exports) { 17446 17447 module.exports = function(it){ 17448 return typeof it === 'object' ? it !== null : typeof it === 'function'; 17449 }; 17450 17451/***/ }), 17452/* 41 */ 17453/***/ (function(module, exports) { 17454 17455 module.exports = true; 17456 17457/***/ }), 17458/* 42 */ 17459/***/ (function(module, exports) { 17460 17461 17462 17463/***/ }), 17464/* 43 */ 17465/***/ (function(module, exports, __webpack_require__) { 17466 17467 module.exports = { "default": __webpack_require__(44), __esModule: true }; 17468 17469/***/ }), 17470/* 44 */ 17471/***/ (function(module, exports, __webpack_require__) { 17472 17473 __webpack_require__(45); 17474 __webpack_require__(51); 17475 module.exports = __webpack_require__(29)('iterator'); 17476 17477/***/ }), 17478/* 45 */ 17479/***/ (function(module, exports, __webpack_require__) { 17480 17481 'use strict'; 17482 var $at = __webpack_require__(46)(true); 17483 17484 // 21.1.3.27 String.prototype[@@iterator]() 17485 __webpack_require__(48)(String, 'String', function(iterated){ 17486 this._t = String(iterated); // target 17487 this._i = 0; // next index 17488 // 21.1.5.2.1 %StringIteratorPrototype%.next() 17489 }, function(){ 17490 var O = this._t 17491 , index = this._i 17492 , point; 17493 if(index >= O.length)return {value: undefined, done: true}; 17494 point = $at(O, index); 17495 this._i += point.length; 17496 return {value: point, done: false}; 17497 }); 17498 17499/***/ }), 17500/* 46 */ 17501/***/ (function(module, exports, __webpack_require__) { 17502 17503 var toInteger = __webpack_require__(47) 17504 , defined = __webpack_require__(35); 17505 // true -> String#at 17506 // false -> String#codePointAt 17507 module.exports = function(TO_STRING){ 17508 return function(that, pos){ 17509 var s = String(defined(that)) 17510 , i = toInteger(pos) 17511 , l = s.length 17512 , a, b; 17513 if(i < 0 || i >= l)return TO_STRING ? '' : undefined; 17514 a = s.charCodeAt(i); 17515 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff 17516 ? TO_STRING ? s.charAt(i) : a 17517 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; 17518 }; 17519 }; 17520 17521/***/ }), 17522/* 47 */ 17523/***/ (function(module, exports) { 17524 17525 // 7.1.4 ToInteger 17526 var ceil = Math.ceil 17527 , floor = Math.floor; 17528 module.exports = function(it){ 17529 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 17530 }; 17531 17532/***/ }), 17533/* 48 */ 17534/***/ (function(module, exports, __webpack_require__) { 17535 17536 'use strict'; 17537 var LIBRARY = __webpack_require__(41) 17538 , $export = __webpack_require__(20) 17539 , redefine = __webpack_require__(24) 17540 , hide = __webpack_require__(25) 17541 , has = __webpack_require__(17) 17542 , Iterators = __webpack_require__(49) 17543 , $iterCreate = __webpack_require__(50) 17544 , setToStringTag = __webpack_require__(28) 17545 , getProto = __webpack_require__(9).getProto 17546 , ITERATOR = __webpack_require__(29)('iterator') 17547 , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` 17548 , FF_ITERATOR = '@@iterator' 17549 , KEYS = 'keys' 17550 , VALUES = 'values'; 17551 17552 var returnThis = function(){ return this; }; 17553 17554 module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ 17555 $iterCreate(Constructor, NAME, next); 17556 var getMethod = function(kind){ 17557 if(!BUGGY && kind in proto)return proto[kind]; 17558 switch(kind){ 17559 case KEYS: return function keys(){ return new Constructor(this, kind); }; 17560 case VALUES: return function values(){ return new Constructor(this, kind); }; 17561 } return function entries(){ return new Constructor(this, kind); }; 17562 }; 17563 var TAG = NAME + ' Iterator' 17564 , DEF_VALUES = DEFAULT == VALUES 17565 , VALUES_BUG = false 17566 , proto = Base.prototype 17567 , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] 17568 , $default = $native || getMethod(DEFAULT) 17569 , methods, key; 17570 // Fix native 17571 if($native){ 17572 var IteratorPrototype = getProto($default.call(new Base)); 17573 // Set @@toStringTag to native iterators 17574 setToStringTag(IteratorPrototype, TAG, true); 17575 // FF fix 17576 if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); 17577 // fix Array#{values, @@iterator}.name in V8 / FF 17578 if(DEF_VALUES && $native.name !== VALUES){ 17579 VALUES_BUG = true; 17580 $default = function values(){ return $native.call(this); }; 17581 } 17582 } 17583 // Define iterator 17584 if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ 17585 hide(proto, ITERATOR, $default); 17586 } 17587 // Plug for library 17588 Iterators[NAME] = $default; 17589 Iterators[TAG] = returnThis; 17590 if(DEFAULT){ 17591 methods = { 17592 values: DEF_VALUES ? $default : getMethod(VALUES), 17593 keys: IS_SET ? $default : getMethod(KEYS), 17594 entries: !DEF_VALUES ? $default : getMethod('entries') 17595 }; 17596 if(FORCED)for(key in methods){ 17597 if(!(key in proto))redefine(proto, key, methods[key]); 17598 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); 17599 } 17600 return methods; 17601 }; 17602 17603/***/ }), 17604/* 49 */ 17605/***/ (function(module, exports) { 17606 17607 module.exports = {}; 17608 17609/***/ }), 17610/* 50 */ 17611/***/ (function(module, exports, __webpack_require__) { 17612 17613 'use strict'; 17614 var $ = __webpack_require__(9) 17615 , descriptor = __webpack_require__(26) 17616 , setToStringTag = __webpack_require__(28) 17617 , IteratorPrototype = {}; 17618 17619 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() 17620 __webpack_require__(25)(IteratorPrototype, __webpack_require__(29)('iterator'), function(){ return this; }); 17621 17622 module.exports = function(Constructor, NAME, next){ 17623 Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)}); 17624 setToStringTag(Constructor, NAME + ' Iterator'); 17625 }; 17626 17627/***/ }), 17628/* 51 */ 17629/***/ (function(module, exports, __webpack_require__) { 17630 17631 __webpack_require__(52); 17632 var Iterators = __webpack_require__(49); 17633 Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; 17634 17635/***/ }), 17636/* 52 */ 17637/***/ (function(module, exports, __webpack_require__) { 17638 17639 'use strict'; 17640 var addToUnscopables = __webpack_require__(53) 17641 , step = __webpack_require__(54) 17642 , Iterators = __webpack_require__(49) 17643 , toIObject = __webpack_require__(32); 17644 17645 // 22.1.3.4 Array.prototype.entries() 17646 // 22.1.3.13 Array.prototype.keys() 17647 // 22.1.3.29 Array.prototype.values() 17648 // 22.1.3.30 Array.prototype[@@iterator]() 17649 module.exports = __webpack_require__(48)(Array, 'Array', function(iterated, kind){ 17650 this._t = toIObject(iterated); // target 17651 this._i = 0; // next index 17652 this._k = kind; // kind 17653 // 22.1.5.2.1 %ArrayIteratorPrototype%.next() 17654 }, function(){ 17655 var O = this._t 17656 , kind = this._k 17657 , index = this._i++; 17658 if(!O || index >= O.length){ 17659 this._t = undefined; 17660 return step(1); 17661 } 17662 if(kind == 'keys' )return step(0, index); 17663 if(kind == 'values')return step(0, O[index]); 17664 return step(0, [index, O[index]]); 17665 }, 'values'); 17666 17667 // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) 17668 Iterators.Arguments = Iterators.Array; 17669 17670 addToUnscopables('keys'); 17671 addToUnscopables('values'); 17672 addToUnscopables('entries'); 17673 17674/***/ }), 17675/* 53 */ 17676/***/ (function(module, exports) { 17677 17678 module.exports = function(){ /* empty */ }; 17679 17680/***/ }), 17681/* 54 */ 17682/***/ (function(module, exports) { 17683 17684 module.exports = function(done, value){ 17685 return {value: value, done: !!done}; 17686 }; 17687 17688/***/ }), 17689/* 55 */ 17690/***/ (function(module, exports, __webpack_require__) { 17691 17692 module.exports = { "default": __webpack_require__(56), __esModule: true }; 17693 17694/***/ }), 17695/* 56 */ 17696/***/ (function(module, exports, __webpack_require__) { 17697 17698 __webpack_require__(51); 17699 __webpack_require__(45); 17700 module.exports = __webpack_require__(57); 17701 17702/***/ }), 17703/* 57 */ 17704/***/ (function(module, exports, __webpack_require__) { 17705 17706 var anObject = __webpack_require__(39) 17707 , get = __webpack_require__(58); 17708 module.exports = __webpack_require__(21).getIterator = function(it){ 17709 var iterFn = get(it); 17710 if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); 17711 return anObject(iterFn.call(it)); 17712 }; 17713 17714/***/ }), 17715/* 58 */ 17716/***/ (function(module, exports, __webpack_require__) { 17717 17718 var classof = __webpack_require__(59) 17719 , ITERATOR = __webpack_require__(29)('iterator') 17720 , Iterators = __webpack_require__(49); 17721 module.exports = __webpack_require__(21).getIteratorMethod = function(it){ 17722 if(it != undefined)return it[ITERATOR] 17723 || it['@@iterator'] 17724 || Iterators[classof(it)]; 17725 }; 17726 17727/***/ }), 17728/* 59 */ 17729/***/ (function(module, exports, __webpack_require__) { 17730 17731 // getting tag from 19.1.3.6 Object.prototype.toString() 17732 var cof = __webpack_require__(34) 17733 , TAG = __webpack_require__(29)('toStringTag') 17734 // ES3 wrong here 17735 , ARG = cof(function(){ return arguments; }()) == 'Arguments'; 17736 17737 module.exports = function(it){ 17738 var O, T, B; 17739 return it === undefined ? 'Undefined' : it === null ? 'Null' 17740 // @@toStringTag case 17741 : typeof (T = (O = Object(it))[TAG]) == 'string' ? T 17742 // builtinTag case 17743 : ARG ? cof(O) 17744 // ES3 arguments fallback 17745 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; 17746 }; 17747 17748/***/ }), 17749/* 60 */ 17750/***/ (function(module, exports, __webpack_require__) { 17751 17752 module.exports = { "default": __webpack_require__(61), __esModule: true }; 17753 17754/***/ }), 17755/* 61 */ 17756/***/ (function(module, exports, __webpack_require__) { 17757 17758 __webpack_require__(62); 17759 module.exports = __webpack_require__(21).Object.keys; 17760 17761/***/ }), 17762/* 62 */ 17763/***/ (function(module, exports, __webpack_require__) { 17764 17765 // 19.1.2.14 Object.keys(O) 17766 var toObject = __webpack_require__(63); 17767 17768 __webpack_require__(64)('keys', function($keys){ 17769 return function keys(it){ 17770 return $keys(toObject(it)); 17771 }; 17772 }); 17773 17774/***/ }), 17775/* 63 */ 17776/***/ (function(module, exports, __webpack_require__) { 17777 17778 // 7.1.13 ToObject(argument) 17779 var defined = __webpack_require__(35); 17780 module.exports = function(it){ 17781 return Object(defined(it)); 17782 }; 17783 17784/***/ }), 17785/* 64 */ 17786/***/ (function(module, exports, __webpack_require__) { 17787 17788 // most Object methods by ES6 should accept primitives 17789 var $export = __webpack_require__(20) 17790 , core = __webpack_require__(21) 17791 , fails = __webpack_require__(19); 17792 module.exports = function(KEY, exec){ 17793 var fn = (core.Object || {})[KEY] || Object[KEY] 17794 , exp = {}; 17795 exp[KEY] = exec(fn); 17796 $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); 17797 }; 17798 17799/***/ }), 17800/* 65 */ 17801/***/ (function(module, exports, __webpack_require__) { 17802 17803 'use strict'; 17804 17805 var _interopRequireDefault = __webpack_require__(1)['default']; 17806 17807 exports.__esModule = true; 17808 17809 var _exception = __webpack_require__(6); 17810 17811 var _exception2 = _interopRequireDefault(_exception); 17812 17813 exports['default'] = function (instance) { 17814 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 17815 if (arguments.length === 1) { 17816 // A missing field in a {{foo}} construct. 17817 return undefined; 17818 } else { 17819 // Someone is actually trying to call something, blow up. 17820 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 17821 } 17822 }); 17823 }; 17824 17825 module.exports = exports['default']; 17826 17827/***/ }), 17828/* 66 */ 17829/***/ (function(module, exports, __webpack_require__) { 17830 17831 'use strict'; 17832 17833 var _interopRequireDefault = __webpack_require__(1)['default']; 17834 17835 exports.__esModule = true; 17836 17837 var _utils = __webpack_require__(5); 17838 17839 var _exception = __webpack_require__(6); 17840 17841 var _exception2 = _interopRequireDefault(_exception); 17842 17843 exports['default'] = function (instance) { 17844 instance.registerHelper('if', function (conditional, options) { 17845 if (arguments.length != 2) { 17846 throw new _exception2['default']('#if requires exactly one argument'); 17847 } 17848 if (_utils.isFunction(conditional)) { 17849 conditional = conditional.call(this); 17850 } 17851 17852 // Default behavior is to render the positive path if the value is truthy and not empty. 17853 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 17854 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 17855 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 17856 return options.inverse(this); 17857 } else { 17858 return options.fn(this); 17859 } 17860 }); 17861 17862 instance.registerHelper('unless', function (conditional, options) { 17863 if (arguments.length != 2) { 17864 throw new _exception2['default']('#unless requires exactly one argument'); 17865 } 17866 return instance.helpers['if'].call(this, conditional, { 17867 fn: options.inverse, 17868 inverse: options.fn, 17869 hash: options.hash 17870 }); 17871 }); 17872 }; 17873 17874 module.exports = exports['default']; 17875 17876/***/ }), 17877/* 67 */ 17878/***/ (function(module, exports) { 17879 17880 'use strict'; 17881 17882 exports.__esModule = true; 17883 17884 exports['default'] = function (instance) { 17885 instance.registerHelper('log', function () /* message, options */{ 17886 var args = [undefined], 17887 options = arguments[arguments.length - 1]; 17888 for (var i = 0; i < arguments.length - 1; i++) { 17889 args.push(arguments[i]); 17890 } 17891 17892 var level = 1; 17893 if (options.hash.level != null) { 17894 level = options.hash.level; 17895 } else if (options.data && options.data.level != null) { 17896 level = options.data.level; 17897 } 17898 args[0] = level; 17899 17900 instance.log.apply(instance, args); 17901 }); 17902 }; 17903 17904 module.exports = exports['default']; 17905 17906/***/ }), 17907/* 68 */ 17908/***/ (function(module, exports) { 17909 17910 'use strict'; 17911 17912 exports.__esModule = true; 17913 17914 exports['default'] = function (instance) { 17915 instance.registerHelper('lookup', function (obj, field, options) { 17916 if (!obj) { 17917 // Note for 5.0: Change to "obj == null" in 5.0 17918 return obj; 17919 } 17920 return options.lookupProperty(obj, field); 17921 }); 17922 }; 17923 17924 module.exports = exports['default']; 17925 17926/***/ }), 17927/* 69 */ 17928/***/ (function(module, exports, __webpack_require__) { 17929 17930 'use strict'; 17931 17932 var _interopRequireDefault = __webpack_require__(1)['default']; 17933 17934 exports.__esModule = true; 17935 17936 var _utils = __webpack_require__(5); 17937 17938 var _exception = __webpack_require__(6); 17939 17940 var _exception2 = _interopRequireDefault(_exception); 17941 17942 exports['default'] = function (instance) { 17943 instance.registerHelper('with', function (context, options) { 17944 if (arguments.length != 2) { 17945 throw new _exception2['default']('#with requires exactly one argument'); 17946 } 17947 if (_utils.isFunction(context)) { 17948 context = context.call(this); 17949 } 17950 17951 var fn = options.fn; 17952 17953 if (!_utils.isEmpty(context)) { 17954 var data = options.data; 17955 if (options.data && options.ids) { 17956 data = _utils.createFrame(options.data); 17957 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 17958 } 17959 17960 return fn(context, { 17961 data: data, 17962 blockParams: _utils.blockParams([context], [data && data.contextPath]) 17963 }); 17964 } else { 17965 return options.inverse(this); 17966 } 17967 }); 17968 }; 17969 17970 module.exports = exports['default']; 17971 17972/***/ }), 17973/* 70 */ 17974/***/ (function(module, exports, __webpack_require__) { 17975 17976 'use strict'; 17977 17978 var _interopRequireDefault = __webpack_require__(1)['default']; 17979 17980 exports.__esModule = true; 17981 exports.registerDefaultDecorators = registerDefaultDecorators; 17982 17983 var _decoratorsInline = __webpack_require__(71); 17984 17985 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 17986 17987 function registerDefaultDecorators(instance) { 17988 _decoratorsInline2['default'](instance); 17989 } 17990 17991/***/ }), 17992/* 71 */ 17993/***/ (function(module, exports, __webpack_require__) { 17994 17995 'use strict'; 17996 17997 exports.__esModule = true; 17998 17999 var _utils = __webpack_require__(5); 18000 18001 exports['default'] = function (instance) { 18002 instance.registerDecorator('inline', function (fn, props, container, options) { 18003 var ret = fn; 18004 if (!props.partials) { 18005 props.partials = {}; 18006 ret = function (context, options) { 18007 // Create a new partials stack frame prior to exec. 18008 var original = container.partials; 18009 container.partials = _utils.extend({}, original, props.partials); 18010 var ret = fn(context, options); 18011 container.partials = original; 18012 return ret; 18013 }; 18014 } 18015 18016 props.partials[options.args[0]] = options.fn; 18017 18018 return ret; 18019 }); 18020 }; 18021 18022 module.exports = exports['default']; 18023 18024/***/ }), 18025/* 72 */ 18026/***/ (function(module, exports, __webpack_require__) { 18027 18028 'use strict'; 18029 18030 exports.__esModule = true; 18031 18032 var _utils = __webpack_require__(5); 18033 18034 var logger = { 18035 methodMap: ['debug', 'info', 'warn', 'error'], 18036 level: 'info', 18037 18038 // Maps a given level value to the `methodMap` indexes above. 18039 lookupLevel: function lookupLevel(level) { 18040 if (typeof level === 'string') { 18041 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 18042 if (levelMap >= 0) { 18043 level = levelMap; 18044 } else { 18045 level = parseInt(level, 10); 18046 } 18047 } 18048 18049 return level; 18050 }, 18051 18052 // Can be overridden in the host environment 18053 log: function log(level) { 18054 level = logger.lookupLevel(level); 18055 18056 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 18057 var method = logger.methodMap[level]; 18058 // eslint-disable-next-line no-console 18059 if (!console[method]) { 18060 method = 'log'; 18061 } 18062 18063 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 18064 message[_key - 1] = arguments[_key]; 18065 } 18066 18067 console[method].apply(console, message); // eslint-disable-line no-console 18068 } 18069 } 18070 }; 18071 18072 exports['default'] = logger; 18073 module.exports = exports['default']; 18074 18075/***/ }), 18076/* 73 */ 18077/***/ (function(module, exports, __webpack_require__) { 18078 18079 'use strict'; 18080 18081 var _Object$create = __webpack_require__(74)['default']; 18082 18083 var _Object$keys = __webpack_require__(60)['default']; 18084 18085 var _interopRequireDefault = __webpack_require__(1)['default']; 18086 18087 exports.__esModule = true; 18088 exports.createProtoAccessControl = createProtoAccessControl; 18089 exports.resultIsAllowed = resultIsAllowed; 18090 exports.resetLoggedProperties = resetLoggedProperties; 18091 18092 var _
18092createNewLookupObject = __webpack_require__(76); 18093 18094 var _logger = __webpack_require__(72); 18095 18096 var _logger2 = _interopRequireDefault(_logger); 18097 18098 var loggedProperties = _Object$create(null); 18099 18100 function createProtoAccessControl(runtimeOptions) { 18101 var defaultMethodWhiteList = _Object$create(null); 18102 defaultMethodWhiteList['constructor'] = false;
vendor: 11,824 bytes, lines 18103-18451
18103 defaultMethodWhiteList['__defineGetter__'] = false; 18104 defaultMethodWhiteList['__defineSetter__'] = false; 18105 defaultMethodWhiteList['__lookupGetter__'] = false; 18106 18107 var defaultPropertyWhiteList = _Object$create(null); 18108 // eslint-disable-next-line no-proto 18109 defaultPropertyWhiteList['__proto__'] = false; 18110 18111 return { 18112 properties: { 18113 whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), 18114 defaultValue: runtimeOptions.allowProtoPropertiesByDefault 18115 }, 18116 methods: { 18117 whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), 18118 defaultValue: runtimeOptions.allowProtoMethodsByDefault 18119 } 18120 }; 18121 } 18122 18123 function resultIsAllowed(result, protoAccessControl, propertyName) { 18124 if (typeof result === 'function') { 18125 return checkWhiteList(protoAccessControl.methods, propertyName); 18126 } else { 18127 return checkWhiteList(protoAccessControl.properties, propertyName); 18128 } 18129 } 18130 18131 function checkWhiteList(protoAccessControlForType, propertyName) { 18132 if (protoAccessControlForType.whitelist[propertyName] !== undefined) { 18133 return protoAccessControlForType.whitelist[propertyName] === true; 18134 } 18135 if (protoAccessControlForType.defaultValue !== undefined) { 18136 return protoAccessControlForType.defaultValue; 18137 } 18138 logUnexpecedPropertyAccessOnce(propertyName); 18139 return false; 18140 } 18141 18142 function logUnexpecedPropertyAccessOnce(propertyName) { 18143 if (loggedProperties[propertyName] !== true) { 18144 loggedProperties[propertyName] = true; 18145 _logger2['default'].log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); 18146 } 18147 } 18148 18149 function resetLoggedProperties() { 18150 _Object$keys(loggedProperties).forEach(function (propertyName) { 18151 delete loggedProperties[propertyName]; 18152 }); 18153 } 18154 18155/***/ }), 18156/* 74 */ 18157/***/ (function(module, exports, __webpack_require__) { 18158 18159 module.exports = { "default": __webpack_require__(75), __esModule: true }; 18160 18161/***/ }), 18162/* 75 */ 18163/***/ (function(module, exports, __webpack_require__) { 18164 18165 var $ = __webpack_require__(9); 18166 module.exports = function create(P, D){ 18167 return $.create(P, D); 18168 }; 18169 18170/***/ }), 18171/* 76 */ 18172/***/ (function(module, exports, __webpack_require__) { 18173 18174 'use strict'; 18175 18176 var _Object$create = __webpack_require__(74)['default']; 18177 18178 exports.__esModule = true; 18179 exports.createNewLookupObject = createNewLookupObject; 18180 18181 var _utils = __webpack_require__(5); 18182 18183 /** 18184 * Create a new object with "null"-prototype to avoid truthy results on prototype properties. 18185 * The resulting object can be used with "object[property]" to check if a property exists 18186 * @param {...object} sources a varargs parameter of source objects that will be merged 18187 * @returns {object} 18188 */ 18189 18190 function createNewLookupObject() { 18191 for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { 18192 sources[_key] = arguments[_key]; 18193 } 18194 18195 return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); 18196 } 18197 18198/***/ }), 18199/* 77 */ 18200/***/ (function(module, exports) { 18201 18202 // Build out our basic SafeString type 18203 'use strict'; 18204 18205 exports.__esModule = true; 18206 function SafeString(string) { 18207 this.string = string; 18208 } 18209 18210 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 18211 return '' + this.string; 18212 }; 18213 18214 exports['default'] = SafeString; 18215 module.exports = exports['default']; 18216 18217/***/ }), 18218/* 78 */ 18219/***/ (function(module, exports, __webpack_require__) { 18220 18221 'use strict'; 18222 18223 var _Object$seal = __webpack_require__(79)['default']; 18224 18225 var _Object$keys = __webpack_require__(60)['default']; 18226 18227 var _interopRequireWildcard = __webpack_require__(3)['default']; 18228 18229 var _interopRequireDefault = __webpack_require__(1)['default']; 18230 18231 exports.__esModule = true; 18232 exports.checkRevision = checkRevision; 18233 exports.template = template; 18234 exports.wrapProgram = wrapProgram; 18235 exports.resolvePartial = resolvePartial; 18236 exports.invokePartial = invokePartial; 18237 exports.noop = noop; 18238 18239 var _utils = __webpack_require__(5); 18240 18241 var Utils = _interopRequireWildcard(_utils); 18242 18243 var _exception = __webpack_require__(6); 18244 18245 var _exception2 = _interopRequireDefault(_exception); 18246 18247 var _base = __webpack_require__(4); 18248 18249 var _helpers = __webpack_require__(10); 18250 18251 var _internalWrapHelper = __webpack_require__(82); 18252 18253 var _internalProtoAccess = __webpack_require__(73); 18254 18255 function checkRevision(compilerInfo) { 18256 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 18257 currentRevision = _base.COMPILER_REVISION; 18258 18259 if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { 18260 return; 18261 } 18262 18263 if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { 18264 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 18265 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 18266 throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); 18267 } else { 18268 // Use the embedded version info since the runtime doesn't know about this revision yet 18269 throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); 18270 } 18271 } 18272 18273 function template(templateSpec, env) { 18274 /* istanbul ignore next */ 18275 if (!env) { 18276 throw new _exception2['default']('No environment passed to template'); 18277 } 18278 if (!templateSpec || !templateSpec.main) { 18279 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 18280 } 18281 18282 templateSpec.main.decorator = templateSpec.main_d; 18283 18284 // Note: Using env.VM references rather than local var references throughout this section to allow 18285 // for external users to override these as pseudo-supported APIs. 18286 env.VM.checkRevision(templateSpec.compiler); 18287 18288 // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) 18289 var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; 18290 18291 function invokePartialWrapper(partial, context, options) { 18292 if (options.hash) { 18293 context = Utils.extend({}, context, options.hash); 18294 if (options.ids) { 18295 options.ids[0] = true; 18296 } 18297 } 18298 partial = env.VM.resolvePartial.call(this, partial, context, options); 18299 18300 var extendedOptions = Utils.extend({}, options, { 18301 hooks: this.hooks, 18302 protoAccessControl: this.protoAccessControl 18303 }); 18304 18305 var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); 18306 18307 if (result == null && env.compile) { 18308 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 18309 result = options.partials[options.name](context, extendedOptions); 18310 } 18311 if (result != null) { 18312 if (options.indent) { 18313 var lines = result.split('\n'); 18314 for (var i = 0, l = lines.length; i < l; i++) { 18315 if (!lines[i] && i + 1 === l) { 18316 break; 18317 } 18318 18319 lines[i] = options.indent + lines[i]; 18320 } 18321 result = lines.join('\n'); 18322 } 18323 return result; 18324 } else { 18325 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 18326 } 18327 } 18328 18329 // Just add water 18330 var container = { 18331 strict: function strict(obj, name, loc) { 18332 if (!obj || !(name in obj)) { 18333 throw new _exception2['default']('"' + name + '" not defined in ' + obj, { 18334 loc: loc 18335 }); 18336 } 18337 return container.lookupProperty(obj, name); 18338 }, 18339 lookupProperty: function lookupProperty(parent, propertyName) { 18340 var result = parent[propertyName]; 18341 if (result == null) { 18342 return result; 18343 } 18344 if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { 18345 return result; 18346 } 18347 18348 if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { 18349 return result; 18350 } 18351 return undefined; 18352 }, 18353 lookup: function lookup(depths, name) { 18354 var len = depths.length; 18355 for (var i = 0; i < len; i++) { 18356 var result = depths[i] && container.lookupProperty(depths[i], name); 18357 if (result != null) { 18358 return depths[i][name]; 18359 } 18360 } 18361 }, 18362 lambda: function lambda(current, context) { 18363 return typeof current === 'function' ? current.call(context) : current; 18364 }, 18365 18366 escapeExpression: Utils.escapeExpression, 18367 invokePartial: invokePartialWrapper, 18368 18369 fn: function fn(i) { 18370 var ret = templateSpec[i]; 18371 ret.decorator = templateSpec[i + '_d']; 18372 return ret; 18373 }, 18374 18375 programs: [], 18376 program: function program(i, data, declaredBlockParams, blockParams, depths) { 18377 var programWrapper = this.programs[i], 18378 fn = this.fn(i); 18379 if (data || depths || blockParams || declaredBlockParams) { 18380 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 18381 } else if (!programWrapper) { 18382 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 18383 } 18384 return programWrapper; 18385 }, 18386 18387 data: function data(value, depth) { 18388 while (value && depth--) { 18389 value = value._parent; 18390 } 18391 return value; 18392 }, 18393 mergeIfNeeded: function mergeIfNeeded(param, common) { 18394 var obj = param || common; 18395 18396 if (param && common && param !== common) { 18397 obj = Utils.extend({}, common, param); 18398 } 18399 18400 return obj; 18401 }, 18402 // An empty object to use as replacement for null-contexts 18403 nullContext: _Object$seal({}), 18404 18405 noop: env.VM.noop, 18406 compilerInfo: templateSpec.compiler 18407 }; 18408 18409 function ret(context) { 18410 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 18411 18412 var data = options.data; 18413 18414 ret._setup(options); 18415 if (!options.partial && templateSpec.useData) { 18416 data = initData(context, data); 18417 } 18418 var depths = undefined, 18419 blockParams = templateSpec.useBlockParams ? [] : undefined; 18420 if (templateSpec.useDepths) { 18421 if (options.depths) { 18422 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 18423 } else { 18424 depths = [context]; 18425 } 18426 } 18427 18428 function main(context /*, options*/) { 18429 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 18430 } 18431 18432 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 18433 return main(context, options); 18434 } 18435 18436 ret.isTop = true; 18437 18438 ret._setup = function (options) { 18439 if (!options.partial) { 18440 var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); 18441 wrapHelpersToPassLookupProperty(mergedHelpers, container); 18442 container.helpers = mergedHelpers; 18443 18444 if (templateSpec.usePartial) { 18445 // Use mergeIfNeeded here to prevent compiling global partials multiple times 18446 container.partials = container.mergeIfNeeded(options.partials, env.partials); 18447 } 18448 if (templateSpec.usePartial || templateSpec.useDecorators) { 18449 container.decorators = Utils.extend({}, env.decorators, options.decorators); 18450 } 18451
vendor: 4,565 bytes, lines 18452-18580
18452 container.hooks = {}; 18453 container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); 18454 18455 var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; 18456 _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); 18457 _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); 18458 } else { 18459 container.protoAccessControl = options.protoAccessControl; // internal option 18460 container.helpers = options.helpers; 18461 container.partials = options.partials; 18462 container.decorators = options.decorators; 18463 container.hooks = options.hooks; 18464 } 18465 }; 18466 18467 ret._child = function (i, data, blockParams, depths) { 18468 if (templateSpec.useBlockParams && !blockParams) { 18469 throw new _exception2['default']('must pass block params'); 18470 } 18471 if (templateSpec.useDepths && !depths) { 18472 throw new _exception2['default']('must pass parent depths'); 18473 } 18474 18475 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 18476 }; 18477 return ret; 18478 } 18479 18480 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 18481 function prog(context) { 18482 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 18483 18484 var currentDepths = depths; 18485 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 18486 currentDepths = [context].concat(depths); 18487 } 18488 18489 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 18490 } 18491 18492 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 18493 18494 prog.program = i; 18495 prog.depth = depths ? depths.length : 0; 18496 prog.blockParams = declaredBlockParams || 0; 18497 return prog; 18498 } 18499 18500 /** 18501 * This is currently part of the official API, therefore implementation details should not be changed. 18502 */ 18503 18504 function resolvePartial(partial, context, options) { 18505 if (!partial) { 18506 if (options.name === '@partial-block') { 18507 partial = options.data['partial-block']; 18508 } else { 18509 partial = options.partials[options.name]; 18510 } 18511 } else if (!partial.call && !options.name) { 18512 // This is a dynamic partial that returned a string 18513 options.name = partial; 18514 partial = options.partials[partial]; 18515 } 18516 return partial; 18517 } 18518 18519 function invokePartial(partial, context, options) { 18520 // Use the current closure context to save the partial-block if this partial 18521 var currentPartialBlock = options.data && options.data['partial-block']; 18522 options.partial = true; 18523 if (options.ids) { 18524 options.data.contextPath = options.ids[0] || options.data.contextPath; 18525 } 18526 18527 var partialBlock = undefined; 18528 if (options.fn && options.fn !== noop) { 18529 (function () { 18530 options.data = _base.createFrame(options.data); 18531 // Wrapper function to get access to currentPartialBlock from the closure 18532 var fn = options.fn; 18533 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 18534 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 18535 18536 // Restore the partial-block from the closure for the execution of the block 18537 // i.e. the part inside the block of the partial call. 18538 options.data = _base.createFrame(options.data); 18539 options.data['partial-block'] = currentPartialBlock; 18540 return fn(context, options); 18541 }; 18542 if (fn.partials) { 18543 options.partials = Utils.extend({}, options.partials, fn.partials); 18544 } 18545 })(); 18546 } 18547 18548 if (partial === undefined && partialBlock) { 18549 partial = partialBlock; 18550 } 18551 18552 if (partial === undefined) { 18553 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 18554 } else if (partial instanceof Function) { 18555 return partial(context, options); 18556 } 18557 } 18558 18559 function noop() { 18560 return ''; 18561 } 18562 18563 function initData(context, data) { 18564 if (!data || !('root' in data)) { 18565 data = data ? _base.createFrame(data) : {}; 18566 data.root = context; 18567 } 18568 return data; 18569 } 18570 18571 function executeDecorators(fn, prog, container, depths, data, blockParams) { 18572 if (fn.decorator) { 18573 var props = {}; 18574 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 18575 Utils.extend(prog, props); 18576 } 18577 return prog; 18578 } 18579 18580 function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
vendor: 9,825 bytes, lines 18581-18816
18581 _Object$keys(mergedHelpers).forEach(function (helperName) { 18582 var helper = mergedHelpers[helperName]; 18583 mergedHelpers[helperName] = passLookupPropertyOption(helper, container); 18584 }); 18585 } 18586 18587 function passLookupPropertyOption(helper, container) { 18588 var lookupProperty = container.lookupProperty; 18589 return _internalWrapHelper.wrapHelper(helper, function (options) { 18590 return Utils.extend({ lookupProperty: lookupProperty }, options); 18591 }); 18592 } 18593 18594/***/ }), 18595/* 79 */ 18596/***/ (function(module, exports, __webpack_require__) { 18597 18598 module.exports = { "default": __webpack_require__(80), __esModule: true }; 18599 18600/***/ }), 18601/* 80 */ 18602/***/ (function(module, exports, __webpack_require__) { 18603 18604 __webpack_require__(81); 18605 module.exports = __webpack_require__(21).Object.seal; 18606 18607/***/ }), 18608/* 81 */ 18609/***/ (function(module, exports, __webpack_require__) { 18610 18611 // 19.1.2.17 Object.seal(O) 18612 var isObject = __webpack_require__(40); 18613 18614 __webpack_require__(64)('seal', function($seal){ 18615 return function seal(it){ 18616 return $seal && isObject(it) ? $seal(it) : it; 18617 }; 18618 }); 18619 18620/***/ }), 18621/* 82 */ 18622/***/ (function(module, exports) { 18623 18624 'use strict'; 18625 18626 exports.__esModule = true; 18627 exports.wrapHelper = wrapHelper; 18628 18629 function wrapHelper(helper, transformOptionsFn) { 18630 if (typeof helper !== 'function') { 18631 // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 18632 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. 18633 return helper; 18634 } 18635 var wrapper = function wrapper() /* dynamic arguments */{ 18636 var options = arguments[arguments.length - 1]; 18637 arguments[arguments.length - 1] = transformOptionsFn(options); 18638 return helper.apply(this, arguments); 18639 }; 18640 return wrapper; 18641 } 18642 18643/***/ }), 18644/* 83 */ 18645/***/ (function(module, exports) { 18646 18647 /* global globalThis */ 18648 'use strict'; 18649 18650 exports.__esModule = true; 18651 18652 exports['default'] = function (Handlebars) { 18653 /* istanbul ignore next */ 18654 // https://mathiasbynens.be/notes/globalthis 18655 (function () { 18656 if (typeof globalThis === 'object') return; 18657 Object.prototype.__defineGetter__('__magic__', function () { 18658 return this; 18659 }); 18660 __magic__.globalThis = __magic__; // eslint-disable-line no-undef 18661 delete Object.prototype.__magic__; 18662 })(); 18663 18664 var $Handlebars = globalThis.Handlebars; 18665 18666 /* istanbul ignore next */ 18667 Handlebars.noConflict = function () { 18668 if (globalThis.Handlebars === Handlebars) { 18669 globalThis.Handlebars = $Handlebars; 18670 } 18671 return Handlebars; 18672 }; 18673 }; 18674 18675 module.exports = exports['default']; 18676 18677/***/ }), 18678/* 84 */ 18679/***/ (function(module, exports) { 18680 18681 'use strict'; 18682 18683 exports.__esModule = true; 18684 var AST = { 18685 // Public API used to evaluate derived attributes regarding AST nodes 18686 helpers: { 18687 // a mustache is definitely a helper if: 18688 // * it is an eligible helper, and 18689 // * it has at least one parameter or hash segment 18690 helperExpression: function helperExpression(node) { 18691 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 18692 }, 18693 18694 scopedId: function scopedId(path) { 18695 return (/^\.|this\b/.test(path.original) 18696 ); 18697 }, 18698 18699 // an ID is simple if it only has one part, and that part is not 18700 // `..` or `this`. 18701 simpleId: function simpleId(path) { 18702 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 18703 } 18704 } 18705 }; 18706 18707 // Must be exported as an object rather than the root of the module as the jison lexer 18708 // must modify the object to operate properly. 18709 exports['default'] = AST; 18710 module.exports = exports['default']; 18711 18712/***/ }), 18713/* 85 */ 18714/***/ (function(module, exports, __webpack_require__) { 18715 18716 'use strict'; 18717 18718 var _interopRequireDefault = __webpack_require__(1)['default']; 18719 18720 var _interopRequireWildcard = __webpack_require__(3)['default']; 18721 18722 exports.__esModule = true; 18723 exports.parseWithoutProcessing = parseWithoutProcessing; 18724 exports.parse = parse; 18725 18726 var _parser = __webpack_require__(86); 18727 18728 var _parser2 = _interopRequireDefault(_parser); 18729 18730 var _whitespaceControl = __webpack_require__(87); 18731 18732 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 18733 18734 var _helpers = __webpack_require__(89); 18735 18736 var Helpers = _interopRequireWildcard(_helpers); 18737 18738 var _utils = __webpack_require__(5); 18739 18740 exports.parser = _parser2['default']; 18741 18742 var yy = {}; 18743 _utils.extend(yy, Helpers); 18744 18745 function parseWithoutProcessing(input, options) { 18746 // Just return if an already-compiled AST was passed in. 18747 if (input.type === 'Program') { 18748 return input; 18749 } 18750 18751 _parser2['default'].yy = yy; 18752 18753 // Altering the shared object here, but this is ok as parser is a sync operation 18754 yy.locInfo = function (locInfo) { 18755 return new yy.SourceLocation(options && options.srcName, locInfo); 18756 }; 18757 18758 var ast = _parser2['default'].parse(input); 18759 18760 return ast; 18761 } 18762 18763 function parse(input, options) { 18764 var ast = parseWithoutProcessing(input, options); 18765 var strip = new _whitespaceControl2['default'](options); 18766 18767 return strip.accept(ast); 18768 } 18769 18770/***/ }), 18771/* 86 */ 18772/***/ (function(module, exports) { 18773 18774 // File ignored in coverage tests via setting in .istanbul.yml 18775 /* Jison generated parser */ 18776 "use strict"; 18777 18778 exports.__esModule = true; 18779 var handlebars = (function () { 18780 var parser = { trace: function trace() {}, 18781 yy: {}, 18782 symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, 18783 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, 18784 productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], 18785 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { 18786 18787 var $0 = $$.length - 1; 18788 switch (yystate) { 18789 case 1: 18790 return $$[$0 - 1]; 18791 break; 18792 case 2: 18793 this.$ = yy.prepareProgram($$[$0]); 18794 break; 18795 case 3: 18796 this.$ = $$[$0]; 18797 break; 18798 case 4: 18799 this.$ = $$[$0]; 18800 break; 18801 case 5: 18802 this.$ = $$[$0]; 18803 break; 18804 case 6: 18805 this.$ = $$[$0]; 18806 break; 18807 case 7: 18808 this.$ = $$[$0]; 18809 break; 18810 case 8: 18811 this.$ = $$[$0]; 18812 break; 18813 case 9: 18814 this.$ = { 18815 type: 'CommentStatement', 18816 value: yy.stripComment($$[$0]),
vendor: 8,908 bytes, lines 18817-19037
18817 strip: yy.stripFlags($$[$0], $$[$0]), 18818 loc: yy.locInfo(this._$) 18819 }; 18820 18821 break; 18822 case 10: 18823 this.$ = { 18824 type: 'ContentStatement', 18825 original: $$[$0], 18826 value: $$[$0], 18827 loc: yy.locInfo(this._$) 18828 }; 18829 18830 break; 18831 case 11: 18832 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 18833 break; 18834 case 12: 18835 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 18836 break; 18837 case 13: 18838 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 18839 break; 18840 case 14: 18841 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 18842 break; 18843 case 15: 18844 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 18845 break; 18846 case 16: 18847 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 18848 break; 18849 case 17: 18850 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 18851 break; 18852 case 18: 18853 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 18854 break; 18855 case 19: 18856 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 18857 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 18858 program.chained = true; 18859 18860 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 18861 18862 break; 18863 case 20: 18864 this.$ = $$[$0]; 18865 break; 18866 case 21: 18867 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 18868 break; 18869 case 22: 18870 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 18871 break; 18872 case 23: 18873 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 18874 break; 18875 case 24: 18876 this.$ = { 18877 type: 'PartialStatement', 18878 name: $$[$0 - 3], 18879 params: $$[$0 - 2], 18880 hash: $$[$0 - 1], 18881 indent: '', 18882 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 18883 loc: yy.locInfo(this._$) 18884 }; 18885 18886 break; 18887 case 25: 18888 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 18889 break; 18890 case 26: 18891 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 18892 break; 18893 case 27: 18894 this.$ = $$[$0]; 18895 break; 18896 case 28: 18897 this.$ = $$[$0]; 18898 break; 18899 case 29: 18900 this.$ = { 18901 type: 'SubExpression', 18902 path: $$[$0 - 3], 18903 params: $$[$0 - 2], 18904 hash: $$[$0 - 1], 18905 loc: yy.locInfo(this._$) 18906 }; 18907 18908 break; 18909 case 30: 18910 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 18911 break; 18912 case 31: 18913 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 18914 break; 18915 case 32: 18916 this.$ = yy.id($$[$0 - 1]); 18917 break; 18918 case 33: 18919 this.$ = $$[$0]; 18920 break; 18921 case 34: 18922 this.$ = $$[$0]; 18923 break; 18924 case 35: 18925 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 18926 break; 18927 case 36: 18928 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 18929 break; 18930 case 37: 18931 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 18932 break; 18933 case 38: 18934 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 18935 break; 18936 case 39: 18937 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 18938 break; 18939 case 40: 18940 this.$ = $$[$0]; 18941 break; 18942 case 41: 18943 this.$ = $$[$0]; 18944 break; 18945 case 42: 18946 this.$ = yy.preparePath(true, $$[$0], this._$); 18947 break; 18948 case 43: 18949 this.$ = yy.preparePath(false, $$[$0], this._$); 18950 break; 18951 case 44: 18952 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 18953 break; 18954 case 45: 18955 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 18956 break; 18957 case 46: 18958 this.$ = []; 18959 break; 18960 case 47: 18961 $$[$0 - 1].push($$[$0]); 18962 break; 18963 case 48: 18964 this.$ = []; 18965 break; 18966 case 49: 18967 $$[$0 - 1].push($$[$0]); 18968 break; 18969 case 50: 18970 this.$ = []; 18971 break; 18972 case 51: 18973 $$[$0 - 1].push($$[$0]); 18974 break; 18975 case 58: 18976 this.$ = []; 18977 break; 18978 case 59: 18979 $$[$0 - 1].push($$[$0]); 18980 break; 18981 case 64: 18982 this.$ = []; 18983 break; 18984 case 65: 18985 $$[$0 - 1].push($$[$0]); 18986 break; 18987 case 70: 18988 this.$ = []; 18989 break; 18990 case 71: 18991 $$[$0 - 1].push($$[$0]); 18992 break; 18993 case 78: 18994 this.$ = []; 18995 break; 18996 case 79: 18997 $$[$0 - 1].push($$[$0]); 18998 break; 18999 case 82: 19000 this.$ = []; 19001 break; 19002 case 83: 19003 $$[$0 - 1].push($$[$0]); 19004 break; 19005 case 86: 19006 this.$ = []; 19007 break; 19008 case 87: 19009 $$[$0 - 1].push($$[$0]); 19010 break; 19011 case 90: 19012 this.$ = []; 19013 break; 19014 case 91: 19015 $$[$0 - 1].push($$[$0]); 19016 break; 19017 case 94: 19018 this.$ = []; 19019 break; 19020 case 95: 19021 $$[$0 - 1].push($$[$0]); 19022 break; 19023 case 98: 19024 this.$ = [$$[$0]]; 19025 break; 19026 case 99: 19027 $$[$0 - 1].push($$[$0]); 19028 break; 19029 case 100: 19030 this.$ = [$$[$0]]; 19031 break; 19032 case 101: 19033 $$[$0 - 1].push($$[$0]); 19034 break; 19035 } 19036 }, 19037
vendor: 11,458 bytes, line 19037
19037 table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }
vendor: 24,487 bytes, lines 19037-19512
19037, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], 19038 defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, 19039 parseError: function parseError(str, hash) { 19040 throw new Error(str); 19041 }, 19042 parse: function parse(input) { 19043 var self = this, 19044 stack = [0], 19045 vstack = [null], 19046 lstack = [], 19047 table = this.table, 19048 yytext = "", 19049 yylineno = 0, 19050 yyleng = 0, 19051 recovering = 0, 19052 TERROR = 2, 19053 EOF = 1; 19054 this.lexer.setInput(input); 19055 this.lexer.yy = this.yy; 19056 this.yy.lexer = this.lexer; 19057 this.yy.parser = this; 19058 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 19059 var yyloc = this.lexer.yylloc; 19060 lstack.push(yyloc); 19061 var ranges = this.lexer.options && this.lexer.options.ranges; 19062 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 19063 function popStack(n) { 19064 stack.length = stack.length - 2 * n; 19065 vstack.length = vstack.length - n; 19066 lstack.length = lstack.length - n; 19067 } 19068 function lex() { 19069 var token; 19070 token = self.lexer.lex() || 1; 19071 if (typeof token !== "number") { 19072 token = self.symbols_[token] || token; 19073 } 19074 return token; 19075 } 19076 var symbol, 19077 preErrorSymbol, 19078 state, 19079 action, 19080 a, 19081 r, 19082 yyval = {}, 19083 p, 19084 len, 19085 newState, 19086 expected; 19087 while (true) { 19088 state = stack[stack.length - 1]; 19089 if (this.defaultActions[state]) { 19090 action = this.defaultActions[state]; 19091 } else { 19092 if (symbol === null || typeof symbol == "undefined") { 19093 symbol = lex(); 19094 } 19095 action = table[state] && table[state][symbol]; 19096 } 19097 if (typeof action === "undefined" || !action.length || !action[0]) { 19098 var errStr = ""; 19099 if (!recovering) { 19100 expected = []; 19101 for (p in table[state]) if (this.terminals_[p] && p > 2) { 19102 expected.push("'" + this.terminals_[p] + "'"); 19103 } 19104 if (this.lexer.showPosition) { 19105 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 19106 } else { 19107 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 19108 } 19109 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 19110 } 19111 } 19112 if (action[0] instanceof Array && action.length > 1) { 19113 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 19114 } 19115 switch (action[0]) { 19116 case 1: 19117 stack.push(symbol); 19118 vstack.push(this.lexer.yytext); 19119 lstack.push(this.lexer.yylloc); 19120 stack.push(action[1]); 19121 symbol = null; 19122 if (!preErrorSymbol) { 19123 yyleng = this.lexer.yyleng; 19124 yytext = this.lexer.yytext; 19125 yylineno = this.lexer.yylineno; 19126 yyloc = this.lexer.yylloc; 19127 if (recovering > 0) recovering--; 19128 } else { 19129 symbol = preErrorSymbol; 19130 preErrorSymbol = null; 19131 } 19132 break; 19133 case 2: 19134 len = this.productions_[action[1]][1]; 19135 yyval.$ = vstack[vstack.length - len]; 19136 yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; 19137 if (ranges) { 19138 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 19139 } 19140 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 19141 if (typeof r !== "undefined") { 19142 return r; 19143 } 19144 if (len) { 19145 stack = stack.slice(0, -1 * len * 2); 19146 vstack = vstack.slice(0, -1 * len); 19147 lstack = lstack.slice(0, -1 * len); 19148 } 19149 stack.push(this.productions_[action[1]][0]); 19150 vstack.push(yyval.$); 19151 lstack.push(yyval._$); 19152 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 19153 stack.push(newState); 19154 break; 19155 case 3: 19156 return true; 19157 } 19158 } 19159 return true; 19160 } 19161 }; 19162 /* Jison generated lexer */ 19163 var lexer = (function () { 19164 var lexer = { EOF: 1, 19165 parseError: function parseError(str, hash) { 19166 if (this.yy.parser) { 19167 this.yy.parser.parseError(str, hash); 19168 } else { 19169 throw new Error(str); 19170 } 19171 }, 19172 setInput: function setInput(input) { 19173 this._input = input; 19174 this._more = this._less = this.done = false; 19175 this.yylineno = this.yyleng = 0; 19176 this.yytext = this.matched = this.match = ''; 19177 this.conditionStack = ['INITIAL']; 19178 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 19179 if (this.options.ranges) this.yylloc.range = [0, 0]; 19180 this.offset = 0; 19181 return this; 19182 }, 19183 input: function input() { 19184 var ch = this._input[0]; 19185 this.yytext += ch; 19186 this.yyleng++; 19187 this.offset++; 19188 this.match += ch; 19189 this.matched += ch; 19190 var lines = ch.match(/(?:\r\n?|\n).*/g); 19191 if (lines) { 19192 this.yylineno++; 19193 this.yylloc.last_line++; 19194 } else { 19195 this.yylloc.last_column++; 19196 } 19197 if (this.options.ranges) this.yylloc.range[1]++; 19198 19199 this._input = this._input.slice(1); 19200 return ch; 19201 }, 19202 unput: function unput(ch) { 19203 var len = ch.length; 19204 var lines = ch.split(/(?:\r\n?|\n)/g); 19205 19206 this._input = ch + this._input; 19207 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 19208 //this.yyleng -= len; 19209 this.offset -= len; 19210 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 19211 this.match = this.match.substr(0, this.match.length - 1); 19212 this.matched = this.matched.substr(0, this.matched.length - 1); 19213 19214 if (lines.length - 1) this.yylineno -= lines.length - 1; 19215 var r = this.yylloc.range; 19216 19217 this.yylloc = { first_line: this.yylloc.first_line, 19218 last_line: this.yylineno + 1, 19219 first_column: this.yylloc.first_column, 19220 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len 19221 }; 19222 19223 if (this.options.ranges) { 19224 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 19225 } 19226 return this; 19227 }, 19228 more: function more() { 19229 this._more = true; 19230 return this; 19231 }, 19232 less: function less(n) { 19233 this.unput(this.match.slice(n)); 19234 }, 19235 pastInput: function pastInput() { 19236 var past = this.matched.substr(0, this.matched.length - this.match.length); 19237 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 19238 }, 19239 upcomingInput: function upcomingInput() { 19240 var next = this.match; 19241 if (next.length < 20) { 19242 next += this._input.substr(0, 20 - next.length); 19243 } 19244 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 19245 }, 19246 showPosition: function showPosition() { 19247 var pre = this.pastInput(); 19248 var c = new Array(pre.length + 1).join("-"); 19249 return pre + this.upcomingInput() + "\n" + c + "^"; 19250 }, 19251 next: function next() { 19252 if (this.done) { 19253 return this.EOF; 19254 } 19255 if (!this._input) this.done = true; 19256 19257 var token, match, tempMatch, index, col, lines; 19258 if (!this._more) { 19259 this.yytext = ''; 19260 this.match = ''; 19261 } 19262 var rules = this._currentRules(); 19263 for (var i = 0; i < rules.length; i++) { 19264 tempMatch = this._input.match(this.rules[rules[i]]); 19265 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 19266 match = tempMatch; 19267 index = i; 19268 if (!this.options.flex) break; 19269 } 19270 } 19271 if (match) { 19272 lines = match[0].match(/(?:\r\n?|\n).*/g); 19273 if (lines) this.yylineno += lines.length; 19274 this.yylloc = { first_line: this.yylloc.last_line, 19275 last_line: this.yylineno + 1, 19276 first_column: this.yylloc.last_column, 19277 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 19278 this.yytext += match[0]; 19279 this.match += match[0]; 19280 this.matches = match; 19281 this.yyleng = this.yytext.length; 19282 if (this.options.ranges) { 19283 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 19284 } 19285 this._more = false; 19286 this._input = this._input.slice(match[0].length); 19287 this.matched += match[0]; 19288 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 19289 if (this.done && this._input) this.done = false; 19290 if (token) return token;else return; 19291 } 19292 if (this._input === "") { 19293 return this.EOF; 19294 } else { 19295 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 19296 } 19297 }, 19298 lex: function lex() { 19299 var r = this.next(); 19300 if (typeof r !== 'undefined') { 19301 return r; 19302 } else { 19303 return this.lex(); 19304 } 19305 }, 19306 begin: function begin(condition) { 19307 this.conditionStack.push(condition); 19308 }, 19309 popState: function popState() { 19310 return this.conditionStack.pop(); 19311 }, 19312 _currentRules: function _currentRules() { 19313 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 19314 }, 19315 topState: function topState() { 19316 return this.conditionStack[this.conditionStack.length - 2]; 19317 }, 19318 pushState: function begin(condition) { 19319 this.begin(condition); 19320 } }; 19321 lexer.options = {}; 19322 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { 19323 19324 function strip(start, end) { 19325 return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); 19326 } 19327 19328 var YYSTATE = YY_START; 19329 switch ($avoiding_name_collisions) { 19330 case 0: 19331 if (yy_.yytext.slice(-2) === "\\\\") { 19332 strip(0, 1); 19333 this.begin("mu"); 19334 } else if (yy_.yytext.slice(-1) === "\\") { 19335 strip(0, 1); 19336 this.begin("emu"); 19337 } else { 19338 this.begin("mu"); 19339 } 19340 if (yy_.yytext) return 15; 19341 19342 break; 19343 case 1: 19344 return 15; 19345 break; 19346 case 2: 19347 this.popState(); 19348 return 15; 19349 19350 break; 19351 case 3: 19352 this.begin('raw');return 15; 19353 break; 19354 case 4: 19355 this.popState(); 19356 // Should be using `this.topState()` below, but it currently 19357 // returns the second top instead of the first top. Opened an 19358 // issue about it at https://github.com/zaach/jison/issues/291 19359 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 19360 return 15; 19361 } else { 19362 strip(5, 9); 19363 return 'END_RAW_BLOCK'; 19364 } 19365 19366 break; 19367 case 5: 19368 return 15; 19369 break; 19370 case 6: 19371 this.popState(); 19372 return 14; 19373 19374 break; 19375 case 7: 19376 return 65; 19377 break; 19378 case 8: 19379 return 68; 19380 break; 19381 case 9: 19382 return 19; 19383 break; 19384 case 10: 19385 this.popState(); 19386 this.begin('raw'); 19387 return 23; 19388 19389 break; 19390 case 11: 19391 return 55; 19392 break; 19393 case 12: 19394 return 60; 19395 break; 19396 case 13: 19397 return 29; 19398 break; 19399 case 14: 19400 return 47; 19401 break; 19402 case 15: 19403 this.popState();return 44; 19404 break; 19405 case 16: 19406 this.popState();return 44; 19407 break; 19408 case 17: 19409 return 34; 19410 break; 19411 case 18: 19412 return 39; 19413 break; 19414 case 19: 19415 return 51; 19416 break; 19417 case 20: 19418 return 48; 19419 break; 19420 case 21: 19421 this.unput(yy_.yytext); 19422 this.popState(); 19423 this.begin('com'); 19424 19425 break; 19426 case 22: 19427 this.popState(); 19428 return 14; 19429 19430 break; 19431 case 23: 19432 return 48; 19433 break; 19434 case 24: 19435 return 73; 19436 break; 19437 case 25: 19438 return 72; 19439 break; 19440 case 26: 19441 return 72; 19442 break; 19443 case 27: 19444 return 87; 19445 break; 19446 case 28: 19447 // ignore whitespace 19448 break; 19449 case 29: 19450 this.popState();return 54; 19451 break; 19452 case 30: 19453 this.popState();return 33; 19454 break; 19455 case 31: 19456 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 19457 break; 19458 case 32: 19459 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 19460 break; 19461 case 33: 19462 return 85; 19463 break; 19464 case 34: 19465 return 82; 19466 break; 19467 case 35: 19468 return 82; 19469 break; 19470 case 36: 19471 return 83; 19472 break; 19473 case 37: 19474 return 84; 19475 break; 19476 case 38: 19477 return 81; 19478 break; 19479 case 39: 19480 return 75; 19481 break; 19482 case 40: 19483 return 77; 19484 break; 19485 case 41: 19486 return 72; 19487 break; 19488 case 42: 19489 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 19490 break; 19491 case 43: 19492 return 'INVALID'; 19493 break; 19494 case 44: 19495 return 5; 19496 break; 19497 } 19498 }; 19499 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 19500 lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; 19501 return lexer; 19502 })(); 19503 parser.lexer = lexer; 19504 function Parser() { 19505 this.yy = {}; 19506 }Parser.prototype = parser;parser.Parser = Parser; 19507 return new Parser(); 19508 })();exports["default"] = handlebars; 19509 module.exports = exports["default"]; 19510 19511/***/ }), 19512/* 8
vendor: 10,642 bytes, lines 19512-19879
195127 */ 19513/***/ (function(module, exports, __webpack_require__) { 19514 19515 'use strict'; 19516 19517 var _interopRequireDefault = __webpack_require__(1)['default']; 19518 19519 exports.__esModule = true; 19520 19521 var _visitor = __webpack_require__(88); 19522 19523 var _visitor2 = _interopRequireDefault(_visitor); 19524 19525 function WhitespaceControl() { 19526 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 19527 19528 this.options = options; 19529 } 19530 WhitespaceControl.prototype = new _visitor2['default'](); 19531 19532 WhitespaceControl.prototype.Program = function (program) { 19533 var doStandalone = !this.options.ignoreStandalone; 19534 19535 var isRoot = !this.isRootSeen; 19536 this.isRootSeen = true; 19537 19538 var body = program.body; 19539 for (var i = 0, l = body.length; i < l; i++) { 19540 var current = body[i], 19541 strip = this.accept(current); 19542 19543 if (!strip) { 19544 continue; 19545 } 19546 19547 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 19548 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 19549 openStandalone = strip.openStandalone && _isPrevWhitespace, 19550 closeStandalone = strip.closeStandalone && _isNextWhitespace, 19551 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 19552 19553 if (strip.close) { 19554 omitRight(body, i, true); 19555 } 19556 if (strip.open) { 19557 omitLeft(body, i, true); 19558 } 19559 19560 if (doStandalone && inlineStandalone) { 19561 omitRight(body, i); 19562 19563 if (omitLeft(body, i)) { 19564 // If we are on a standalone node, save the indent info for partials 19565 if (current.type === 'PartialStatement') { 19566 // Pull out the whitespace from the final line 19567 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 19568 } 19569 } 19570 } 19571 if (doStandalone && openStandalone) { 19572 omitRight((current.program || current.inverse).body); 19573 19574 // Strip out the previous content node if it's whitespace only 19575 omitLeft(body, i); 19576 } 19577 if (doStandalone && closeStandalone) { 19578 // Always strip the next node 19579 omitRight(body, i); 19580 19581 omitLeft((current.inverse || current.program).body); 19582 } 19583 } 19584 19585 return program; 19586 }; 19587 19588 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 19589 this.accept(block.program); 19590 this.accept(block.inverse); 19591 19592 // Find the inverse program that is involed with whitespace stripping. 19593 var program = block.program || block.inverse, 19594 inverse = block.program && block.inverse, 19595 firstInverse = inverse, 19596 lastInverse = inverse; 19597 19598 if (inverse && inverse.chained) { 19599 firstInverse = inverse.body[0].program; 19600 19601 // Walk the inverse chain to find the last inverse that is actually in the chain. 19602 while (lastInverse.chained) { 19603 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 19604 } 19605 } 19606 19607 var strip = { 19608 open: block.openStrip.open, 19609 close: block.closeStrip.close, 19610 19611 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 19612 // so our parent can determine if we actually are standalone 19613 openStandalone: isNextWhitespace(program.body), 19614 closeStandalone: isPrevWhitespace((firstInverse || program).body) 19615 }; 19616 19617 if (block.openStrip.close) { 19618 omitRight(program.body, null, true); 19619 } 19620 19621 if (inverse) { 19622 var inverseStrip = block.inverseStrip; 19623 19624 if (inverseStrip.open) { 19625 omitLeft(program.body, null, true); 19626 } 19627 19628 if (inverseStrip.close) { 19629 omitRight(firstInverse.body, null, true); 19630 } 19631 if (block.closeStrip.open) { 19632 omitLeft(lastInverse.body, null, true); 19633 } 19634 19635 // Find standalone else statments 19636 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 19637 omitLeft(program.body); 19638 omitRight(firstInverse.body); 19639 } 19640 } else if (block.closeStrip.open) { 19641 omitLeft(program.body, null, true); 19642 } 19643 19644 return strip; 19645 }; 19646 19647 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 19648 return mustache.strip; 19649 }; 19650 19651 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 19652 /* istanbul ignore next */ 19653 var strip = node.strip || {}; 19654 return { 19655 inlineStandalone: true, 19656 open: strip.open, 19657 close: strip.close 19658 }; 19659 }; 19660 19661 function isPrevWhitespace(body, i, isRoot) { 19662 if (i === undefined) { 19663 i = body.length; 19664 } 19665 19666 // Nodes that end with newlines are considered whitespace (but are special 19667 // cased for strip operations) 19668 var prev = body[i - 1], 19669 sibling = body[i - 2]; 19670 if (!prev) { 19671 return isRoot; 19672 } 19673 19674 if (prev.type === 'ContentStatement') { 19675 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 19676 } 19677 } 19678 function isNextWhitespace(body, i, isRoot) { 19679 if (i === undefined) { 19680 i = -1; 19681 } 19682 19683 var next = body[i + 1], 19684 sibling = body[i + 2]; 19685 if (!next) { 19686 return isRoot; 19687 } 19688 19689 if (next.type === 'ContentStatement') { 19690 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 19691 } 19692 } 19693 19694 // Marks the node to the right of the position as omitted. 19695 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 19696 // 19697 // If i is undefined, then the first child will be marked as such. 19698 // 19699 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 19700 // content is met. 19701 function omitRight(body, i, multiple) { 19702 var current = body[i == null ? 0 : i + 1]; 19703 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 19704 return; 19705 } 19706 19707 var original = current.value; 19708 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 19709 current.rightStripped = current.value !== original; 19710 } 19711 19712 // Marks the node to the left of the position as omitted. 19713 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 19714 // 19715 // If i is undefined then the last child will be marked as such. 19716 // 19717 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 19718 // content is met. 19719 function omitLeft(body, i, multiple) { 19720 var current = body[i == null ? body.length - 1 : i - 1]; 19721 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 19722 return; 19723 } 19724 19725 // We omit the last node if it's whitespace only and not preceded by a non-content node. 19726 var original = current.value; 19727 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 19728 current.leftStripped = current.value !== original; 19729 return current.leftStripped; 19730 } 19731 19732 exports['default'] = WhitespaceControl; 19733 module.exports = exports['default']; 19734 19735/***/ }), 19736/* 88 */ 19737/***/ (function(module, exports, __webpack_require__) { 19738 19739 'use strict'; 19740 19741 var _interopRequireDefault = __webpack_require__(1)['default']; 19742 19743 exports.__esModule = true; 19744 19745 var _exception = __webpack_require__(6); 19746 19747 var _exception2 = _interopRequireDefault(_exception); 19748 19749 function Visitor() { 19750 this.parents = []; 19751 } 19752 19753 Visitor.prototype = { 19754 constructor: Visitor, 19755 mutating: false, 19756 19757 // Visits a given value. If mutating, will replace the value if necessary. 19758 acceptKey: function acceptKey(node, name) { 19759 var value = this.accept(node[name]); 19760 if (this.mutating) { 19761 // Hacky sanity check: This may have a few false positives for type for the helper 19762 // methods but will generally do the right thing without a lot of overhead. 19763 if (value && !Visitor.prototype[value.type]) { 19764 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 19765 } 19766 node[name] = value; 19767 } 19768 }, 19769 19770 // Performs an accept operation with added sanity check to ensure 19771 // required keys are not removed. 19772 acceptRequired: function acceptRequired(node, name) { 19773 this.acceptKey(node, name); 19774 19775 if (!node[name]) { 19776 throw new _exception2['default'](node.type + ' requires ' + name); 19777 } 19778 }, 19779 19780 // Traverses a given array. If mutating, empty respnses will be removed 19781 // for child elements. 19782 acceptArray: function acceptArray(array) { 19783 for (var i = 0, l = array.length; i < l; i++) { 19784 this.acceptKey(array, i); 19785 19786 if (!array[i]) { 19787 array.splice(i, 1); 19788 i--; 19789 l--; 19790 } 19791 } 19792 }, 19793 19794 accept: function accept(object) { 19795 if (!object) { 19796 return; 19797 } 19798 19799 /* istanbul ignore next: Sanity code */ 19800 if (!this[object.type]) { 19801 throw new _exception2['default']('Unknown type: ' + object.type, object); 19802 } 19803 19804 if (this.current) { 19805 this.parents.unshift(this.current); 19806 } 19807 this.current = object; 19808 19809 var ret = this[object.type](object); 19810 19811 this.current = this.parents.shift(); 19812 19813 if (!this.mutating || ret) { 19814 return ret; 19815 } else if (ret !== false) { 19816 return object; 19817 } 19818 }, 19819 19820 Program: function Program(program) { 19821 this.acceptArray(program.body); 19822 }, 19823 19824 MustacheStatement: visitSubExpression, 19825 Decorator: visitSubExpression, 19826 19827 BlockStatement: visitBlock, 19828 DecoratorBlock: visitBlock, 19829 19830 PartialStatement: visitPartial, 19831 PartialBlockStatement: function PartialBlockStatement(partial) { 19832 visitPartial.call(this, partial); 19833 19834 this.acceptKey(partial, 'program'); 19835 }, 19836 19837 ContentStatement: function ContentStatement() /* content */{}, 19838 CommentStatement: function CommentStatement() /* comment */{}, 19839 19840 SubExpression: visitSubExpression, 19841 19842 PathExpression: function PathExpression() /* path */{}, 19843 19844 StringLiteral: function StringLiteral() /* string */{}, 19845 NumberLiteral: function NumberLiteral() /* number */{}, 19846 BooleanLiteral: function BooleanLiteral() /* bool */{}, 19847 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 19848 NullLiteral: function NullLiteral() /* literal */{}, 19849 19850 Hash: function Hash(hash) { 19851 this.acceptArray(hash.pairs); 19852 }, 19853 HashPair: function HashPair(pair) { 19854 this.acceptRequired(pair, 'value'); 19855 } 19856 }; 19857 19858 function visitSubExpression(mustache) { 19859 this.acceptRequired(mustache, 'path'); 19860 this.acceptArray(mustache.params); 19861 this.acceptKey(mustache, 'hash'); 19862 } 19863 function visitBlock(block) { 19864 visitSubExpression.call(this, block); 19865 19866 this.acceptKey(block, 'program'); 19867 this.acceptKey(block, 'inverse'); 19868 } 19869 function visitPartial(partial) { 19870 this.acceptRequired(partial, 'name'); 19871 this.acceptArray(partial.params); 19872 this.acceptKey(partial, 'hash'); 19873 } 19874 19875 exports['default'] = Visitor; 19876 module.exports = exports['default']; 19877 19878/***/ }), 19879/* 89
vendor: 5,593 bytes, lines 19879-20110
19879 */ 19880/***/ (function(module, exports, __webpack_require__) { 19881 19882 'use strict'; 19883 19884 var _interopRequireDefault = __webpack_require__(1)['default']; 19885 19886 exports.__esModule = true; 19887 exports.SourceLocation = SourceLocation; 19888 exports.id = id; 19889 exports.stripFlags = stripFlags; 19890 exports.stripComment = stripComment; 19891 exports.preparePath = preparePath; 19892 exports.prepareMustache = prepareMustache; 19893 exports.prepareRawBlock = prepareRawBlock; 19894 exports.prepareBlock = prepareBlock; 19895 exports.prepareProgram = prepareProgram; 19896 exports.preparePartialBlock = preparePartialBlock; 19897 19898 var _exception = __webpack_require__(6); 19899 19900 var _exception2 = _interopRequireDefault(_exception); 19901 19902 function validateClose(open, close) { 19903 close = close.path ? close.path.original : close; 19904 19905 if (open.path.original !== close) { 19906 var errorNode = { loc: open.path.loc }; 19907 19908 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 19909 } 19910 } 19911 19912 function SourceLocation(source, locInfo) { 19913 this.source = source; 19914 this.start = { 19915 line: locInfo.first_line, 19916 column: locInfo.first_column 19917 }; 19918 this.end = { 19919 line: locInfo.last_line, 19920 column: locInfo.last_column 19921 }; 19922 } 19923 19924 function id(token) { 19925 if (/^\[.*\]$/.test(token)) { 19926 return token.substring(1, token.length - 1); 19927 } else { 19928 return token; 19929 } 19930 } 19931 19932 function stripFlags(open, close) { 19933 return { 19934 open: open.charAt(2) === '~', 19935 close: close.charAt(close.length - 3) === '~' 19936 }; 19937 } 19938 19939 function stripComment(comment) { 19940 return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 19941 } 19942 19943 function preparePath(data, parts, loc) { 19944 loc = this.locInfo(loc); 19945 19946 var original = data ? '@' : '', 19947 dig = [], 19948 depth = 0; 19949 19950 for (var i = 0, l = parts.length; i < l; i++) { 19951 var part = parts[i].part, 19952 19953 // If we have [] syntax then we do not treat path references as operators, 19954 // i.e. foo.[this] resolves to approximately context.foo['this'] 19955 isLiteral = parts[i].original !== part; 19956 original += (parts[i].separator || '') + part; 19957 19958 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 19959 if (dig.length > 0) { 19960 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 19961 } else if (part === '..') { 19962 depth++; 19963 } 19964 } else { 19965 dig.push(part); 19966 } 19967 } 19968 19969 return { 19970 type: 'PathExpression', 19971 data: data, 19972 depth: depth, 19973 parts: dig, 19974 original: original, 19975 loc: loc 19976 }; 19977 } 19978 19979 function prepareMustache(path, params, hash, open, strip, locInfo) { 19980 // Must use charAt to support IE pre-10 19981 var escapeFlag = open.charAt(3) || open.charAt(2), 19982 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 19983 19984 var decorator = /\*/.test(open); 19985 return { 19986 type: decorator ? 'Decorator' : 'MustacheStatement', 19987 path: path, 19988 params: params, 19989 hash: hash, 19990 escaped: escaped, 19991 strip: strip, 19992 loc: this.locInfo(locInfo) 19993 }; 19994 } 19995 19996 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 19997 validateClose(openRawBlock, close); 19998 19999 locInfo = this.locInfo(locInfo); 20000 var program = { 20001 type: 'Program', 20002 body: contents, 20003 strip: {}, 20004 loc: locInfo 20005 }; 20006 20007 return { 20008 type: 'BlockStatement', 20009 path: openRawBlock.path, 20010 params: openRawBlock.params, 20011 hash: openRawBlock.hash, 20012 program: program, 20013 openStrip: {}, 20014 inverseStrip: {}, 20015 closeStrip: {}, 20016 loc: locInfo 20017 }; 20018 } 20019 20020 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 20021 if (close && close.path) { 20022 validateClose(openBlock, close); 20023 } 20024 20025 var decorator = /\*/.test(openBlock.open); 20026 20027 program.blockParams = openBlock.blockParams; 20028 20029 var inverse = undefined, 20030 inverseStrip = undefined; 20031 20032 if (inverseAndProgram) { 20033 if (decorator) { 20034 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 20035 } 20036 20037 if (inverseAndProgram.chain) { 20038 inverseAndProgram.program.body[0].closeStrip = close.strip; 20039 } 20040 20041 inverseStrip = inverseAndProgram.strip; 20042 inverse = inverseAndProgram.program; 20043 } 20044 20045 if (inverted) { 20046 inverted = inverse; 20047 inverse = program; 20048 program = inverted; 20049 } 20050 20051 return { 20052 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 20053 path: openBlock.path, 20054 params: openBlock.params, 20055 hash: openBlock.hash, 20056 program: program, 20057 inverse: inverse, 20058 openStrip: openBlock.strip, 20059 inverseStrip: inverseStrip, 20060 closeStrip: close && close.strip, 20061 loc: this.locInfo(locInfo) 20062 }; 20063 } 20064 20065 function prepareProgram(statements, loc) { 20066 if (!loc && statements.length) { 20067 var firstLoc = statements[0].loc, 20068 lastLoc = statements[statements.length - 1].loc; 20069 20070 /* istanbul ignore else */ 20071 if (firstLoc && lastLoc) { 20072 loc = { 20073 source: firstLoc.source, 20074 start: { 20075 line: firstLoc.start.line, 20076 column: firstLoc.start.column 20077 }, 20078 end: { 20079 line: lastLoc.end.line, 20080 column: lastLoc.end.column 20081 } 20082 }; 20083 } 20084 } 20085 20086 return { 20087 type: 'Program', 20088 body: statements, 20089 strip: {}, 20090 loc: loc 20091 }; 20092 } 20093 20094 function preparePartialBlock(open, program, close, locInfo) { 20095 validateClose(open, close); 20096 20097 return { 20098 type: 'PartialBlockStatement', 20099 name: open.path, 20100 params: open.params, 20101 hash: open.hash, 20102 program: program, 20103 openStrip: open.strip, 20104 closeStrip: close && close.strip, 20105 loc: this.locInfo(locInfo) 20106 }; 20107 } 20108 20109/***/ }), 20110/*
2011090 */ 20111/***/ (function(module, exports, __webpack_require__) { 20112 20113 /* eslint-disable new-cap */ 20114 20115 'use strict'; 20116 20117 var _Object$create = __webpack_require__(74)['default']; 20118 20119 var _interopRequireDefault = __webpack_require__(1)['default']; 20120 20121 exports.__esModule = true; 20122 exports.Compiler = Compiler; 20123 exports.precompile = precompile; 20124 exports.compile = compile; 20125 20126 var _exception = __webpack_require__(6); 20127 20128 var _exception2 = _interopRequireDefault(_exception); 20129 20130 var _utils = __webpack_require__(5); 20131 20132 var _ast = __webpack_require__(84
vendor: 15,890 bytes, lines 20132-20681
20132); 20133 20134 var _ast2 = _interopRequireDefault(_ast); 20135 20136 var slice = [].slice; 20137 20138 function Compiler() {} 20139 20140 // the foundHelper register will disambiguate helper lookup from finding a 20141 // function in a context. This is necessary for mustache compatibility, which 20142 // requires that context functions in blocks are evaluated by blockHelperMissing, 20143 // and then proceed as if the resulting value was provided to blockHelperMissing. 20144 20145 Compiler.prototype = { 20146 compiler: Compiler, 20147 20148 equals: function equals(other) { 20149 var len = this.opcodes.length; 20150 if (other.opcodes.length !== len) { 20151 return false; 20152 } 20153 20154 for (var i = 0; i < len; i++) { 20155 var opcode = this.opcodes[i], 20156 otherOpcode = other.opcodes[i]; 20157 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 20158 return false; 20159 } 20160 } 20161 20162 // We know that length is the same between the two arrays because they are directly tied 20163 // to the opcode behavior above. 20164 len = this.children.length; 20165 for (var i = 0; i < len; i++) { 20166 if (!this.children[i].equals(other.children[i])) { 20167 return false; 20168 } 20169 } 20170 20171 return true; 20172 }, 20173 20174 guid: 0, 20175 20176 compile: function compile(program, options) { 20177 this.sourceNode = []; 20178 this.opcodes = []; 20179 this.children = []; 20180 this.options = options; 20181 this.stringParams = options.stringParams; 20182 this.trackIds = options.trackIds; 20183 20184 options.blockParams = options.blockParams || []; 20185 20186 options.knownHelpers = _utils.extend(_Object$create(null), { 20187 helperMissing: true, 20188 blockHelperMissing: true, 20189 each: true, 20190 'if': true, 20191 unless: true, 20192 'with': true, 20193 log: true, 20194 lookup: true 20195 }, options.knownHelpers); 20196 20197 return this.accept(program); 20198 }, 20199 20200 compileProgram: function compileProgram(program) { 20201 var childCompiler = new this.compiler(), 20202 // eslint-disable-line new-cap 20203 result = childCompiler.compile(program, this.options), 20204 guid = this.guid++; 20205 20206 this.usePartial = this.usePartial || result.usePartial; 20207 20208 this.children[guid] = result; 20209 this.useDepths = this.useDepths || result.useDepths; 20210 20211 return guid; 20212 }, 20213 20214 accept: function accept(node) { 20215 /* istanbul ignore next: Sanity code */ 20216 if (!this[node.type]) { 20217 throw new _exception2['default']('Unknown type: ' + node.type, node); 20218 } 20219 20220 this.sourceNode.unshift(node); 20221 var ret = this[node.type](node); 20222 this.sourceNode.shift(); 20223 return ret; 20224 }, 20225 20226 Program: function Program(program) { 20227 this.options.blockParams.unshift(program.blockParams); 20228 20229 var body = program.body, 20230 bodyLength = body.length; 20231 for (var i = 0; i < bodyLength; i++) { 20232 this.accept(body[i]); 20233 } 20234 20235 this.options.blockParams.shift(); 20236 20237 this.isSimple = bodyLength === 1; 20238 this.blockParams = program.blockParams ? program.blockParams.length : 0; 20239 20240 return this; 20241 }, 20242 20243 BlockStatement: function BlockStatement(block) { 20244 transformLiteralToPath(block); 20245 20246 var program = block.program, 20247 inverse = block.inverse; 20248 20249 program = program && this.compileProgram(program); 20250 inverse = inverse && this.compileProgram(inverse); 20251 20252 var type = this.classifySexpr(block); 20253 20254 if (type === 'helper') { 20255 this.helperSexpr(block, program, inverse); 20256 } else if (type === 'simple') { 20257 this.simpleSexpr(block); 20258 20259 // now that the simple mustache is resolved, we need to 20260 // evaluate it by executing `blockHelperMissing` 20261 this.opcode('pushProgram', program); 20262 this.opcode('pushProgram', inverse); 20263 this.opcode('emptyHash'); 20264 this.opcode('blockValue', block.path.original); 20265 } else { 20266 this.ambiguousSexpr(block, program, inverse); 20267 20268 // now that the simple mustache is resolved, we need to 20269 // evaluate it by executing `blockHelperMissing` 20270 this.opcode('pushProgram', program); 20271 this.opcode('pushProgram', inverse); 20272 this.opcode('emptyHash'); 20273 this.opcode('ambiguousBlockValue'); 20274 } 20275 20276 this.opcode('append'); 20277 }, 20278 20279 DecoratorBlock: function DecoratorBlock(decorator) { 20280 var program = decorator.program && this.compileProgram(decorator.program); 20281 var params = this.setupFullMustacheParams(decorator, program, undefined), 20282 path = decorator.path; 20283 20284 this.useDecorators = true; 20285 this.opcode('registerDecorator', params.length, path.original); 20286 }, 20287 20288 PartialStatement: function PartialStatement(partial) { 20289 this.usePartial = true; 20290 20291 var program = partial.program; 20292 if (program) { 20293 program = this.compileProgram(partial.program); 20294 } 20295 20296 var params = partial.params; 20297 if (params.length > 1) { 20298 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 20299 } else if (!params.length) { 20300 if (this.options.explicitPartialContext) { 20301 this.opcode('pushLiteral', 'undefined'); 20302 } else { 20303 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 20304 } 20305 } 20306 20307 var partialName = partial.name.original, 20308 isDynamic = partial.name.type === 'SubExpression'; 20309 if (isDynamic) { 20310 this.accept(partial.name); 20311 } 20312 20313 this.setupFullMustacheParams(partial, program, undefined, true); 20314 20315 var indent = partial.indent || ''; 20316 if (this.options.preventIndent && indent) { 20317 this.opcode('appendContent', indent); 20318 indent = ''; 20319 } 20320 20321 this.opcode('invokePartial', isDynamic, partialName, indent); 20322 this.opcode('append'); 20323 }, 20324 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 20325 this.PartialStatement(partialBlock); 20326 }, 20327 20328 MustacheStatement: function MustacheStatement(mustache) { 20329 this.SubExpression(mustache); 20330 20331 if (mustache.escaped && !this.options.noEscape) { 20332 this.opcode('appendEscaped'); 20333 } else { 20334 this.opcode('append'); 20335 } 20336 }, 20337 Decorator: function Decorator(decorator) { 20338 this.DecoratorBlock(decorator); 20339 }, 20340 20341 ContentStatement: function ContentStatement(content) { 20342 if (content.value) { 20343 this.opcode('appendContent', content.value); 20344 } 20345 }, 20346 20347 CommentStatement: function CommentStatement() {}, 20348 20349 SubExpression: function SubExpression(sexpr) { 20350 transformLiteralToPath(sexpr); 20351 var type = this.classifySexpr(sexpr); 20352 20353 if (type === 'simple') { 20354 this.simpleSexpr(sexpr); 20355 } else if (type === 'helper') { 20356 this.helperSexpr(sexpr); 20357 } else { 20358 this.ambiguousSexpr(sexpr); 20359 } 20360 }, 20361 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 20362 var path = sexpr.path, 20363 name = path.parts[0], 20364 isBlock = program != null || inverse != null; 20365 20366 this.opcode('getContext', path.depth); 20367 20368 this.opcode('pushProgram', program); 20369 this.opcode('pushProgram', inverse); 20370 20371 path.strict = true; 20372 this.accept(path); 20373 20374 this.opcode('invokeAmbiguous', name, isBlock); 20375 }, 20376 20377 simpleSexpr: function simpleSexpr(sexpr) { 20378 var path = sexpr.path; 20379 path.strict = true; 20380 this.accept(path); 20381 this.opcode('resolvePossibleLambda'); 20382 }, 20383 20384 helperSexpr: function helperSexpr(sexpr, program, inverse) { 20385 var params = this.setupFullMustacheParams(sexpr, program, inverse), 20386 path = sexpr.path, 20387 name = path.parts[0]; 20388 20389 if (this.options.knownHelpers[name]) { 20390 this.opcode('invokeKnownHelper', params.length, name); 20391 } else if (this.options.knownHelpersOnly) { 20392 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 20393 } else { 20394 path.strict = true; 20395 path.falsy = true; 20396 20397 this.accept(path); 20398 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 20399 } 20400 }, 20401 20402 PathExpression: function PathExpression(path) { 20403 this.addDepth(path.depth); 20404 this.opcode('getContext', path.depth); 20405 20406 var name = path.parts[0], 20407 scoped = _ast2['default'].helpers.scopedId(path), 20408 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 20409 20410 if (blockParamId) { 20411 this.opcode('lookupBlockParam', blockParamId, path.parts); 20412 } else if (!name) { 20413 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 20414 this.opcode('pushContext'); 20415 } else if (path.data) { 20416 this.options.data = true; 20417 this.opcode('lookupData', path.depth, path.parts, path.strict); 20418 } else { 20419 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 20420 } 20421 }, 20422 20423 StringLiteral: function StringLiteral(string) { 20424 this.opcode('pushString', string.value); 20425 }, 20426 20427 NumberLiteral: function NumberLiteral(number) { 20428 this.opcode('pushLiteral', number.value); 20429 }, 20430 20431 BooleanLiteral: function BooleanLiteral(bool) { 20432 this.opcode('pushLiteral', bool.value); 20433 }, 20434 20435 UndefinedLiteral: function UndefinedLiteral() { 20436 this.opcode('pushLiteral', 'undefined'); 20437 }, 20438 20439 NullLiteral: function NullLiteral() { 20440 this.opcode('pushLiteral', 'null'); 20441 }, 20442 20443 Hash: function Hash(hash) { 20444 var pairs = hash.pairs, 20445 i = 0, 20446 l = pairs.length; 20447 20448 this.opcode('pushHash'); 20449 20450 for (; i < l; i++) { 20451 this.pushParam(pairs[i].value); 20452 } 20453 while (i--) { 20454 this.opcode('assignToHash', pairs[i].key); 20455 } 20456 this.opcode('popHash'); 20457 }, 20458 20459 // HELPERS 20460 opcode: function opcode(name) { 20461 this.opcodes.push({ 20462 opcode: name, 20463 args: slice.call(arguments, 1), 20464 loc: this.sourceNode[0].loc 20465 }); 20466 }, 20467 20468 addDepth: function addDepth(depth) { 20469 if (!depth) { 20470 return; 20471 } 20472 20473 this.useDepths = true; 20474 }, 20475 20476 classifySexpr: function classifySexpr(sexpr) { 20477 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 20478 20479 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 20480 20481 // a mustache is an eligible helper if: 20482 // * its id is simple (a single part, not `this` or `..`) 20483 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 20484 20485 // if a mustache is an eligible helper but not a definite 20486 // helper, it is ambiguous, and will be resolved in a later 20487 // pass or at runtime. 20488 var isEligible = !isBlockParam && (isHelper || isSimple); 20489 20490 // if ambiguous, we can possibly resolve the ambiguity now 20491 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 20492 if (isEligible && !isHelper) { 20493 var _name = sexpr.path.parts[0], 20494 options = this.options; 20495 if (options.knownHelpers[_name]) { 20496 isHelper = true; 20497 } else if (options.knownHelpersOnly) { 20498 isEligible = false; 20499 } 20500 } 20501 20502 if (isHelper) { 20503 return 'helper'; 20504 } else if (isEligible) { 20505 return 'ambiguous'; 20506 } else { 20507 return 'simple'; 20508 } 20509 }, 20510 20511 pushParams: function pushParams(params) { 20512 for (var i = 0, l = params.length; i < l; i++) { 20513 this.pushParam(params[i]); 20514 } 20515 }, 20516 20517 pushParam: function pushParam(val) { 20518 var value = val.value != null ? val.value : val.original || ''; 20519 20520 if (this.stringParams) { 20521 if (value.replace) { 20522 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 20523 } 20524 20525 if (val.depth) { 20526 this.addDepth(val.depth); 20527 } 20528 this.opcode('getContext', val.depth || 0); 20529 this.opcode('pushStringParam', value, val.type); 20530 20531 if (val.type === 'SubExpression') { 20532 // SubExpressions get evaluated and passed in 20533 // in string params mode. 20534 this.accept(val); 20535 } 20536 } else { 20537 if (this.trackIds) { 20538 var blockParamIndex = undefined; 20539 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 20540 blockParamIndex = this.blockParamIndex(val.parts[0]); 20541 } 20542 if (blockParamIndex) { 20543 var blockParamChild = val.parts.slice(1).join('.'); 20544 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 20545 } else { 20546 value = val.original || value; 20547 if (value.replace) { 20548 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 20549 } 20550 20551 this.opcode('pushId', val.type, value); 20552 } 20553 } 20554 this.accept(val); 20555 } 20556 }, 20557 20558 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 20559 var params = sexpr.params; 20560 this.pushParams(params); 20561 20562 this.opcode('pushProgram', program); 20563 this.opcode('pushProgram', inverse); 20564 20565 if (sexpr.hash) { 20566 this.accept(sexpr.hash); 20567 } else { 20568 this.opcode('emptyHash', omitEmpty); 20569 } 20570 20571 return params; 20572 }, 20573 20574 blockParamIndex: function blockParamIndex(name) { 20575 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 20576 var blockParams = this.options.blockParams[depth], 20577 param = blockParams && _utils.indexOf(blockParams, name); 20578 if (blockParams && param >= 0) { 20579 return [depth, param]; 20580 } 20581 } 20582 } 20583 }; 20584 20585 function precompile(input, options, env) { 20586 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 20587 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 20588 } 20589 20590 options = options || {}; 20591 if (!('data' in options)) { 20592 options.data = true; 20593 } 20594 if (options.compat) { 20595 options.useDepths = true; 20596 } 20597 20598 var ast = env.parse(input, options), 20599 environment = new env.Compiler().compile(ast, options); 20600 return new env.JavaScriptCompiler().compile(environment, options); 20601 } 20602 20603 function compile(input, options, env) { 20604 if (options === undefined) options = {}; 20605 20606 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 20607 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 20608 } 20609 20610 options = _utils.extend({}, options); 20611 if (!('data' in options)) { 20612 options.data = true; 20613 } 20614 if (options.compat) { 20615 options.useDepths = true; 20616 } 20617 20618 var compiled = undefined; 20619 20620 function compileInput() { 20621 var ast = env.parse(input, options), 20622 environment = new env.Compiler().compile(ast, options), 20623 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 20624 return env.template(templateSpec); 20625 } 20626 20627 // Template is only compiled on first use and cached after that point. 20628 function ret(context, execOptions) { 20629 if (!compiled) { 20630 compiled = compileInput(); 20631 } 20632 return compiled.call(this, context, execOptions); 20633 } 20634 ret._setup = function (setupOptions) { 20635 if (!compiled) { 20636 compiled = compileInput(); 20637 } 20638 return compiled._setup(setupOptions); 20639 }; 20640 ret._child = function (i, data, blockParams, depths) { 20641 if (!compiled) { 20642 compiled = compileInput(); 20643 } 20644 return compiled._child(i, data, blockParams, depths); 20645 }; 20646 return ret; 20647 } 20648 20649 function argEquals(a, b) { 20650 if (a === b) { 20651 return true; 20652 } 20653 20654 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 20655 for (var i = 0; i < a.length; i++) { 20656 if (!argEquals(a[i], b[i])) { 20657 return false; 20658 } 20659 } 20660 return true; 20661 } 20662 } 20663 20664 function transformLiteralToPath(sexpr) { 20665 if (!sexpr.path.parts) { 20666 var literal = sexpr.path; 20667 // Casting to string here to make false and 0 literal values play nicely with the rest 20668 // of the system. 20669 sexpr.path = { 20670 type: 'PathExpression', 20671 data: false, 20672 depth: 0, 20673 parts: [literal.original + ''], 20674 original: literal.original + '', 20675 loc: literal.loc 20676 }; 20677 } 20678 } 20679 20680/***/ }), 20681/* 9
vendor: 5,335 bytes, lines 20681-20850
206811 */ 20682/***/ (function(module, exports, __webpack_require__) { 20683 20684 'use strict'; 20685 20686 var _Object$keys = __webpack_require__(60)['default']; 20687 20688 var _interopRequireDefault = __webpack_require__(1)['default']; 20689 20690 exports.__esModule = true; 20691 20692 var _base = __webpack_require__(4); 20693 20694 var _exception = __webpack_require__(6); 20695 20696 var _exception2 = _interopRequireDefault(_exception); 20697 20698 var _utils = __webpack_require__(5); 20699 20700 var _codeGen = __webpack_require__(92); 20701 20702 var _codeGen2 = _interopRequireDefault(_codeGen); 20703 20704 function Literal(value) { 20705 this.value = value; 20706 } 20707 20708 function JavaScriptCompiler() {} 20709 20710 JavaScriptCompiler.prototype = { 20711 // PUBLIC API: You can override these methods in a subclass to provide 20712 // alternative compiled forms for name lookup and buffering semantics 20713 nameLookup: function nameLookup(parent, name /*, type */) { 20714 return this.internalNameLookup(parent, name); 20715 }, 20716 depthedLookup: function depthedLookup(name) { 20717 return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; 20718 }, 20719 20720 compilerInfo: function compilerInfo() { 20721 var revision = _base.COMPILER_REVISION, 20722 versions = _base.REVISION_CHANGES[revision]; 20723 return [revision, versions]; 20724 }, 20725 20726 appendToBuffer: function appendToBuffer(source, location, explicit) { 20727 // Force a source as this simplifies the merge logic. 20728 if (!_utils.isArray(source)) { 20729 source = [source]; 20730 } 20731 source = this.source.wrap(source, location); 20732 20733 if (this.environment.isSimple) { 20734 return ['return ', source, ';']; 20735 } else if (explicit) { 20736 // This is a case where the buffer operation occurs as a child of another 20737 // construct, generally braces. We have to explicitly output these buffer 20738 // operations to ensure that the emitted code goes in the correct location. 20739 return ['buffer += ', source, ';']; 20740 } else { 20741 source.appendToBuffer = true; 20742 return source; 20743 } 20744 }, 20745 20746 initializeBuffer: function initializeBuffer() { 20747 return this.quotedString(''); 20748 }, 20749 // END PUBLIC API 20750 internalNameLookup: function internalNameLookup(parent, name) { 20751 this.lookupPropertyFunctionIsUsed = true; 20752 return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; 20753 }, 20754 20755 lookupPropertyFunctionIsUsed: false, 20756 20757 compile: function compile(environment, options, context, asObject) { 20758 this.environment = environment; 20759 this.options = options; 20760 this.stringParams = this.options.stringParams; 20761 this.trackIds = this.options.trackIds; 20762 this.precompile = !asObject; 20763 20764 this.name = this.environment.name; 20765 this.isChild = !!context; 20766 this.context = context || { 20767 decorators: [], 20768 programs: [], 20769 environments: [] 20770 }; 20771 20772 this.preamble(); 20773 20774 this.stackSlot = 0; 20775 this.stackVars = []; 20776 this.aliases = {}; 20777 this.registers = { list: [] }; 20778 this.hashes = []; 20779 this.compileStack = []; 20780 this.inlineStack = []; 20781 this.blockParams = []; 20782 20783 this.compileChildren(environment, options); 20784 20785 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 20786 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 20787 20788 var opcodes = environment.opcodes, 20789 opcode = undefined, 20790 firstLoc = undefined, 20791 i = undefined, 20792 l = undefined; 20793 20794 for (i = 0, l = opcodes.length; i < l; i++) { 20795 opcode = opcodes[i]; 20796 20797 this.source.currentLocation = opcode.loc; 20798 firstLoc = firstLoc || opcode.loc; 20799 this[opcode.opcode].apply(this, opcode.args); 20800 } 20801 20802 // Flush any trailing content that might be pending. 20803 this.source.currentLocation = firstLoc; 20804 this.pushSource(''); 20805 20806 /* istanbul ignore next */ 20807 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 20808 throw new _exception2['default']('Compile completed with content left on stack'); 20809 } 20810 20811 if (!this.decorators.isEmpty()) { 20812 this.useDecorators = true; 20813 20814 this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); 20815 this.decorators.push('return fn;'); 20816 20817 if (asObject) { 20818 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 20819 } else { 20820 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 20821 this.decorators.push('}\n'); 20822 this.decorators = this.decorators.merge(); 20823 } 20824 } else { 20825 this.decorators = undefined; 20826 } 20827 20828 var fn = this.createFunctionContext(asObject); 20829 if (!this.isChild) { 20830 var ret = { 20831 compiler: this.compilerInfo(), 20832 main: fn 20833 }; 20834 20835 if (this.decorators) { 20836 ret.main_d = this.decorators; // eslint-disable-line camelcase 20837 ret.useDecorators = true; 20838 } 20839 20840 var _context = this.context; 20841 var programs = _context.programs; 20842 var decorators = _context.decorators; 20843 20844 for (i = 0, l = programs.length; i < l; i++) { 20845 if (programs[i]) { 20846 ret[i] = programs[i]; 20847 if (decorators[i]) { 20848 ret[i + '_d'] = decorators[i]; 20849 ret.useDecorators = true; 20850 }
vendor: 10,178 bytes, lines 20850-21176
20850 20851 } 20852 } 20853 20854 if (this.environment.usePartial) { 20855 ret.usePartial = true; 20856 } 20857 if (this.options.data) { 20858 ret.useData = true; 20859 } 20860 if (this.useDepths) { 20861 ret.useDepths = true; 20862 } 20863 if (this.useBlockParams) { 20864 ret.useBlockParams = true; 20865 } 20866 if (this.options.compat) { 20867 ret.compat = true; 20868 } 20869 20870 if (!asObject) { 20871 ret.compiler = JSON.stringify(ret.compiler); 20872 20873 this.source.currentLocation = { start: { line: 1, column: 0 } }; 20874 ret = this.objectLiteral(ret); 20875 20876 if (options.srcName) { 20877 ret = ret.toStringWithSourceMap({ file: options.destName }); 20878 ret.map = ret.map && ret.map.toString(); 20879 } else { 20880 ret = ret.toString(); 20881 } 20882 } else { 20883 ret.compilerOptions = this.options; 20884 } 20885 20886 return ret; 20887 } else { 20888 return fn; 20889 } 20890 }, 20891 20892 preamble: function preamble() { 20893 // track the last context pushed into place to allow skipping the 20894 // getContext opcode when it would be a noop 20895 this.lastContext = 0; 20896 this.source = new _codeGen2['default'](this.options.srcName); 20897 this.decorators = new _codeGen2['default'](this.options.srcName); 20898 }, 20899 20900 createFunctionContext: function createFunctionContext(asObject) { 20901 // istanbul ignore next 20902 20903 var _this = this; 20904 20905 var varDeclarations = ''; 20906 20907 var locals = this.stackVars.concat(this.registers.list); 20908 if (locals.length > 0) { 20909 varDeclarations += ', ' + locals.join(', '); 20910 } 20911 20912 // Generate minimizer alias mappings 20913 // 20914 // When using true SourceNodes, this will update all references to the given alias 20915 // as the source nodes are reused in situ. For the non-source node compilation mode, 20916 // aliases will not be used, but this case is already being run on the client and 20917 // we aren't concern about minimizing the template size. 20918 var aliasCount = 0; 20919 _Object$keys(this.aliases).forEach(function (alias) { 20920 var node = _this.aliases[alias]; 20921 if (node.children && node.referenceCount > 1) { 20922 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 20923 node.children[0] = 'alias' + aliasCount; 20924 } 20925 }); 20926 20927 if (this.lookupPropertyFunctionIsUsed) { 20928 varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); 20929 } 20930 20931 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 20932 20933 if (this.useBlockParams || this.useDepths) { 20934 params.push('blockParams'); 20935 } 20936 if (this.useDepths) { 20937 params.push('depths'); 20938 } 20939 20940 // Perform a second pass over the output to merge content when possible 20941 var source = this.mergeSource(varDeclarations); 20942 20943 if (asObject) { 20944 params.push(source); 20945 20946 return Function.apply(this, params); 20947 } else { 20948 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 20949 } 20950 }, 20951 mergeSource: function mergeSource(varDeclarations) { 20952 var isSimple = this.environment.isSimple, 20953 appendOnly = !this.forceBuffer, 20954 appendFirst = undefined, 20955 sourceSeen = undefined, 20956 bufferStart = undefined, 20957 bufferEnd = undefined; 20958 this.source.each(function (line) { 20959 if (line.appendToBuffer) { 20960 if (bufferStart) { 20961 line.prepend(' + '); 20962 } else { 20963 bufferStart = line; 20964 } 20965 bufferEnd = line; 20966 } else { 20967 if (bufferStart) { 20968 if (!sourceSeen) { 20969 appendFirst = true; 20970 } else { 20971 bufferStart.prepend('buffer += '); 20972 } 20973 bufferEnd.add(';'); 20974 bufferStart = bufferEnd = undefined; 20975 } 20976 20977 sourceSeen = true; 20978 if (!isSimple) { 20979 appendOnly = false; 20980 } 20981 } 20982 }); 20983 20984 if (appendOnly) { 20985 if (bufferStart) { 20986 bufferStart.prepend('return '); 20987 bufferEnd.add(';'); 20988 } else if (!sourceSeen) { 20989 this.source.push('return "";'); 20990 } 20991 } else { 20992 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 20993 20994 if (bufferStart) { 20995 bufferStart.prepend('return buffer + '); 20996 bufferEnd.add(';'); 20997 } else { 20998 this.source.push('return buffer;'); 20999 } 21000 } 21001 21002 if (varDeclarations) { 21003 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 21004 } 21005 21006 return this.source.merge(); 21007 }, 21008 21009 lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { 21010 return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); 21011 }, 21012 21013 // [blockValue] 21014 // 21015 // On stack, before: hash, inverse, program, value 21016 // On stack, after: return value of blockHelperMissing 21017 // 21018 // The purpose of this opcode is to take a block of the form 21019 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 21020 // replace it on the stack with the result of properly 21021 // invoking blockHelperMissing. 21022 blockValue: function blockValue(name) { 21023 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 21024 params = [this.contextName(0)]; 21025 this.setupHelperArgs(name, 0, params); 21026 21027 var blockName = this.popStack(); 21028 params.splice(1, 0, blockName); 21029 21030 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 21031 }, 21032 21033 // [ambiguousBlockValue] 21034 // 21035 // On stack, before: hash, inverse, program, value 21036 // Compiler value, before: lastHelper=value of last found helper, if any 21037 // On stack, after, if no lastHelper: same as [blockValue] 21038 // On stack, after, if lastHelper: value 21039 ambiguousBlockValue: function ambiguousBlockValue() { 21040 // We're being a bit cheeky and reusing the options value from the prior exec 21041 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 21042 params = [this.contextName(0)]; 21043 this.setupHelperArgs('', 0, params, true); 21044 21045 this.flushInline(); 21046 21047 var current = this.topStack(); 21048 params.splice(1, 0, current); 21049 21050 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 21051 }, 21052 21053 // [appendContent] 21054 // 21055 // On stack, before: ... 21056 // On stack, after: ... 21057 // 21058 // Appends the string value of `content` to the current buffer 21059 appendContent: function appendContent(content) { 21060 if (this.pendingContent) { 21061 content = this.pendingContent + content; 21062 } else { 21063 this.pendingLocation = this.source.currentLocation; 21064 } 21065 21066 this.pendingContent = content; 21067 }, 21068 21069 // [append] 21070 // 21071 // On stack, before: value, ... 21072 // On stack, after: ... 21073 // 21074 // Coerces `value` to a String and appends it to the current buffer. 21075 // 21076 // If `value` is truthy, or 0, it is coerced into a string and appended 21077 // Otherwise, the empty string is appended 21078 append: function append() { 21079 if (this.isInline()) { 21080 this.replaceStack(function (current) { 21081 return [' != null ? ', current, ' : ""']; 21082 }); 21083 21084 this.pushSource(this.appendToBuffer(this.popStack())); 21085 } else { 21086 var local = this.popStack(); 21087 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 21088 if (this.environment.isSimple) { 21089 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 21090 } 21091 } 21092 }, 21093 21094 // [appendEscaped] 21095 // 21096 // On stack, before: value, ... 21097 // On stack, after: ... 21098 // 21099 // Escape `value` and append it to the buffer 21100 appendEscaped: function appendEscaped() { 21101 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 21102 }, 21103 21104 // [getContext] 21105 // 21106 // On stack, before: ... 21107 // On stack, after: ... 21108 // Compiler value, after: lastContext=depth 21109 // 21110 // Set the value of the `lastContext` compiler value to the depth 21111 getContext: function getContext(depth) { 21112 this.lastContext = depth; 21113 }, 21114 21115 // [pushContext] 21116 // 21117 // On stack, before: ... 21118 // On stack, after: currentContext, ... 21119 // 21120 // Pushes the value of the current context onto the stack. 21121 pushContext: function pushContext() { 21122 this.pushStackLiteral(this.contextName(this.lastContext)); 21123 }, 21124 21125 // [lookupOnContext] 21126 // 21127 // On stack, before: ... 21128 // On stack, after: currentContext[name], ... 21129 // 21130 // Looks up the value of `name` on the current context and pushes 21131 // it onto the stack. 21132 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 21133 var i = 0; 21134 21135 if (!scoped && this.options.compat && !this.lastContext) { 21136 // The depthed query is expected to handle the undefined logic for the root level that 21137 // is implemented below, so we evaluate that directly in compat mode 21138 this.push(this.depthedLookup(parts[i++])); 21139 } else { 21140 this.pushContext(); 21141 } 21142 21143 this.resolvePath('context', parts, i, falsy, strict); 21144 }, 21145 21146 // [lookupBlockParam] 21147 // 21148 // On stack, before: ... 21149 // On stack, after: blockParam[name], ... 21150 // 21151 // Looks up the value of `parts` on the given block param and pushes 21152 // it onto the stack. 21153 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 21154 this.useBlockParams = true; 21155 21156 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 21157 this.resolvePath('context', parts, 1); 21158 }, 21159 21160 // [lookupData] 21161 // 21162 // On stack, before: ... 21163 // On stack, after: data, ... 21164 // 21165 // Push the data lookup operator 21166 lookupData: function lookupData(depth, parts, strict) { 21167 if (!depth) { 21168 this.pushStackLiteral('data'); 21169 } else { 21170 this.pushStackLiteral('container.data(data, ' + depth + ')'); 21171 } 21172 21173 this.resolvePath('data', parts, 0, true, strict); 21174 }, 21175 21176 resolvePath: function resolvePath(type, parts,
vendor: 2,919 bytes, lines 21176-21273
21176i, falsy, strict) { 21177 // istanbul ignore next 21178 21179 var _this2 = this; 21180 21181 if (this.options.strict || this.options.assumeObjects) { 21182 this.push(strictLookup(this.options.strict && strict, this, parts, i, type)); 21183 return; 21184 } 21185 21186 var len = parts.length; 21187 for (; i < len; i++) { 21188 /* eslint-disable no-loop-func */ 21189 this.replaceStack(function (current) { 21190 var lookup = _this2.nameLookup(current, parts[i], type); 21191 // We want to ensure that zero and false are handled properly if the context (falsy flag) 21192 // needs to have the special handling for these values. 21193 if (!falsy) { 21194 return [' != null ? ', lookup, ' : ', current]; 21195 } else { 21196 // Otherwise we can use generic falsy handling 21197 return [' && ', lookup]; 21198 } 21199 }); 21200 /* eslint-enable no-loop-func */ 21201 } 21202 }, 21203 21204 // [resolvePossibleLambda] 21205 // 21206 // On stack, before: value, ... 21207 // On stack, after: resolved value, ... 21208 // 21209 // If the `value` is a lambda, replace it on the stack by 21210 // the return value of the lambda 21211 resolvePossibleLambda: function resolvePossibleLambda() { 21212 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 21213 }, 21214 21215 // [pushStringParam] 21216 // 21217 // On stack, before: ... 21218 // On stack, after: string, currentContext, ... 21219 // 21220 // This opcode is designed for use in string mode, which 21221 // provides the string value of a parameter along with its 21222 // depth rather than resolving it immediately. 21223 pushStringParam: function pushStringParam(string, type) { 21224 this.pushContext(); 21225 this.pushString(type); 21226 21227 // If it's a subexpression, the string result 21228 // will be pushed after this opcode. 21229 if (type !== 'SubExpression') { 21230 if (typeof string === 'string') { 21231 this.pushString(string); 21232 } else { 21233 this.pushStackLiteral(string); 21234 } 21235 } 21236 }, 21237 21238 emptyHash: function emptyHash(omitEmpty) { 21239 if (this.trackIds) { 21240 this.push('{}'); // hashIds 21241 } 21242 if (this.stringParams) { 21243 this.push('{}'); // hashContexts 21244 this.push('{}'); // hashTypes 21245 } 21246 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 21247 }, 21248 pushHash: function pushHash() { 21249 if (this.hash) { 21250 this.hashes.push(this.hash); 21251 } 21252 this.hash = { values: {}, types: [], contexts: [], ids: [] }; 21253 }, 21254 popHash: function popHash() { 21255 var hash = this.hash; 21256 this.hash = this.hashes.pop(); 21257 21258 if (this.trackIds) { 21259 this.push(this.objectLiteral(hash.ids)); 21260 } 21261 if (this.stringParams) { 21262 this.push(this.objectLiteral(hash.contexts)); 21263 this.push(this.objectLiteral(hash.types)); 21264 } 21265 21266 this.push(this.objectLiteral(hash.values)); 21267 }, 21268 21269 // [pushString] 21270 // 21271 // On stack, before: ... 21272 // On stack, after: quotedString(string), ... 21273 //
vendor: 7,424 bytes, lines 21274-21502
21274 // Push a quoted version of `string` onto the stack 21275 pushString: function pushString(string) { 21276 this.pushStackLiteral(this.quotedString(string)); 21277 }, 21278 21279 // [pushLiteral] 21280 // 21281 // On stack, before: ... 21282 // On stack, after: value, ... 21283 // 21284 // Pushes a value onto the stack. This operation prevents 21285 // the compiler from creating a temporary variable to hold 21286 // it. 21287 pushLiteral: function pushLiteral(value) { 21288 this.pushStackLiteral(value); 21289 }, 21290 21291 // [pushProgram] 21292 // 21293 // On stack, before: ... 21294 // On stack, after: program(guid), ... 21295 // 21296 // Push a program expression onto the stack. This takes 21297 // a compile-time guid and converts it into a runtime-accessible 21298 // expression. 21299 pushProgram: function pushProgram(guid) { 21300 if (guid != null) { 21301 this.pushStackLiteral(this.programExpression(guid)); 21302 } else { 21303 this.pushStackLiteral(null); 21304 } 21305 }, 21306 21307 // [registerDecorator] 21308 // 21309 // On stack, before: hash, program, params..., ... 21310 // On stack, after: ... 21311 // 21312 // Pops off the decorator's parameters, invokes the decorator, 21313 // and inserts the decorator into the decorators list. 21314 registerDecorator: function registerDecorator(paramSize, name) { 21315 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 21316 options = this.setupHelperArgs(name, paramSize); 21317 21318 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 21319 }, 21320 21321 // [invokeHelper] 21322 // 21323 // On stack, before: hash, inverse, program, params..., ... 21324 // On stack, after: result of helper invocation 21325 // 21326 // Pops off the helper's parameters, invokes the helper, 21327 // and pushes the helper's return value onto the stack. 21328 // 21329 // If the helper is not found, `helperMissing` is called. 21330 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 21331 var nonHelper = this.popStack(), 21332 helper = this.setupHelper(paramSize, name); 21333 21334 var possibleFunctionCalls = []; 21335 21336 if (isSimple) { 21337 // direct call to helper 21338 possibleFunctionCalls.push(helper.name); 21339 } 21340 // call a function from the input object 21341 possibleFunctionCalls.push(nonHelper); 21342 if (!this.options.strict) { 21343 possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); 21344 } 21345 21346 var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; 21347 var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); 21348 this.push(functionCall); 21349 }, 21350 21351 itemsSeparatedBy: function itemsSeparatedBy(items, separator) { 21352 var result = []; 21353 result.push(items[0]); 21354 for (var i = 1; i < items.length; i++) { 21355 result.push(separator, items[i]); 21356 } 21357 return result; 21358 }, 21359 // [invokeKnownHelper] 21360 // 21361 // On stack, before: hash, inverse, program, params..., ... 21362 // On stack, after: result of helper invocation 21363 // 21364 // This operation is used when the helper is known to exist, 21365 // so a `helperMissing` fallback is not required. 21366 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 21367 var helper = this.setupHelper(paramSize, name); 21368 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 21369 }, 21370 21371 // [invokeAmbiguous] 21372 // 21373 // On stack, before: hash, inverse, program, params..., ... 21374 // On stack, after: result of disambiguation 21375 // 21376 // This operation is used when an expression like `{{foo}}` 21377 // is provided, but we don't know at compile-time whether it 21378 // is a helper or a path. 21379 // 21380 // This operation emits more code than the other options, 21381 // and can be avoided by passing the `knownHelpers` and 21382 // `knownHelpersOnly` flags at compile-time. 21383 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 21384 this.useRegister('helper'); 21385 21386 var nonHelper = this.popStack(); 21387 21388 this.emptyHash(); 21389 var helper = this.setupHelper(0, name, helperCall); 21390 21391 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 21392 21393 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 21394 if (!this.options.strict) { 21395 lookup[0] = '(helper = '; 21396 lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); 21397 } 21398 21399 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 21400 }, 21401 21402 // [invokePartial] 21403 // 21404 // On stack, before: context, ... 21405 // On stack after: result of partial invocation 21406 // 21407 // This operation pops off a context, invokes a partial with that context, 21408 // and pushes the result of the invocation back. 21409 invokePartial: function invokePartial(isDynamic, name, indent) { 21410 var params = [], 21411 options = this.setupParams(name, 1, params); 21412 21413 if (isDynamic) { 21414 name = this.popStack(); 21415 delete options.name; 21416 } 21417 21418 if (indent) { 21419 options.indent = JSON.stringify(indent); 21420 } 21421 options.helpers = 'helpers'; 21422 options.partials = 'partials'; 21423 options.decorators = 'container.decorators'; 21424 21425 if (!isDynamic) { 21426 params.unshift(this.nameLookup('partials', name, 'partial')); 21427 } else { 21428 params.unshift(name); 21429 } 21430 21431 if (this.options.compat) { 21432 options.depths = 'depths'; 21433 } 21434 options = this.objectLiteral(options); 21435 params.push(options); 21436 21437 this.push(this.source.functionCall('container.invokePartial', '', params)); 21438 }, 21439 21440 // [assignToHash] 21441 // 21442 // On stack, before: value, ..., hash, ... 21443 // On stack, after: ..., hash, ... 21444 // 21445 // Pops a value off the stack and assigns it to the current hash 21446 assignToHash: function assignToHash(key) { 21447 var value = this.popStack(), 21448 context = undefined, 21449 type = undefined, 21450 id = undefined; 21451 21452 if (this.trackIds) { 21453 id = this.popStack(); 21454 } 21455 if (this.stringParams) { 21456 type = this.popStack(); 21457 context = this.popStack(); 21458 } 21459 21460 var hash = this.hash; 21461 if (context) { 21462 hash.contexts[key] = context; 21463 } 21464 if (type) { 21465 hash.types[key] = type; 21466 } 21467 if (id) { 21468 hash.ids[key] = id; 21469 } 21470 hash.values[key] = value; 21471 }, 21472 21473 pushId: function pushId(type, name, child) { 21474 if (type === 'BlockParam') { 21475 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 21476 } else if (type === 'PathExpression') { 21477 this.pushString(name); 21478 } else if (type === 'SubExpression') { 21479 this.pushStackLiteral('true'); 21480 } else { 21481 this.pushStackLiteral('null'); 21482 } 21483 }, 21484 21485 // HELPERS 21486 21487 compiler: JavaScriptCompiler, 21488 21489 compileChildren: function compileChildren(environment, options) { 21490 var children = environment.children, 21491 child = undefined, 21492 compiler = undefined; 21493 21494 for (var i = 0, l = children.length; i < l; i++) { 21495 child = children[i]; 21496 compiler = new this.compiler(); // eslint-disable-line new-cap 21497 21498 var existing = this.matchExistingProgram(child); 21499 21500 if (existing == null) { 21501 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 21502 var index = this.context.programs.length
vendor: 9,546 bytes, lines 21502-21822
21502; 21503 child.index = index; 21504 child.name = 'program' + index; 21505 this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); 21506 this.context.decorators[index] = compiler.decorators; 21507 this.context.environments[index] = child; 21508 21509 this.useDepths = this.useDepths || compiler.useDepths; 21510 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 21511 child.useDepths = this.useDepths; 21512 child.useBlockParams = this.useBlockParams; 21513 } else { 21514 child.index = existing.index; 21515 child.name = 'program' + existing.index; 21516 21517 this.useDepths = this.useDepths || existing.useDepths; 21518 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 21519 } 21520 } 21521 }, 21522 matchExistingProgram: function matchExistingProgram(child) { 21523 for (var i = 0, len = this.context.environments.length; i < len; i++) { 21524 var environment = this.context.environments[i]; 21525 if (environment && environment.equals(child)) { 21526 return environment; 21527 } 21528 } 21529 }, 21530 21531 programExpression: function programExpression(guid) { 21532 var child = this.environment.children[guid], 21533 programParams = [child.index, 'data', child.blockParams]; 21534 21535 if (this.useBlockParams || this.useDepths) { 21536 programParams.push('blockParams'); 21537 } 21538 if (this.useDepths) { 21539 programParams.push('depths'); 21540 } 21541 21542 return 'container.program(' + programParams.join(', ') + ')'; 21543 }, 21544 21545 useRegister: function useRegister(name) { 21546 if (!this.registers[name]) { 21547 this.registers[name] = true; 21548 this.registers.list.push(name); 21549 } 21550 }, 21551 21552 push: function push(expr) { 21553 if (!(expr instanceof Literal)) { 21554 expr = this.source.wrap(expr); 21555 } 21556 21557 this.inlineStack.push(expr); 21558 return expr; 21559 }, 21560 21561 pushStackLiteral: function pushStackLiteral(item) { 21562 this.push(new Literal(item)); 21563 }, 21564 21565 pushSource: function pushSource(source) { 21566 if (this.pendingContent) { 21567 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 21568 this.pendingContent = undefined; 21569 } 21570 21571 if (source) { 21572 this.source.push(source); 21573 } 21574 }, 21575 21576 replaceStack: function replaceStack(callback) { 21577 var prefix = ['('], 21578 stack = undefined, 21579 createdStack = undefined, 21580 usedLiteral = undefined; 21581 21582 /* istanbul ignore next */ 21583 if (!this.isInline()) { 21584 throw new _exception2['default']('replaceStack on non-inline'); 21585 } 21586 21587 // We want to merge the inline statement into the replacement statement via ',' 21588 var top = this.popStack(true); 21589 21590 if (top instanceof Literal) { 21591 // Literals do not need to be inlined 21592 stack = [top.value]; 21593 prefix = ['(', stack]; 21594 usedLiteral = true; 21595 } else { 21596 // Get or create the current stack name for use by the inline 21597 createdStack = true; 21598 var _name = this.incrStack(); 21599 21600 prefix = ['((', this.push(_name), ' = ', top, ')']; 21601 stack = this.topStack(); 21602 } 21603 21604 var item = callback.call(this, stack); 21605 21606 if (!usedLiteral) { 21607 this.popStack(); 21608 } 21609 if (createdStack) { 21610 this.stackSlot--; 21611 } 21612 this.push(prefix.concat(item, ')')); 21613 }, 21614 21615 incrStack: function incrStack() { 21616 this.stackSlot++; 21617 if (this.stackSlot > this.stackVars.length) { 21618 this.stackVars.push('stack' + this.stackSlot); 21619 } 21620 return this.topStackName(); 21621 }, 21622 topStackName: function topStackName() { 21623 return 'stack' + this.stackSlot; 21624 }, 21625 flushInline: function flushInline() { 21626 var inlineStack = this.inlineStack; 21627 this.inlineStack = []; 21628 for (var i = 0, len = inlineStack.length; i < len; i++) { 21629 var entry = inlineStack[i]; 21630 /* istanbul ignore if */ 21631 if (entry instanceof Literal) { 21632 this.compileStack.push(entry); 21633 } else { 21634 var stack = this.incrStack(); 21635 this.pushSource([stack, ' = ', entry, ';']); 21636 this.compileStack.push(stack); 21637 } 21638 } 21639 }, 21640 isInline: function isInline() { 21641 return this.inlineStack.length; 21642 }, 21643 21644 popStack: function popStack(wrapped) { 21645 var inline = this.isInline(), 21646 item = (inline ? this.inlineStack : this.compileStack).pop(); 21647 21648 if (!wrapped && item instanceof Literal) { 21649 return item.value; 21650 } else { 21651 if (!inline) { 21652 /* istanbul ignore next */ 21653 if (!this.stackSlot) { 21654 throw new _exception2['default']('Invalid stack pop'); 21655 } 21656 this.stackSlot--; 21657 } 21658 return item; 21659 } 21660 }, 21661 21662 topStack: function topStack() { 21663 var stack = this.isInline() ? this.inlineStack : this.compileStack, 21664 item = stack[stack.length - 1]; 21665 21666 /* istanbul ignore if */ 21667 if (item instanceof Literal) { 21668 return item.value; 21669 } else { 21670 return item; 21671 } 21672 }, 21673 21674 contextName: function contextName(context) { 21675 if (this.useDepths && context) { 21676 return 'depths[' + context + ']'; 21677 } else { 21678 return 'depth' + context; 21679 } 21680 }, 21681 21682 quotedString: function quotedString(str) { 21683 return this.source.quotedString(str); 21684 }, 21685 21686 objectLiteral: function objectLiteral(obj) { 21687 return this.source.objectLiteral(obj); 21688 }, 21689 21690 aliasable: function aliasable(name) { 21691 var ret = this.aliases[name]; 21692 if (ret) { 21693 ret.referenceCount++; 21694 return ret; 21695 } 21696 21697 ret = this.aliases[name] = this.source.wrap(name); 21698 ret.aliasable = true; 21699 ret.referenceCount = 1; 21700 21701 return ret; 21702 }, 21703 21704 setupHelper: function setupHelper(paramSize, name, blockHelper) { 21705 var params = [], 21706 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 21707 var foundHelper = this.nameLookup('helpers', name, 'helper'), 21708 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 21709 21710 return { 21711 params: params, 21712 paramsInit: paramsInit, 21713 name: foundHelper, 21714 callParams: [callContext].concat(params) 21715 }; 21716 }, 21717 21718 setupParams: function setupParams(helper, paramSize, params) { 21719 var options = {}, 21720 contexts = [], 21721 types = [], 21722 ids = [], 21723 objectArgs = !params, 21724 param = undefined; 21725 21726 if (objectArgs) { 21727 params = []; 21728 } 21729 21730 options.name = this.quotedString(helper); 21731 options.hash = this.popStack(); 21732 21733 if (this.trackIds) { 21734 options.hashIds = this.popStack(); 21735 } 21736 if (this.stringParams) { 21737 options.hashTypes = this.popStack(); 21738 options.hashContexts = this.popStack(); 21739 } 21740 21741 var inverse = this.popStack(), 21742 program = this.popStack(); 21743 21744 // Avoid setting fn and inverse if neither are set. This allows 21745 // helpers to do a check for `if (options.fn)` 21746 if (program || inverse) { 21747 options.fn = program || 'container.noop'; 21748 options.inverse = inverse || 'container.noop'; 21749 } 21750 21751 // The parameters go on to the stack in order (making sure that they are evaluated in order) 21752 // so we need to pop them off the stack in reverse order 21753 var i = paramSize; 21754 while (i--) { 21755 param = this.popStack(); 21756 params[i] = param; 21757 21758 if (this.trackIds) { 21759 ids[i] = this.popStack(); 21760 } 21761 if (this.stringParams) { 21762 types[i] = this.popStack(); 21763 contexts[i] = this.popStack(); 21764 } 21765 } 21766 21767 if (objectArgs) { 21768 options.args = this.source.generateArray(params); 21769 } 21770 21771 if (this.trackIds) { 21772 options.ids = this.source.generateArray(ids); 21773 } 21774 if (this.stringParams) { 21775 options.types = this.source.generateArray(types); 21776 options.contexts = this.source.generateArray(contexts); 21777 } 21778 21779 if (this.options.data) { 21780 options.data = 'data'; 21781 } 21782 if (this.useBlockParams) { 21783 options.blockParams = 'blockParams'; 21784 } 21785 return options; 21786 }, 21787 21788 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 21789 var options = this.setupParams(helper, paramSize, params); 21790 options.loc = JSON.stringify(this.source.currentLocation); 21791 options = this.objectLiteral(options); 21792 if (useRegister) { 21793 this.useRegister('options'); 21794 params.push('options'); 21795 return ['options=', options]; 21796 } else if (params) { 21797 params.push(options); 21798 return ''; 21799 } else { 21800 return options; 21801 } 21802 } 21803 }; 21804 21805 (function () { 21806 var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); 21807 21808 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 21809 21810 for (var i = 0, l = reservedWords.length; i < l; i++) { 21811 compilerWords[reservedWords[i]] = true; 21812 } 21813 })(); 21814 21815 /** 21816 * @deprecated May be removed in the next major version 21817 */ 21818 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 21819 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 21820 }; 21821 21822 function strictLookup(requireTerminal, compiler, parts,
vendor: 4,006 bytes, lines 21822-21970
21822i, type) { 21823 var stack = compiler.popStack(), 21824 len = parts.length; 21825 if (requireTerminal) { 21826 len--; 21827 } 21828 21829 for (; i < len; i++) { 21830 stack = compiler.nameLookup(stack, parts[i], type); 21831 } 21832 21833 if (requireTerminal) { 21834 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; 21835 } else { 21836 return stack; 21837 } 21838 } 21839 21840 exports['default'] = JavaScriptCompiler; 21841 module.exports = exports['default']; 21842 21843/***/ }), 21844/* 92 */ 21845/***/ (function(module, exports, __webpack_require__) { 21846 21847 /* global define, require */ 21848 'use strict'; 21849 21850 var _Object$keys = __webpack_require__(60)['default']; 21851 21852 exports.__esModule = true; 21853 21854 var _utils = __webpack_require__(5); 21855 21856 var SourceNode = undefined; 21857 21858 try { 21859 /* istanbul ignore next */ 21860 if (false) { 21861 // We don't support this in AMD environments. For these environments, we assume that 21862 // they are running on the browser and thus have no need for the source-map library. 21863 var SourceMap = require('source-map'); 21864 SourceNode = SourceMap.SourceNode; 21865 } 21866 } catch (err) {} 21867 /* NOP */ 21868 21869 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 21870 if (!SourceNode) { 21871 SourceNode = function (line, column, srcFile, chunks) { 21872 this.src = ''; 21873 if (chunks) { 21874 this.add(chunks); 21875 } 21876 }; 21877 /* istanbul ignore next */ 21878 SourceNode.prototype = { 21879 add: function add(chunks) { 21880 if (_utils.isArray(chunks)) { 21881 chunks = chunks.join(''); 21882 } 21883 this.src += chunks; 21884 }, 21885 prepend: function prepend(chunks) { 21886 if (_utils.isArray(chunks)) { 21887 chunks = chunks.join(''); 21888 } 21889 this.src = chunks + this.src; 21890 }, 21891 toStringWithSourceMap: function toStringWithSourceMap() { 21892 return { code: this.toString() }; 21893 }, 21894 toString: function toString() { 21895 return this.src; 21896 } 21897 }; 21898 } 21899 21900 function castChunk(chunk, codeGen, loc) { 21901 if (_utils.isArray(chunk)) { 21902 var ret = []; 21903 21904 for (var i = 0, len = chunk.length; i < len; i++) { 21905 ret.push(codeGen.wrap(chunk[i], loc)); 21906 } 21907 return ret; 21908 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 21909 // Handle primitives that the SourceNode will throw up on 21910 return chunk + ''; 21911 } 21912 return chunk; 21913 } 21914 21915 function CodeGen(srcFile) { 21916 this.srcFile = srcFile; 21917 this.source = []; 21918 } 21919 21920 CodeGen.prototype = { 21921 isEmpty: function isEmpty() { 21922 return !this.source.length; 21923 }, 21924 prepend: function prepend(source, loc) { 21925 this.source.unshift(this.wrap(source, loc)); 21926 }, 21927 push: function push(source, loc) { 21928 this.source.push(this.wrap(source, loc)); 21929 }, 21930 21931 merge: function merge() { 21932 var source = this.empty(); 21933 this.each(function (line) { 21934 source.add([' ', line, '\n']); 21935 }); 21936 return source; 21937 }, 21938 21939 each: function each(iter) { 21940 for (var i = 0, len = this.source.length; i < len; i++) { 21941 iter(this.source[i]); 21942 } 21943 }, 21944 21945 empty: function empty() { 21946 var loc = this.currentLocation || { start: {} }; 21947 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 21948 }, 21949 wrap: function wrap(chunk) { 21950 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 21951 21952 if (chunk instanceof SourceNode) { 21953 return chunk; 21954 } 21955 21956 chunk = castChunk(chunk, this, loc); 21957 21958 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 21959 }, 21960 21961 functionCall: function functionCall(fn, type, params) { 21962 params = this.generateList(params); 21963 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 21964 }, 21965 21966 quotedString: function quotedString(str) { 21967 return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 21968 .replace(/\u2029/g, '\\u2029') + '"'; 21969 }, 21970
21971 objectLiteral: function objectLiteral(obj) { 21972 // istanbul ignore next 21973 21974 var _this = this; 21975 21976 var pairs = []; 21977 21978 _Object$keys(obj).forEach(function (key) { 21979 var value = castChunk(obj[key], _this); 21980 if (value !== 'undefined') { 21981 pairs.push([_this.quotedString(key), ':', value]); 21982 } 21983 }); 21984 21985 var ret = this.generateList(pairs); 21986 ret.prepend('{'); 21987 ret.add('}'); 21988 return ret; 21989 }, 21990 21991 generateList: function generateList(entries) { 21992 var ret = this.empty(); 21993 21994 for (var i = 0, len = entries.length; i < len; i++) { 21995 if (i) { 21996 ret.add(','); 21997 } 21998 21999 ret.add(castChunk(entries[i], this)); 22000 } 22001 22002 return ret; 22003 }, 22004 22005 generateArray: function generateArray(entries) { 22006 var ret = this.generateList(entries); 22007 ret.prepend('['); 22008 ret.add(']'); 22009 22010 return ret; 22011 } 22012 }; 22013 22014 exports['default'] = CodeGen; 22015 module.exports = exports['default']; 22016 22017/***/ }) 22018/******/ ]) 22019}); 22020; 22021$(document).ready(function () { 22022var directory = document.getElementsByClassName('directory'); 22023if(directory && directory.length > 0) { 22024 TapsMainRetails(); 22025 TapsBrowseType(); 22026 TapsTypeName(); 22027 TapsTypeCat(); 22028 TabsSelectFloor(); 22029 AccordionFloorPlan(); 22030 addActiveClass(); 22031 activateEnterButton("catSearch-text", "catSearchButton"); 22032 activateEnterButton("nameSearch-text","nameSearchButton"); 22033 } 22034}); 22035 22036function addActiveClass() { 22037 const element = document.querySelector('.mainBodyTabs .itemBodyTabs .floorTabs .itemFloorTitle'); 22038 if (element) { 22039 element.click(); 22040 } 22041} 22042 22043 22044$(window).on("load resize", function () { 22045 TapsTypeName(); 22046 TapsTypeCat(); 22047}); 22048 22049$(window).scroll(function(){ 22050 22051 var element = $(".mainDirectoryBrowseSec .browseBodyTabs"); 22052 22053 if (element.length) { 22054 var offsetTop = element.offset().top; 22055 if ($(this).scrollTop() > (offsetTop + 100)) { 22056 $('.mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody .filterBrowse').addClass('sticky'); 22057 } else { 22058 $('.mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody .filterBrowse').removeClass('sticky'); 22059 } 22060 } 22061 22062}); 22063 22064$(".mainDirectoryBrowseSec").on('click',".btn_view_detail", function () { 22065 updateModal(this); 22066 22067}); 22068 22069 22070 22071function TapsMainRetails() { 22072 $(".mainDirectoryBrowseSec .mainTitleTabs .itemTitleTab .tab").click(function () { 22073 $(".mainDirectoryBrowseSec .mainTitleTabs .itemTitleTab").removeClass("active"); 22074 $(this).parent().addClass("active"); 22075 updateRetail(this); 22076 22077 22078 }); 22079} 22080 22081function TapsBrowseType() { 22082 $(".mainDirectoryBrowseSec .browseTitleTabs .itemBrowseTitle .tab").click(function () { 22083 $(".mainDirectoryBrowseSec .browseTitleTabs .itemBrowseTitle").removeClass("active"); 22084 $(this).parent().addClass("active"); 22085 var clickedTabIndex = $(this).parent().index(); 22086 $(".mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody").removeClass("active"); 22087 $(".mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody:eq(" + clickedTabIndex + ")").addClass("active"); 22088 22089 $(".catResultBrowse .actionBrowse .btnBackResult.name").removeClass("name"); 22090 }); 22091 22092 $(".mainDirectoryBrowseSec .browseTitleTabs .ui.inline.dropdown").dropdown({ 22093 forceSelection: false, //***** 22094 direction: "downward", 22095 delay: { 22096 touch: 2000, 22097 }, 22098 onChange: function (value, text, $selectedItem) { 22099 var $item = $('.mainDirectoryBrowseSec .menu .item[data-text="' + text + '"]'); 22100 var selectedIndex = $item.data('index') 22101 $(".mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody").removeClass("active"); 22102 $(".mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody:eq(" + selectedIndex + ")").addClass("active"); 22103 22104 } 22105 }); 22106} 22107 22108function TapsTypeName() { 22109 var isInputVisible = false; 22110 widthFunction = $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseTitleTabs").width(); 22111 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton").width(widthFunction); 22112 $(".mainDirectoryBrowseSec .filterBrowse .btnSearchName").click(function () { 22113 widthTitle = $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseTitleTabs").width(); 22114 widthInput = $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseSearchInput").width(); 22115 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseSearchInput .fmBrowseSearch").val(""); 22116 if (!isInputVisible) { 22117 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton").width(widthInput); 22118 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseTitleTabs").removeClass("show"); 22119 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseSearchInput").addClass("show"); 22120 $(".mainDirectoryBrowseSec .browseName .filterBrowse .swiper-button-search-next").addClass("d-none"); 22121 $(".mainDirectoryBrowseSec .browseName .filterBrowse .swiper-button-search-prev").addClass("d-none"); 22122 $(".mainDirectoryBrowseSec .browseName .filterBrowse").addClass("fix"); 22123 22124 } else { 22125 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton").width(widthTitle); 22126 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseTitleTabs").addClass("show"); 22127 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseSearchInput").removeClass("show"); 22128 $(".mainDirectoryBrowseSec .browseName .filterBrowse .swiper-button-search-next").removeClass("d-none"); 22129 $(".mainDirectoryBrowseSec .browseName .filterBrowse .swiper-button-search-prev").removeClass("d-none"); 22130 $(".mainDirectoryBrowseSec .browseName .filterBrowse").removeClass("fix"); 22131 } 22132 isInputVisible = !isInputVisible; 22133 }); 22134 22135 22136 $(".mainDirectoryBrowseSec .filterBrowse .btnSearchClose").click(function () { 22137 widthTitle = $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseTitleTabs").width(); 22138 widthInput = $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseSearchInput").width(); 22139 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseSearchInput .fmBrowseSearch").val(""); 22140 if (isInputVisible) { 22141 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton").width(widthTitle); 22142 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseTitleTabs").addClass("show"); 22143 $(".mainDirectoryBrowseSec .browseName .filterBrowse .nameBrowseSearchFunciton .nameBrowseSearchInput").removeClass("show"); 22144 $(".mainDirectoryBrowseSec .browseName .filterBrowse .swiper-button-search-next").removeClass("d-none"); 22145 $(".mainDirectoryBrowseSec .browseName .filterBrowse .swiper-button-search-prev").removeClass("d-none"); 22146 $(".mainDirectoryBrowseSec .browseName .filterBrowse").removeClass("fix"); 22147 goToA(); 22148 } 22149 isInputVisible = !isInputVisible; 22150 }); 22151 22152 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseTitleTabs .itemNameBroWseTitle").click(function () { 22153 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultTitle").removeClass("active"); 22154 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .listContentBrowse").addClass("active"); 22155 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultBrowse").removeClass("active"); 22156 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseTitleTabs .itemNameBroWseTitle").removeClass("active"); 22157 $(this).addClass("active"); 22158 var clickedTabIndex = $(this).parent().index(); 22159 updateDirectory($(this).text().trim()); 22160 }); 22161 22162 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseSearchInput .btnSearchNameAgree").
22162click(function () { 22163 var searchString = $(this).siblings(".fmBrowseSearch").val(); 22164 if(searchString.trim() !== ""){ 22165 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .listContentBrowse").removeClass("active"); 22166 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultBrowse").addClass("active"); 22167 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultTitle").addClass("active"); 22168 searchAllShopByName(searchString) 22169 $(".browseName.active .searchResultTitle.active .titleSearch .descText>span").text(searchString); 22170 } 22171 }); 22172 22173 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultBrowse .btnBackResult").click(function () { 22174 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .listContentBrowse").addClass("active"); 22175 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultBrowse").removeClass("active"); 22176 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseSearchInput .fmBrowseSearch").val(""); 22177 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .searchResultTitle").removeClass("active"); 22178 22179 }); 22180} 22181 22182function TapsTypeCat() { 22183 var isInputVisible = false; 22184 widthFunction = $(".mainDirectoryBrowseSec .browseCategories .filterBrowse .catBrowseSearchFunciton .catBrowseTitleTabs").width(); 22185 $(".mainDirectoryBrowseSec .browseCategories .filterBrowse .catBrowseSearchFunciton").width(widthFunction); 22186 22187 $(".mainDirectoryBrowseSec .browseCategories .filterBrowse .btnSearchCat").click(function () { 22188 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse").removeClass("active"); 22189 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultBrowse").addClass("active"); 22190 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultTitle").addClass("active"); 22191 }); 22192 22193 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse .itemImgBrowse .boxImgBrowse").click(function () { 22194 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse").removeClass("active"); 22195 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .filterBrowse").addClass("d-none"); 22196 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .catResultBrowse").addClass("active"); 22197 var cat = $(this).data("tag"); 22198 setAllShopByCategory(cat); 22199 $(".catResultBrowse .titleCatResult h3.titleText").text($(this).find(".boxItem .boxContent p.subText").text()); 22200 }); 22201 22202 $(".browseBodyTabs").on("click",".contentBrowse .itemContent .boxContent .textContent .tags .innerTag .itemTag .tag a",function (e) { 22203 e.preventDefault(); 22204 clickTag(this); 22205 }); 22206 22207 22208 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .catResultBrowse .btnBackResult").click(function () { 22209 if(!$(this).hasClass("name")){ 22210 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse").addClass("active"); 22211 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .catResultBrowse").removeClass("active"); 22212 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .filterBrowse").removeClass("d-none"); 22213 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .filterBrowse .catBrowseSearchInput .fmBrowseSearch").val(""); 22214 } else { 22215 var currentActiveTab = $(".browseTitleTabs .itemBrowseTitle.active"); 22216 $(".browseTitleTabs .itemBrowseTitle:not(.active)").addClass("active"); 22217 currentActiveTab.removeClass("active"); 22218 22219 var curTabBody = $(".mainDirectoryBrowseSec .browseBodyTabs .itemBrowseBody.browseCategories"); 22220 curTabBody.removeClass("active"); 22221 $(".browseBodyTabs .browseName").addClass("active"); 22222 $(".catResultBrowse .actionBrowse .btnBackResult.name").removeClass("name"); 22223 } 22224 }); 22225 22226 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .filterBrowse .catBrowseSearchInput .btnSearchNameAgree").
22226click(function () { 22227 var searchString = $(this).siblings(".fmBrowseSearch").val(); 22228 if(searchString.trim() !== ""){ 22229 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse").removeClass("active"); 22230 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultBrowse").addClass("active"); 22231 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultTitle").addClass("active"); 22232 22233 searchAllShopByCategory(searchString); 22234 $(".browseCategories.active .searchResultTitle.active .titleSearch .descText>span").text(searchString); 22235 } 22236 22237 }); 22238 22239 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultBrowse .btnBackResult").click(function () { 22240 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse").addClass("active"); 22241 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultBrowse").removeClass("active"); 22242 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .filterBrowse .catBrowseSearchInput .fmBrowseSearch").val(""); 22243 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .searchResultTitle").removeClass("active"); 22244 }); 22245} 22246 22247function AccordionFloorPlan() { 22248 var accordions = $('.mainDirectoryBrowseSec .itemFloorBody .ui.accordion'); 22249 $(accordions).accordion(); 22250} 22251 22252function TabsSelectFloor() { 22253 $(".mainDirectoryBrowseSec .floorTitleTabs .itemFloorTitle").click(function () { 22254 $(".mainDirectoryBrowseSec .floorTitleTabs .itemFloorTitle").removeClass("active"); 22255 $(this).addClass("active"); 22256 var clickedTabIndex = $(this).index(); 22257 $(".mainDirectoryBrowseSec .floorBodyTabs .itemFloorBody").removeClass("active"); 22258 $(".mainDirectoryBrowseSec .floorBodyTabs .itemFloorBody:eq(" + clickedTabIndex + ")").addClass("active"); 22259 $(".mainDirectoryBrowseSec .floorBodyTabs .itemFloorBody.active .ui.accordion .title:eq('0')").addClass("active"); 22260 $(".mainDirectoryBrowseSec .floorBodyTabs .itemFloorBody.active .ui.accordion .content:eq('0')").addClass("active"); 22261 }); 22262} 22263 22264$(".mainDirectoryBrowseSec .floorBodyTabs .itemFloorBody .boxImg .btnViewFull").click(function () { 22265 var content = $(this).find(".container-custom-container").html(); 22266 $('.ui.modal.modalFloorZoom .contentModal .container').html(content); 22267 $('.ui.modal.modalFloorZoom').modal('show'); 22268 new Zoomist('.modalFloorZoom .zoomist-container', { 22269 maxScale: 4, 22270 bounds: true, 22271 slider: true, 22272 zoomer: true 22273 }); 22274}); 22275 22276var nameBrowseTitleSwiperObj = $(".nameBrowseTitleSwiper"); 22277if(nameBrowseTitleSwiperObj && nameBrowseTitleSwiperObj.length > 0){ 22278 var nameBrowseTitleSwiper = new Swiper(".nameBrowseTitleSwiper", { 22279 slidesPerView: "auto", 22280 spaceBetween: 0, 22281 slidesPerGroup: 1, 22282 resizeObserver:!($("body").data('custom-mode') == "edit"), 22283 speed: 500, 22284 breakpoints: { 22285 1200: { 22286 slidesPerView: "auto", 22287 spaceBetween: 0, 22288 slidesPerGroup: 1, 22289 navigation: { 22290 nextEl: ".swiper-button-search-next", 22291 prevEl: ".swiper-button-search-prev", 22292 }, 22293 }, 22294 992: { 22295 slidesPerView: 20, 22296 spaceBetween: 0, 22297 slidesPerGroup: 3, 22298 navigation: { 22299 nextEl: ".swiper-button-search-next", 22300 prevEl: ".swiper-button-search-prev", 22301 }, 22302 }, 22303 768: { 22304 slidesPerView: 15, 22305 spaceBetween: 0, 22306 slidesPerGroup: 3, 22307 navigation: { 22308 nextEl: ".swiper-button-search-next", 22309 prevEl: ".swiper-button-search-prev", 22310 }, 22311 }, 22312 250: { 22313 slidesPerView: "auto", 22314 spaceBetween: 0, 22315 slidesPerGroup: 3, 22316 navigation: { 22317 nextEl: ".swiper-button-search-next", 22318 prevEl: ".swiper-button-search-prev", 22319 }, 22320 } 22321 } 22322 }); 22323} 22324 22325 22326var dataResult; 22327var directoryList; 22328$(document).ready(function(){ 22329 22330 var path = $(".default") ? $(".default").data("path") : ''; 22331 22332 if(path){ 22333 $.ajax({ 22334 url: path+".model.json", 22335 success: function(result){ 22336 $("#div1").html(result); 22337 dataResult = result; 22338 22339 directoryList = dataResult.directoryList; 22340 setAllShopByName('A'); 22341 loadCategorySearch(); 22342 } 22343 }); 22344 } 22345 22346 22347}); 22348 22349function updateRetail(that){ 22350 var all = $(that).hasClass("default"); 22351 if(all){ 22352 directoryList = dataResult.directoryList; 22353 }else{ 22354 directoryList = setRetailDirectory(that); 22355 } 22356 22357 goToA(); 22358} 22359 22360function goToA(){ 22361 $(".mainDirectoryBrowseSec .browseBodyTabs .browseName .filterBrowse .nameBrowseTitleTabs .itemNameBroWseTitle p:contains('A')").click(); 22362} 22363 22364/** 22365Shops By Name 22366**/ 22367 22368function setAllShopByName(startWithChar){ 22369 if(dataResult){ 22370 var shopList = []; 22371 var slist = {}; 22372 if(!startWithChar){ 22373 startWithChar = 'A'; 22374 } 22375 22376 $.each(directoryList, function(i, item) { 22377 if(startWithChar !== '#') { 22378 var shops = $.grep( 22379 item.shopList, function( n, i ) { 22380 return n.heading.toLowerCase().startsWith(startWithChar.toLowerCase()); 22381 }); 22382 } else { 22383 var shops = $.grep( 22384 item.shopList, function( n, i ) { 22385 return !/^[a-zA-Z]/.test(n.heading.charAt(0)); 22386 }); 22387 } 22388 shopList = shopList.concat(shops); 22389 22390 }); 22391 console.log("ShopList"); 22392 console.log(shopList); 22393 slist.shopList = sortItemList(shopList); 22394 if(shopList.length > 0){ 22395 $(".browseName .listContentBrowse.active .itemContentBrowse.active .contentBrowse").html(applyHandleBar("itemContent-template",slist)); 22396 } else { 22397 $(".browseName .listContentBrowse.active .itemContentBrowse.active .contentBrowse").html($("#no-result").html()); 22398 } 22399 } 22400 22401} 22402 22403function searchAllShopByName(searchString){ 22404 if(dataResult && searchString){ 22405 var shopList = []; 22406 var slist = {}; 22407 22408 $.each(directoryList, function(i, item) { 22409 var shops = $.grep( 22410 item.shopList, function( n, i ) { 22411 return n.heading.toLowerCase().startsWith(searchString.toLowerCase()); 22412 }); 22413 shopList = shopList.concat(shops); 22414 22415 }); 22416 slist.shopList = sortItemList(shopList); 22417 if(shopList.length > 0){ 22418 $(".browseName.active .searchResultBrowse.active .contentBrowse").html(applyHandleBar("itemContent-template",slist)); 22419 } else { 22420 $(".browseName.active .searchResultBrowse.active .contentBrowse").html($("#no-result").html()); 22421 } 22422 } 22423 22424} 22425 22426function applyHandleBar(id,json){ 22427 var template = $("#"+id).html(); 22428 const templateFunction = Handlebars.compile(template); 22429 const htmlStr = templateFunction(json); 22430 return htmlStr; 22431} 22432function updateDirectory(startWithChar){ 22433 $("#alpha").text(startWithChar); 22434 setAllShopByName(startWithChar) 22435} 22436 22437function setRetailDirectory(that){ 22438 var path = $(that).data("path"); 22439 return $.grep(dataResult.directoryList, function( n, i ) { 22440 return n.currentResourcePath === path; 22441 }); 22442} 22443 22444function updateModal(that){ 22445 22446 var url = $(that).data("path"); 22447 22448 if(url){ 22449 url = url + ".html"; 22450 $.get( url, function( data ) { 22451 var modalElem = $('#directoryModal') 22452 modalElem.addClass('bgThemeWhite'); 22453 modalElem.html(data); 22454 $('.ui.modal.modalDirectoryDetail').modal('show'); 22455 }); 22456 } 22457 22458} 22459 22460function sortItemList(sl){ 22461 return sl.sort((a, b) => (a.heading.toLowerCase() > b.heading.toLowerCase() ? 1 : -1)); 22462} 22463 22464function getParameterByName(name) { 22465 var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); 22466 return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); 22467} 22468 22469function loadCategorySearch(){ 22470 var cat = getParameterByName("cat"); 22471 if(cat){ 22472 $(".browseTitleTabs .itemBrowseTitle .tab").click(); 22473 $(".boxImgBrowse[data-tag='"+cat+"']").click(); 22474 } 22475} 22476//catResultBrowse 22477 22478function setAllShopByCategory(category){ 22479 if(dataResult && category){ 22480 var shopList = []; 22481 var slist = {}; 22482 22483 if(category.toLowerCase() === 'other'){ 22484 shopList = otherCategorySearch(directoryList,shopList); 22485 }else{ 22486 $.each(directoryList, function(i, item) { 22487 var shops = $.grep( 22488 item.shopList, function( n, i ) { 22489 return n.shopTags.includes(category); 22490 }); 22491 shopList = shopList.concat(shops); 22492 22493 }); 22494 } 22495 console.log("ShopList"); 22496 slist.shopList = sortItemList(shopList); 22497 22498 if(shopList.length > 0) { 22499 $(".catResultBrowse.active .contentBrowse").html(applyHandleBar("itemContent-template",slist)); 22500 } else { 22501 $(".catResultBrowse.active .contentBrowse").html($("#no-result").html()); 22502 } 22503 } 22504 22505} 22506 22507 22508function searchAllShopByCategory(searchString){ 22509 if(dataResult && searchString){ 22510 var shopList = []; 22511 var slist = {}; 22512 22513 $.each(directoryList, function(i, item) { 22514 var shops = $.grep( 22515 item.shopList, function( n, i ) { 22516 return n.heading.toLowerCase().includes(searchString.toLowerCase()) || n.subHeading.toLowerCase().includes(searchString.toLowerCase()); 22517 }); 22518 shopList = shopList.concat(shops); 22519 22520 }); 22521 slist.shopList = sortItemList(shopList); 22522 if(shopList.length > 0) { 22523 $(".browseCategories.active .searchResultBrowse.active .contentBrowse").html(applyHandleBar("itemContent-template",slist)); 22524 } else { 22525 $(".browseCategories.active .searchResultBrowse.active .contentBrowse").html($("#no-result").html()); 22526 } 22527 } 22528 22529} 22530 22531function allConfiguredCat(){ 22532 var confCat = []; 22533 $(".innerContentImgBrowse .itemImgBrowse .boxImgBrowse").each(function(){ 22534 if($(this).data('tag').toLowerCase() !== 'other'){ 22535 confCat.push($(this).data('tag')); 22536 } 22537 }); 22538 return confCat; 22539} 22540 22541function otherCategorySearch(directoryList,shopList){ 22542 22543 var confCat = allConfiguredCat(); 22544 22545 $.each(directoryList, function(i, item) { 22546 var shops = $.grep( 22547 item.shopList, function( n, i ) { 22548 return notMatchesAny(confCat, n.shopTags); 22549 }); 22550 shopList = shopList.concat(shops); 22551 22552 }); 22553 22554 return shopList; 22555} 22556function notMatchesAny(a1,a2){ 22557 for(let a in a2){ 22558 if(a1.includes(a2[a])){ 22559 return false;
22560 } 22561 } 22562 return true; 22563} 22564 22565function isOther(searchString){ 22566 var confCat = allConfiguredCat(); 22567 return !confCat.includes(searchString); 22568} 22569 22570function clickTag(that){ 22571 var cat = $(that).data("tag"); 22572 if(cat){ 22573 $(".browseTitleTabs .itemBrowseTitle .tab").click(); 22574 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .listContentBrowse").removeClass("active"); 22575 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .filterBrowse").addClass("d-none"); 22576 $(".mainDirectoryBrowseSec .browseBodyTabs .browseCategories .catResultBrowse").addClass("active"); 22577 setAllShopByCategory(cat); 22578 $(".catResultBrowse .actionBrowse .btnBackResult").addClass("name"); 22579 $(".catResultBrowse .titleCatResult h3.titleText").text($(that).text()); 22580 } 22581} 22582 22583$(document).ready(function () { 22584 var sectionmainLifeSec = document.getElementsByClassName('mainLifeSec'); 22585 if (sectionmainLifeSec && sectionmainLifeSec.length > 0) { 22586 fixSpaceMainLifeSec(); 22587 } 22588}); 22589 22590$(window).on("load resize", function () { 22591 fixSpaceMainLifeSec(); 22592}); 22593 22594function fixSpaceMainLifeSec() { 22595 $(".mainLifeSec .lifeSwiper").css("padding-right", $(".container.custom-container").offset().left + 15); 22596 $(".mainLifeSec .lifeSwiper").css("padding-left", $(".container.custom-container").offset().left + 15); 22597} 22598 22599var lifeSwiper = new Swiper(".lifeSwiper", { 22600 spaceBetween: 20, 22601 speed: 500, 22602 resizeObserver:!($("body").data('custom-mode') == "edit"), 22603 pagination: { 22604 el: '.swiper-pagination', 22605 clickable: true, 22606 }, 22607 breakpoints: { 22608 1480: { 22609 slidesPerView: 1.4, 22610 spaceBetween: 20, 22611 centeredSlides: false, 22612 slidesPerGroup: 1, 22613 }, 22614 768: { 22615 slidesPerView: 1, 22616 spaceBetween: 20, 22617 centeredSlides: false, 22618 slidesPerGroup: 1, 22619 }, 22620 250: { 22621 slidesPerView: 1.1, 22622 spaceBetween: 10, 22623 slidesPerGroup: 1, 22624 centeredSlides: true, 22625 } 22626 } 22627}); 22628$(document).ready(function () { 22629 var sectionmainDeliveringContentSec = document.getElementsByClassName('mainDeliveringContentSec'); 22630 if (sectionmainDeliveringContentSec && sectionmainDeliveringContentSec.length > 0) { 22631 FixHeight(); 22632 } 22633}); 22634 22635$(window).on("load resize", function () { 22636 FixHeight(); 22637}); 22638 22639function FixHeight() { 22640 var heightDesc = $(".mainDeliveringContentSec .headlineSec .desc").innerHeight() + 10 22641 $(".mainDeliveringContentSec .listIconContent").css("margin-top", -heightDesc); 22642} 22643$(document).ready(function () { 22644 var contentCarouselsWithTabs = document.getElementsByClassName('mainExperienceSec'); 22645 if (contentCarouselsWithTabs && contentCarouselsWithTabs.length > 0) { 22646 $('.mainExperienceSec').each(function (index, section) { 22647 var experienceSwipers = []; 22648 22649 $(section).find('.experienceSwiper').each(function (i, element) { 22650 var swiper = new Swiper(element, { 22651 spaceBetween: 20, 22652 speed: 500, 22653 resizeObserver:!($("body").data('custom-mode') == "edit"), 22654 pagination: { 22655 el: $(element).find('.swiper-pagination')[0], 22656 clickable: true, 22657 }, 22658 breakpoints: { 22659 992: { 22660 slidesPerView: 3, 22661 spaceBetween: 20, 22662 centeredSlides: false, 22663 slidesPerGroup: 3, 22664 }, 22665 768: { 22666 slidesPerView: 2, 22667 spaceBetween: 20, 22668 centeredSlides: false, 22669 slidesPerGroup: 2, 22670 }, 22671 540: { 22672 slidesPerView: 2, 22673 spaceBetween: 10, 22674 centeredSlides: false, 22675 slidesPerGroup: 2, 22676 }, 22677 250: { 22678 slidesPerView: 1.1, 22679 spaceBetween: 10, 22680 slidesPerGroup: 1, 22681 centeredSlides: true, 22682 } 22683 } 22684 }); 22685 experienceSwipers.push(swiper); 22686 }); 22687 22688 $(section).find('.tabsExperience .tabsMenu .item').tab({ 22689 context: $(section) 22690 }); 22691 22692 $(section).find('.tabsExperience .tabsMenu .item').on('click', function () { 22693 $(section).find('.tabsExperience .tabsMenu .item').removeClass('active'); 22694 $(this).addClass('active');
22695 experienceSwipers.forEach(function (swiper) { 22696 swiper.slideTo(0); 22697 }); 22698 }); 22699 22700 $(section).find(".selectMenu .ui.inline.dropdown").dropdown({ 22701 forceSelection: false, //***** 22702 direction: "downward", 22703 delay: { 22704 touch: 0, 22705 }, 22706 onShow: function () { 22707 $(section).find(".ui.inline.dropdown").not(this).dropdown('hide'); 22708 } 22709 }); 22710 22711 var tabsTitleExperienceSwiper = new Swiper($(section).find(".tabsTitleExperienceSwiper")[0], { 22712 slidesPerView: "auto", 22713 spaceBetween: 0, 22714 slidesPerGroup: 1, 22715 speed: 500, 22716 navigation: { 22717 nextEl: $(section).find(".swiper-button-title-next")[0], 22718 prevEl: $(section).find(".swiper-button-title-prev")[0], 22719 }, 22720 }); 22721 }); 22722 22723} 22724}); 22725 22726 22727$(document).ready(function () {
22728 $('.mainTapsJourneySec').each(function (index, section) { 22729 22730 var tabsTitleJourneySwiper = new Swiper($(section).find(".tabsTitleJourneySwiper")[0], { 22731 slidesPerView: "auto", 22732 spaceBetween: 0, 22733 slidesPerGroup: 1, 22734 speed: 500, 22735 navigation: { 22736 nextEl: $(section).find(".swiper-button-title-next")[0], 22737 prevEl: $(section).find(".swiper-button-title-prev")[0], 22738 }, 22739 }); 22740 22741 $(section).find('.tabsJourney .menu .item').tab({ 22742 context: $(section) 22743 }); 22744 22745 $(section).find('.tabsJourney .menu .item').on('click', function () { 22746 $(section).find('.tabsJourney .menu .item').removeClass('active'); 22747 $(this).addClass('active'); 22748 }); 22749 22750 $(section).find(".selectMenu .ui.inline.dropdown").dropdown({ 22751 forceSelection: false, //***** 22752 direction: "downward", 22753 delay: { 22754 touch: 0, 22755 }, 22756 onShow: function () { 22757 $(section).find(".ui.inline.dropdown").not(this).dropdown('hide'); 22758 } 22759 }); 22760 }); 22761}); 22762 22763 22764$(document).ready(function () { 22765 22766 var careerBannerSection = document.getElementsByClassName('mainOurPeopleSec'); 22767 if (careerBannerSection && careerBannerSection.length > 0) { 22768 22769 fixSpaceMainOurPeopleSec(); 22770 initializeOurPeopleSwiper(); 22771 autoPlayVideo(); 22772 22773 var maxCharsTitle = 110; 22774 var maxCharsDesc = 105; 22775 22776 $('.mainOurPeopleSec .ourPeopleSlide .swiper-slide .slideContent .content .titleText').each(function () { 22777 var textTitle = $(this).text(); 22778 if (textTitle.length > maxCharsTitle) { 22779 var truncatedText = textTitle.substring(0, maxCharsTitle); 22780 $(this).text(truncatedText); 22781 } 22782 }); 22783 22784 $('.mainOurPeopleSec .ourPeopleSlide .swiper-slide .slideContent .content .descText').each(function () { 22785 var textDetail = $(this).text(); 22786 if (textDetail.length > maxCharsDesc) { 22787 var truncatedText = textDetail.substring(0, maxCharsDesc); 22788 $(this).text(truncatedText); 22789 } 22790 }); 22791 22792 $(window).on("scroll", function () { 22793 PauseVideo(); 22794 }); 22795 22796 let resizeTimeout; 22797 $(window).on("load resize", function () { 22798 clearTimeout(resizeTimeout); 22799 resizeTimeout = setTimeout(function () { 22800 fixSpaceMainOurPeopleSec(); 22801 }, 100); // debounce resize 22802 }); 22803 } 22804}); 22805 22806function fixSpaceMainOurPeopleSec() { 22807 22808 var offsetContainer = $(".container.custom-container").offset().left; 22809 22810 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 22811 var arrowPo1 = 95; 22812 var arrowPo2 = 10; 22813 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 22814 var arrowPo1 = 80; 22815 var arrowPo2 = 30; 22816 } 22817 22818 if (offsetContainer < 85) { 22819 $(".mainOurPeopleSec .ourPeopleSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo2); 22820 $(".mainOurPeopleSec .ourPeopleSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo2); 22821 $(".mainOurPeopleSec .ourPeopleSwiper .swiper-slide .slideContent .content").addClass("fixSpace"); 22822 } else { 22823 $(".mainOurPeopleSec .ourPeopleSwiper .swiper-button-prev").css("margin-left", $(".container.custom-container").offset().left - arrowPo1); 22824 $(".mainOurPeopleSec .ourPeopleSwiper .swiper-button-next").css("margin-right", $(".container.custom-container").offset().left - arrowPo1); 22825 $(".mainOurPeopleSec .ourPeopleSwiper .swiper-slide .slideContent .content").removeClass("fixSpace"); 22826 } 22827 22828} 22829 22830function initializeOurPeopleSwiper() { 22831 22832 document.querySelectorAll('.mainOurPeopleSec').forEach(section => { 22833 const swipers = section.querySelectorAll('.ourPeopleSwiper'); 22834 22835 swipers.forEach(swiperElement => { 22836 // Avoid reinitializing if already exists 22837 if (swiperElement.swiper) { 22838 return; 22839 } 22840 22841 let autoplayvariable; 22842 const autoPlayDelay = swiperElement.getAttribute('data-autoplay-delay') || 5000; 22843 const disableOnInteraction = swiperElement.getAttribute('data-disable-on-interaction') === 'true'; 22844 22845 if (disableOnInteraction) { 22846 autoplayvariable = { 22847 delay: parseInt(autoPlayDelay), 22848 disableOnInteraction: disableOnInteraction 22849 }; 22850 } else { 22851 autoplayvariable = false;
22852 } 22853 22854 const swiper = new Swiper(swiperElement, { 22855 loop: true, 22856 effect: "fade", 22857 speed: 1000, 22858 resizeObserver: !($("body").data('custom-mode') == "edit"), 22859 pagination: { 22860 el: '.swiper-pagination', 22861 clickable: true, 22862 renderBullet: function (index, className) { 22863 return '<div class="' + className + '">' + 22864 '<div class="c-progress c-progress-' + (index + 1) + '">' + 22865 '<div class="c-in"></div></div>' + 22866 "</div>"; 22867 }, 22868 }, 22869 autoplay: autoplayvariable, 22870 navigation: { 22871 nextEl: ".swiper-button-next", 22872 prevEl: ".swiper-button-prev", 22873 }, 22874 }); 22875 22876 swiper.on('slideChangeTransitionEnd', function () { 22877 autoPlayVideo(swiper, section); 22878 if (!disableOnInteraction) { 22879 swiper.autoplay.stop(); 22880 } 22881 }); 22882 }); 22883 }); 22884} 22885 22886 22887function autoPlayVideo(swiper, section) { 22888 if (swiper && swiper.slides && swiper.slides.length > 0 && swiper.activeIndex !== undefined) { 22889 const currentSlide = swiper.slides[swiper.activeIndex]; 22890 22891 // Pause and reset all videos on other slides 22892 const allVideos = section.querySelectorAll('video'); 22893 allVideos.forEach(video => { 22894 video.pause(); 22895 video.currentTime = 0; 22896 }); 22897 22898 // Handle the video on the active slide 22899 const activeVideo = currentSlide.querySelector('video'); 22900 if (activeVideo) { 22901 swiper.autoplay.stop(); // Stop Swiper autoplay when a video is present 22902 activeVideo.play(); 22903 22904 activeVideo.addEventListener('play', function () { 22905 swiper.autoplay.stop(); // Ensure autoplay remains stopped while the video is playing 22906 }); 22907 22908 activeVideo.addEventListener('ended', function () { 22909 if (swiper.params.autoplay.enabled) { 22910 swiper.autoplay.start(); // Resume Swiper autoplay if it's enabled 22911 swiper.slideNext(); // Move to the next slide 22912 } 22913 }); 22914 22915 activeVideo.addEventListener('pause', function () { 22916 if (!activeVideo.ended) { 22917 swiper.autoplay.stop(); // Keep Swiper autoplay stopped if video is paused 22918 } 22919 }); 22920 } else { 22921 if (swiper.params.autoplay.enabled) { 22922 swiper.autoplay.start(); // Resume autoplay if there is no video on the current slide 22923 } 22924 } 22925 } 22926} 22927 22928function PauseVideo() { 22929 document.querySelectorAll('.mainOurPeopleSec').forEach(section => { 22930 const mainBanner = section; 22931 const allVideos = mainBanner.getElementsByTagName("video"); 22932 const offsetTop = mainBanner.offsetTop; 22933 const scrollPosition = window.pageYOffset; 22934 const elementHeight = mainBanner.offsetHeight - 150; 22935 22936 for (let i = 0; i < allVideos.length; i++) { 22937 if (scrollPosition > (offsetTop - 100) && scrollPosition < offsetTop + elementHeight) { 22938 allVideos[i].play().catch(error => { 22939 console.log(error); 22940 }); 22941 } else { 22942 allVideos[i].pause(); 22943 } 22944 } 22945 }); 22946} 22947 22948'use strict' 22949 22950function TagMore() { 22951 var itemMediaDefault = $('.mainListMediaSec .itemMedia').width() - 40; 22952 $('.mainListMediaSec .itemMedia').each(function () { 22953 var totalItemTagWidth = 0; 22954 $(this).find('.tags .itemTag').each(function () { 22955 var itemTagWidth = $(this).innerWidth(); 22956 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 22957 totalItemTagWidth += itemTagWidth; 22958 } else { 22959 $(this).addClass('d-none'); 22960 $(this).siblings(".itemTagMore").addClass('d-block'); 22961 } 22962 }); 22963 }); 22964 // console.log(itemMediaDefault) 22965} 22966 22967 22968const onListingFilter = new Event('onFilterChanged') 22969const onPageGoToTop = true 22970 22971const CONTENT_CONFIG_Blog = { 22972 maximumItemPerPage: 9, 22973} 22974 22975let CONTENT_LISTING_Blog = { 22976 page: { 22977 yearfilter: null, 22978 monthfilter: null, 22979 tagfilter: null, 22980 searchString: null, 22981 sorteddate: null, 22982 currentFilter: null, 22983 filterKey: null, 22984 currentPage: 0, 22985 offset: 0, 22986 data: [], 22987 showing: { 22988 start: 0, 22989 end: CONTENT_CONFIG_Blog.maximumItemPerPage - 1, 22990 }, 22991 }, 22992} 22993 22994let FILTERED_CONTENT_LISTING_Blog = { 22995 page: { 22996 yearfilter: null, 22997 monthfilter: null, 22998 tagfilter: null, 22999 searchString: null, 23000 currentFilter: null, 23001 filterKey: null, 23002 currentPage: 0, 23003 offset: 0, 23004 data: [], 23005 showing: { 23006 start: 0, 23007 end: CONTENT_CONFIG_Blog.maximumItemPerPage - 1, 23008 }, 23009 }, 23010} 23011 23012function updateDivStylesBlog() { 23013 var innerDivs = document.querySelectorAll('div.inner'); 23014 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 23015 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 23016
23017 innerDivs.forEach(function (div) { 23018 div.style.display = 'none'; 23019 }); 23020 23021 paginationMediaDivs.forEach(function (div) { 23022 div.style.display = 'none'; 23023 }); 23024 23025 boxNotFoundDivs.forEach(function (div) { 23026 div.classList.remove("hidden"); 23027 div.style.display = 'block'; 23028 }); 23029} 23030function reverseDivStylesblog() { 23031 var innerDivs = document.querySelectorAll('div.inner'); 23032 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 23033 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 23034 23035 innerDivs.forEach(function (div) { 23036 div.style.display = 'flex'; 23037 }); 23038 23039 paginationMediaDivs.forEach(function (div) { 23040 div.style.display = 'block'; 23041 }); 23042 23043 boxNotFoundDivs.forEach(function (div) { 23044 div.style.display = 'none'; 23045 }); 23046} 23047 23048// Sort function 23049function sortByDateBlog(data, order) { 23050 return data.sort((a, b) => { 23051 const dateA = new Date(a.sortedFormattedDate); 23052 const dateB = new Date(b.sortedFormattedDate); 23053 if (order === "asc") { 23054 return dateA - dateB; 23055 } else if (order === "dsc") { 23056 return dateB - dateA; 23057 } 23058 }); 23059} 23060 23061 23062const generateMonthDropdownFilterBlog = (name, value, formattedFilteredMonth, active = false) => { 23063 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 23064 ${formattedFilteredMonth} 23065 </div>` 23066 return htmlToElement(item) 23067} 23068 23069const generateDropdownFilterBlog = (name, value, active = false) => { 23070 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 23071 ${name} 23072 </div>` 23073 return htmlToElement(item) 23074} 23075 23076const resetPagePaginationBlog = (activePage = null) => { 23077console.log(" reset Page Pagination Blog "); 23078 if (activePage !== null) { 23079 FILTERED_CONTENT_LISTING_Blog.page.currentPage = activePage 23080 } 23081 23082 const paginationDots = document.querySelector('.pagination--dots') 23083 const config = CONTENT_LISTING_Blog.page 23084 23085 var testone = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value'); 23086 var testtwo = document.querySelector(' .custom-dropdown__opt-sort .item.active').getAttribute('data-option-value'); 23087 var testthree = document.getElementById('searchterm').value; 23088 23089 const filteredDataTag = _.filter(config.data, (item) => { 23090 if (config.tagfilter === null || config.tagfilter === 'Categories') { 23091 return true; 23092 } else { 23093 return item.tags.includes(config.tagfilter); 23094 } 23095 }); 23096 23097 const filteredDataSearch = testthree ? _.filter(filteredDataTag, (item) => { 23098 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(testthree.toLowerCase())); 23099 }) : filteredDataTag; 23100 23101 const filteredData = sortByDateBlog(filteredDataSearch, CONTENT_LISTING_Blog.page.sorteddate); 23102 23103 // const filteredData = config.data 23104 23105 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Blog.maximumItemPerPage) 23106 23107 const fragment = document.createDocumentFragment() 23108 23109 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 23110 23111 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 23112 23113 let currentActiveDot = null 23114 _.forEach(getChildNodes(paginationDots), (item, index) => { 23115 if (item.classList.contains('active')) { 23116 currentActiveDot = index 23117 } 23118 item.remove() 23119 }) 23120 23121 let newActiveDot = null 23122 23123 _.times(_.size(dataChunk), (index) => { 23124 if (_.size(dataChunk) > 1) { 23125 const node = document.createElement('a'); 23126 node.innerText = index + 1; // Adding 1 to index since index starts from 0 23127 if (index === config.currentPage) { 23128 node.classList.add('active'); 23129 newActiveDot = index; 23130 } 23131 node.addEventListener('click', () => { 23132 23133 23134 reRenderPageContentBlog({ 23135 page: index 23136 }); 23137 onPageGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }); 23138 }); 23139 fragment.appendChild(node); 23140 23141 } else { 23142 document.querySelector(".paginationMedia").style.display = "none"; 23143 } 23144 }); 23145 23146 23147 paginationDots.appendChild(fragment) 23148 normalizePagination(currentActiveDot, newActiveDot) 23149 23150 if (config.currentPage > 0) { 23151 prevBtn.classList.remove('disabled') 23152 } else { 23153 prevBtn.classList.add('disabled') 23154 } 23155 23156 if (config.currentPage < _.size(dataChunk) - 1) { 23157 nextBtn.classList.remove('disabled') 23158 } else { 23159 nextBtn.classList.add('disabled') 23160 } 23161 let requestUpdatePagination = new Event('requestUpdatePagination') 23162 document.dispatchEvent(requestUpdatePagination) 23163 updatePagination(); 23164} 23165 23166const setPagePaginationBlog = (activePage = null) => { 23167console.log(" setPagePaginationBlog Page Pagination Blog "); 23168 if (activePage !== null) { 23169 23170 CONTENT_LISTING_Blog.page.currentPage = activePage 23171 } 23172 23173 const paginationDots = document.querySelector('.pagination--dots') 23174 const config = CONTENT_LISTING_Blog.page 23175 var testone = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value'); 23176 var testtwo = document.querySelector(' .custom-dropdown__opt-sort .item.active').getAttribute('data-option-value'); 23177 var testthree = document.getElementById('searchterm').value; 23178 23179 const filteredDataTag = _.filter(config.data, (item) => { 23180 if (config.tagfilter === null || config.tagfilter === 'Categories') { 23181 return true; 23182 } else { 23183 return item.tags.includes(config.tagfilter); 23184 } 23185 }); 23186 23187 const filteredDataSearch = testthree ? _.filter(filteredDataTag, (item) => { 23188 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(testthree.toLowerCase())); 23189 }) : filteredDataTag; 23190 23191 const filteredData = sortByDateBlog(filteredDataSearch, CONTENT_LISTING_Blog.page.sorteddate); 23192 23193 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Blog.maximumItemPerPage) 23194 23195 const fragment = document.createDocumentFragment() 23196 23197 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 23198 23199 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 23200
23201 let currentActiveDot = null 23202 23203 _.forEach(getChildNodes(paginationDots), (item, index) => { 23204 if (item.classList.contains('active')) { 23205 currentActiveDot = index 23206 } 23207 item.remove() 23208 }) 23209 23210 let newActiveDot = null 23211 23212 _.times(_.size(dataChunk), (index) => { 23213 if (_.size(dataChunk) > 1) { 23214 const node = document.createElement('a'); 23215 node.innerText = index + 1; // Adding 1 to index since index starts from 0 23216 if (index === config.currentPage) { 23217 node.classList.add('active'); 23218 newActiveDot = index; 23219 } 23220 node.addEventListener('click', () => { 23221 reRenderPageContentBlog({ page: index }); 23222 onPageGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }); 23223 }); 23224 fragment.appendChild(node); 23225 23226 } else { 23227 document.querySelector(".paginationMedia").style.display = "none"; 23228 } 23229 }); 23230 23231 23232 paginationDots.appendChild(fragment) 23233 normalizePagination(currentActiveDot, newActiveDot) 23234 23235 if (config.currentPage > 0) { 23236 prevBtn.classList.remove('disabled') 23237 } else { 23238 prevBtn.classList.add('disabled') 23239 } 23240 23241 if (config.currentPage < _.size(dataChunk) - 1) { 23242 nextBtn.classList.remove('disabled') 23243 } else { 23244 nextBtn.classList.add('disabled') 23245 } 23246 let requestUpdatePagination = new Event('requestUpdatePagination') 23247 document.dispatchEvent(requestUpdatePagination) 23248 updatePagination(); 23249} 23250 23251// Function to capture dropdown values and call reRenderPageContentBlog 23252function updateContentblog() { 23253 // const filterValue = document.querySelector(' .custom-dropdown__opt .item.active').getAttribute('data-option-value') 23254 // const filterMonthValue = document.querySelector(' .custom-dropdown__opt-month .item.active').getAttribute('data-option-value') 23255 var filterTagsValue = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value'); 23256 var filterSortValue = document.querySelector(' .custom-dropdown__opt-sort .item.active').getAttribute('data-option-value'); 23257 var searchvalue = document.getElementById('searchterm').value; 23258 23259 reRenderPageContentBlog({ 23260 filterTags: filterTagsValue, 23261 sortdate: filterSortValue, 23262 searchString: searchvalue 23263 }); 23264} 23265 23266function updateContentGeneral() { 23267 var searchvalue = document.getElementById('searchterm').value; 23268 23269 reRenderPageContentBlog({ 23270 searchString: searchvalue 23271 }); 23272} 23273 23274 23275 23276const reRenderPageContentBlog = ({ page = 0, filter = null, filtermonth = null, filterTags = null, loadmore = false, searchString = null, sortdate = null }) => { 23277 // If filters are applied, reset page and offset 23278 var filtersApplied = filter || filtermonth || filterTags || searchString || sortdate; 23279 if (filtersApplied) { 23280 23281 page = 0; 23282 // resetPagePaginationBlog(page); 23283 CONTENT_LISTING_Blog.page.offset = 0; 23284 CONTENT_LISTING_Blog.page.currentFilter = filter; 23285 CONTENT_LISTING_Blog.page.yearfilter = filter; 23286 CONTENT_LISTING_Blog.page.monthfilter = filtermonth; 23287 CONTENT_LISTING_Blog.page.tagfilter = filterTags; 23288 CONTENT_LISTING_Blog.page.searchString = searchString; 23289 CONTENT_LISTING_Blog.page.sorteddate = sortdate; 23290 FILTERED_CONTENT_LISTING_Blog.page.offset = 0; 23291 FILTERED_CONTENT_LISTING_Blog.page.currentFilter = filter; 23292 FILTERED_CONTENT_LISTING_Blog.page.yearfilter = filter; 23293 FILTERED_CONTENT_LISTING_Blog.page.monthfilter = filtermonth; 23294 FILTERED_CONTENT_LISTING_Blog.page.tagfilter = filterTags; 23295 FILTERED_CONTENT_LISTING_Blog.page.searchString = searchString; 23296 } else{ 23297 setPagePaginationBlog(page); 23298 } 23299 23300 23301 23302 const config = CONTENT_LISTING_Blog.page; 23303 23304 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`); 23305 23306 const filteredDataTag = _.filter(config.data, (item) => { 23307 if (config.tagfilter === null || config.tagfilter === 'Categories') { 23308 return true; 23309 } else { 23310 return item.tags.includes(config.tagfilter); 23311 } 23312 }); 23313 23314 const filteredDataSearch = searchString ? _.filter(filteredDataTag, (item) => { 23315 return _.some([item.heading.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(searchString.toLowerCase())); 23316 }) : filteredDataTag; 23317 23318 const filteredData = sortByDateBlog(filteredDataSearch, CONTENT_LISTING_Blog.page.sorteddate); 23319 23320 if (filteredData.length > 0) { 23321 reverseDivStylesblog(); 23322 23323 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Blog.maximumItemPerPage + config.offset); 23324 23325 if (contentWrapperEl) { 23326 let dataToShown; 23327 23328 if (!loadmore) { 23329 contentWrapperEl.innerHTML = ''; 23330 dataToShown = dataChunk[config.currentPage]; 23331 } else { 23332 dataToShown = _.slice(dataChunk[config.currentPage], config.offset); 23333 } 23334 23335 _.forEach(dataToShown, (item) => {
23336 let el = generateArticleThumbnailBlog({ 23337 head: item.heading, 23338 tags: item.tags, 23339 summary: item.summary, 23340 date: item.date, 23341 month: item.month, 23342 ctaUrl: item.ctaUrl, 23343 imgAlt: item.thumbnailalttext, 23344 year: item.year, 23345 imgUrl: item.url, 23346 ctaLabel: item.ctaLabel, 23347 }); 23348 contentWrapperEl.appendChild(el); 23349 }); 23350 23351 CONTENT_LISTING_Blog.page = { 23352 ...CONTENT_LISTING_Blog.page, 23353 showing: { 23354 start: config.currentPage * CONTENT_CONFIG_Blog.maximumItemPerPage, 23355 end: config.currentPage * CONTENT_CONFIG_Blog.maximumItemPerPage + _.size(dataToShown) - 1, 23356 }, 23357 }; 23358 23359 if (filtersApplied) { 23360 FILTERED_CONTENT_LISTING_Blog.page.data = filteredData; 23361 FILTERED_CONTENT_LISTING_Blog.page.filterKey = ['year', 'month', 'tag']; 23362 resetPagePaginationBlog(page); 23363 } 23364 23365 } 23366 } else { 23367 updateDivStylesBlog(); 23368 } 23369 $('#searchterm')[0].click(); 23370}; 23371 23372 23373const renderPageContentBlog = ({ els = [], filter = [], filtermonth = [], filterTags = [] }) => { 23374 23375 23376 const config = CONTENT_LISTING_Blog.page 23377 23378 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 23379 23380 const contentFilterEl = document.querySelector(`[data-content-filter=page]`) 23381 23382 23383 const pagination = document.querySelector('.pagination') 23384 23385 const emptyResult = contentWrapperEl?.nextElementSibling 23386 23387 if (_.size(els) == 0) { 23388 emptyResult?.classList.remove('hidden') 23389 return false 23390 } else { 23391 pagination.classList.remove('hidden') 23392 emptyResult?.classList.add('hidden') 23393 } 23394 23395 const dataChunk = _.chunk(els, CONTENT_CONFIG_Blog.maximumItemPerPage) 23396 23397 23398 if (contentWrapperEl) { 23399 const dataToShown = dataChunk[0] 23400 23401 _.forEach(dataToShown, (item) => { 23402 contentWrapperEl.appendChild(item) 23403 23404 }) 23405 } 23406 23407 if (contentFilterEl) { 23408 const optionsWrapperElTag = document.querySelector('.custom-dropdown__opt-tag') 23409 23410 document.querySelector('.custom-dropdown__opt-tag').addEventListener('click', updateContentblog); 23411 document.querySelector('.custom-dropdown__opt-sort').addEventListener('click', updateContentblog); 23412 23413 const filterOptionElTag = _.map(_.orderBy(filterTags, 'value', 'desc'), (item) => { 23414 let el = generateDropdownFilterBlog(item.name, item.value) 23415 23416 return el 23417 }) 23418 const filterElsTag = filterOptionElTag 23419 23420 _.forEach(filterOptionElTag, (item) => { 23421 23422 optionsWrapperElTag.appendChild(item) 23423 }) 23424 23425 document.dispatchEvent(onListingFilter) 23426 23427 setPagePaginationBlog() 23428 23429 const prevBtn = pagination.querySelector('.pagPrev') 23430 23431 const nextBtn = pagination.querySelector('.pagNext') 23432 23433 const filteredData = _.filter(config.data, (item) => { 23434 if (config.currentFilter === null || config.currentFilter === 'Categories') { 23435 23436 return true 23437 } else { 23438 23439 return item[config.filterKey[0]] == config.currentFilter 23440 } 23441 }) 23442 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_Blog.maximumItemPerPage) 23443 23444 prevBtn.addEventListener('click', () => { 23445 const config = CONTENT_LISTING_Blog.page 23446 if (config.currentPage > 0) { 23447 reRenderPageContentBlog({ page: config.currentPage - 1 }) 23448 onPageGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }) 23449 } 23450 }) 23451 23452 nextBtn.addEventListener('click', () => { 23453 const config = CONTENT_LISTING_Blog.page 23454 if (config.currentPage < _.size(dataChunk) - 1) { 23455 reRenderPageContentBlog({ page: config.currentPage + 1 }) 23456 onPageGoToTop && window.scrollTo({ top: 0, behavior: 'smooth' }) 23457 } 23458 }) 23459 } 23460 let requestUpdatePagination = new Event('requestUpdatePagination') 23461 document.dispatchEvent(requestUpdatePagination) 23462 updatePagination(); 23463 setTimeout( function() { TagMore(); },50); 23464} 23465
23466const generateArticleThumbnailBlog = ({ head, tags, summary, date, ctaUrl, imgAlt, year, imgUrl, ctaLabel }) => { 23467 // Generate HTML for the first two tags 23468 let visibleTagsHTML = tags.slice(0, 7).map(tag => ` 23469 <div class="itemTag"> 23470 <div class="tag"> 23471 <a href="${ctaUrl}"> 23472 <span>${tag}</span> 23473 </a> 23474 </div> 23475 </div> 23476 `).join(''); 23477 23478 // Generate HTML for additional tags, if any 23479 let hiddenTagsHTML = ''; 23480 if (tags.length > 1) { 23481 hiddenTagsHTML = ` 23482 <div class="itemTagMore"> 23483 <div class="tag"> 23484 <span>...</span> 23485 </div> 23486 </div> 23487 `; 23488 } 23489 23490 // Construct the HTML for the article thumbnail 23491 let item = ` 23492 <div class="itemMedia"> 23493 <div class="boxImg"> 23494 <a href="${ctaUrl}"> 23495 <img src="${imgUrl}" alt="${imgAlt}"> 23496 </a> 23497 </div> 23498 <div class="boxContent"> 23499 <div class="tags"> 23500 ${visibleTagsHTML} 23501 ${hiddenTagsHTML} 23502 </div> 23503 <a href="${ctaUrl}"> 23504 <p class="subText">${head}</p> 23505 </a> 23506 ${shouldShowDateForGeneralList() ? ` 23507 <div class="detail"> 23508 <p>${date}</p> 23509 </div> 23510 ` : ''} 23511 </div> 23512 </div>`; 23513 23514 return htmlToElement(item); 23515} 23516 23517 23518const initPageListingBlog = (url) => { 23519 const reqUrl = `${url}` 23520 23521 let els = [] 23522 let filter = [] 23523 let filtermonth = [] 23524 let filterYear = [] 23525 let filterTags = [] 23526 23527 axios.get(reqUrl).then((res) => { 23528 const responseData = JSON.parse(res.data.newsDetails) 23529 23530 // const responseData = res.data 23531 _.forEach( 23532 _.filter(responseData, (item) => true), 23533 (item) => { 23534 23535 els.push( 23536 generateArticleThumbnailBlog({ 23537 head: item.heading, 23538 tags: item.tags, 23539 summary: item.summary, 23540 date: item.date, 23541 month: item.month, 23542 formattedFilteredMonth: item.formattedFilteredMonth, 23543 ctaUrl: item.ctaUrl, 23544 imgAlt: item.thumbnailalttext, 23545 year: item.year, 23546 imgUrl: item.url, 23547 ctaLabel: item.ctaLabel, 23548 }) 23549 ) 23550 23551 filter.push({ name: item.year, value: item.year }) 23552 23553 filterYear.push({ name: item.year, value: item.year }) 23554 23555 filtermonth.push({ name: item.month, value: item.month, formattedFilteredMonth: item.formattedFilteredMonth }) 23556 23557 filterTags.push(...item.tags.map(tag => ({ name: tag, value: tag }))) 23558 23559 CONTENT_LISTING_Blog.page = { ...CONTENT_LISTING_Blog.page, currentPage: 0, data: responseData, filterKey: ['year', 'month', 'tag'] } 23560 } 23561 ) 23562 23563 renderPageContentBlog({ 23564 els, 23565 filter: _.uniqBy(filter, 'value'), 23566 filtermonth: _.uniqBy(filtermonth, 'value'), 23567 filterYear: _.uniqBy(filterYear, 'value'), 23568 filterTags: _.uniqBy(filterTags, 'value') 23569 }) 23570 }) 23571} 23572 23573 23574function getPageTypeInSectionBlog() { 23575 var sectionElements = document.querySelectorAll('section'); 23576 for (var i = 0; i < sectionElements.length; i++) { 23577 var sectionElement = sectionElements[i]; 23578 if (sectionElement.hasAttribute('data-page-type')) { 23579 var pageType = sectionElement.getAttribute('data-page-type'); 23580 // Return the value of the attribute 23581 return pageType; 23582 } 23583 } 23584} 23585 23586function shouldShowDateForGeneralList() { 23587 const section = document.querySelector('[data-page-type="generallist"]'); 23588 23589 if (!section) { 23590 return false; 23591 } 23592 23593 console.log(getPageTypeInSectionBlog() === "generallist" && section.dataset.showDate === "true"); 23594 23595 return ( 23596 getPageTypeInSectionBlog() === "generallist" && 23597 section.dataset.contentDate === "true" 23598 ); 23599} 23600 23601const __initContentList = () => { 23602 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 23603 var current_page = window.location.href; 23604 var current_page_split = current_page.split(".html"); 23605 _.forEach(dataContentRenderingContainer, (contentRender) => { 23606 if (contentRender.dataset.contentRender === 'page') { 23607 var pagetype = getPageTypeInSectionBlog(); 23608 initPageListingBlog(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 23609 } 23610 }) 23611} 23612 ; (function () { 23613 let stateCheck = setInterval(() => { 23614 if (document.readyState === 'complete' && getPageTypeInSectionBlog() == "bloglist" ) { 23615 clearInterval(stateCheck) 23616 __initContentList() 23617 console.log('Init page listing script imported') 23618 } 23619 if (document.readyState === 'complete' && getPageTypeInSectionBlog() == "generallist" ) { 23620 clearInterval(stateCheck) 23621 __initContentList() 23622 console.log('Init page listing script imported') 23623 } 23624 23625 }, 100) 23626 })() 23627 23628 23629$(document).ready(function () { 23630 var listblog = document.getElementsByClassName('bloglist'); 23631 if (listblog && listblog.length > 0) { 23632 $('.bloglist').click(TagMore); 23633 PagNext(); 23634 PagPrev(); 23635 updatePagination(); 23636 PagActive(); 23637 } 23638}); 23639 23640/* 23641The pagenation functions listed below are written in Newslist components JavaScript. 23642 PagNext(); 23643 PagPrev(); 23644 updatePagination(); 23645 PagActive(); 23646*/ 23647 23648var resizeTimer; 23649 23650$(window).on('resize', function () { 23651 clearTimeout(resizeTimer); 23652 resizeTimer = setTimeout(function () { 23653 TagMore(); 23654 }, 250); 23655}); 23656 23657function TagMore() { 23658 var itemMediaDefault = $('.mainListMediaSec .itemMedia').width() - 40; 23659 $('.mainListMediaSec .itemMedia').each(function () { 23660 var totalItemTagWidth = 0; 23661 $(this).find('.tags .itemTag').each(function () { 23662 var itemTagWidth = $(this).innerWidth(); 23663 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 23664 totalItemTagWidth += itemTagWidth; 23665 } else { 23666 $(this).addClass('d-none'); 23667 $(this).siblings(".itemTagMore").addClass('d-block'); 23668 } 23669 }); 23670 }); 23671 // console.log(itemMediaDefault) 23672} 23673 23674var bloglist = document.getElementsByClassName('bloglist'); 23675if(bloglist && bloglist.length > 0) { 23676$(".bloglist .mainListMediaSec .filterYear .ui.inline.dropdown").dropdown({ 23677 forceSelection: false, //***** 23678 direction: "downward", 23679 delay: { 23680 touch: 0, 23681 }, 23682 onShow: function () { 23683 $(".ui.inline.dropdown").not(this).dropdown('hide'); 23684 } 23685}); 23686 23687$(".bloglist .mainListMediaSec .filterMonths .ui.inline.dropdown").dropdown({ 23688 forceSelection: false, //***** 23689 direction: "downward", 23690 delay: { 23691 touch: 0, 23692 }, 23693 onShow: function () { 23694 $(".ui.inline.dropdown").not(this).dropdown('hide'); 23695 } 23696}); 23697 23698$(".bloglist .mainListMediaSec .filterSegments .ui.inline.dropdown").dropdown({ 23699 forceSelection: false, //***** 23700 direction: "downward", 23701 delay: { 23702 touch: 0, 23703 }, 23704 onShow: function () { 23705 $(".ui.inline.dropdown").not(this).dropdown('hide'); 23706 } 23707}); 23708 23709$(".bloglist .mainListMediaSec .filterSoft .ui.inline.dropdown").dropdown({ 23710 forceSelection: false, //***** 23711 direction: "downward", 23712 delay: { 23713 touch: 0, 23714 }, 23715 onShow: function () { 23716 $(".ui.inline.dropdown").not(this).dropdown('hide'); 23717 } 23718}); 23719} 23720 23721 23722 23723 23724$(window).ready(function() { 23725$(".mainContentLeftRightSec .itemContent").each(function() { 23726 var $boxText = $(this).find(".boxText"); 23727 var $boxImgSlide = $(this).find(".boxImgSlide"); 23728 var $iconText = $(this).find(".iconText"); 23729 var $action = $(this).find("div.action"); 23730 var requiredHeight = ($boxImgSlide.height() - $iconText.height() - $action.height() - 43) + "px"; 23731 if ($boxImgSlide.height() < $boxText.height()) { 23732 $boxText.addClass("loadMore"); 23733 $(this).find('.loadMore .descText').css("max-height", requiredHeight); 23734 $(this).find(".action").removeClass('hide'); 23735 $(this).find(".btn_plus_more").removeClass('hide'); 23736 } else { 23737 $(this).find(".action").addClass('hide'); 23738 $(this).find(".btn_plus_more").addClass('hide'); 23739 } 23740 }); 23741 23742 document.querySelectorAll(".mainContentLeftRightSec").forEach(section => {
23743 const btn_minus_more_list = section.querySelectorAll('.btn_minus_more'); 23744 const btn_plus_more_list = section.querySelectorAll('.btn_plus_more'); 23745 btn_minus_more_list.forEach(btn_minus_more => { 23746 btn_minus_more.addEventListener('click', function () { 23747 var $boxText = $(this).closest('.itemContent').find('.boxText'); 23748 $boxText.find('.descText').removeClass("textMaxHeight"); 23749 $boxText.addClass('loadMore'); 23750 $(this).addClass('hide'); 23751 $boxText.find('.btn_plus_more').removeClass('hide'); 23752 var targetSection = $(".mainContentLeftRightSec"); 23753 $('html, body').animate({ 23754 scrollTop: section.offsetTop 23755 }) 23756 }); 23757 }); 23758 btn_plus_more_list.forEach( btn_plus_more => { 23759 btn_plus_more.addEventListener('click', function () { 23760 var $boxText = $(this).closest('.itemContent').find('.boxText'); 23761 $boxText.find('.descText').addClass("textMaxHeight");
23762 $boxText.removeClass('loadMore'); 23763 $(this).addClass('hide'); 23764 $boxText.find('.btn_minus_more').removeClass('hide'); 23765 }); 23766 }); 23767 }); 23768 initializeImageContentSwipers(); 23769}); 23770 23771 23772 23773function initializeImageContentSwipers() { 23774 $('.mainContentLeftRightSec .itemContent').each(function () { 23775 var container = $(this); 23776 23777 container.find('.imgContentSwiper').each(function () { 23778 var swiperContainer = $(this); 23779 23780 new Swiper(swiperContainer[0], { 23781 slidesPerView: 1, 23782 spaceBetween: 20, 23783 slidesPerGroup: 1, 23784 resizeObserver:!($("body").data('custom-mode') == "edit"), 23785 speed: 500, 23786 loop: true, 23787 navigation: { 23788 nextEl: swiperContainer.find('.swiper-button-next')[0], 23789 prevEl: swiperContainer.find('.swiper-button-prev')[0], 23790 }, 23791 }); 23792 }); 23793 }); 23794} 23795 23796'use strict' 23797 23798var apiResponse = []; // Define apiResponse globally 23799 23800var NewResponse = []; // Define apiResponse globally 23801 23802function isMobile() { 23803 return window.innerWidth <= 768; 23804} 23805 23806var clickonfirst = true; 23807 23808var detailtranslation 23809var directiontranslation 23810var map 23811var infowindow 23812var contentString = 23813 '<div id="content">' + 23814 '<div id="siteNotice">' + 23815 "</div>" + 23816 '<h1 id="firstHeading" class="firstHeading">Uluru</h1>' + 23817 '<div id="bodyContent">' + 23818 "<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large " + 23819 "sandstone rock formation in the southern part of the " + 23820 "Northern Territory, central Australia. It lies 335 km (208 mi) " + 23821 "south west of the nearest large town, Alice Springs; 450 km " + 23822 "(280 mi) by road. Kata Tjuta and Uluru are the two major " + 23823 "features of the Uluru - Kata Tjuta National Park. Uluru is " + 23824 "sacred to the Pitjantjatjara and Yankunytjatjara, the " + 23825 "Aboriginal people of the area. It has many springs, waterholes, " + 23826 "rock caves and ancient paintings. Uluru is listed as a World " + 23827 "Heritage Site.</p>" + 23828 '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">' + 23829 "https://en.wikipedia.org/w/index.php?title=Uluru</a> " + 23830 "(last visited June 22, 2009).</p>" + 23831 "</div>" + 23832 "</div>"; 23833 23834var plantMapSwiper = new Swiper(".plantMapSwiper", { 23835 speed: 500, 23836 resizeObserver:!($("body").data('custom-mode') == "edit"), 23837 loop: 'true', 23838 breakpoints: { 23839 768: { 23840 slidesPerView: 2, 23841 spaceBetween: 20, 23842 slidesPerGroup: 1, 23843 }, 23844 250: { 23845 slidesPerView: 1, 23846 spaceBetween: 0, 23847 slidesPerGroup: 1, 23848 } 23849 } 23850}); 23851 23852 23853var currentIndex = 0; 23854var itemsPerPage = isMobile() ? 5 : 10; 23855 23856 23857function initMap() { 23858 23859 var styledMapType = new google.maps.StyledMapType( 23860 [ 23861 { 23862 "elementType": "geometry", 23863 "stylers": [ 23864 { "color": "#e9e9e9" } 23865 ] 23866 }, 23867 { 23868 "elementType": "labels.text.fill", 23869 "stylers": [ 23870 { "color": "#333333" } 23871 ] 23872 }, 23873 { 23874 "elementType": "labels.text.stroke", 23875 "stylers": [ 23876 { "color": "#ffffff" } 23877 ] 23878 }, 23879 { 23880 "featureType": "administrative", 23881 "elementType": "geometry", 23882 "stylers": [ 23883 { "visibility": "off" } 23884 ] 23885 }, 23886 { 23887 "featureType": "landscape", 23888 "elementType": "geometry", 23889 "stylers": [ 23890 { "color": "#f0f0f0" } 23891 ] 23892 }, 23893 { 23894 "featureType": "poi", 23895 "elementType": "geometry", 23896 "stylers": [ 23897 { "color": "#cfe7f3" } 23898 ] 23899 }, 23900 { 23901 "featureType": "road", 23902 "elementType": "geometry", 23903 "stylers": [ 23904 { "color": "#b3b3b3" } 23905 ] 23906 }, 23907 { 23908 "featureType": "road", 23909 "elementType": "labels.text.fill", 23910 "stylers": [ 23911 { "color": "#808080" } 23912 ] 23913 }, 23914 { 23915 "featureType": "road", 23916 "elementType": "labels.text.stroke", 23917 "stylers": [ 23918 { "color": "#ffffff" } 23919 ] 23920 }, 23921 { 23922 "featureType": "water", 23923 "elementType": "geometry", 23924 "stylers": [ 23925 { "color": "#a0d3d3" } 23926 ] 23927 }, 23928 { 23929 "featureType": "water", 23930 "elementType": "labels.text.fill", 23931 "stylers": [ 23932 { "color": "#737373" } 23933 ] 23934 } 23935 ], 23936 { name: 'Blue Styled Map' } 23937 ); 23938 23939 map = new google.maps.Map(document.getElementById('map'), { 23940 center: { lat: 13.75, lng: 100.5 }, 23941 mapTypeControl: false, 23942 fullscreenControl: false, 23943 zoom: 11, 23944 mapTypeControlOptions: { 23945 mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain', 'styled_map'] 23946 } 23947 }); 23948 23949 map.mapTypes.set('styled_map', styledMapType); 23950 map.setMapTypeId('styled_map'); 23951} 23952 23953function addARTMarker(plant, index) { 23954 var artmapMarkerValue = document.querySelector('.artmap .mainListMediaSec .container') 23955 ? document.querySelector('.artmap .mainListMediaSec .container').getAttribute('data-mapmarker') || '/content/dam/onebangkok_v2/mark_point.png' 23956 : '/content/dam/onebangkok_v2/mark_point.png'; 23957 var icon = { 23958 url: artmapMarkerValue, 23959 scaledSize: new google.maps.Size(25, 25), // scaled size 23960 origin: new google.maps.Point(0, 0), // origin 23961 anchor: new google.maps.Point(0, 0) // anchor 23962 }; 23963 23964 var marker = new google.maps.Marker({ 23965 position: { lat: plant.lat, lng: plant.lng }, 23966 map: map, 23967 title: plant.name, 23968 icon: icon, 23969 }); 23970 23971 apiResponse[plant.id - 1]['marker'] = marker; 23972 23973 marker.addListener('click', function () { 23974 moveARTMap(plant.id - 1) 23975 23976 $(".mainListMediaSec .listItem .item").removeClass("active"); 23977 $(".mainListMediaSec .listItem .item").eq(plant.id - 1).addClass("active"); 23978 23979 var scrollableDiv = $('.mainListMediaSec .listItem'); 23980 var activeItem = $('.mainListMediaSec .listItem .item.active'); 23981 if (activeItem.length) { 23982 scrollableDiv.animate({ 23983 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 23984 }, 500); 23985 } 23986 23987 }); 23988 23989} 23990 23991const onListingFilterChangedArt = new Event('onFilterChanged') 23992 23993const onPageChangedGoToTopArt = true 23994 23995const CONTENT_CONFIG_ART = { 23996 maximumItemPerPage: 9, 23997} 23998 23999let CONTENT_LISTING_ART = { 24000 page: { 24001 yearfilter: null, 24002 monthfilter: null, 24003 tagfilter: null, 24004 searchString: null, 24005 sorteddate: null, 24006 currentFilter: null, 24007 filterKey: null, 24008 currentPage: 0, 24009 offset: 0, 24010 data: [], 24011 showing: { 24012 start: 0, 24013 end: CONTENT_CONFIG_ART.maximumItemPerPage - 1, 24014 }, 24015 }, 24016} 24017 24018let FILTERED_CONTENT_LISTING_ART = { 24019 page: { 24020 yearfilter: null, 24021 monthfilter: null, 24022 tagfilter: null, 24023 searchString: null, 24024 currentFilter: null, 24025 filterKey: null, 24026 currentPage: 0, 24027 offset: 0, 24028 data: [], 24029 showing: { 24030 start: 0, 24031 end: CONTENT_CONFIG_ART.maximumItemPerPage - 1, 24032 }, 24033 }, 24034} 24035function TagMore() { 24036 var itemMediaDefault = $('.mainListMediaSec .itemMedia').width() - 40; 24037 $('.mainListMediaSec .itemMedia').each(function () { 24038 var totalItemTagWidth = 0; 24039 $(this).find('.tags .itemTag').each(function () { 24040 var itemTagWidth = $(this).innerWidth(); 24041 if ((totalItemTagWidth + itemTagWidth) <= itemMediaDefault) { 24042 totalItemTagWidth += itemTagWidth; 24043 } else { 24044 $(this).addClass('d-none'); 24045 $(this).siblings(".itemTagMore").addClass('d-block'); 24046 } 24047 }); 24048 }); 24049 // console.log(itemMediaDefault) 24050} 24051function updateArtDivStyles() { 24052 var innerDivs = document.querySelectorAll('div.inner'); 24053 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 24054 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 24055 var mapdivs = document.querySelector('.mainListMediaSec .mediaList .itemBodyTab .innerMap'); 24056
24057 innerDivs.forEach(function (div) { 24058 div.style.display = 'none'; 24059 }); 24060 24061 paginationMediaDivs.forEach(function (div) { 24062 div.style.display = 'none'; 24063 }); 24064 24065 boxNotFoundDivs.forEach(function (div) { 24066 div.classList.remove("hidden"); 24067 div.style.display = 'block'; 24068 }); 24069 24070 mapdivs.classList.add('hidden'); 24071} 24072function reverseartDivStyles() { 24073 var innerDivs = document.querySelectorAll('div.inner'); 24074 var paginationMediaDivs = document.querySelectorAll('div.paginationMedia'); 24075 var boxNotFoundDivs = document.querySelectorAll('div.boxNotFound'); 24076 var mapdivs = document.querySelector('.mainListMediaSec .mediaList .itemBodyTab .innerMap'); 24077 24078 innerDivs.forEach(function (div) { 24079 div.style.display = 'flex'; 24080 }); 24081 24082 paginationMediaDivs.forEach(function (div) { 24083 div.style.display = 'block'; 24084 }); 24085 24086 boxNotFoundDivs.forEach(function (div) { 24087 div.style.display = 'none'; 24088 }); 24089 24090 mapdivs.classList.remove('hidden'); 24091} 24092 24093function displayArtist(plants = undefined, isLoadMore = false) { 24094 24095 let dataToDisplay; 24096 24097 if (plants == undefined) { 24098 dataToDisplay = apiResponse.slice(currentIndex, currentIndex + itemsPerPage); 24099 } else { 24100 24101 dataToDisplay = plants.slice(currentIndex, currentIndex + itemsPerPage); 24102 } 24103 24104 var $plantsList = $('#plants-list'); 24105 24106 if (!isLoadMore) { 24107 // Only clear the list if not loading more data (i.e., initial load or new filter applied) 24108 $plantsList.empty(); 24109 currentIndex = 0; 24110 } 24111 24112 24113 $.each(dataToDisplay, function (index, plant) { 24114 var plantHtml = ` 24115 <div class="item" id="${plant.id}" onClick='moveARTMap(${plant.id - 1})'> 24116 <div class="boxImg"> 24117 <img src="${plant.image}" alt=""> 24118 </div> 24119 <div class="boxContent"> 24120 <div class="top"> 24121 <p class="descText">${plant.name}</p> 24122 <p class="sub">${plant.plantorigin}</p> 24123 </div> 24124 <div class="bottom"> 24125 <p class="sub"> 24126 <i class="icon-ic-location"></i>${plant.LocationTitle} 24127 </p> 24128 </div> 24129 </div> 24130 </div> 24131 `; 24132 $plantsList.append(plantHtml); 24133 addARTMarker(plant, index); 24134 }); 24135 24136 24137 // Check if more items are available to show 24138 if (plants == undefined) { 24139 if (currentIndex + itemsPerPage >= apiResponse.length) { 24140 $('.artmap .mainListMediaSec .viewMore').hide(); 24141 } else { 24142 $('.artmap .mainListMediaSec .viewMore').show(); 24143 } 24144 } else { 24145 if (currentIndex + itemsPerPage >= plants.length) { 24146 $('.artmap .mainListMediaSec .viewMore').hide(); 24147 } else { 24148 $('.artmap .mainListMediaSec .viewMore').show(); 24149 } 24150 } 24151 24152 currentIndex += itemsPerPage; // Update index for the next batch 24153 24154 // Trigger click on the first item on initial load 24155 if (!isLoadMore && currentIndex === itemsPerPage) { 24156 // Only trigger if it's the initial load (not loading more) 24157 const firstItem = $plantsList.find('.item').first(); 24158 if (firstItem.length) { 24159 firstItem.addClass('active'); // Set the first item as active 24160 firstItem.trigger('click'); // Trigger click event on the first item 24161 } 24162 } 24163 24164 //clickOnArtActiveItem(); 24165} 24166 24167function clickOnArtActiveItem() { 24168 // Find the element with the class "item active" 24169 const activeItem = document.querySelector('.artmap .mainListMediaSec #plants-list .item'); 24170 if (activeItem) { 24171 activeItem.click(); 24172 } else { 24173 console.error("No element with class 'item active' found."); 24174 } 24175} 24176 24177function clickArt() { 24178 const activeItem = document.querySelector('.artmap .mainListMediaSec .mediaList .itemBodyTab.active #plants-list .item') 24179 // If the element is found, simulate a click event on it 24180 if (activeItem) { 24181 setTimeout(function () { 24182 activeItem.click(); 24183 }, 150); 24184 clickonfirst = false;
24185 } else { 24186 console.log("No element with class 'item active' found."); 24187 } 24188} 24189 24190 24191function moveARTMap(index) { 24192 var item = apiResponse[index] 24193 var pos = { 24194 lat: parseFloat(item['lat']), 24195 lng: parseFloat(item['lng']) 24196 }; 24197 24198 var detailText = detailtranslation; 24199 var directionText = directiontranslation; 24200 24201 contentString = 24202 '<div class="boxMarkMap">' + 24203 '<div class="itemMarkMap">' + 24204 '<div class="boxImg">' + 24205 '<img src=' + item['image'] + '>' + 24206 '</div>' + 24207 '<div class="boxContent">' + 24208 '<p class="descText">' + item['name'] + '</p>' + 24209 '<p class="sub">' + item['plantorigin'] + '</p>' + 24210 '<div class="bottom">' + 24211 '<p class="sub">' + '<i class="icon-ic-location"></i>' + item['LocationTitle'] + '</p>' + 24212 '</div>' + 24213 '<div class="action">' + 24214 '<button class="btn-default">' + 24215 '<span class="buttonContainer">' + 24216 '<a target="_blank" href="' + item['ctaUrl'] + '">' + 24217 '<span class="buttonText">' + 24218 '<span>' + detailText + '</span>' + 24219 '<span>' + detailText + '</span>' + 24220 '</span>' + 24221 '</span>' + 24222 '</a>' + 24223 '</button>' + 24224 '<button class="btn-link">' + 24225 '<a target=â_blankâ href="https://www.google.com/maps/dir/?api=1&destination=' + item['lat'] + ',' + item['lng'] + '">' + 24226 '<i class="icon-ic-curve-arrow"></i>' + 24227 '<span>' + directionText + '</span>' + 24228 '</a>' + 24229 '</button>' + 24230 '</div>' 24231 "</div>" + 24232 "</div>" + 24233 "</div>"; 24234 if (infowindow) { 24235 infowindow.close(); 24236 } 24237 infowindow = new google.maps.InfoWindow({ 24238 content: contentString, 24239 }); 24240 24241 map.setCenter(pos); 24242 // map.setZoom(11) 24243 infowindow.open(map, item.marker); 24244 24245 setTimeout(() => { 24246 var heightButton = $('.mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 24247 24248 if (heightButton > 120) { 24249 $(".mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 24250 } else { 24251 $(".mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 24252 } 24253 }, 50); 24254/* 24255 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 24256 $([document.documentElement, document.body]).animate({ 24257 scrollTop: $("#map").offset().top - 150 24258 }, 500); 24259 } 24260 */ 24261 24262} 24263 24264function sortPlantByDate(data, order) { 24265 const getDate = (item) => { 24266 if (order === "Popular") { 24267 return new Date(item.sortedFormattedDate); 24268 } else { 24269 return new Date(item.date); 24270 } 24271 }; 24272 24273 return data.sort((a, b) => { 24274 const dateA = getDate(a); 24275 const dateB = getDate(b); 24276 24277 if (order === "asc") { 24278 return dateA - dateB; 24279 } else if (order === "dsc") { 24280 return dateB - dateA; 24281 } else if (order === "Popular") { 24282 return dateA - dateB; 24283 } 24284 }); 24285} 24286 24287// Function to capture dropdown values and call reRenderPageContentPlant 24288function updateContentMapList() { 24289 const filterValue = document.querySelector(' .custom-dropdown__opt .item.active').getAttribute('data-option-value') 24290 const filterMonthValue = document.querySelector(' .custom-dropdown__opt-month .item.active').getAttribute('data-option-name') 24291 const filterTagsValue = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value') 24292 24293 NewResponse = filterArtAPIResponse(apiResponse, filterValue, filterMonthValue, filterTagsValue); 24294 currentIndex = 0; // Reset pagination 24295 displayArtist(NewResponse); 24296} 24297 24298 24299function searchPlants(apiResponse, keyword) { 24300 const filteredResponse = apiResponse.filter(plant => { 24301 return plant.sub_name.toLowerCase().includes(keyword.toLowerCase()) || 24302 plant.name.toLowerCase().includes(keyword.toLowerCase()); 24303 }); 24304 return filteredResponse; 24305} 24306 24307function filterArtAPIResponse(apiData, planttype, plantorigin, locationTitle) { 24308 24309 let filteredData = apiResponse; 24310 24311 // Primary filter for planttype 24312 if (planttype !== null && planttype.trim() !== "Type of artwork") { 24313 filteredData = _.filter(filteredData, item => item.planttype.trim() === planttype.trim()); 24314 } 24315 24316 // Secondary filter for plantorigin (now using artist batches) 24317 if (plantorigin !== null && plantorigin !== "Artist name") { 24318 filteredData = _.filter(filteredData, item => { 24319 const artistBatch = getArtistBatch(item.plantorigin); 24320 return artistBatch === plantorigin; 24321 }); 24322 } 24323 24324 // Tertiary filter for LocationTitle 24325 if (locationTitle !== null && locationTitle !== "Location") { 24326 filteredData = _.filter(filteredData, item => item.LocationTitle === locationTitle); 24327 } 24328 if (filteredData.length == 0) { 24329 toggleMapClass(document.querySelector('.boxNotFound'), 'hidden', false); 24330 toggleMapClass(document.querySelector('.inner'), 'hidden', true); 24331 return; 24332 } 24333 toggleMapClass(document.querySelector('.boxNotFound'), 'hidden', true); 24334 toggleMapClass(document.querySelector('.inner'), 'hidden', false); 24335 24336 return filteredData; 24337 24338} 24339 24340function clickOnArtActiveItem() { 24341 const activeItems = document.querySelectorAll('.artmap .mainListMediaSec .mediaList .itemBodyTab.active #plants-list .item'); 24342 const prevItem = document.querySelector('.artmap .mainListMediaSec .mediaList .itemBodyTab.active #plants-list .item.active'); 24343 if (NewResponse != null || NewResponse != undefined) { 24344 if (prevItem) { 24345 // Find the next sibling of the prevItem 24346 const nextActiveItem = prevItem.nextElementSibling; 24347 24348 // Check if the next sibling exists and is an 'active' item 24349 if (nextActiveItem && nextActiveItem.classList.contains('item')) { 24350 setTimeout(function () { 24351 nextActiveItem.click(); 24352 }, 150); 24353 } else if (activeItems.length > 0) { 24354 // If no next active sibling is found, click on the first 'activeItem' 24355 setTimeout(function () { 24356 activeItems[0].click(); 24357 }, 150); 24358 } else { 24359 console.log("No element with class 'item' found."); 24360 } 24361 } else { 24362 // No prevItem found, click the first 'activeItem' directly if available 24363 if (activeItems.length > 0) { 24364 setTimeout(function () { 24365 activeItems[0].click(); 24366 }, 150); 24367 } else { 24368 console.log("No element with class 'item' found."); 24369 } 24370 } 24371 } 24372 else { 24373 setTimeout(function () { 24374 activeItems.click(); 24375 }, 150); 24376 24377 } 24378} 24379 24380 24381 24382function searchkeywordss() { 24383 var searchvalue = document.getElementById('searchterm').value
24384 reRenderPageContentART({ searchString: searchvalue }); 24385 24386 let NewResponse = searchPlants(apiResponse, searchvalue) 24387 currentIndex = 0; // Reset pagination 24388 displayArtist(NewResponse) 24389} 24390 24391 24392const generateMonthDropdownFilterART = (name, value, formattedFilteredMonth, active = false) => { 24393 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 24394 ${formattedFilteredMonth} 24395 </div>` 24396 return htmlToElement(item) 24397} 24398 24399const generateDropdownFilterART = (name, value, active = false) => { 24400 let item = `<div class=" item ${active ? 'active' : ''}" data-option-value="${value}" data-option-name="${name}"> 24401 ${name} 24402 </div>` 24403 return htmlToElement(item) 24404} 24405 24406const resetPagePaginationART = (activePage = null) => { 24407 if (activePage !== null) { 24408 FILTERED_CONTENT_LISTING_ART.page.currentPage = activePage 24409 } 24410 24411 const paginationDots = document.querySelector('.pagination--dots') 24412 const config = FILTERED_CONTENT_LISTING_ART.page 24413 24414 var teststring = document.getElementById('searchterm').value; 24415 24416 const filteredDataYear = _.filter(config.data, (item) => { 24417 if (config.currentFilter === null || config.currentFilter === 'Type of artwork') { 24418 24419 return true 24420 } else { 24421 return item.planttype == config.currentFilter 24422 } 24423 }) 24424 24425 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 24426 24427 if (config.monthfilter === null || config.monthfilter === "Artist name") { 24428 return true 24429 } 24430 else { 24431 const artistBatch = getArtistBatch(item.plantorigin); 24432 return artistBatch === config.monthfilter; 24433 } 24434 24435 }) 24436 24437 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 24438 if (config.tagfilter === null || config.tagfilter === 'Location') { 24439 return true 24440 } else { 24441 return item.LocationTitle.includes(config.tagfilter); 24442 } 24443 }) 24444 const filteredDataSearch = teststring ? _.filter(filteredDataTag, (item) => { 24445 return _.some([item.name.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(teststring.toLowerCase())); 24446 }) : filteredDataTag; 24447 24448 const filteredData = sortPlantByDate(filteredDataSearch, CONTENT_LISTING_ART.page.sorteddate); 24449 24450 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_ART.maximumItemPerPage) 24451 24452 const fragment = document.createDocumentFragment() 24453 24454 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 24455 24456 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 24457 24458 let currentActiveDot = null 24459 _.forEach(getChildNodes(paginationDots), (item, index) => { 24460 if (item.classList.contains('active')) { 24461 currentActiveDot = index 24462 } 24463 item.remove() 24464 }) 24465 24466 let newActiveDot = null 24467 24468 _.times(_.size(dataChunk), (index) => { 24469 if (_.size(dataChunk) > 1) { 24470 const node = document.createElement('a'); 24471 node.innerText = index + 1; // Adding 1 to index since index starts from 0 24472 if (index === config.currentPage) { 24473 node.classList.add('active'); 24474 newActiveDot = index; 24475 } 24476 node.addEventListener('click', () => { 24477 reRenderPageContentART({ page: index }); 24478 onPageChangedGoToTopArt && window.scrollTo({ top: 0, behavior: 'smooth' }); 24479 }); 24480 fragment.appendChild(node); 24481 24482 } else { 24483 document.querySelector(".paginationMedia").style.display = "none"; 24484 } 24485 }); 24486 24487 24488 paginationDots.appendChild(fragment) 24489 normalizePagination(currentActiveDot, newActiveDot) 24490 24491 if (config.currentPage > 0) { 24492 prevBtn.classList.remove('disabled') 24493 } else { 24494 prevBtn.classList.add('disabled') 24495 } 24496 24497 if (config.currentPage < _.size(dataChunk) - 1) { 24498 nextBtn.classList.remove('disabled') 24499 } else { 24500 nextBtn.classList.add('disabled') 24501 } 24502 let requestUpdatePagination = new Event('requestUpdatePagination') 24503 document.dispatchEvent(requestUpdatePagination) 24504 updatePagination(); 24505} 24506 24507const setPagePaginationART = (activePage = null) => { 24508 if (activePage !== null) { 24509 24510 CONTENT_LISTING_ART.page.currentPage = activePage 24511 } 24512 24513 const paginationDots = document.querySelector('.pagination--dots') 24514 const config = CONTENT_LISTING_ART.page 24515 24516 24517 var teststring = document.getElementById('searchterm').value; 24518 24519 const filteredDataYear = _.filter(config.data, (item) => { 24520 if (config.currentFilter === null || config.currentFilter === 'Type of artwork') { 24521 24522 return true 24523 } else { 24524 return item.planttype == config.currentFilter 24525 } 24526 }) 24527 24528const filteredDatamonth = _.filter(filteredDataYear, (item) => { 24529 24530 if (config.monthfilter === null || config.monthfilter === "Artist name") { 24531 return true 24532 } 24533 else { 24534 const artistBatch = getArtistBatch(item.plantorigin); 24535 return artistBatch === config.monthfilter; 24536 } 24537 24538 }) 24539 24540 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 24541 24542 if (config.tagfilter === null || config.tagfilter === 'Location') { 24543 return true 24544 } else { 24545 return item.LocationTitle.includes(config.tagfilter); 24546 } 24547 }) 24548 const filteredDataSearch = teststring ? _.filter(filteredDataTag, (item) => { 24549 return _.some([item.name.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(teststring.toLowerCase())); 24550 }) : filteredDataTag; 24551 24552 const filteredData = sortPlantByDate(filteredDataSearch, CONTENT_LISTING_ART.page.sorteddate); 24553 24554 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_ART.maximumItemPerPage) 24555 24556 const fragment = document.createDocumentFragment() 24557 24558 const prevBtn = paginationDots.parentNode.querySelector('.pagPrev') 24559 24560 const nextBtn = paginationDots.parentNode.querySelector('.pagNext') 24561
24562 let currentActiveDot = null 24563 _.forEach(getChildNodes(paginationDots), (item, index) => { 24564 if (item.classList.contains('active')) { 24565 currentActiveDot = index 24566 } 24567 item.remove() 24568 }) 24569 24570 let newActiveDot = null 24571 24572 _.times(_.size(dataChunk), (index) => { 24573 if (_.size(dataChunk) > 1) { 24574 const node = document.createElement('a'); 24575 node.innerText = index + 1; // Adding 1 to index since index starts from 0 24576 if (index === config.currentPage) { 24577 node.classList.add('active'); 24578 newActiveDot = index; 24579 } 24580 node.addEventListener('click', () => { 24581 reRenderPageContentART({ page: index }); 24582 onPageChangedGoToTopArt && window.scrollTo({ top: 0, behavior: 'smooth' }); 24583 }); 24584 fragment.appendChild(node); 24585 24586 } else { 24587 document.querySelector(".paginationMedia").style.display = "none"; 24588 } 24589 }); 24590 24591 24592 paginationDots.appendChild(fragment) 24593 normalizePagination(currentActiveDot, newActiveDot) 24594 24595 if (config.currentPage > 0) { 24596 prevBtn.classList.remove('disabled') 24597 } else { 24598 prevBtn.classList.add('disabled') 24599 } 24600 24601 if (config.currentPage < _.size(dataChunk) - 1) { 24602 nextBtn.classList.remove('disabled') 24603 } else { 24604 nextBtn.classList.add('disabled') 24605 } 24606 let requestUpdatePagination = new Event('requestUpdatePagination') 24607 document.dispatchEvent(requestUpdatePagination) 24608 updatePagination(); 24609} 24610 24611// Function to capture dropdown values and call reRenderPageContentART 24612function updateContentART() { 24613 const filterValue = document.querySelector(' .custom-dropdown__opt .item.active').getAttribute('data-option-value') 24614 const filterMonthValue = document.querySelector(' .custom-dropdown__opt-month .item.active').getAttribute('data-option-name') 24615 const filterTagsValue = document.querySelector(' .custom-dropdown__opt-tag .item.active').getAttribute('data-option-value') 24616 const filterSortValue = document.querySelector(' .custom-dropdown__opt-sort .item.active').getAttribute('data-option-value') 24617 24618 checkActiveClass(); 24619 24620 reRenderPageContentART({ 24621 filter: filterValue, 24622 filtermonth: filterMonthValue, 24623 filterTags: filterTagsValue, 24624 sortdate: filterSortValue 24625 }); 24626} 24627 24628function checkActiveClass() { 24629 const mapTestElement = document.querySelector('.maptest'); 24630 if (mapTestElement && mapTestElement.classList.contains('active')) { 24631 updateContentMapList(); 24632 } 24633} 24634 24635const reRenderPageContentART = ({ page = 0, filter = null, filtermonth = null, filterTags = null, loadmore = false, searchString = null, sortdate = null }) => { 24636 if (typeof page !== 'undefined') { 24637 setPagePaginationART(page) 24638 } 24639 24640 if (filter || filtermonth || filterTags || searchString || sortdate) { 24641 setPagePaginationART(0) 24642 CONTENT_LISTING_ART.page.offset = 0 24643 CONTENT_LISTING_ART.page.currentFilter = filter 24644 CONTENT_LISTING_ART.page.yearfilter = filter 24645 CONTENT_LISTING_ART.page.monthfilter = filtermonth 24646 CONTENT_LISTING_ART.page.tagfilter = filterTags 24647 CONTENT_LISTING_ART.page.searchString = searchString 24648 24649 resetPagePaginationART(0) 24650 CONTENT_LISTING_ART.page.sorteddate = sortdate 24651 FILTERED_CONTENT_LISTING_ART.page.offset = 0 24652 FILTERED_CONTENT_LISTING_ART.page.currentFilter = filter 24653 FILTERED_CONTENT_LISTING_ART.page.yearfilter = filter 24654 FILTERED_CONTENT_LISTING_ART.page.monthfilter = filtermonth 24655 FILTERED_CONTENT_LISTING_ART.page.tagfilter = filterTags 24656 FILTERED_CONTENT_LISTING_ART.page.searchString = searchString; 24657 } 24658 24659 const config = CONTENT_LISTING_ART.page 24660 24661 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 24662 const filteredDataYear = _.filter(config.data, (item) => { 24663 if (config.currentFilter === null || config.currentFilter === 'Type of artwork') { 24664 24665 return true 24666 } else { 24667 return item.planttype == config.currentFilter 24668 } 24669 }) 24670
24671 const filteredDatamonth = _.filter(filteredDataYear, (item) => { 24672 24673 if (config.monthfilter === null || config.monthfilter === "Artist name") { 24674 return true 24675 } 24676 else { 24677 const artistBatch = getArtistBatch(item.plantorigin); 24678 return artistBatch === config.monthfilter; 24679 } 24680 24681 }) 24682 24683 const filteredDataTag = _.filter(filteredDatamonth, (item) => { 24684 if (config.tagfilter === null || config.tagfilter === 'Location') { 24685 return true 24686 } else { 24687 return item.LocationTitle.includes(config.tagfilter); 24688 } 24689 }) 24690 const filteredDataSearch = searchString ? _.filter(filteredDataTag, (item) => { 24691 return _.some([item.name.toLowerCase(), ...item.tags.map(tag => tag.toLowerCase())], tag => tag.includes(searchString.toLowerCase())); 24692 }) : filteredDataTag; 24693 24694 const filteredData = sortPlantByDate(filteredDataSearch, CONTENT_LISTING_ART.page.sorteddate); 24695 24696 24697 if (filteredData.length > 0) { 24698 reverseartDivStyles(); 24699 24700 24701 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_ART.maximumItemPerPage + config.offset) 24702 24703 if (contentWrapperEl) { 24704 let dataToShown 24705 24706 if (!loadmore) { 24707 contentWrapperEl.innerHTML = '' 24708 dataToShown = dataChunk[config.currentPage] 24709 } else { 24710 dataToShown = _.slice(dataChunk[config.currentPage], config.offset) 24711 24712 } 24713 24714 _.forEach(dataToShown, (item) => { 24715 let el = generateArticleThumbnailART({ 24716 head: item.name, 24717 tags: item.tags, 24718 scientific: item.scientific, 24719 family: item.family, 24720 locationtitle: item.LocationTitle, 24721 locationurl: item.LocationUrl, 24722 summary: item.summary, 24723 planttype: item.planttype, 24724 plantorigin: item.plantorigin, 24725 sortedFormattedDate: item.sortedFormattedDate, 24726 ctaUrl: item.ctaUrl, 24727 imgAlt: item.thumbnailalttext, 24728 imgUrl: item.image, 24729 ctaLabel: item.ctaLabel, 24730 }) 24731 contentWrapperEl.appendChild(el) 24732 }) 24733 24734 CONTENT_LISTING_ART.page = { 24735 ...CONTENT_LISTING_ART.page, 24736 showing: { 24737 start: config.currentPage * CONTENT_CONFIG_ART.maximumItemPerPage, 24738 end: config.currentPage * CONTENT_CONFIG_ART.maximumItemPerPage + _.size(dataToShown) - 1, 24739 }, 24740 } 24741 24742 if (filter || filtermonth || filterTags || searchString || sortdate) { 24743 24744 FILTERED_CONTENT_LISTING_ART.page.data = filteredData 24745 FILTERED_CONTENT_LISTING_ART.page.filterKey = ['year', 'month', 'tag'] 24746 resetPagePaginationART(page) 24747 } else { 24748 setPagePaginationART(page) 24749 } 24750 } 24751 } else { 24752 updateArtDivStyles(); 24753 } 24754 if(!$('div.maptest').hasClass("active")){ 24755 TagMore(); 24756 24757 } 24758} 24759 24760const renderPageContentART = ({ els = [], filter = [], filtermonth = [], filterTags = [] }) => { 24761 24762 const config = CONTENT_LISTING_ART.page 24763 24764 const contentWrapperEl = document.querySelector(`[data-content-listing=page]`) 24765 24766 const contentFilterEl = document.querySelector(`[data-content-filter=page]`) 24767 24768 const pagination = document.querySelector('.pagination') 24769 24770 const emptyResult = contentWrapperEl?.nextElementSibling 24771 24772 if (_.size(els) == 0) { 24773 // pagination.classList.add('hidden') 24774 emptyResult?.classList.remove('hidden') 24775 return false 24776 } else { 24777 pagination.classList.remove('hidden') 24778 emptyResult?.classList.add('hidden') 24779 } 24780 24781 const dataChunk = _.chunk(els, CONTENT_CONFIG_ART.maximumItemPerPage) 24782 24783 24784 if (contentWrapperEl) { 24785 const dataToShown = dataChunk[0] 24786 24787 _.forEach(dataToShown, (item) => { 24788 contentWrapperEl.appendChild(item) 24789 24790 }) 24791 } 24792 24793 if (contentFilterEl) { 24794 const optionsWrapperEl = document.querySelector('.custom-dropdown__opt') 24795 // const optionsWrapperElMonth = document.querySelector('.custom-dropdown__opt-month') 24796 const optionsWrapperElTag = document.querySelector('.custom-dropdown__opt-tag') 24797 24798 // Adding click event listeners to dropdowns 24799 document.querySelector('.custom-dropdown__opt').addEventListener('click', updateContentART); 24800 document.querySelector('.custom-dropdown__opt-month').addEventListener('click', updateContentART); 24801 document.querySelector('.custom-dropdown__opt-tag').addEventListener('click', updateContentART); 24802 document.querySelector('.custom-dropdown__opt-sort').addEventListener('click', updateContentART); 24803 24804 const filterOptionEl = _.map(_.orderBy(filter, 'value', 'desc'), (item) => { 24805 let el = generateDropdownFilterART(item.name, item.value) 24806 24807 return el 24808 }) 24809 24810 24811 24812 const filterOptionElTag = _.map(_.orderBy(filterTags, 'value', 'desc'), (item) => { 24813 let el = generateDropdownFilterART(item.name, item.value) 24814 24815 return el 24816 }) 24817 24818 const filterEls = filterOptionEl 24819 24820 // const filterElsmonth = filterOptionElMonth 24821 24822 const filterElsTag = filterOptionElTag 24823 24824 24825 _.forEach(filterEls, (item) => { 24826 24827 optionsWrapperEl.appendChild(item) 24828 }) 24829 24830 24831 _.forEach(filterOptionElTag, (item) => { 24832 24833 optionsWrapperElTag.appendChild(item) 24834 }) 24835 24836 document.dispatchEvent(onListingFilterChangedArt) 24837 24838 setPagePaginationART() 24839 24840 const prevBtn = pagination.querySelector('.pagPrev') 24841 24842 const nextBtn = pagination.querySelector('.pagNext') 24843 24844 const filteredData = _.filter(config.data, (item) => { 24845 if (config.currentFilter === null || config.currentFilter === 'Location') { 24846 24847 return true 24848 } else { 24849 24850 return item[config.filterKey[0]] == config.currentFilter 24851 } 24852 }) 24853 24854 const dataChunk = _.chunk(filteredData, CONTENT_CONFIG_ART.maximumItemPerPage) 24855 24856 prevBtn.addEventListener('click', () => { 24857 const config = CONTENT_LISTING_ART.page 24858 if (config.currentPage > 0) {
24859 reRenderPageContentART({ page: config.currentPage - 1 }) 24860 onPageChangedGoToTopArt && window.scrollTo({ top: 0, behavior: 'smooth' }) 24861 } 24862 }) 24863 24864 nextBtn.addEventListener('click', () => { 24865 const config = CONTENT_LISTING_ART.page 24866 if (config.currentPage < _.size(dataChunk) - 1) { 24867 reRenderPageContentART({ page: config.currentPage + 1 }) 24868 onPageChangedGoToTopArt && window.scrollTo({ top: 0, behavior: 'smooth' }) 24869 } 24870 }) 24871 } 24872 let requestUpdatePagination = new Event('requestUpdatePagination') 24873 document.dispatchEvent(requestUpdatePagination); 24874 if(!$('div.maptest').hasClass("active")){ 24875 setTimeout( function() { TagMore(); updatePagination(); },50); 24876 } 24877} 24878 24879const generateArticleThumbnailART = ({ head, tags, scientific, family, locationtitle, locationurl, summary, planttype, plantorigin, date, ctaUrl, imgAlt, year, imgUrl, ctaLabel }) => { 24880 24881 // Generate HTML for the first two tags 24882 let visibleTagsHTML = tags.slice(0, 7).map(tag => ` 24883 <div class="itemTag"> 24884 <div class="tag"> 24885 <a href="${ctaUrl}"> 24886 <span>${tag}</span> 24887 </a> 24888 </div> 24889 </div> 24890 `).join(''); 24891 24892 // Generate HTML for additional tags, if any 24893 let hiddenTagsHTML = ''; 24894 if (tags.length > 1) { 24895 hiddenTagsHTML = ` 24896 <div class="itemTagMore"> 24897 <div class="tag"> 24898 <span>...</span> 24899 </div> 24900 </div> 24901 `; 24902 } 24903 24904 // Construct the HTML for the article thumbnail 24905 let item = ` 24906 <div class="itemMedia"> 24907 <div class="boxImg"> 24908 <a href="${ctaUrl}"> 24909 <img src="${imgUrl}" alt="${imgAlt}"> 24910 </a> 24911 </div> 24912 <div class="boxContent"> 24913 <div class="tags"> 24914 ${visibleTagsHTML} 24915 ${hiddenTagsHTML} 24916 </div> 24917 <a href="${ctaUrl}"> 24918 <p class="subText">${head}</p> 24919 </a> 24920 <div class="detail"> 24921 <p> 24922 ${plantorigin} 24923 </p> 24924 <a href="${locationurl}"> 24925 <p> 24926 <i class="icon-ic-location"></i> 24927 ${locationtitle} 24928 </p> 24929 </a> 24930 </div> 24931 </div> 24932 </div>`; 24933 24934 return htmlToElement(item); 24935} 24936 24937function mainList() { 24938 $('.paginationMedia').removeClass('hidden'); 24939 setTimeout( function() { TagMore(); },50); 24940} 24941 24942function mainMap() { 24943 $('.paginationMedia').addClass('hidden'); 24944} 24945function starting() { 24946 $(".mainListMediaSec .listItem").on("click", ".item", function () { 24947 $(".mainListMediaSec .listItem .item").removeClass("active"); 24948 $(this).addClass("active"); 24949 }); 24950 24951 $('.mainListMediaSec .viewMore .btn-default').on('click', function () { 24952 // updateContentMapList(); 24953 24954 displayArtist(NewResponse.length > 0 ? NewResponse : undefined, true);; 24955 if (currentIndex > itemsPerPage) { 24956 moveARTMap(currentIndex - itemsPerPage); 24957 $(".mainListMediaSec .listItem .item").removeClass("active"); 24958 $(".mainListMediaSec .listItem .item").eq(currentIndex - itemsPerPage).addClass("active"); 24959 var scrollableDiv = $('.mainListMediaSec .listItem'); 24960 var activeItem = $('.mainListMediaSec .listItem .item.active'); 24961 if (activeItem.length) { 24962 scrollableDiv.animate({ 24963 scrollTop: activeItem.offset().top - scrollableDiv.offset().top + scrollableDiv.scrollTop() 24964 }, 500); 24965 } 24966 } 24967 var plants = apiResponse 24968 if (currentIndex >= plants.length) { 24969 $('.mainListMediaSec .viewMore').hide(); 24970 } 24971 }); 24972} 24973 24974const initPageListingART = (url) => { 24975 const reqUrl = `${url}` 24976 let els = [] 24977 let filter = [] 24978 let filtermonth = [] 24979 let filterYear = [] 24980 let filterTags = [] 24981 24982 axios.get(reqUrl).then((res) => {
24983 const responseData = JSON.parse(res.data.newsDetails) 24984 apiResponse = JSON.parse(res.data.newsDetails); 24985 detailtranslation = res.data.detailText; 24986 directiontranslation = res.data.directionText; 24987 24988 // const responseData = res.data 24989 _.forEach( 24990 _.filter(responseData, (item) => true), 24991 (item) => { 24992 24993 els.push( 24994 generateArticleThumbnailART({ 24995 head: item.name, 24996 tags: item.tags, 24997 scientific: item.scientific, 24998 family: item.family, 24999 locationtitle: item.LocationTitle, 25000 locationurl: item.LocationUrl, 25001 summary: item.summary, 25002 planttype: item.planttype, 25003 plantorigin: item.plantorigin, 25004 sortedFormattedDate: item.sortedFormattedDate, 25005 ctaUrl: item.ctaUrl, 25006 imgAlt: item.thumbnailalttext, 25007 imgUrl: item.image, 25008 ctaLabel: item.ctaLabel, 25009 }) 25010 ) 25011 25012 filter.push({ name: item.planttype, value: item.planttype }) 25013 25014 filterYear.push({ name: item.planttype, value: item.planttype }) 25015 25016 filtermonth.push({ name: item.plantorigin, value: item.plantorigin, formattedFilteredMonth: item.plantorigin }) 25017 25018 filterTags.push({ name: item.LocationTitle, value: item.LocationTitle }) 25019 25020 25021 CONTENT_LISTING_ART.page = { ...CONTENT_LISTING_ART.page, currentPage: 0, data: responseData, filterKey: ['year', 'month', 'tag'] } 25022 25023 } 25024 ) 25025 renderPageContentART({ 25026 els, 25027 filter: _.uniqBy(filter, 'value'), 25028 filtermonth: _.uniqBy(filtermonth, 'value'), 25029 filterYear: _.uniqBy(filterYear, 'value'), 25030 filterTags: _.uniqBy(filterTags, 'value') 25031 }) 25032 initMap(); 25033 displayArtist(); 25034 starting(); 25035 }) 25036} 25037 25038 25039function getPageTypeInSection() { 25040 var sectionElements = document.querySelectorAll('section'); 25041 for (var i = 0; i < sectionElements.length; i++) { 25042 var sectionElement = sectionElements[i]; 25043 if (sectionElement.hasAttribute('data-page-type')) { 25044 var pageType = sectionElement.getAttribute('data-page-type'); 25045 // Return the value of the attribute 25046 return pageType; 25047 } 25048 } 25049} 25050 25051 25052const __initContentListingART = () => { 25053 const dataContentRenderingContainer = document.querySelectorAll('[data-content-render]') 25054 25055 var current_page = window.location.href; 25056 25057 var current_page_split = current_page.split(".html"); 25058 25059 _.forEach(dataContentRenderingContainer, (contentRender) => { 25060 25061 if (contentRender.dataset.contentRender === 'page') { 25062 25063 var pagetype = getPageTypeInSection(); 25064 25065 initPageListingART(current_page_split[0] + '/jcr:content/root/container/container/' + pagetype + '.model.json') 25066 25067 // initPageListingART('https://xieranmaya.github.io/images/cats/cats.json') 25068 } 25069 }) 25070}; 25071 25072 25073 25074(function () { 25075 let stateCheck = setInterval(() => { 25076 if (document.readyState === 'complete' && getPageTypeInSection() == "artmap") { 25077 clearInterval(stateCheck) 25078 __initContentListingART() 25079 console.log('Art Map page listing script imported') 25080 } 25081 }, 100) 25082})() 25083 25084$(document).ready(function () { 25085var listartmap = document.getElementsByClassName('artmap'); 25086 if (listartmap && listartmap.length > 0) { 25087 SwitchTags(); 25088 PagNext(); 25089 PagPrev(); 25090 updatePagination(); 25091 PagActive(); 25092 } 25093}); 25094 25095/* 25096The pagenation functions listed below are written in Newslist components JavaScript. 25097 PagNext(); 25098 PagPrev(); 25099 updatePagination(); 25100 PagActive(); 25101*/ 25102var artmap = document.getElementsByClassName('artmap'); 25103if(artmap && artmap.length > 0) { 25104$(".artmap .mainListMediaSec .filterYear .ui.inline.dropdown").dropdown({ 25105 forceSelection: false, //***** 25106 direction: "downward", 25107 delay: { 25108 touch: 0, 25109 }, 25110 onShow: function () { 25111 $(".ui.inline.dropdown").not(this).dropdown('hide'); 25112 } 25113}); 25114 25115$(".artmap .mainListMediaSec .filterMonths .ui.inline.dropdown").dropdown({ 25116 forceSelection: false, //***** 25117 direction: "downward", 25118 delay: { 25119 touch: 0, 25120 }, 25121 onShow: function () { 25122 $(".ui.inline.dropdown").not(this).dropdown('hide'); 25123 } 25124}); 25125 25126$(".artmap .mainListMediaSec .filterSegments .ui.inline.dropdown").dropdown({ 25127 forceSelection: false, //***** 25128 direction: "downward", 25129 delay: { 25130 touch: 0, 25131 }, 25132 onShow: function () { 25133 $(".ui.inline.dropdown").not(this).dropdown('hide'); 25134 } 25135}); 25136 25137 $(".artmap .mainListMediaSec .filterSoft .ui.inline.dropdown").dropdown({ 25138 forceSelection: false, //***** 25139 direction: "downward", 25140 delay: { 25141 touch: 0, 25142 }, 25143 onShow: function () { 25144 $(".ui.inline.dropdown").not(this).dropdown('hide'); 25145 } 25146 }); 25147} 25148 25149function SwitchTags() { 25150 $(".artmap .mainListMediaSec .titleMediaTabs .itemTitleTab").click(function () { 25151 $(".mainListMediaSec .titleMediaTabs .itemTitleTab").removeClass("active"); 25152 $(this).addClass("active"); 25153 var clickedTabIndex = $(this).index(); 25154 $(".mainListMediaSec .tabsMedia .itemBodyTab").removeClass("active"); 25155 $(".mainListMediaSec .tabsMedia .itemBodyTab:eq(" + clickedTabIndex + ")").addClass("active"); 25156 25157 if (clickedTabIndex == 1) { 25158 $(".artmap .mainListMediaSec .filterSoft").addClass("d-none"); 25159 }else { 25160 $(".artmap .mainListMediaSec .filterSoft").removeClass("d-none"); 25161 } 25162 25163 setTimeout(() => { 25164 var heightButton = $('.artmap .mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent .action .btn-default').innerWidth(); 25165 25166 if (heightButton > 120) { 25167 $(".artmap .mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent").addClass('fixHeight'); 25168 } else { 25169 $(".artmap .mainListMediaSec .mediaList .tabsMedia .itemBodyTab .blockMapList .innerMap .plantMap .boxMarkMap .itemMarkMap .boxContent").removeClass('fixHeight'); 25170 } 25171 }, 100); 25172 }); 25173} 25174 25175$(document).ready(function () { 25176 initializeLogoSlideShow(); 25177}); 25178 25179$(window).on("load resize", function () { 25180 initializeLogoSlideShow(); 25181}); 25182 25183function initializeLogoSlideShow() { 25184 $('.mainWorldClassSec').each(function (index, section) { 25185 var swiperContainer = $(section).find('.worldClassSwiper'); 25186 25187 new Swiper(swiperContainer[0], { 25188 slidesPerView: "auto", 25189 spaceBetween: 0, 25190 resizeObserver:!($("body").data('custom-mode') == "edit"), 25191 loop: true, 25192 }); 25193 25194 var screenWidth = $(window).width(); 25195 25196 var totalWidth = 0; 25197 $(section).find('.worldClassSlide .swiper-slide').each(function () { 25198 totalWidth += $(this).width(); 25199 }); 25200 25201 var slideItem = $(section).find('.worldClassSlide .worldClassSwiper'); 25202 slideItem.css('width', totalWidth); 25203 25204 var speed = 45; 25205 var SpeedWidth1 = $(this).attr("data-speed-w1"); 25206 var SpeedWidth2 = $(this).attr("data-speed-w2"); 25207 var SpeedWidth3 = $(this).attr("data-speed-w3"); 25208 25209 if ($(window).width() <= 5000 && $(window).width() >= 1200) { 25210 var Speed = Number(SpeedWidth1); 25211 } else if ($(window).width() <= 1199 && $(window).width() >= 768) { 25212 var Speed = Number(SpeedWidth2); 25213 } else { 25214 var Speed = Number(SpeedWidth3); 25215 } 25216 25217 var animation = gsap.to(slideItem, Speed, { 25218 x: -(totalWidth - screenWidth), 25219 ease: Linear.easeNone, 25220 repeat: -1, 25221 }); 25222 25223 $(slideItem).hover( 25224 function () { 25225 animation.pause(); 25226 }, 25227 function () { 25228 animation.play(); 25229 } 25230 ); 25231 }); 25232} 25233 25234 25235 25236 25237 25238
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.