(()=>{var e,t={95137(e,t,r){"use strict";const n="update",a="remove";class o{constructor(e,t){this.dom=e,this.data=t}run(){throw new Error(`Action type '${this.data.type}' - not implemented`)}incrementBodyDivIndex(e){const t=/(\/body\[\d+\]\/div\[)(\d+)/;return e.match(t)?e.replace(t,(e,t,r)=>`${t}${parseInt(r,10)+1}`):e}getElementByXPath(e){let t=e.replace("svg","*[name()='svg']");return document.getElementById("wpadminbar")&&(t=this.incrementBodyDivIndex(t)),this.dom.evaluate(t,this.dom,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}getElementByXPathFallbackSnippet(e,t=null){const r=t?this.getElementByXPath(t):null,n="string"==typeof e&&""!==e.trim();if(r&&n){const t=e.replace(/\s+/g," ").trim().toLowerCase();if(r.outerHTML.replace(/\s+/g," ").trim().toLowerCase().includes(t))return r}if(!n)return r||null;const a=(new DOMParser).parseFromString(e.trim(),"text/html").body.firstElementChild;if(!a)return r||null;const o=[a.tagName.toLowerCase()];a.id&&o.push(`#${a.id}`),a.classList.length&&o.push(`.${Array.from(a.classList).join(".")}`);const i=o.join("");return document.querySelector(i)||r||null}createElement(e,t=[],r=""){const n=document.createElement(e);return t.forEach(e=>{n.setAttribute(e.name,e.value)}),r&&(n.textContent=r),n}}class i extends o{run(){const{xpath:e,action:t,attribute_name:r,attribute_value:o,find:i}=this.data,l=e.replace("svg","*[name()='svg']"),s=this.getElementByXPathFallbackSnippet(i,l);if(!s)return!1;switch(t){case"add":case n:s.setAttribute(r,o);const e={alt:["role","title"],role:["alt","title"]};e[r]&&e[r].forEach(e=>s.removeAttribute(e));break;case a:s.removeAttribute(r);break;case"clear":s.setAttribute(r,"")}return!0}}class l extends o{run(){const{xpath:e,action:t,content:r,child:o}=this.data,i=this.getElementByXPath(e);if(!i)return!1;let l=null;if(o)try{l=this.createElement(o.tag,o.attributes||[],o.content||"")}catch(e){return}switch(t){case n:i.nodeValue=r;break;case a:i.remove();break;case"add_child":l&&i.appendChild(l);break;case"remove_child":l&&i.removeChild(l);break;case"add_before":l&&i.parentNode&&i.parentNode.insertBefore(l,i);break;case"add_after":l&&i.parentNode&&i.parentNode.insertBefore(l,i.nextSibling)}return!0}}class s extends o{replaceIgnoreCase(e,t,r,n,a){const o=n.indexOf(a);return-1===o?e:e.substring(0,o)+r+e.substring(o+t.length)}run(){const{xpath:e,find:t,replace:r}=this.data,n=this.getElementByXPathFallbackSnippet(t,e);if(!n)return!1;const a=n.outerHTML;if("string"!=typeof t||"string"!=typeof r)return!1;const o=a.toLowerCase(),i=t.toLowerCase();if(!o.includes(i))return!1;const l=this.replaceIgnoreCase(a,t,r,o,i);if(l===a)return!1;const s=document.createElement("div");s.innerHTML=l;const c=s.firstElementChild;return c&&n.parentNode&&n.parentNode.replaceChild(c,n),!0}}var c=r(76105),d=r.n(c),u=r(37347);const h=e=>{try{return!(!e||"string"!=typeof e||(u.Ay.parse(e),0))}catch(e){return!1}},g=e=>{const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/i);if(!t)return null;const r=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),a=parseInt(t[3]).toString(16).padStart(2,"0");return void 0!==t[4]&&parseFloat(t[4])<1?`#${r}${n}${a}${Math.round(255*parseFloat(t[4])).toString(16).padStart(2,"0")}`.toUpperCase():`#${r}${n}${a}`.toUpperCase()};class m extends o{constructor(e,t){super(e,t),this.maybeAddStyleTag()}maybeAddStyleTag(){let e=this.dom.querySelector("style#ea11y-remediation-styles");e||(e=this.dom.createElement("style"),e.id="ea11y-remediation-styles",this.dom.body.appendChild(e))}getStyleTag(){return this.dom.querySelector("style#ea11y-remediation-styles")}getElementCSSSelector(e){let t=this.getElementByXPath(e);if(!(t&&t instanceof Element))return null;const r=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;){let e=t.tagName.toLowerCase();if(t.id){e+=`#${t.id}`,r.unshift(e);break}if(t.className&&"body"!==t.tagName.toLowerCase()){const r=t.className.trim().split(/\s+/);r.length&&(e+="."+r.join("."))}const n=t.parentNode;if(n&&("body"!==n.tagName?.toLowerCase()||"div"!==t.tagName?.toLowerCase())){const r=Array.from(n.children).filter(e=>e.tagName===t.tagName);r.length>1&&(e+=`:nth-of-type(${r.indexOf(t)+1})`)}r.unshift(e),t=t.parentElement}return r.join(" > ")}getCssRulesForContrast(e=null,t=null,r=null,n=null){try{const a=e?this.getElementCSSSelector(e):null,o=r?this.getElementCSSSelector(r):null,i=`${a&&t?`${a} {color: ${t} !important;}`:""}${o&&n?`${o} {background-color: ${n} !important;}`:""}`;return h(i)?i:""}catch(e){return console.warn("Failed to convert XPath to CSS selector",e),""}}run(){const e=this.getStyleTag();if(!e)return!1;let t=this.data.rule;if("1"===this.data.global){const e=(()=>{const e={color:null,background:null},t=this.data.rule.matchAll(/([^{]+)\s*\{([^}]+)\}/g);for(const[,r,n]of t){let t;try{t=document.querySelector(r.trim())}catch{continue}const a=n.match(/(?<!background-)color\s*:\s*([^;!]+)/i),o=n.match(/background-color\s*:\s*([^;!]+)/i),i=a?a[1].trim():null,l=o?o[1].trim():null;if(i&&!e.color&&(e.color={item:t,value:i}),l&&!e.background&&(e.background={item:t,value:l}),e.color&&e.background)break}const r=e.color?.item||e.background?.item;if(r){const t=window.getComputedStyle(r);e.color||(e.color={item:r,value:g(t.getPropertyValue("color"))}),e.background||(e.background={item:r,value:g(t.getPropertyValue("background-color"))})}return e})(),r=d()(this.getElementByXPathFallbackSnippet(this.data.xpath,this.data.find)),n=d()(this.getElementByXPathFallbackSnippet(this.data.parentXPath,this.data.parentFind));t=this.getCssRulesForContrast(r,e.color.value,n,e.background.value)}return h(this.data.rule)&&(e.innerText+=t),!0}}class p{constructor(e){this.remediations=e,this.classMap={attribute:i,element:l,replace:s,styles:m,global:s},this.checkTimeout=null,this.runAll()}runAll(){this.remediations=this.remediations.filter(e=>!this.runRemediation(e))}runRemediation(e){const t=("1"===e.global?"global":e.type).toLowerCase(),r=this.classMap[t];if(r)try{return new r(document,e).run()}catch(t){window.AllyRemediations?.debug&&window.AllyRemediations.debug&&console.error("Remediation failed",t,e)}return!1}checkRemediations(){this.isComplete()||this.runAll()}isComplete(){return 0===this.remediations.length}}if(window?.AllyRemediations&&Array.isArray(window.AllyRemediations?.remediations)){let b=null,f=null,y=!1;function v(){y?b.runAll():(y=!0,b=new p(window.AllyRemediations.remediations),window.MutationObserver&&b.remediations.length>0&&(f=new MutationObserver(e=>{let t=!1;for(const r of e)if("childList"===r.type&&r.addedNodes.length>0){t=!0;break}t&&(clearTimeout(b.checkTimeout),b.checkTimeout=setTimeout(()=>{b.checkRemediations(),b.isComplete()&&f&&(f.disconnect(),f=null)},100))}),f.observe(document.body,{childList:!0,subtree:!0})))}window.AllyRemediations.initialize=v,window.addEventListener("DOMContentLoaded",function(){setTimeout(()=>{v()},400)}),"loading"!==document.readyState&&setTimeout(()=>{v()},400)}},76105(e){e.exports=function(){function e(){return(e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}var t={ignoreId:!1},r="undefined"!=typeof Node,n=r?Node.ELEMENT_NODE:1,a=r?Node.TEXT_NODE:3,o=r?Node.DOCUMENT_TYPE_NODE:10;return function(r,i){var l=e({},t,i),s=r;if(s&&s.id&&!l.ignoreId)return'//*[@id="'+s.id+'"]';for(var c=[];s&&(n===s.nodeType||a===s.nodeType);){for(var d=0,u=!1,h=s.previousSibling;h;)h.nodeType!==o&&h.nodeName===s.nodeName&&d++,h=h.previousSibling;for(h=s.nextSibling;h;){if(h.nodeName===s.nodeName){u=!0;break}h=h.nextSibling}var g=d||u?"["+(d+1)+"]":"";c.push(s.nodeType!=a?(s.prefix?s.prefix+":":"")+s.localName+g:"text()"+(g||"[1]")),s=s.parentNode}return c.length?"/"+c.reverse().join("/"):""}}()},48633(e){var t=String,r=function(){return{isColorSupported:!1,reset:t,bold:t,dim:t,italic:t,underline:t,inverse:t,hidden:t,strikethrough:t,black:t,red:t,green:t,yellow:t,blue:t,magenta:t,cyan:t,white:t,gray:t,bgBlack:t,bgRed:t,bgGreen:t,bgYellow:t,bgBlue:t,bgMagenta:t,bgCyan:t,bgWhite:t,blackBright:t,redBright:t,greenBright:t,yellowBright:t,blueBright:t,magentaBright:t,cyanBright:t,whiteBright:t,bgBlackBright:t,bgRedBright:t,bgGreenBright:t,bgYellowBright:t,bgBlueBright:t,bgMagentaBright:t,bgCyanBright:t,bgWhiteBright:t}};e.exports=r(),e.exports.createColors=r},49746(){},19977(){},197(){},21866(){},52739(){},95042(e){e.exports={nanoid:(e=21)=>{let t="",r=0|e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",a=0|r;for(;a--;)n+=e[Math.random()*e.length|0];return n}}}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var o=r[e]={exports:{}};return t[e].call(o.exports,o,o.exports,n),o.exports}n.m=t,e=[],n.O=(t,r,a,o)=>{if(!r){var i=1/0;for(d=0;d<e.length;d++){for(var[r,a,o]=e[d],l=!0,s=0;s<r.length;s++)(!1&o||i>=o)&&Object.keys(n.O).every(e=>n.O[e](r[s]))?r.splice(s--,1):(l=!1,o<i&&(i=o));if(l){e.splice(d--,1);var c=a();void 0!==c&&(t=c)}}return t}o=o||0;for(var d=e.length;d>0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[r,a,o]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={1275:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var a,o,[i,l,s]=r,c=0;if(i.some(t=>0!==e[t])){for(a in l)n.o(l,a)&&(n.m[a]=l[a]);if(s)var d=s(n)}for(t&&t(r);c<i.length;c++)o=i[c],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(d)},r=globalThis.webpackChunkpojo_accessibility=globalThis.webpackChunkpojo_accessibility||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=n.O(void 0,[5168],()=>n(95137));a=n.O(a)})();
const cuteAlert=({url:e,type:t,title:n,message:s,img:a,buttonText:o="OK",confirmText:c="OK",vibrate:r=[],playSound:l=null,cancelText:i="Cancel",closeStyle:d})=>new Promise(e=>{const u=document.querySelector(".alert-wrapper");u&&u.remove();const m=document.querySelector("body"),v=document.getElementsByTagName("script");let b="";for(let e of v)e.src.includes("cute-alert.js")&&(b=e.src.substring(0,e.src.lastIndexOf("/")));let g=`\n    <button class="alert-button ${t}-bg ${t}-btn">${o}</button>\n    `;if("question"===t&&(g=`\n      <div class="question-buttons">\n        <button class="confirm-button ${t}-bg ${t}-btn">${c}</button>\n        <button class="cancel-button error-bg error-btn">${i}</button>\n      </div>\n      `),r.length>0&&navigator.vibrate(r),null!==l){new Audio(l).play()}const y=`\n    <div class="alert-wrapper">\n      <div class="alert-frame">\n        ${a===undefined?'<div class="alert-header '+t+'-bg">':'<div class="alert-header-base">'}\n          <span class="alert-close ${"circle"===d?"alert-close-circle":"alert-close-default"}">X</span>\n          ${a===undefined?'<img class="alert-img" src="'+b+"/img/"+t+'.svg" />':'<div class="custom-img-wrapper">'+a+"</div>"}\n        </div>\n        <div class="alert-body">\n          <span class="alert-title">${n}</span>\n          <span class="alert-message">${s}</span>\n          ${g}\n        </div>\n      </div>\n    </div>\n    `;m.insertAdjacentHTML("afterend",y);const p=document.querySelector(".alert-wrapper"),f=document.querySelector(".alert-frame"),$=document.querySelector(".alert-close");if("question"===t){const t=document.querySelector(".confirm-button"),n=document.querySelector(".cancel-button");t.addEventListener("click",()=>{p.remove(),e("confirm")}),n.addEventListener("click",()=>{p.remove(),e()})}else{document.querySelector(".alert-button").addEventListener("click",()=>{p.remove(),e("ok")})}$.addEventListener("click",()=>{p.remove(),e("close")}),f.addEventListener("click",e=>{e.stopPropagation()})}),cuteToast=({type:e,title:t,message:n,timer:s=5e3,vibrate:a=[],playSound:o=null})=>new Promise(c=>{const r=document.querySelector("body"),l=document.getElementsByTagName("script");let i="";for(let e of l)e.src.includes("cute-alert.js")&&(i=e.src.substring(0,e.src.lastIndexOf("/")));let d=document.querySelector(".toast-container");d||(r.insertAdjacentHTML("afterend",'<div class="toast-container"></div>'),d=document.querySelector(".toast-container"));const u=mfCaoId(),m=`\n    <div class="toast-content ${e}-bg" id="${u}-toast-content">\n      <div>\n        <div class="toast-frame">\n          <div class="toast-body">\n            <img class="toast-body-img" src="${i}/img/${e}.svg" />'\n            <div class="toast-body-content">\n              <span class="toast-title">${t}</span>\n              <span class="toast-message">${n}</span>\n            </div>\n            <div class="toast-close" id="${u}-toast-close">X</div>\n          </div>\n        </div>\n        <div class="toast-timer ${e}-timer"  style="animation: timer${s}ms linear;>\n      </div>\n    </div>\n    `,v=document.querySelectorAll(".toast-content");v.length?v[0].insertAdjacentHTML("beforebegin",m):d.innerHTML=m;const b=document.getElementById(`${u}-toast-content`);if(a.length>0&&navigator.vibrate(a),null!==o){new Audio(o).play()}setTimeout(()=>{b.remove(),c()},s);document.getElementById(`${u}-toast-close`).addEventListener("click",()=>{b.remove(),c()})}),mfCaId=()=>"_"+Math.random().toString(36).substr(2,9);
!function(){class e{constructor(){this.initSettings(),this.initElements(),this.bindEvents()}initSettings(){this.settings={selectors:{menuToggle:".site-header .site-navigation-toggle",menuToggleHolder:".site-header .site-navigation-toggle-holder",dropdownMenu:".site-header .site-navigation-dropdown"}}}initElements(){this.elements={window:window,menuToggle:document.querySelector(this.settings.selectors.menuToggle),menuToggleHolder:document.querySelector(this.settings.selectors.menuToggleHolder),dropdownMenu:document.querySelector(this.settings.selectors.dropdownMenu)}}bindEvents(){this.elements.menuToggleHolder&&!this.elements.menuToggleHolder?.classList.contains("hide")&&(this.elements.menuToggle.addEventListener("click",()=>this.handleMenuToggle()),this.elements.dropdownMenu.querySelectorAll(".menu-item-has-children > a").forEach(e=>e.addEventListener("click",e=>this.handleMenuChildren(e))))}closeMenuItems(){this.elements.menuToggleHolder.classList.remove("elementor-active"),this.elements.window.removeEventListener("resize",()=>this.closeMenuItems())}handleMenuToggle(){const e=!this.elements.menuToggleHolder.classList.contains("elementor-active");this.elements.menuToggle.setAttribute("aria-expanded",e),this.elements.dropdownMenu.setAttribute("aria-hidden",!e),this.elements.dropdownMenu.inert=!e,this.elements.menuToggleHolder.classList.toggle("elementor-active",e),this.elements.dropdownMenu.querySelectorAll(".elementor-active").forEach(e=>e.classList.remove("elementor-active")),e?this.elements.window.addEventListener("resize",()=>this.closeMenuItems()):this.elements.window.removeEventListener("resize",()=>this.closeMenuItems())}handleMenuChildren(e){const t=e.currentTarget.parentElement;t?.classList&&t.classList.toggle("elementor-active")}}document.addEventListener("DOMContentLoaded",()=>{new e})}();
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function b(b){var i=".smartmenus_mouse";if(h||b)h&&b&&(a(document).off(i),h=!1);else{var j=!0,k=null,l={mousemove:function(b){var c={x:b.pageX,y:b.pageY,timeStamp:(new Date).getTime()};if(k){var d=Math.abs(k.x-c.x),g=Math.abs(k.y-c.y);if((d>0||g>0)&&d<=4&&g<=4&&c.timeStamp-k.timeStamp<=300&&(f=!0,j)){var h=a(b.target).closest("a");h.is("a")&&a.each(e,function(){if(a.contains(this.$root[0],h[0]))return this.itemEnter({currentTarget:h[0]}),!1}),j=!1}}k=c}};l[g?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(a){c(a.originalEvent)&&(f=!1)},a(document).on(d(l,i)),h=!0}}function c(a){return!/^(4|mouse)$/.test(a.pointerType)}function d(a,b){b||(b="");var c={};for(var d in a)c[d.split(" ").join(b+" ")+b]=a[d];return c}var e=[],f=!1,g="ontouchstart"in window,h=!1,i=window.requestAnimationFrame||function(a){return setTimeout(a,1e3/60)},j=window.cancelAnimationFrame||function(a){clearTimeout(a)},k=!!a.fn.animate;return a.SmartMenus=function(b,c){this.$root=a(b),this.opts=c,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in b.style||"webkitPerspective"in b.style,this.wasCollapsible=!1,this.init()},a.extend(a.SmartMenus,{hideAll:function(){a.each(e,function(){this.menuHideAll()})},destroy:function(){for(;e.length;)e[0].destroy();b(!0)},prototype:{init:function(c){var f=this;if(!c){e.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var g=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(d({"mouseover focusin":a.proxy(this.rootOver,this),"mouseout focusout":a.proxy(this.rootOut,this),keydown:a.proxy(this.rootKeyDown,this)},g)).on(d({mouseenter:a.proxy(this.itemEnter,this),mouseleave:a.proxy(this.itemLeave,this),mousedown:a.proxy(this.itemDown,this),focus:a.proxy(this.itemFocus,this),blur:a.proxy(this.itemBlur,this),click:a.proxy(this.itemClick,this)},g),"a"),g+=this.rootId,this.opts.hideOnClick&&a(document).on(d({touchstart:a.proxy(this.docTouchStart,this),touchmove:a.proxy(this.docTouchMove,this),touchend:a.proxy(this.docTouchEnd,this),click:a.proxy(this.docClick,this)},g)),a(window).on(d({"resize orientationchange":a.proxy(this.winResize,this)},g)),this.opts.subIndicators&&(this.$subArrow=a("<span/>").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),b()}if(this.$firstSub=this.$root.find("ul").each(function(){f.menuInit(a(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var h=/(index|default)\.[^#\?\/]*/i,i=/#.*/,j=window.location.href.replace(h,""),k=j.replace(i,"");this.$root.find("a:not(.mega-menu a)").each(function(){var b=this.href.replace(h,""),c=a(this);b!=j&&b!=k||(c.addClass("current"),f.opts.markCurrentTree&&c.parentsUntil("[data-smartmenus-id]","ul").each(function(){a(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(b){if(!b){var c=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(c),c+=this.rootId,a(document).off(c),a(window).off(c),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var d=this;this.$root.find("ul").each(function(){var b=a(this);b.dataSM("scroll-arrows")&&b.dataSM("scroll-arrows").remove(),b.dataSM("shown-before")&&((d.opts.subMenusMinWidth||d.opts.subMenusMaxWidth)&&b.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),b.dataSM("scroll-arrows")&&b.dataSM("scroll-arrows").remove(),b.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(b.attr("id")||"").indexOf(d.accessIdPrefix)&&b.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var b=a(this);0==b.attr("id").indexOf(d.accessIdPrefix)&&b.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),b||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),e.splice(a.inArray(this,e),1))},disable:function(b){if(!this.disabled){if(this.menuHideAll(),!b&&!this.opts.isPopup&&this.$root.is(":visible")){var c=this.$root.offset();this.$disableOverlay=a('<div class="sm-jquery-disable-overlay"/>').css({position:"absolute",top:c.top,left:c.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(b){return this.$touchScrollingSub?void(this.$touchScrollingSub=null):void((this.visibleSubMenus.length&&!a.contains(this.$root[0],b.target)||a(b.target).closest("a").length)&&this.menuHideAll())},docTouchEnd:function(b){if(this.lastTouch){if(this.visibleSubMenus.length&&(void 0===this.lastTouch.x2||this.lastTouch.x1==this.lastTouch.x2)&&(void 0===this.lastTouch.y2||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!a.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var c=this;this.hideTimeout=setTimeout(function(){c.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(a){if(this.lastTouch){var b=a.originalEvent.touches[0];this.lastTouch.x2=b.pageX,this.lastTouch.y2=b.pageY}},docTouchStart:function(a){var b=a.originalEvent.touches[0];this.lastTouch={x1:b.pageX,y1:b.pageY,target:b.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(b){for(var c=a(b).closest("ul");c.dataSM("in-mega");)c=c.parent().closest("ul");return c[0]||null},getHeight:function(a){return this.getOffset(a,!0)},getOffset:function(a,b){var c;"none"==a.css("display")&&(c={position:a[0].style.position,visibility:a[0].style.visibility},a.css({position:"absolute",visibility:"hidden"}).show());var d=a[0].getBoundingClientRect&&a[0].getBoundingClientRect(),e=d&&(b?d.height||d.bottom-d.top:d.width||d.right-d.left);return e||0===e||(e=b?a[0].offsetHeight:a[0].offsetWidth),c&&a.hide().css(c),e},getStartZIndex:function(a){var b=parseInt(this[a?"$root":"$firstSub"].css("z-index"));return!a&&isNaN(b)&&(b=parseInt(this.$root.css("z-index"))),isNaN(b)?1:b},getTouchPoint:function(a){return a.touches&&a.touches[0]||a.changedTouches&&a.changedTouches[0]||a},getViewport:function(a){var b=a?"Height":"Width",c=document.documentElement["client"+b],d=window["inner"+b];return d&&(c=Math.min(c,d)),c},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(a){return this.getOffset(a)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(a){return this.handleEvents()&&!this.isLinkInMegaMenu(a)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var b="fixed"==this.$root.css("position");return b||this.$root.parentsUntil("body").each(function(){if("fixed"==a(this).css("position"))return b=!0,!1}),b},isLinkInMegaMenu:function(b){return a(this.getClosestMenu(b[0])).hasClass("mega-menu")},isTouchMode:function(){return!f||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(b,c){var d=b.closest("ul"),e=d.dataSM("level");if(e>1&&(!this.activatedItems[e-2]||this.activatedItems[e-2][0]!=d.dataSM("parent-a")[0])){var f=this;a(d.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(d).each(function(){f.itemActivate(a(this).dataSM("parent-a"))})}if(this.isCollapsible()&&!c||this.menuHideSubMenus(this.activatedItems[e-1]&&this.activatedItems[e-1][0]==b[0]?e:e-1),this.activatedItems[e-1]=b,this.$root.triggerHandler("activate.smapi",b[0])!==!1){var g=b.dataSM("sub");g&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(g)}},itemBlur:function(b){var c=a(b.currentTarget);this.handleItemEvents(c)&&this.$root.triggerHandler("blur.smapi",c[0])},itemClick:function(b){var c=a(b.currentTarget);if(this.handleItemEvents(c)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==c.closest("ul")[0])return this.$touchScrollingSub=null,b.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",c[0])===!1)return!1;var d=c.dataSM("sub"),e=!!d&&2==d.dataSM("level");if(d){var f=a(b.target).is(".sub-arrow"),g=this.isCollapsible(),h=/toggle$/.test(this.opts.collapsibleBehavior),i=/link$/.test(this.opts.collapsibleBehavior),j=/^accordion/.test(this.opts.collapsibleBehavior);if(d.is(":visible")){if(!g&&this.opts.showOnClick&&e)return this.menuHide(d),this.clickActivated=!1,this.focusActivated=!1,!1;if(g&&(h||f))return this.itemActivate(c,j),this.menuHide(d),!1}else if((!i||!g||f)&&(!g&&this.opts.showOnClick&&e&&(this.clickActivated=!0),this.itemActivate(c,j),d.is(":visible")))return this.focusActivated=!0,!1}return!(!g&&this.opts.showOnClick&&e||c.hasClass("disabled")||this.$root.triggerHandler("select.smapi",c[0])===!1)&&void 0}},itemDown:function(b){var c=a(b.currentTarget);this.handleItemEvents(c)&&c.dataSM("mousedown",!0)},itemEnter:function(b){var c=a(b.currentTarget);if(this.handleItemEvents(c)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var d=this;this.showTimeout=setTimeout(function(){d.itemActivate(c)},this.opts.showOnClick&&1==c.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",c[0])}},itemFocus:function(b){var c=a(b.currentTarget);this.handleItemEvents(c)&&(!this.focusActivated||this.isTouchMode()&&c.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==c[0]||this.itemActivate(c,!0),this.$root.triggerHandler("focus.smapi",c[0]))},itemLeave:function(b){var c=a(b.currentTarget);this.handleItemEvents(c)&&(this.isTouchMode()||(c[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),c.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",c[0]))},menuHide:function(b){if(this.$root.triggerHandler("beforehide.smapi",b[0])!==!1&&(k&&b.stop(!0,!0),"none"!=b.css("display"))){var c=function(){b.css("z-index","")};this.isCollapsible()?k&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,b,c):b.hide(this.opts.collapsibleHideDuration,c):k&&this.opts.hideFunction?this.opts.hideFunction.call(this,b,c):b.hide(this.opts.hideDuration,c),b.dataSM("scroll")&&(this.menuScrollStop(b),b.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),b.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),b.attr({"aria-expanded":"false","aria-hidden":"true"});var d=b.dataSM("level");this.activatedItems.splice(d-1,1),this.visibleSubMenus.splice(a.inArray(b,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",b[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var a=this.opts.isPopup?1:0,b=this.visibleSubMenus.length-1;b>=a;b--)this.menuHide(this.visibleSubMenus[b]);this.opts.isPopup&&(k&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(k&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(a){for(var b=this.activatedItems.length-1;b>=a;b--){var c=this.activatedItems[b].dataSM("sub");c&&this.menuHide(c)}},menuInit:function(a){if(!a.dataSM("in-mega")){a.hasClass("mega-menu")&&a.find("ul").dataSM("in-mega",!0);for(var b=2,c=a[0];(c=c.parentNode.parentNode)!=this.$root[0];)b++;var d=a.prevAll("a").eq(-1);d.length||(d=a.prevAll().find("a").eq(-1)),d.addClass("has-submenu").dataSM("sub",a),a.dataSM("parent-a",d).dataSM("level",b).parent().dataSM("sub",a);var e=d.attr("id")||this.accessIdPrefix+ ++this.idInc,f=a.attr("id")||this.accessIdPrefix+ ++this.idInc;d.attr({id:e,"aria-haspopup":"true","aria-controls":f,"aria-expanded":"false"}),a.attr({id:f,role:"group","aria-hidden":"true","aria-labelledby":e,"aria-expanded":"false"}),this.opts.subIndicators&&d[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(b){var c,e,f=b.dataSM("parent-a"),h=f.closest("li"),i=h.parent(),j=b.dataSM("level"),k=this.getWidth(b),l=this.getHeight(b),m=f.offset(),n=m.left,o=m.top,p=this.getWidth(f),q=this.getHeight(f),r=a(window),s=r.scrollLeft(),t=r.scrollTop(),u=this.getViewportWidth(),v=this.getViewportHeight(),w=i.parent().is("[data-sm-horizontal-sub]")||2==j&&!i.hasClass("sm-vertical"),x=this.opts.rightToLeftSubMenus&&!h.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&h.is("[data-sm-reverse]"),y=2==j?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,z=2==j?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(w?(c=x?p-k-y:y,e=this.opts.bottomToTopSubMenus?-l-z:q+z):(c=x?y-k:p-y,e=this.opts.bottomToTopSubMenus?q-z-l:z),this.opts.keepInViewport){var A=n+c,B=o+e;if(x&&A<s?c=w?s-A+c:p-y:!x&&A+k>s+u&&(c=w?s+u-k-A+c:y-k),w||(l<v&&B+l>t+v?e+=t+v-l-B:(l>=v||B<t)&&(e+=t-B)),w&&(B+l>t+v+.49||B<t)||!w&&l>v+.49){var C=this;b.dataSM("scroll-arrows")||b.dataSM("scroll-arrows",a([a('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0],a('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]).on({mouseenter:function(){b.dataSM("scroll").up=a(this).hasClass("scroll-up"),C.menuScroll(b)},mouseleave:function(a){C.menuScrollStop(b),C.menuScrollOut(b,a)},"mousewheel DOMMouseScroll":function(a){a.preventDefault()}}).insertAfter(b));var D=".smartmenus_scroll";if(b.dataSM("scroll",{y:this.cssTransforms3d?0:e-q,step:1,itemH:q,subH:l,arrowDownH:this.getHeight(b.dataSM("scroll-arrows").eq(1))}).on(d({mouseover:function(a){C.menuScrollOver(b,a)},mouseout:function(a){C.menuScrollOut(b,a)},"mousewheel DOMMouseScroll":function(a){C.menuScrollMousewheel(b,a)}},D)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:c+(parseInt(b.css("border-left-width"))||0),width:k-(parseInt(b.css("border-left-width"))||0)-(parseInt(b.css("border-right-width"))||0),zIndex:b.css("z-index")}).eq(w&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var E={};E[g?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(a){C.menuScrollTouch(b,a)},b.css({"touch-action":"none","-ms-touch-action":"none"}).on(d(E,D))}}}b.css({top:"auto",left:"0",marginLeft:c,marginTop:e-q})},menuScroll:function(a,b,c){var d,e=a.dataSM("scroll"),g=a.dataSM("scroll-arrows"),h=e.up?e.upEnd:e.downEnd;if(!b&&e.momentum){if(e.momentum*=.92,d=e.momentum,d<.5)return void this.menuScrollStop(a)}else d=c||(b||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(e.step));var j=a.dataSM("level");if(this.activatedItems[j-1]&&this.activatedItems[j-1].dataSM("sub")&&this.activatedItems[j-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(j-1),e.y=e.up&&h<=e.y||!e.up&&h>=e.y?e.y:Math.abs(h-e.y)>d?e.y+(e.up?d:-d):h,a.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+e.y+"px, 0)",transform:"translate3d(0, "+e.y+"px, 0)"}:{marginTop:e.y}),f&&(e.up&&e.y>e.downEnd||!e.up&&e.y<e.upEnd)&&g.eq(e.up?1:0).show(),e.y==h)f&&g.eq(e.up?0:1).hide(),this.menuScrollStop(a);else if(!b){this.opts.scrollAccelerate&&e.step<this.opts.scrollStep&&(e.step+=.2);var k=this;this.scrollTimeout=i(function(){k.menuScroll(a)})}},menuScrollMousewheel:function(a,b){if(this.getClosestMenu(b.target)==a[0]){b=b.originalEvent;var c=(b.wheelDelta||-b.detail)>0;a.dataSM("scroll-arrows").eq(c?0:1).is(":visible")&&(a.dataSM("scroll").up=c,this.menuScroll(a,!0))}b.preventDefault()},menuScrollOut:function(b,c){f&&(/^scroll-(up|down)/.test((c.relatedTarget||"").className)||(b[0]==c.relatedTarget||a.contains(b[0],c.relatedTarget))&&this.getClosestMenu(c.relatedTarget)==b[0]||b.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(b,c){if(f&&!/^scroll-(up|down)/.test(c.target.className)&&this.getClosestMenu(c.target)==b[0]){this.menuScrollRefreshData(b);var d=b.dataSM("scroll"),e=a(window).scrollTop()-b.dataSM("parent-a").offset().top-d.itemH;b.dataSM("scroll-arrows").eq(0).css("margin-top",e).end().eq(1).css("margin-top",e+this.getViewportHeight()-d.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(b){var c=b.dataSM("scroll"),d=a(window).scrollTop()-b.dataSM("parent-a").offset().top-c.itemH;this.cssTransforms3d&&(d=-(parseFloat(b.css("margin-top"))-d)),a.extend(c,{upEnd:d,downEnd:d+this.getViewportHeight()-c.subH})},menuScrollStop:function(a){if(this.scrollTimeout)return j(this.scrollTimeout),this.scrollTimeout=0,a.dataSM("scroll").step=1,!0},menuScrollTouch:function(b,d){if(d=d.originalEvent,c(d)){var e=this.getTouchPoint(d);if(this.getClosestMenu(e.target)==b[0]){var f=b.dataSM("scroll");if(/(start|down)$/i.test(d.type))this.menuScrollStop(b)?(d.preventDefault(),this.$touchScrollingSub=b):this.$touchScrollingSub=null,this.menuScrollRefreshData(b),a.extend(f,{touchStartY:e.pageY,touchStartTime:d.timeStamp});else if(/move$/i.test(d.type)){var g=void 0!==f.touchY?f.touchY:f.touchStartY;if(void 0!==g&&g!=e.pageY){this.$touchScrollingSub=b;var h=g<e.pageY;void 0!==f.up&&f.up!=h&&a.extend(f,{touchStartY:e.pageY,touchStartTime:d.timeStamp}),a.extend(f,{up:h,touchY:e.pageY}),this.menuScroll(b,!0,Math.abs(e.pageY-g))}d.preventDefault()}else void 0!==f.touchY&&((f.momentum=15*Math.pow(Math.abs(e.pageY-f.touchStartY)/(d.timeStamp-f.touchStartTime),2))&&(this.menuScrollStop(b),this.menuScroll(b),d.preventDefault()),delete f.touchY)}}},menuShow:function(a){if((a.dataSM("beforefirstshowfired")||(a.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",a[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",a[0])!==!1&&(a.dataSM("shown-before",!0),k&&a.stop(!0,!0),!a.is(":visible"))){var b=a.dataSM("parent-a"),c=this.isCollapsible();if((this.opts.keepHighlighted||c)&&b.addClass("highlighted"),c)a.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(a.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(a.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&a.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var d=this.getWidth(a);a.css("max-width",this.opts.subMenusMaxWidth),d>this.getWidth(a)&&a.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(a)}var e=function(){a.css("overflow","")};c?k&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,a,e):a.show(this.opts.collapsibleShowDuration,e):k&&this.opts.showFunction?this.opts.showFunction.call(this,a,e):a.show(this.opts.showDuration,e),b.attr("aria-expanded","true"),a.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(a),this.$root.triggerHandler("show.smapi",a[0])}},popupHide:function(a){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var b=this;this.hideTimeout=setTimeout(function(){b.menuHideAll()},a?1:this.opts.hideTimeout)},popupShow:function(a,b){if(!this.opts.isPopup)return void alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),k&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:a,top:b});var c=this,d=function(){c.$root.css("overflow","")};k&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,d):this.$root.show(this.opts.showDuration,d),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(b){if(this.handleEvents())switch(b.keyCode){case 27:var c=this.activatedItems[0];if(c){this.menuHideAll(),c[0].focus();var d=c.dataSM("sub");d&&this.menuHide(d)}break;case 32:var e=a(b.target);if(e.is("a")&&this.handleItemEvents(e)){var d=e.dataSM("sub");d&&!d.is(":visible")&&(this.itemClick({currentTarget:b.target}),b.preventDefault())}}},rootOut:function(a){if(this.handleEvents()&&!this.isTouchMode()&&a.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var b=this;this.hideTimeout=setTimeout(function(){b.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(a){this.handleEvents()&&!this.isTouchMode()&&a.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(a){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==a.type){var b=this.isCollapsible();this.wasCollapsible&&b||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=b}}else if(this.$disableOverlay){var c=this.$root.offset();this.$disableOverlay.css({top:c.top,left:c.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),a.fn.dataSM=function(a,b){return b?this.data(a+"_smartmenus",b):this.data(a+"_smartmenus")},a.fn.removeDataSM=function(a){return this.removeData(a+"_smartmenus")},a.fn.smartmenus=function(b){if("string"==typeof b){var c=arguments,d=b;return Array.prototype.shift.call(c),this.each(function(){var b=a(this).data("smartmenus");b&&b[d]&&b[d].apply(b,c)})}return this.each(function(){var c=a(this).data("sm-options")||null;c&&"object"!=typeof c&&(c=null,alert('ERROR\n\nSmartMenus jQuery init:\nThe value of the "data-sm-options" attribute must be valid JSON.')),c&&a.each(["showFunction","hideFunction","collapsibleShowFunction","collapsibleHideFunction"],function(){this in c&&delete c[this]}),new a.SmartMenus(this,a.extend({},a.fn.smartmenus.defaults,b,c))})},a.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(a,b){a.fadeOut(200,b)},collapsibleShowDuration:0,collapsibleShowFunction:function(a,b){a.slideDown(200,b)},collapsibleHideDuration:0,collapsibleHideFunction:function(a,b){a.slideUp(200,b)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},a});
(typeof navigator!=="undefined")&&(function(root, factory){
if(typeof define==="function"&&define.amd){
define(function(){
return factory(root);
});
}else if(typeof module==="object"&&module.exports){
module.exports=factory(root);
}else{
root.lottie=factory(root);
root.bodymovin=root.lottie;
}}((window||{}), function(window){
"use strict";var svgNS="http://www.w3.org/2000/svg",locationHref="",initialDefaultFrame=-999999,subframeEnabled=!0,expressionsPlugin,isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),cachedColors={},bm_rounder=Math.round,bm_rnd,bm_pow=Math.pow,bm_sqrt=Math.sqrt,bm_abs=Math.abs,bm_floor=Math.floor,bm_max=Math.max,bm_min=Math.min,blitter=10,BMMath={};function ProjectInterface(){return{}}!function(){var t,e=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],r=e.length;for(t=0;t<r;t+=1)BMMath[e[t]]=Math[e[t]]}(),BMMath.random=Math.random,BMMath.abs=function(t){if("object"===typeof t&&t.length){var e,r=createSizedArray(t.length),i=t.length;for(e=0;e<i;e+=1)r[e]=Math.abs(t[e]);return r}return Math.abs(t)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function roundValues(t){bm_rnd=t?Math.round:function(t){return t}}function styleDiv(t){t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.display="block",t.style.transformOrigin=t.style.webkitTransformOrigin="0 0",t.style.backfaceVisibility=t.style.webkitBackfaceVisibility="visible",t.style.transformStyle=t.style.webkitTransformStyle=t.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(t,e,r,i){this.type=t,this.currentTime=e,this.totalTime=r,this.direction=i<0?-1:1}function BMCompleteEvent(t,e){this.type=t,this.direction=e<0?-1:1}function BMCompleteLoopEvent(t,e,r,i){this.type=t,this.currentLoop=r,this.totalLoops=e,this.direction=i<0?-1:1}function BMSegmentStartEvent(t,e,r){this.type=t,this.firstFrame=e,this.totalFrames=r}function BMDestroyEvent(t,e){this.type=t,this.target=e}function BMRenderFrameErrorEvent(t,e){this.type="renderFrameError",this.nativeError=t,this.currentTime=e}function BMConfigErrorEvent(t){this.type="configError",this.nativeError=t}function BMAnimationConfigErrorEvent(t,e){this.type=t,this.nativeError=e,this.currentTime=currentTime}roundValues(!1);var createElementID=(G=0,function(){return"__lottie_element_"+ ++G}),G;function HSVtoRGB(t,e,r){var i,s,a,n,o,h,l,p;switch(h=r*(1-e),l=r*(1-(o=6*t-(n=Math.floor(6*t)))*e),p=r*(1-(1-o)*e),n%6){case 0:i=r,s=p,a=h;break;case 1:i=l,s=r,a=h;break;case 2:i=h,s=r,a=p;break;case 3:i=h,s=l,a=r;break;case 4:i=p,s=h,a=r;break;case 5:i=r,s=h,a=l}return[i,s,a]}function RGBtoHSV(t,e,r){var i,s=Math.max(t,e,r),a=Math.min(t,e,r),n=s-a,o=0===s?0:n/s,h=s/255;switch(s){case a:i=0;break;case t:i=e-r+n*(e<r?6:0),i/=6*n;break;case e:i=r-t+2*n,i/=6*n;break;case r:i=t-e+4*n,i/=6*n}return[i,o,h]}function addSaturationToRGB(t,e){var r=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return r[1]+=e,1<r[1]?r[1]=1:r[1]<=0&&(r[1]=0),HSVtoRGB(r[0],r[1],r[2])}function addBrightnessToRGB(t,e){var r=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return r[2]+=e,1<r[2]?r[2]=1:r[2]<0&&(r[2]=0),HSVtoRGB(r[0],r[1],r[2])}function addHueToRGB(t,e){var r=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return r[0]+=e/360,1<r[0]?r[0]-=1:r[0]<0&&(r[0]+=1),HSVtoRGB(r[0],r[1],r[2])}var rgbToHex=function(){var t,e,i=[];for(t=0;t<256;t+=1)e=t.toString(16),i[t]=1==e.length?"0"+e:e;return function(t,e,r){return t<0&&(t=0),e<0&&(e=0),r<0&&(r=0),"#"+i[t]+i[e]+i[r]}}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(t,e){if(this._cbs[t])for(var r=this._cbs[t].length,i=0;i<r;i++)this._cbs[t][i](e)},addEventListener:function(t,e){return this._cbs[t]||(this._cbs[t]=[]),this._cbs[t].push(e),function(){this.removeEventListener(t,e)}.bind(this)},removeEventListener:function(t,e){if(e){if(this._cbs[t]){for(var r=0,i=this._cbs[t].length;r<i;)this._cbs[t][r]===e&&(this._cbs[t].splice(r,1),r-=1,i-=1),r+=1;this._cbs[t].length||(this._cbs[t]=null)}}else this._cbs[t]=null}};var createTypedArray="function"==typeof Uint8ClampedArray&&"function"==typeof Float32Array?function(t,e){return"float32"===t?new Float32Array(e):"int16"===t?new Int16Array(e):"uint8c"===t?new Uint8ClampedArray(e):void 0}:function(t,e){var r,i=0,s=[];switch(t){case"int16":case"uint8c":r=1;break;default:r=1.1}for(i=0;i<e;i+=1)s.push(r);return s};function createSizedArray(t){return Array.apply(null,{length:t})}function createNS(t){return document.createElementNS(svgNS,t)}function createTag(t){return document.createElement(t)}function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(t){-1===this.dynamicProperties.indexOf(t)&&(this.dynamicProperties.push(t),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var t,e=this.dynamicProperties.length;for(t=0;t<e;t+=1)this.dynamicProperties[t].getValue(),this.dynamicProperties[t]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(t){this.container=t,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var getBlendMode=(Pa={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"},function(t){return Pa[t]||""}),Pa,Matrix=function(){var s=Math.cos,a=Math.sin,n=Math.tan,i=Math.round;function t(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function e(t){if(0===t)return this;var e=s(t),r=a(t);return this._t(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1)}function r(t){if(0===t)return this;var e=s(t),r=a(t);return this._t(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1)}function o(t){if(0===t)return this;var e=s(t),r=a(t);return this._t(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1)}function h(t){if(0===t)return this;var e=s(t),r=a(t);return this._t(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1)}function l(t,e){return this._t(1,e,t,1,0,0)}function p(t,e){return this.shear(n(t),n(e))}function m(t,e){var r=s(e),i=a(e);return this._t(r,i,0,0,-i,r,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,n(t),1,0,0,0,0,1,0,0,0,0,1)._t(r,-i,0,0,i,r,0,0,0,0,1,0,0,0,0,1)}function f(t,e,r){return r||0===r||(r=1),1===t&&1===e&&1===r?this:this._t(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)}function c(t,e,r,i,s,a,n,o,h,l,p,m,f,c,d,u){return this.props[0]=t,this.props[1]=e,this.props[2]=r,this.props[3]=i,this.props[4]=s,this.props[5]=a,this.props[6]=n,this.props[7]=o,this.props[8]=h,this.props[9]=l,this.props[10]=p,this.props[11]=m,this.props[12]=f,this.props[13]=c,this.props[14]=d,this.props[15]=u,this}function d(t,e,r){return r=r||0,0!==t||0!==e||0!==r?this._t(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1):this}function u(t,e,r,i,s,a,n,o,h,l,p,m,f,c,d,u){var y=this.props;if(1===t&&0===e&&0===r&&0===i&&0===s&&1===a&&0===n&&0===o&&0===h&&0===l&&1===p&&0===m)return y[12]=y[12]*t+y[15]*f,y[13]=y[13]*a+y[15]*c,y[14]=y[14]*p+y[15]*d,y[15]=y[15]*u,this._identityCalculated=!1,this;var g=y[0],v=y[1],b=y[2],E=y[3],x=y[4],S=y[5],P=y[6],_=y[7],A=y[8],C=y[9],T=y[10],k=y[11],M=y[12],D=y[13],w=y[14],F=y[15];return y[0]=g*t+v*s+b*h+E*f,y[1]=g*e+v*a+b*l+E*c,y[2]=g*r+v*n+b*p+E*d,y[3]=g*i+v*o+b*m+E*u,y[4]=x*t+S*s+P*h+_*f,y[5]=x*e+S*a+P*l+_*c,y[6]=x*r+S*n+P*p+_*d,y[7]=x*i+S*o+P*m+_*u,y[8]=A*t+C*s+T*h+k*f,y[9]=A*e+C*a+T*l+k*c,y[10]=A*r+C*n+T*p+k*d,y[11]=A*i+C*o+T*m+k*u,y[12]=M*t+D*s+w*h+F*f,y[13]=M*e+D*a+w*l+F*c,y[14]=M*r+D*n+w*p+F*d,y[15]=M*i+D*o+w*m+F*u,this._identityCalculated=!1,this}function y(){return this._identityCalculated||(this._identity=!(1!==this.props[0]||0!==this.props[1]||0!==this.props[2]||0!==this.props[3]||0!==this.props[4]||1!==this.props[5]||0!==this.props[6]||0!==this.props[7]||0!==this.props[8]||0!==this.props[9]||1!==this.props[10]||0!==this.props[11]||0!==this.props[12]||0!==this.props[13]||0!==this.props[14]||1!==this.props[15]),this._identityCalculated=!0),this._identity}function g(t){for(var e=0;e<16;){if(t.props[e]!==this.props[e])return!1;e+=1}return!0}function v(t){var e;for(e=0;e<16;e+=1)t.props[e]=this.props[e]}function b(t){var e;for(e=0;e<16;e+=1)this.props[e]=t[e]}function E(t,e,r){return{x:t*this.props[0]+e*this.props[4]+r*this.props[8]+this.props[12],y:t*this.props[1]+e*this.props[5]+r*this.props[9]+this.props[13],z:t*this.props[2]+e*this.props[6]+r*this.props[10]+this.props[14]}}function x(t,e,r){return t*this.props[0]+e*this.props[4]+r*this.props[8]+this.props[12]}function S(t,e,r){return t*this.props[1]+e*this.props[5]+r*this.props[9]+this.props[13]}function P(t,e,r){return t*this.props[2]+e*this.props[6]+r*this.props[10]+this.props[14]}function _(){var t=this.props[0]*this.props[5]-this.props[1]*this.props[4],e=this.props[5]/t,r=-this.props[1]/t,i=-this.props[4]/t,s=this.props[0]/t,a=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/t,n=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/t,o=new Matrix;return o.props[0]=e,o.props[1]=r,o.props[4]=i,o.props[5]=s,o.props[12]=a,o.props[13]=n,o}function A(t){return this.getInverseMatrix().applyToPointArray(t[0],t[1],t[2]||0)}function C(t){var e,r=t.length,i=[];for(e=0;e<r;e+=1)i[e]=A(t[e]);return i}function T(t,e,r){var i=createTypedArray("float32",6);if(this.isIdentity())i[0]=t[0],i[1]=t[1],i[2]=e[0],i[3]=e[1],i[4]=r[0],i[5]=r[1];else{var s=this.props[0],a=this.props[1],n=this.props[4],o=this.props[5],h=this.props[12],l=this.props[13];i[0]=t[0]*s+t[1]*n+h,i[1]=t[0]*a+t[1]*o+l,i[2]=e[0]*s+e[1]*n+h,i[3]=e[0]*a+e[1]*o+l,i[4]=r[0]*s+r[1]*n+h,i[5]=r[0]*a+r[1]*o+l}return i}function k(t,e,r){return this.isIdentity()?[t,e,r]:[t*this.props[0]+e*this.props[4]+r*this.props[8]+this.props[12],t*this.props[1]+e*this.props[5]+r*this.props[9]+this.props[13],t*this.props[2]+e*this.props[6]+r*this.props[10]+this.props[14]]}function M(t,e){if(this.isIdentity())return t+","+e;var r=this.props;return Math.round(100*(t*r[0]+e*r[4]+r[12]))/100+","+Math.round(100*(t*r[1]+e*r[5]+r[13]))/100}function D(){for(var t=0,e=this.props,r="matrix3d(";t<16;)r+=i(1e4*e[t])/1e4,r+=15===t?")":",",t+=1;return r}function w(t){return t<1e-6&&0<t||-1e-6<t&&t<0?i(1e4*t)/1e4:t}function F(){var t=this.props;return"matrix("+w(t[0])+","+w(t[1])+","+w(t[4])+","+w(t[5])+","+w(t[12])+","+w(t[13])+")"}return function(){this.reset=t,this.rotate=e,this.rotateX=r,this.rotateY=o,this.rotateZ=h,this.skew=p,this.skewFromAxis=m,this.shear=l,this.scale=f,this.setTransform=c,this.translate=d,this.transform=u,this.applyToPoint=E,this.applyToX=x,this.applyToY=S,this.applyToZ=P,this.applyToPointArray=k,this.applyToTriplePoints=T,this.applyToPointStringified=M,this.toCSS=D,this.to2dCSS=F,this.clone=v,this.cloneFromProps=b,this.equals=g,this.inversePoints=C,this.inversePoint=A,this.getInverseMatrix=_,this._t=this.transform,this.isIdentity=y,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();!function(o,h){var l,p=this,m=256,f=6,c="random",d=h.pow(m,f),u=h.pow(2,52),y=2*u,g=m-1;function v(t){var e,r=t.length,n=this,i=0,s=n.i=n.j=0,a=n.S=[];for(r||(t=[r++]);i<m;)a[i]=i++;for(i=0;i<m;i++)a[i]=a[s=g&s+t[i%r]+(e=a[i])],a[s]=e;n.g=function(t){for(var e,r=0,i=n.i,s=n.j,a=n.S;t--;)e=a[i=g&i+1],r=r*m+a[g&(a[i]=a[s=g&s+e])+(a[s]=e)];return n.i=i,n.j=s,r}}function b(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function E(t,e){for(var r,i=t+"",s=0;s<i.length;)e[g&s]=g&(r^=19*e[g&s])+i.charCodeAt(s++);return x(e)}function x(t){return String.fromCharCode.apply(0,t)}h["seed"+c]=function(t,e,r){var i=[],s=E(function t(e,r){var i,s=[],a=typeof e;if(r&&"object"==a)for(i in e)try{s.push(t(e[i],r-1))}catch(t){}return s.length?s:"string"==a?e:e+"\0"}((e=!0===e?{entropy:!0}:e||{}).entropy?[t,x(o)]:null===t?function(){try{if(l)return x(l.randomBytes(m));var t=new Uint8Array(m);return(p.crypto||p.msCrypto).getRandomValues(t),x(t)}catch(t){var e=p.navigator,r=e&&e.plugins;return[+new Date,p,r,p.screen,x(o)]}}():t,3),i),a=new v(i),n=function(){for(var t=a.g(f),e=d,r=0;t<u;)t=(t+r)*m,e*=m,r=a.g(1);for(;y<=t;)t/=2,e/=2,r>>>=1;return(t+r)/e};return n.int32=function(){return 0|a.g(4)},n.quick=function(){return a.g(4)/4294967296},n.double=n,E(x(a.S),o),(e.pass||r||function(t,e,r,i){return i&&(i.S&&b(i,a),t.state=function(){return b(a,{})}),r?(h[c]=t,e):t})(n,s,"global"in e?e.global:this==h,e.state)},E(h.random(),o)}([],BMMath);var BezierFactory=function(){var t={getBezierEasing:function(t,e,r,i,s){var a=s||("bez_"+t+"_"+e+"_"+r+"_"+i).replace(/\./g,"p");if(o[a])return o[a];var n=new h([t,e,r,i]);return o[a]=n}},o={};var l=11,p=1/(l-1),e="function"==typeof Float32Array;function i(t,e){return 1-3*e+3*t}function s(t,e){return 3*e-6*t}function a(t){return 3*t}function m(t,e,r){return((i(e,r)*t+s(e,r))*t+a(e))*t}function f(t,e,r){return 3*i(e,r)*t*t+2*s(e,r)*t+a(e)}function h(t){this._p=t,this._mSampleValues=e?new Float32Array(l):new Array(l),this._precomputed=!1,this.get=this.get.bind(this)}return h.prototype={get:function(t){var e=this._p[0],r=this._p[1],i=this._p[2],s=this._p[3];return this._precomputed||this._precompute(),e===r&&i===s?t:0===t?0:1===t?1:m(this._getTForX(t),r,s)},_precompute:function(){var t=this._p[0],e=this._p[1],r=this._p[2],i=this._p[3];this._precomputed=!0,t===e&&r===i||this._calcSampleValues()},_calcSampleValues:function(){for(var t=this._p[0],e=this._p[2],r=0;r<l;++r)this._mSampleValues[r]=m(r*p,t,e)},_getTForX:function(t){for(var e=this._p[0],r=this._p[2],i=this._mSampleValues,s=0,a=1,n=l-1;a!==n&&i[a]<=t;++a)s+=p;var o=s+(t-i[--a])/(i[a+1]-i[a])*p,h=f(o,e,r);return.001<=h?function(t,e,r,i){for(var s=0;s<4;++s){var a=f(e,r,i);if(0===a)return e;e-=(m(e,r,i)-t)/a}return e}(t,o,e,r):0===h?o:function(t,e,r,i,s){for(var a,n,o=0;0<(a=m(n=e+(r-e)/2,i,s)-t)?r=n:e=n,1e-7<Math.abs(a)&&++o<10;);return n}(t,s,s+p,e,r)}},t}();function extendPrototype(t,e){var r,i,s=t.length;for(r=0;r<s;r+=1)for(var a in i=t[r].prototype)i.hasOwnProperty(a)&&(e.prototype[a]=i[a])}function getDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)}function createProxyFunction(t){function e(){}return e.prototype=t,e}function bezFunction(){Math;function y(t,e,r,i,s,a){var n=t*i+e*s+r*a-s*i-a*t-r*e;return-.001<n&&n<.001}var p=function(t,e,r,i){var s,a,n,o,h,l,p=defaultCurveSegments,m=0,f=[],c=[],d=bezier_length_pool.newElement();for(n=r.length,s=0;s<p;s+=1){for(h=s/(p-1),a=l=0;a<n;a+=1)o=bm_pow(1-h,3)*t[a]+3*bm_pow(1-h,2)*h*r[a]+3*(1-h)*bm_pow(h,2)*i[a]+bm_pow(h,3)*e[a],f[a]=o,null!==c[a]&&(l+=bm_pow(f[a]-c[a],2)),c[a]=f[a];l&&(m+=l=bm_sqrt(l)),d.percents[s]=h,d.lengths[s]=m}return d.addedLength=m,d};function g(t){this.segmentLength=0,this.points=new Array(t)}function v(t,e){this.partialLength=t,this.point=e}var b,t=(b={},function(t,e,r,i){var s=(t[0]+"_"+t[1]+"_"+e[0]+"_"+e[1]+"_"+r[0]+"_"+r[1]+"_"+i[0]+"_"+i[1]).replace(/\./g,"p");if(!b[s]){var a,n,o,h,l,p,m,f=defaultCurveSegments,c=0,d=null;2===t.length&&(t[0]!=e[0]||t[1]!=e[1])&&y(t[0],t[1],e[0],e[1],t[0]+r[0],t[1]+r[1])&&y(t[0],t[1],e[0],e[1],e[0]+i[0],e[1]+i[1])&&(f=2);var u=new g(f);for(o=r.length,a=0;a<f;a+=1){for(m=createSizedArray(o),l=a/(f-1),n=p=0;n<o;n+=1)h=bm_pow(1-l,3)*t[n]+3*bm_pow(1-l,2)*l*(t[n]+r[n])+3*(1-l)*bm_pow(l,2)*(e[n]+i[n])+bm_pow(l,3)*e[n],m[n]=h,null!==d&&(p+=bm_pow(m[n]-d[n],2));c+=p=bm_sqrt(p),u.points[a]=new v(p,m),d=m}u.segmentLength=c,b[s]=u}return b[s]});function M(t,e){var r=e.percents,i=e.lengths,s=r.length,a=bm_floor((s-1)*t),n=t*e.addedLength,o=0;if(a===s-1||0===a||n===i[a])return r[a];for(var h=i[a]>n?-1:1,l=!0;l;)if(i[a]<=n&&i[a+1]>n?(o=(n-i[a])/(i[a+1]-i[a]),l=!1):a+=h,a<0||s-1<=a){if(a===s-1)return r[a];l=!1}return r[a]+(r[a+1]-r[a])*o}var D=createTypedArray("float32",8);return{getSegmentsLength:function(t){var e,r=segments_length_pool.newElement(),i=t.c,s=t.v,a=t.o,n=t.i,o=t._length,h=r.lengths,l=0;for(e=0;e<o-1;e+=1)h[e]=p(s[e],s[e+1],a[e],n[e+1]),l+=h[e].addedLength;return i&&o&&(h[e]=p(s[e],s[0],a[e],n[0]),l+=h[e].addedLength),r.totalLength=l,r},getNewSegment:function(t,e,r,i,s,a,n){var o,h=M(s=s<0?0:1<s?1:s,n),l=M(a=1<a?1:a,n),p=t.length,m=1-h,f=1-l,c=m*m*m,d=h*m*m*3,u=h*h*m*3,y=h*h*h,g=m*m*f,v=h*m*f+m*h*f+m*m*l,b=h*h*f+m*h*l+h*m*l,E=h*h*l,x=m*f*f,S=h*f*f+m*l*f+m*f*l,P=h*l*f+m*l*l+h*f*l,_=h*l*l,A=f*f*f,C=l*f*f+f*l*f+f*f*l,T=l*l*f+f*l*l+l*f*l,k=l*l*l;for(o=0;o<p;o+=1)D[4*o]=Math.round(1e3*(c*t[o]+d*r[o]+u*i[o]+y*e[o]))/1e3,D[4*o+1]=Math.round(1e3*(g*t[o]+v*r[o]+b*i[o]+E*e[o]))/1e3,D[4*o+2]=Math.round(1e3*(x*t[o]+S*r[o]+P*i[o]+_*e[o]))/1e3,D[4*o+3]=Math.round(1e3*(A*t[o]+C*r[o]+T*i[o]+k*e[o]))/1e3;return D},getPointInSegment:function(t,e,r,i,s,a){var n=M(s,a),o=1-n;return[Math.round(1e3*(o*o*o*t[0]+(n*o*o+o*n*o+o*o*n)*r[0]+(n*n*o+o*n*n+n*o*n)*i[0]+n*n*n*e[0]))/1e3,Math.round(1e3*(o*o*o*t[1]+(n*o*o+o*n*o+o*o*n)*r[1]+(n*n*o+o*n*n+n*o*n)*i[1]+n*n*n*e[1]))/1e3]},buildBezierData:t,pointOnLine2D:y,pointOnLine3D:function(t,e,r,i,s,a,n,o,h){if(0===r&&0===a&&0===h)return y(t,e,i,s,n,o);var l,p=Math.sqrt(Math.pow(i-t,2)+Math.pow(s-e,2)+Math.pow(a-r,2)),m=Math.sqrt(Math.pow(n-t,2)+Math.pow(o-e,2)+Math.pow(h-r,2)),f=Math.sqrt(Math.pow(n-i,2)+Math.pow(o-s,2)+Math.pow(h-a,2));return-1e-4<(l=m<p?f<p?p-m-f:f-m-p:m<f?f-m-p:m-p-f)&&l<1e-4}}}!function(){for(var a=0,t=["ms","moz","webkit","o"],e=0;e<t.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[t[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[e]+"CancelAnimationFrame"]||window[t[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,e){var r=(new Date).getTime(),i=Math.max(0,16-(r-a)),s=setTimeout(function(){t(r+i)},i);return a=r+i,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();var bez=bezFunction();function dataFunctionManager(){function m(t,e,r){var i,s,a,n,o,h,l=t.length;for(s=0;s<l;s+=1)if("ks"in(i=t[s])&&!i.completed){if(i.completed=!0,i.tt&&(t[s-1].td=i.tt),[],-1,i.hasMask){var p=i.masksProperties;for(n=p.length,a=0;a<n;a+=1)if(p[a].pt.k.i)d(p[a].pt.k);else for(h=p[a].pt.k.length,o=0;o<h;o+=1)p[a].pt.k[o].s&&d(p[a].pt.k[o].s[0]),p[a].pt.k[o].e&&d(p[a].pt.k[o].e[0])}0===i.ty?(i.layers=f(i.refId,e),m(i.layers,e,r)):4===i.ty?c(i.shapes):5==i.ty&&u(i,r)}}function f(t,e){for(var r=0,i=e.length;r<i;){if(e[r].id===t)return e[r].layers.__used?JSON.parse(JSON.stringify(e[r].layers)):(e[r].layers.__used=!0,e[r].layers);r+=1}}function c(t){var e,r,i;for(e=t.length-1;0<=e;e-=1)if("sh"==t[e].ty){if(t[e].ks.k.i)d(t[e].ks.k);else for(i=t[e].ks.k.length,r=0;r<i;r+=1)t[e].ks.k[r].s&&d(t[e].ks.k[r].s[0]),t[e].ks.k[r].e&&d(t[e].ks.k[r].e[0]);!0}else"gr"==t[e].ty&&c(t[e].it)}function d(t){var e,r=t.i.length;for(e=0;e<r;e+=1)t.i[e][0]+=t.v[e][0],t.i[e][1]+=t.v[e][1],t.o[e][0]+=t.v[e][0],t.o[e][1]+=t.v[e][1]}function o(t,e){var r=e?e.split("."):[100,100,100];return t[0]>r[0]||!(r[0]>t[0])&&(t[1]>r[1]||!(r[1]>t[1])&&(t[2]>r[2]||!(r[2]>t[2])&&void 0))}var h,r=function(){var i=[4,4,14];function s(t){var e,r,i,s=t.length;for(e=0;e<s;e+=1)5===t[e].ty&&(r=t[e],void 0,i=r.t.d,r.t.d={k:[{s:i,t:0}]})}return function(t){if(o(i,t.v)&&(s(t.layers),t.assets)){var e,r=t.assets.length;for(e=0;e<r;e+=1)t.assets[e].layers&&s(t.assets[e].layers)}}}(),i=(h=[4,7,99],function(t){if(t.chars&&!o(h,t.v)){var e,r,i,s,a,n=t.chars.length;for(e=0;e<n;e+=1)if(t.chars[e].data&&t.chars[e].data.shapes)for(i=(a=t.chars[e].data.shapes[0].it).length,r=0;r<i;r+=1)(s=a[r].ks.k).__converted||(d(a[r].ks.k),s.__converted=!0)}}),s=function(){var i=[4,1,9];function a(t){var e,r,i,s=t.length;for(e=0;e<s;e+=1)if("gr"===t[e].ty)a(t[e].it);else if("fl"===t[e].ty||"st"===t[e].ty)if(t[e].c.k&&t[e].c.k[0].i)for(i=t[e].c.k.length,r=0;r<i;r+=1)t[e].c.k[r].s&&(t[e].c.k[r].s[0]/=255,t[e].c.k[r].s[1]/=255,t[e].c.k[r].s[2]/=255,t[e].c.k[r].s[3]/=255),t[e].c.k[r].e&&(t[e].c.k[r].e[0]/=255,t[e].c.k[r].e[1]/=255,t[e].c.k[r].e[2]/=255,t[e].c.k[r].e[3]/=255);else t[e].c.k[0]/=255,t[e].c.k[1]/=255,t[e].c.k[2]/=255,t[e].c.k[3]/=255}function s(t){var e,r=t.length;for(e=0;e<r;e+=1)4===t[e].ty&&a(t[e].shapes)}return function(t){if(o(i,t.v)&&(s(t.layers),t.assets)){var e,r=t.assets.length;for(e=0;e<r;e+=1)t.assets[e].layers&&s(t.assets[e].layers)}}}(),a=function(){var i=[4,4,18];function l(t){var e,r,i;for(e=t.length-1;0<=e;e-=1)if("sh"==t[e].ty){if(t[e].ks.k.i)t[e].ks.k.c=t[e].closed;else for(i=t[e].ks.k.length,r=0;r<i;r+=1)t[e].ks.k[r].s&&(t[e].ks.k[r].s[0].c=t[e].closed),t[e].ks.k[r].e&&(t[e].ks.k[r].e[0].c=t[e].closed);!0}else"gr"==t[e].ty&&l(t[e].it)}function s(t){var e,r,i,s,a,n,o=t.length;for(r=0;r<o;r+=1){if((e=t[r]).hasMask){var h=e.masksProperties;for(s=h.length,i=0;i<s;i+=1)if(h[i].pt.k.i)h[i].pt.k.c=h[i].cl;else for(n=h[i].pt.k.length,a=0;a<n;a+=1)h[i].pt.k[a].s&&(h[i].pt.k[a].s[0].c=h[i].cl),h[i].pt.k[a].e&&(h[i].pt.k[a].e[0].c=h[i].cl)}4===e.ty&&l(e.shapes)}}return function(t){if(o(i,t.v)&&(s(t.layers),t.assets)){var e,r=t.assets.length;for(e=0;e<r;e+=1)t.assets[e].layers&&s(t.assets[e].layers)}}}();function u(t,e){0!==t.t.a.length||"m"in t.t.p||(t.singleShape=!0)}var t={completeData:function(t,e){t.__complete||(s(t),r(t),i(t),a(t),m(t.layers,t.assets,e),t.__complete=!0)}};return t.checkColors=s,t.checkChars=i,t.checkShapes=a,t.completeLayers=m,t}var dataManager=dataFunctionManager(),FontManager=function(){var a={w:0,size:0,shapes:[]},t=[];function u(t,e){var r=createTag("span");r.style.fontFamily=e;var i=createTag("span");i.innerHTML="giItT1WQy@!-/#",r.style.position="absolute",r.style.left="-10000px",r.style.top="-10000px",r.style.fontSize="300px",r.style.fontVariant="normal",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.letterSpacing="0",r.appendChild(i),document.body.appendChild(r);var s=i.offsetWidth;return i.style.fontFamily=t+", "+e,{node:i,w:s,parent:r}}t=t.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var e=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this.initTime=Date.now()};return e.getCombinedCharacterCodes=function(){return t},e.prototype.addChars=function(t){if(t){this.chars||(this.chars=[]);var e,r,i,s=t.length,a=this.chars.length;for(e=0;e<s;e+=1){for(r=0,i=!1;r<a;)this.chars[r].style===t[e].style&&this.chars[r].fFamily===t[e].fFamily&&this.chars[r].ch===t[e].ch&&(i=!0),r+=1;i||(this.chars.push(t[e]),a+=1)}}},e.prototype.addFonts=function(t,e){if(t){if(this.chars)return this.isLoaded=!0,void(this.fonts=t.list);var r,i,s,a,n=t.list,o=n.length,h=o;for(r=0;r<o;r+=1){var l,p,m=!0;if(n[r].loaded=!1,n[r].monoCase=u(n[r].fFamily,"monospace"),n[r].sansCase=u(n[r].fFamily,"sans-serif"),n[r].fPath){if("p"===n[r].fOrigin||3===n[r].origin){if(0<(l=document.querySelectorAll('style[f-forigin="p"][f-family="'+n[r].fFamily+'"], style[f-origin="3"][f-family="'+n[r].fFamily+'"]')).length&&(m=!1),m){var f=createTag("style");f.setAttribute("f-forigin",n[r].fOrigin),f.setAttribute("f-origin",n[r].origin),f.setAttribute("f-family",n[r].fFamily),f.type="text/css",f.innerHTML="@font-face {font-family: "+n[r].fFamily+"; font-style: normal; src: url('"+n[r].fPath+"');}",e.appendChild(f)}}else if("g"===n[r].fOrigin||1===n[r].origin){for(l=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),p=0;p<l.length;p++)-1!==l[p].href.indexOf(n[r].fPath)&&(m=!1);if(m){var c=createTag("link");c.setAttribute("f-forigin",n[r].fOrigin),c.setAttribute("f-origin",n[r].origin),c.type="text/css",c.rel="stylesheet",c.href=n[r].fPath,document.body.appendChild(c)}}else if("t"===n[r].fOrigin||2===n[r].origin){for(l=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),p=0;p<l.length;p++)n[r].fPath===l[p].src&&(m=!1);if(m){var d=createTag("link");d.setAttribute("f-forigin",n[r].fOrigin),d.setAttribute("f-origin",n[r].origin),d.setAttribute("rel","stylesheet"),d.setAttribute("href",n[r].fPath),e.appendChild(d)}}}else n[r].loaded=!0,h-=1;n[r].helper=(i=e,s=n[r],a=void 0,(a=createNS("text")).style.fontSize="100px",a.setAttribute("font-family",s.fFamily),a.setAttribute("font-style",s.fStyle),a.setAttribute("font-weight",s.fWeight),a.textContent="1",s.fClass?(a.style.fontFamily="inherit",a.setAttribute("class",s.fClass)):a.style.fontFamily=s.fFamily,i.appendChild(a),createTag("canvas").getContext("2d").font=s.fWeight+" "+s.fStyle+" 100px "+s.fFamily,a),n[r].cache={},this.fonts.push(n[r])}0===h?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}else this.isLoaded=!0},e.prototype.getCharData=function(t,e,r){for(var i=0,s=this.chars.length;i<s;){if(this.chars[i].ch===t&&this.chars[i].style===e&&this.chars[i].fFamily===r)return this.chars[i];i+=1}return("string"==typeof t&&13!==t.charCodeAt(0)||!t)&&console&&console.warn&&console.warn("Missing character from exported characters list: ",t,e,r),a},e.prototype.getFontByName=function(t){for(var e=0,r=this.fonts.length;e<r;){if(this.fonts[e].fName===t)return this.fonts[e];e+=1}return this.fonts[0]},e.prototype.measureText=function(t,e,r){var i=this.getFontByName(e),s=t.charCodeAt(0);if(!i.cache[s+1]){var a=i.helper;if(" "===t){a.textContent="|"+t+"|";var n=a.getComputedTextLength();a.textContent="||";var o=a.getComputedTextLength();i.cache[s+1]=(n-o)/100}else a.textContent=t,i.cache[s+1]=a.getComputedTextLength()/100}return i.cache[s+1]*r},e.prototype.checkLoadedFonts=function(){var t,e,r,i=this.fonts.length,s=i;for(t=0;t<i;t+=1)this.fonts[t].loaded?s-=1:"n"===this.fonts[t].fOrigin||0===this.fonts[t].origin?this.fonts[t].loaded=!0:(e=this.fonts[t].monoCase.node,r=this.fonts[t].monoCase.w,e.offsetWidth!==r?(s-=1,this.fonts[t].loaded=!0):(e=this.fonts[t].sansCase.node,r=this.fonts[t].sansCase.w,e.offsetWidth!==r&&(s-=1,this.fonts[t].loaded=!0)),this.fonts[t].loaded&&(this.fonts[t].sansCase.parent.parentNode.removeChild(this.fonts[t].sansCase.parent),this.fonts[t].monoCase.parent.parentNode.removeChild(this.fonts[t].monoCase.parent)));0!==s&&Date.now()-this.initTime<5e3?setTimeout(this.checkLoadedFonts.bind(this),20):setTimeout(function(){this.isLoaded=!0}.bind(this),0)},e.prototype.loaded=function(){return this.isLoaded},e}(),PropertyFactory=function(){var m=initialDefaultFrame,s=Math.abs;function f(t,e){var r,i=this.offsetTime;"multidimensional"===this.propType&&(r=createTypedArray("float32",this.pv.length));for(var s,a,n,o,h,l,p,m,f=e.lastIndex,c=f,d=this.keyframes.length-1,u=!0;u;){if(s=this.keyframes[c],a=this.keyframes[c+1],c===d-1&&t>=a.t-i){s.h&&(s=a),f=0;break}if(a.t-i>t){f=c;break}c<d-1?c+=1:(f=0,u=!1)}var y,g,v,b,E,x,S,P,_,A,C=a.t-i,T=s.t-i;if(s.to){s.bezierData||(s.bezierData=bez.buildBezierData(s.s,a.s||s.e,s.to,s.ti));var k=s.bezierData;if(C<=t||t<T){var M=C<=t?k.points.length-1:0;for(o=k.points[M].point.length,n=0;n<o;n+=1)r[n]=k.points[M].point[n]}else{s.__fnct?m=s.__fnct:(m=BezierFactory.getBezierEasing(s.o.x,s.o.y,s.i.x,s.i.y,s.n).get,s.__fnct=m),h=m((t-T)/(C-T));var D,w=k.segmentLength*h,F=e.lastFrame<t&&e._lastKeyframeIndex===c?e._lastAddedLength:0;for(p=e.lastFrame<t&&e._lastKeyframeIndex===c?e._lastPoint:0,u=!0,l=k.points.length;u;){if(F+=k.points[p].partialLength,0===w||0===h||p===k.points.length-1){for(o=k.points[p].point.length,n=0;n<o;n+=1)r[n]=k.points[p].point[n];break}if(F<=w&&w<F+k.points[p+1].partialLength){for(D=(w-F)/k.points[p+1].partialLength,o=k.points[p].point.length,n=0;n<o;n+=1)r[n]=k.points[p].point[n]+(k.points[p+1].point[n]-k.points[p].point[n])*D;break}p<l-1?p+=1:u=!1}e._lastPoint=p,e._lastAddedLength=F-k.points[p].partialLength,e._lastKeyframeIndex=c}}else{var I,V,R,B,L;if(d=s.s.length,y=a.s||s.e,this.sh&&1!==s.h)if(C<=t)r[0]=y[0],r[1]=y[1],r[2]=y[2];else if(t<=T)r[0]=s.s[0],r[1]=s.s[1],r[2]=s.s[2];else{var G=N(s.s),z=N(y);g=r,v=function(t,e,r){var i,s,a,n,o,h=[],l=t[0],p=t[1],m=t[2],f=t[3],c=e[0],d=e[1],u=e[2],y=e[3];(s=l*c+p*d+m*u+f*y)<0&&(s=-s,c=-c,d=-d,u=-u,y=-y);o=1e-6<1-s?(i=Math.acos(s),a=Math.sin(i),n=Math.sin((1-r)*i)/a,Math.sin(r*i)/a):(n=1-r,r);return h[0]=n*l+o*c,h[1]=n*p+o*d,h[2]=n*m+o*u,h[3]=n*f+o*y,h}(G,z,(t-T)/(C-T)),b=v[0],E=v[1],x=v[2],S=v[3],P=Math.atan2(2*E*S-2*b*x,1-2*E*E-2*x*x),_=Math.asin(2*b*E+2*x*S),A=Math.atan2(2*b*S-2*E*x,1-2*b*b-2*x*x),g[0]=P/degToRads,g[1]=_/degToRads,g[2]=A/degToRads}else for(c=0;c<d;c+=1)1!==s.h&&(h=C<=t?1:t<T?0:(s.o.x.constructor===Array?(s.__fnct||(s.__fnct=[]),s.__fnct[c]?m=s.__fnct[c]:(I=void 0===s.o.x[c]?s.o.x[0]:s.o.x[c],V=void 0===s.o.y[c]?s.o.y[0]:s.o.y[c],R=void 0===s.i.x[c]?s.i.x[0]:s.i.x[c],B=void 0===s.i.y[c]?s.i.y[0]:s.i.y[c],m=BezierFactory.getBezierEasing(I,V,R,B).get,s.__fnct[c]=m)):s.__fnct?m=s.__fnct:(I=s.o.x,V=s.o.y,R=s.i.x,B=s.i.y,m=BezierFactory.getBezierEasing(I,V,R,B).get,s.__fnct=m),m((t-T)/(C-T)))),y=a.s||s.e,L=1===s.h?s.s[c]:s.s[c]+(y[c]-s.s[c])*h,"multidimensional"===this.propType?r[c]=L:r=L}return e.lastIndex=f,r}function N(t){var e=t[0]*degToRads,r=t[1]*degToRads,i=t[2]*degToRads,s=Math.cos(e/2),a=Math.cos(r/2),n=Math.cos(i/2),o=Math.sin(e/2),h=Math.sin(r/2),l=Math.sin(i/2);return[o*h*n+s*a*l,o*a*n+s*h*l,s*h*n-o*a*l,s*a*n-o*h*l]}function c(){var t=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(t===this._caching.lastFrame||this._caching.lastFrame!==m&&(this._caching.lastFrame>=r&&r<=t||this._caching.lastFrame<e&&t<e))){this._caching.lastFrame>=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var i=this.interpolateValue(t,this._caching);this.pv=i}return this._caching.lastFrame=t,this.pv}function d(t){var e;if("unidimensional"===this.propType)e=t*this.mult,1e-5<s(this.v-e)&&(this.v=e,this._mdf=!0);else for(var r=0,i=this.v.length;r<i;)e=t[r]*this.mult,1e-5<s(this.v[r]-e)&&(this.v[r]=e,this._mdf=!0),r+=1}function u(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{this.lock=!0,this._mdf=this._isFirstFrame;var t,e=this.effectsSequence.length,r=this.kf?this.pv:this.data.k;for(t=0;t<e;t+=1)r=this.effectsSequence[t](r);this.setVValue(r),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function y(t){this.effectsSequence.push(t),this.container.addDynamicProperty(this)}function n(t,e,r,i){this.propType="unidimensional",this.mult=r||1,this.data=e,this.v=r?e.k*r:e.k,this.pv=e.k,this._mdf=!1,this.elem=t,this.container=i,this.comp=t.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=u,this.setVValue=d,this.addEffect=y}function o(t,e,r,i){this.propType="multidimensional",this.mult=r||1,this.data=e,this._mdf=!1,this.elem=t,this.container=i,this.comp=t.comp,this.k=!1,this.kf=!1,this.frameId=-1;var s,a=e.k.length;this.v=createTypedArray("float32",a),this.pv=createTypedArray("float32",a);createTypedArray("float32",a);for(this.vel=createTypedArray("float32",a),s=0;s<a;s+=1)this.v[s]=e.k[s]*this.mult,this.pv[s]=e.k[s];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=u,this.setVValue=d,this.addEffect=y}function h(t,e,r,i){this.propType="unidimensional",this.keyframes=e.k,this.offsetTime=t.data.st,this.frameId=-1,this._caching={lastFrame:m,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=e,this.mult=r||1,this.elem=t,this.container=i,this.comp=t.comp,this.v=m,this.pv=m,this._isFirstFrame=!0,this.getValue=u,this.setVValue=d,this.interpolateValue=f,this.effectsSequence=[c.bind(this)],this.addEffect=y}function l(t,e,r,i){this.propType="multidimensional";var s,a,n,o,h,l=e.k.length;for(s=0;s<l-1;s+=1)e.k[s].to&&e.k[s].s&&e.k[s+1]&&e.k[s+1].s&&(a=e.k[s].s,n=e.k[s+1].s,o=e.k[s].to,h=e.k[s].ti,(2===a.length&&(a[0]!==n[0]||a[1]!==n[1])&&bez.pointOnLine2D(a[0],a[1],n[0],n[1],a[0]+o[0],a[1]+o[1])&&bez.pointOnLine2D(a[0],a[1],n[0],n[1],n[0]+h[0],n[1]+h[1])||3===a.length&&(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2])&&bez.pointOnLine3D(a[0],a[1],a[2],n[0],n[1],n[2],a[0]+o[0],a[1]+o[1],a[2]+o[2])&&bez.pointOnLine3D(a[0],a[1],a[2],n[0],n[1],n[2],n[0]+h[0],n[1]+h[1],n[2]+h[2]))&&(e.k[s].to=null,e.k[s].ti=null),a[0]===n[0]&&a[1]===n[1]&&0===o[0]&&0===o[1]&&0===h[0]&&0===h[1]&&(2===a.length||a[2]===n[2]&&0===o[2]&&0===h[2])&&(e.k[s].to=null,e.k[s].ti=null));this.effectsSequence=[c.bind(this)],this.keyframes=e.k,this.offsetTime=t.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=r||1,this.elem=t,this.container=i,this.comp=t.comp,this.getValue=u,this.setVValue=d,this.interpolateValue=f,this.frameId=-1;var p=e.k[0].s.length;for(this.v=createTypedArray("float32",p),this.pv=createTypedArray("float32",p),s=0;s<p;s+=1)this.v[s]=m,this.pv[s]=m;this._caching={lastFrame:m,lastIndex:0,value:createTypedArray("float32",p)},this.addEffect=y}return{getProp:function(t,e,r,i,s){var a;if(e.k.length)if("number"==typeof e.k[0])a=new o(t,e,i,s);else switch(r){case 0:a=new h(t,e,i,s);break;case 1:a=new l(t,e,i,s)}else a=new n(t,e,i,s);return a.effectsSequence.length&&s.addDynamicProperty(a),a}}}(),TransformPropertyFactory=function(){var n=[0,0];function i(t,e,r){if(this.elem=t,this.frameId=-1,this.propType="transform",this.data=e,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(r||t),e.p&&e.p.s?(this.px=PropertyFactory.getProp(t,e.p.x,0,0,this),this.py=PropertyFactory.getProp(t,e.p.y,0,0,this),e.p.z&&(this.pz=PropertyFactory.getProp(t,e.p.z,0,0,this))):this.p=PropertyFactory.getProp(t,e.p||{k:[0,0,0]},1,0,this),e.rx){if(this.rx=PropertyFactory.getProp(t,e.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(t,e.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(t,e.rz,0,degToRads,this),e.or.k[0].ti){var i,s=e.or.k.length;for(i=0;i<s;i+=1)e.or.k[i].to=e.or.k[i].ti=null}this.or=PropertyFactory.getProp(t,e.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(t,e.r||{k:0},0,degToRads,this);e.sk&&(this.sk=PropertyFactory.getProp(t,e.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(t,e.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(t,e.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(t,e.s||{k:[100,100,100]},1,.01,this),e.o?this.o=PropertyFactory.getProp(t,e.o,0,.01,t):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}return i.prototype={applyToMatrix:function(t){var e=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||e,this.a&&t.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&t.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&t.skewFromAxis(-this.sk.v,this.sa.v),this.r?t.rotate(-this.r.v):t.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?t.translate(this.px.v,this.py.v,-this.pz.v):t.translate(this.px.v,this.py.v,0):t.translate(this.p.v[0],this.p.v[1],-this.p.v[2])},getValue:function(t){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||t){if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var e,r,i=this.elem.globalData.frameRate;if(this.p&&this.p.keyframes&&this.p.getValueAtTime)r=this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(e=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/i,0),this.p.getValueAtTime(this.p.keyframes[0].t/i,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(e=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/i,0),this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/i,0)):(e=this.p.pv,this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/i,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){e=[],r=[];var s=this.px,a=this.py;s._caching.lastFrame+s.offsetTime<=s.keyframes[0].t?(e[0]=s.getValueAtTime((s.keyframes[0].t+.01)/i,0),e[1]=a.getValueAtTime((a.keyframes[0].t+.01)/i,0),r[0]=s.getValueAtTime(s.keyframes[0].t/i,0),r[1]=a.getValueAtTime(a.keyframes[0].t/i,0)):s._caching.lastFrame+s.offsetTime>=s.keyframes[s.keyframes.length-1].t?(e[0]=s.getValueAtTime(s.keyframes[s.keyframes.length-1].t/i,0),e[1]=a.getValueAtTime(a.keyframes[a.keyframes.length-1].t/i,0),r[0]=s.getValueAtTime((s.keyframes[s.keyframes.length-1].t-.01)/i,0),r[1]=a.getValueAtTime((a.keyframes[a.keyframes.length-1].t-.01)/i,0)):(e=[s.pv,a.pv],r[0]=s.getValueAtTime((s._caching.lastFrame+s.offsetTime-.01)/i,s.offsetTime),r[1]=a.getValueAtTime((a._caching.lastFrame+a.offsetTime-.01)/i,a.offsetTime))}else e=r=n;this.v.rotate(-Math.atan2(e[1]-r[1],e[0]-r[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}},precalculateMatrix:function(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}if(this.r){if(this.r.effectsSequence.length)return;this.pre.rotate(-this.r.v),this.appliedTransformations=4}else this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}},autoOrient:function(){}},extendPrototype([DynamicPropertyContainer],i),i.prototype.addDynamicProperty=function(t){this._addDynamicProperty(t),this.elem.addDynamicProperty(t),this._isDirty=!0},i.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty,{getTransformProperty:function(t,e,r){return new i(t,e,r)}}}();function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(t,e){this.c=t,this.setLength(e);for(var r=0;r<e;)this.v[r]=point_pool.newElement(),this.o[r]=point_pool.newElement(),this.i[r]=point_pool.newElement(),r+=1},ShapePath.prototype.setLength=function(t){for(;this._maxLength<t;)this.doubleArrayLength();this._length=t},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(t,e,r,i,s){var a;switch(this._length=Math.max(this._length,i+1),this._length>=this._maxLength&&this.doubleArrayLength(),r){case"v":a=this.v;break;case"i":a=this.i;break;case"o":a=this.o}(!a[i]||a[i]&&!s)&&(a[i]=point_pool.newElement()),a[i][0]=t,a[i][1]=e},ShapePath.prototype.setTripleAt=function(t,e,r,i,s,a,n,o){this.setXYAt(t,e,"v",n,o),this.setXYAt(r,i,"o",n,o),this.setXYAt(s,a,"i",n,o)},ShapePath.prototype.reverse=function(){var t=new ShapePath;t.setPathData(this.c,this._length);var e=this.v,r=this.o,i=this.i,s=0;this.c&&(t.setTripleAt(e[0][0],e[0][1],i[0][0],i[0][1],r[0][0],r[0][1],0,!1),s=1);var a,n=this._length-1,o=this._length;for(a=s;a<o;a+=1)t.setTripleAt(e[n][0],e[n][1],i[n][0],i[n][1],r[n][0],r[n][1],a,!1),n-=1;return t};var ShapePropertyFactory=function(){var s=-999999;function t(t,e,r){var i,s,a,n,o,h,l,p,m,f=r.lastIndex,c=this.keyframes;if(t<c[0].t-this.offsetTime)i=c[0].s[0],a=!0,f=0;else if(t>=c[c.length-1].t-this.offsetTime)i=c[c.length-1].s?c[c.length-1].s[0]:c[c.length-2].e[0],a=!0;else{for(var d,u,y=f,g=c.length-1,v=!0;v&&(d=c[y],!((u=c[y+1]).t-this.offsetTime>t));)y<g-1?y+=1:v=!1;if(f=y,!(a=1===d.h)){if(t>=u.t-this.offsetTime)p=1;else if(t<d.t-this.offsetTime)p=0;else{var b;d.__fnct?b=d.__fnct:(b=BezierFactory.getBezierEasing(d.o.x,d.o.y,d.i.x,d.i.y).get,d.__fnct=b),p=b((t-(d.t-this.offsetTime))/(u.t-this.offsetTime-(d.t-this.offsetTime)))}s=u.s?u.s[0]:d.e[0]}i=d.s[0]}for(h=e._length,l=i.i[0].length,r.lastIndex=f,n=0;n<h;n+=1)for(o=0;o<l;o+=1)m=a?i.i[n][o]:i.i[n][o]+(s.i[n][o]-i.i[n][o])*p,e.i[n][o]=m,m=a?i.o[n][o]:i.o[n][o]+(s.o[n][o]-i.o[n][o])*p,e.o[n][o]=m,m=a?i.v[n][o]:i.v[n][o]+(s.v[n][o]-i.v[n][o])*p,e.v[n][o]=m}function a(){this.paths=this.localShapeCollection}function e(t){(function(t,e){if(t._length!==e._length||t.c!==e.c)return!1;var r,i=t._length;for(r=0;r<i;r+=1)if(t.v[r][0]!==e.v[r][0]||t.v[r][1]!==e.v[r][1]||t.o[r][0]!==e.o[r][0]||t.o[r][1]!==e.o[r][1]||t.i[r][0]!==e.i[r][0]||t.i[r][1]!==e.i[r][1])return!1;return!0})(this.v,t)||(this.v=shape_pool.clone(t),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function r(){if(this.elem.globalData.frameId!==this.frameId)if(this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{this.lock=!0,this._mdf=!1;var t,e=this.kf?this.pv:this.data.ks?this.data.ks.k:this.data.pt.k,r=this.effectsSequence.length;for(t=0;t<r;t+=1)e=this.effectsSequence[t](e);this.setVValue(e),this.lock=!1,this.frameId=this.elem.globalData.frameId}else this._mdf=!1}function n(t,e,r){this.propType="shape",this.comp=t.comp,this.container=t,this.elem=t,this.data=e,this.k=!1,this.kf=!1,this._mdf=!1;var i=3===r?e.pt.k:e.ks.k;this.v=shape_pool.clone(i),this.pv=shape_pool.clone(this.v),this.localShapeCollection=shapeCollection_pool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=a,this.effectsSequence=[]}function i(t){this.effectsSequence.push(t),this.container.addDynamicProperty(this)}function o(t,e,r){this.propType="shape",this.comp=t.comp,this.elem=t,this.container=t,this.offsetTime=t.data.st,this.keyframes=3===r?e.pt.k:e.ks.k,this.k=!0,this.kf=!0;var i=this.keyframes[0].s[0].i.length;this.keyframes[0].s[0].i[0].length;this.v=shape_pool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,i),this.pv=shape_pool.clone(this.v),this.localShapeCollection=shapeCollection_pool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=s,this.reset=a,this._caching={lastFrame:s,lastIndex:0},this.effectsSequence=[function(){var t=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime,i=this._caching.lastFrame;return i!==s&&(i<e&&t<e||r<i&&r<t)||(this._caching.lastIndex=i<t?this._caching.lastIndex:0,this.interpolateShape(t,this.pv,this._caching)),this._caching.lastFrame=t,this.pv}.bind(this)]}n.prototype.interpolateShape=t,n.prototype.getValue=r,n.prototype.setVValue=e,n.prototype.addEffect=i,o.prototype.getValue=r,o.prototype.interpolateShape=t,o.prototype.setVValue=e,o.prototype.addEffect=i;var h=function(){var n=roundCorner;function t(t,e){this.v=shape_pool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollection_pool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=e.d,this.elem=t,this.comp=t.comp,this.frameId=-1,this.initDynamicPropertyContainer(t),this.p=PropertyFactory.getProp(t,e.p,1,0,this),this.s=PropertyFactory.getProp(t,e.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return t.prototype={reset:a,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var t=this.p.v[0],e=this.p.v[1],r=this.s.v[0]/2,i=this.s.v[1]/2,s=3!==this.d,a=this.v;a.v[0][0]=t,a.v[0][1]=e-i,a.v[1][0]=s?t+r:t-r,a.v[1][1]=e,a.v[2][0]=t,a.v[2][1]=e+i,a.v[3][0]=s?t-r:t+r,a.v[3][1]=e,a.i[0][0]=s?t-r*n:t+r*n,a.i[0][1]=e-i,a.i[1][0]=s?t+r:t-r,a.i[1][1]=e-i*n,a.i[2][0]=s?t+r*n:t-r*n,a.i[2][1]=e+i,a.i[3][0]=s?t-r:t+r,a.i[3][1]=e+i*n,a.o[0][0]=s?t+r*n:t-r*n,a.o[0][1]=e-i,a.o[1][0]=s?t+r:t-r,a.o[1][1]=e+i*n,a.o[2][0]=s?t-r*n:t+r*n,a.o[2][1]=e+i,a.o[3][0]=s?t-r:t+r,a.o[3][1]=e-i*n}},extendPrototype([DynamicPropertyContainer],t),t}(),l=function(){function t(t,e){this.v=shape_pool.newElement(),this.v.setPathData(!0,0),this.elem=t,this.comp=t.comp,this.data=e,this.frameId=-1,this.d=e.d,this.initDynamicPropertyContainer(t),1===e.sy?(this.ir=PropertyFactory.getProp(t,e.ir,0,0,this),this.is=PropertyFactory.getProp(t,e.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(t,e.pt,0,0,this),this.p=PropertyFactory.getProp(t,e.p,1,0,this),this.r=PropertyFactory.getProp(t,e.r,0,degToRads,this),this.or=PropertyFactory.getProp(t,e.or,0,0,this),this.os=PropertyFactory.getProp(t,e.os,0,.01,this),this.localShapeCollection=shapeCollection_pool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return t.prototype={reset:a,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var t,e,r,i,s=2*Math.floor(this.pt.v),a=2*Math.PI/s,n=!0,o=this.or.v,h=this.ir.v,l=this.os.v,p=this.is.v,m=2*Math.PI*o/(2*s),f=2*Math.PI*h/(2*s),c=-Math.PI/2;c+=this.r.v;var d=3===this.data.d?-1:1;for(t=this.v._length=0;t<s;t+=1){r=n?l:p,i=n?m:f;var u=(e=n?o:h)*Math.cos(c),y=e*Math.sin(c),g=0===u&&0===y?0:y/Math.sqrt(u*u+y*y),v=0===u&&0===y?0:-u/Math.sqrt(u*u+y*y);u+=+this.p.v[0],y+=+this.p.v[1],this.v.setTripleAt(u,y,u-g*i*r*d,y-v*i*r*d,u+g*i*r*d,y+v*i*r*d,t,!0),n=!n,c+=a*d}},convertPolygonToPath:function(){var t,e=Math.floor(this.pt.v),r=2*Math.PI/e,i=this.or.v,s=this.os.v,a=2*Math.PI*i/(4*e),n=-Math.PI/2,o=3===this.data.d?-1:1;for(n+=this.r.v,t=this.v._length=0;t<e;t+=1){var h=i*Math.cos(n),l=i*Math.sin(n),p=0===h&&0===l?0:l/Math.sqrt(h*h+l*l),m=0===h&&0===l?0:-h/Math.sqrt(h*h+l*l);h+=+this.p.v[0],l+=+this.p.v[1],this.v.setTripleAt(h,l,h-p*a*s*o,l-m*a*s*o,h+p*a*s*o,l+m*a*s*o,t,!0),n+=r*o}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],t),t}(),p=function(){function t(t,e){this.v=shape_pool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollection_pool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=t,this.comp=t.comp,this.frameId=-1,this.d=e.d,this.initDynamicPropertyContainer(t),this.p=PropertyFactory.getProp(t,e.p,1,0,this),this.s=PropertyFactory.getProp(t,e.s,1,0,this),this.r=PropertyFactory.getProp(t,e.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return t.prototype={convertRectToPath:function(){var t=this.p.v[0],e=this.p.v[1],r=this.s.v[0]/2,i=this.s.v[1]/2,s=bm_min(r,i,this.r.v),a=s*(1-roundCorner);this.v._length=0,2===this.d||1===this.d?(this.v.setTripleAt(t+r,e-i+s,t+r,e-i+s,t+r,e-i+a,0,!0),this.v.setTripleAt(t+r,e+i-s,t+r,e+i-a,t+r,e+i-s,1,!0),0!==s?(this.v.setTripleAt(t+r-s,e+i,t+r-s,e+i,t+r-a,e+i,2,!0),this.v.setTripleAt(t-r+s,e+i,t-r+a,e+i,t-r+s,e+i,3,!0),this.v.setTripleAt(t-r,e+i-s,t-r,e+i-s,t-r,e+i-a,4,!0),this.v.setTripleAt(t-r,e-i+s,t-r,e-i+a,t-r,e-i+s,5,!0),this.v.setTripleAt(t-r+s,e-i,t-r+s,e-i,t-r+a,e-i,6,!0),this.v.setTripleAt(t+r-s,e-i,t+r-a,e-i,t+r-s,e-i,7,!0)):(this.v.setTripleAt(t-r,e+i,t-r+a,e+i,t-r,e+i,2),this.v.setTripleAt(t-r,e-i,t-r,e-i+a,t-r,e-i,3))):(this.v.setTripleAt(t+r,e-i+s,t+r,e-i+a,t+r,e-i+s,0,!0),0!==s?(this.v.setTripleAt(t+r-s,e-i,t+r-s,e-i,t+r-a,e-i,1,!0),this.v.setTripleAt(t-r+s,e-i,t-r+a,e-i,t-r+s,e-i,2,!0),this.v.setTripleAt(t-r,e-i+s,t-r,e-i+s,t-r,e-i+a,3,!0),this.v.setTripleAt(t-r,e+i-s,t-r,e+i-a,t-r,e+i-s,4,!0),this.v.setTripleAt(t-r+s,e+i,t-r+s,e+i,t-r+a,e+i,5,!0),this.v.setTripleAt(t+r-s,e+i,t+r-a,e+i,t+r-s,e+i,6,!0),this.v.setTripleAt(t+r,e+i-s,t+r,e+i-s,t+r,e+i-a,7,!0)):(this.v.setTripleAt(t-r,e-i,t-r+a,e-i,t-r,e-i,1,!0),this.v.setTripleAt(t-r,e+i,t-r,e+i-a,t-r,e+i,2,!0),this.v.setTripleAt(t+r,e+i,t+r-a,e+i,t+r,e+i,3,!0)))},getValue:function(t){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:a},extendPrototype([DynamicPropertyContainer],t),t}();var m={getShapeProp:function(t,e,r){var i;return 3===r||4===r?i=(3===r?e.pt:e.ks).k.length?new o(t,e,r):new n(t,e,r):5===r?i=new p(t,e):6===r?i=new h(t,e):7===r&&(i=new l(t,e)),i.k&&t.addDynamicProperty(i),i},getConstructorFunction:function(){return n},getKeyframedConstructorFunction:function(){return o}};return m}(),ShapeModifiers=($r={},_r={},$r.registerModifier=function(t,e){_r[t]||(_r[t]=e)},$r.getModifier=function(t,e,r){return new _r[t](e,r)},$r),$r,_r;function ShapeModifier(){}function TrimModifier(){}function RoundCornersModifier(){}function RepeaterModifier(){}function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}function DashProperty(t,e,r,i){this.elem=t,this.frameId=-1,this.dataProps=createSizedArray(e.length),this.renderer=r,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",e.length?e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(i);var s,a,n=e.length||0;for(s=0;s<n;s+=1)a=PropertyFactory.getProp(t,e[s].v,0,0,this),this.k=a.k||this.k,this.dataProps[s]={n:e[s].n,p:a};this.k||this.getValue(!0),this._isAnimated=this.k}function GradientProperty(t,e,r){this.data=e,this.c=createTypedArray("uint8c",4*e.p);var i=e.k.k[0].s?e.k.k[0].s.length-4*e.p:e.k.k.length-4*e.p;this.o=createTypedArray("float32",i),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=i,this.initDynamicPropertyContainer(r),this.prop=PropertyFactory.getProp(t,e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(t){if(!this.closed){t.sh.container.addDynamicProperty(t.sh);var e={shape:t.sh,data:t,localShapeCollection:shapeCollection_pool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&t.setAsAnimated()}},ShapeModifier.prototype.init=function(t,e){this.shapes=[],this.elem=t,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier),extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(t,e){this.s=PropertyFactory.getProp(t,e.s,0,.01,this),this.e=PropertyFactory.getProp(t,e.e,0,.01,this),this.o=PropertyFactory.getProp(t,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(t){t.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(t,e,r,i,s){var a=[];e<=1?a.push({s:t,e:e}):1<=t?a.push({s:t-1,e:e-1}):(a.push({s:t,e:1}),a.push({s:0,e:e-1}));var n,o,h=[],l=a.length;for(n=0;n<l;n+=1){var p,m;if((o=a[n]).e*s<i||o.s*s>i+r);else p=o.s*s<=i?0:(o.s*s-i)/r,m=o.e*s>=i+r?1:(o.e*s-i)/r,h.push([p,m])}return h.length||h.push([0,0]),h},TrimModifier.prototype.releasePathsData=function(t){var e,r=t.length;for(e=0;e<r;e+=1)segments_length_pool.release(t[e]);return t.length=0,t},TrimModifier.prototype.processShapes=function(t){var e,r,i;if(this._mdf||t){var s=this.o.v%360/360;if(s<0&&(s+=1),e=(1<this.s.v?1:this.s.v<0?0:this.s.v)+s,(r=(1<this.e.v?1:this.e.v<0?0:this.e.v)+s)<e){var a=e;e=r,r=a}e=1e-4*Math.round(1e4*e),r=1e-4*Math.round(1e4*r),this.sValue=e,this.eValue=r}else e=this.sValue,r=this.eValue;var n,o,h,l,p,m,f=this.shapes.length,c=0;if(r===e)for(n=0;n<f;n+=1)this.shapes[n].localShapeCollection.releaseShapes(),this.shapes[n].shape._mdf=!0,this.shapes[n].shape.paths=this.shapes[n].localShapeCollection;else if(1===r&&0===e||0===r&&1===e){if(this._mdf)for(n=0;n<f;n+=1)this.shapes[n].pathsData.length=0,this.shapes[n].shape._mdf=!0}else{var d,u,y=[];for(n=0;n<f;n+=1)if((d=this.shapes[n]).shape._mdf||this._mdf||t||2===this.m){if(h=(i=d.shape.paths)._length,m=0,!d.shape._mdf&&d.pathsData.length)m=d.totalShapeLength;else{for(l=this.releasePathsData(d.pathsData),o=0;o<h;o+=1)p=bez.getSegmentsLength(i.shapes[o]),l.push(p),m+=p.totalLength;d.totalShapeLength=m,d.pathsData=l}c+=m,d.shape._mdf=!0}else d.shape.paths=d.localShapeCollection;var g,v=e,b=r,E=0;for(n=f-1;0<=n;n-=1)if((d=this.shapes[n]).shape._mdf){for((u=d.localShapeCollection).releaseShapes(),2===this.m&&1<f?(g=this.calculateShapeEdges(e,r,d.totalShapeLength,E,c),E+=d.totalShapeLength):g=[[v,b]],h=g.length,o=0;o<h;o+=1){v=g[o][0],b=g[o][1],y.length=0,b<=1?y.push({s:d.totalShapeLength*v,e:d.totalShapeLength*b}):1<=v?y.push({s:d.totalShapeLength*(v-1),e:d.totalShapeLength*(b-1)}):(y.push({s:d.totalShapeLength*v,e:d.totalShapeLength}),y.push({s:0,e:d.totalShapeLength*(b-1)}));var x=this.addShapes(d,y[0]);if(y[0].s!==y[0].e){if(1<y.length)if(d.shape.paths.shapes[d.shape.paths._length-1].c){var S=x.pop();this.addPaths(x,u),x=this.addShapes(d,y[1],S)}else this.addPaths(x,u),x=this.addShapes(d,y[1]);this.addPaths(x,u)}}d.shape.paths=u}}},TrimModifier.prototype.addPaths=function(t,e){var r,i=t.length;for(r=0;r<i;r+=1)e.addShape(t[r])},TrimModifier.prototype.addSegment=function(t,e,r,i,s,a,n){s.setXYAt(e[0],e[1],"o",a),s.setXYAt(r[0],r[1],"i",a+1),n&&s.setXYAt(t[0],t[1],"v",a),s.setXYAt(i[0],i[1],"v",a+1)},TrimModifier.prototype.addSegmentFromArray=function(t,e,r,i){e.setXYAt(t[1],t[5],"o",r),e.setXYAt(t[2],t[6],"i",r+1),i&&e.setXYAt(t[0],t[4],"v",r),e.setXYAt(t[3],t[7],"v",r+1)},TrimModifier.prototype.addShapes=function(t,e,r){var i,s,a,n,o,h,l,p,m=t.pathsData,f=t.shape.paths.shapes,c=t.shape.paths._length,d=0,u=[],y=!0;for(p=r?(o=r._length,r._length):(r=shape_pool.newElement(),o=0),u.push(r),i=0;i<c;i+=1){for(h=m[i].lengths,r.c=f[i].c,a=f[i].c?h.length:h.length+1,s=1;s<a;s+=1)if(d+(n=h[s-1]).addedLength<e.s)d+=n.addedLength,r.c=!1;else{if(d>e.e){r.c=!1;break}e.s<=d&&e.e>=d+n.addedLength?(this.addSegment(f[i].v[s-1],f[i].o[s-1],f[i].i[s],f[i].v[s],r,o,y),y=!1):(l=bez.getNewSegment(f[i].v[s-1],f[i].v[s],f[i].o[s-1],f[i].i[s],(e.s-d)/n.addedLength,(e.e-d)/n.addedLength,h[s-1]),this.addSegmentFromArray(l,r,o,y),y=!1,r.c=!1),d+=n.addedLength,o+=1}if(f[i].c&&h.length){if(n=h[s-1],d<=e.e){var g=h[s-1].addedLength;e.s<=d&&e.e>=d+g?(this.addSegment(f[i].v[s-1],f[i].o[s-1],f[i].i[0],f[i].v[0],r,o,y),y=!1):(l=bez.getNewSegment(f[i].v[s-1],f[i].v[0],f[i].o[s-1],f[i].i[0],(e.s-d)/g,(e.e-d)/g,h[s-1]),this.addSegmentFromArray(l,r,o,y),y=!1,r.c=!1)}else r.c=!1;d+=n.addedLength,o+=1}if(r._length&&(r.setXYAt(r.v[p][0],r.v[p][1],"i",p),r.setXYAt(r.v[r._length-1][0],r.v[r._length-1][1],"o",r._length-1)),d>e.e)break;i<c-1&&(r=shape_pool.newElement(),y=!0,u.push(r),o=0)}return u},ShapeModifiers.registerModifier("tm",TrimModifier),extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(t,e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(t,e){var r=shape_pool.newElement();r.c=t.c;var i,s,a,n,o,h,l,p,m,f,c,d,u,y=t._length,g=0;for(i=0;i<y;i+=1)s=t.v[i],n=t.o[i],a=t.i[i],s[0]===n[0]&&s[1]===n[1]&&s[0]===a[0]&&s[1]===a[1]?0!==i&&i!==y-1||t.c?(o=0===i?t.v[y-1]:t.v[i-1],l=(h=Math.sqrt(Math.pow(s[0]-o[0],2)+Math.pow(s[1]-o[1],2)))?Math.min(h/2,e)/h:0,p=d=s[0]+(o[0]-s[0])*l,m=u=s[1]-(s[1]-o[1])*l,f=p-(p-s[0])*roundCorner,c=m-(m-s[1])*roundCorner,r.setTripleAt(p,m,f,c,d,u,g),g+=1,o=i===y-1?t.v[0]:t.v[i+1],l=(h=Math.sqrt(Math.pow(s[0]-o[0],2)+Math.pow(s[1]-o[1],2)))?Math.min(h/2,e)/h:0,p=f=s[0]+(o[0]-s[0])*l,m=c=s[1]+(o[1]-s[1])*l,d=p-(p-s[0])*roundCorner,u=m-(m-s[1])*roundCorner,r.setTripleAt(p,m,f,c,d,u,g)):r.setTripleAt(s[0],s[1],n[0],n[1],a[0],a[1],g):r.setTripleAt(t.v[i][0],t.v[i][1],t.o[i][0],t.o[i][1],t.i[i][0],t.i[i][1],g),g+=1;return r},RoundCornersModifier.prototype.processShapes=function(t){var e,r,i,s,a,n,o=this.shapes.length,h=this.rd.v;if(0!==h)for(r=0;r<o;r+=1){if((a=this.shapes[r]).shape.paths,n=a.localShapeCollection,a.shape._mdf||this._mdf||t)for(n.releaseShapes(),a.shape._mdf=!0,e=a.shape.paths.shapes,s=a.shape.paths._length,i=0;i<s;i+=1)n.addShape(this.processPath(e[i],h));a.shape.paths=a.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)},ShapeModifiers.registerModifier("rd",RoundCornersModifier),extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(t,e.c,0,null,this),this.o=PropertyFactory.getProp(t,e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(t,e.tr,this),this.so=PropertyFactory.getProp(t,e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(t,e.tr.eo,0,.01,this),this.data=e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(t,e,r,i,s,a){var n=a?-1:1,o=i.s.v[0]+(1-i.s.v[0])*(1-s),h=i.s.v[1]+(1-i.s.v[1])*(1-s);t.translate(i.p.v[0]*n*s,i.p.v[1]*n*s,i.p.v[2]),e.translate(-i.a.v[0],-i.a.v[1],i.a.v[2]),e.rotate(-i.r.v*n*s),e.translate(i.a.v[0],i.a.v[1],i.a.v[2]),r.translate(-i.a.v[0],-i.a.v[1],i.a.v[2]),r.scale(a?1/o:o,a?1/h:h),r.translate(i.a.v[0],i.a.v[1],i.a.v[2])},RepeaterModifier.prototype.init=function(t,e,r,i){this.elem=t,this.arr=e,this.pos=r,this.elemsData=i,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,e[r]);for(;0<r;)r-=1,this._elements.unshift(e[r]),1;this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,r=t.length;for(e=0;e<r;e+=1)t[e]._processed=!1,"gr"===t[e].ty&&this.resetElements(t[e].it)},RepeaterModifier.prototype.cloneElements=function(t){t.length;var e=JSON.parse(JSON.stringify(t));return this.resetElements(e),e},RepeaterModifier.prototype.changeGroupRender=function(t,e){var r,i=t.length;for(r=0;r<i;r+=1)t[r]._render=e,"gr"===t[r].ty&&this.changeGroupRender(t[r].it,e)},RepeaterModifier.prototype.processShapes=function(t){var e,r,i,s,a;if(this._mdf||t){var n,o=Math.ceil(this.c.v);if(this._groups.length<o){for(;this._groups.length<o;){var h={it:this.cloneElements(this._elements),ty:"gr"};h.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,h),this._groups.splice(0,0,h),this._currentCopies+=1}this.elem.reloadShapes()}for(i=a=0;i<=this._groups.length-1;i+=1)n=a<o,this._groups[i]._render=n,this.changeGroupRender(this._groups[i].it,n),a+=1;this._currentCopies=o;var l=this.o.v,p=l%1,m=0<l?Math.floor(l):Math.ceil(l),f=(this.tr.v.props,this.pMatrix.props),c=this.rMatrix.props,d=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var u,y,g=0;if(0<l){for(;g<m;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),g+=1;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,p,!1),g+=p)}else if(l<0){for(;m<g;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),g-=1;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-p,!0),g-=p)}for(i=1===this.data.m?0:this._currentCopies-1,s=1===this.data.m?1:-1,a=this._currentCopies;a;){if(y=(r=(e=this.elemsData[i].it)[e.length-1].transform.mProps.v.props).length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this.so.v+(this.eo.v-this.so.v)*(i/(this._currentCopies-1)),0!==g){for((0!==i&&1===s||i!==this._currentCopies-1&&-1===s)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]),this.matrix.transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15]),this.matrix.transform(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]),u=0;u<y;u+=1)r[u]=this.matrix.props[u];this.matrix.reset()}else for(this.matrix.reset(),u=0;u<y;u+=1)r[u]=this.matrix.props[u];g+=1,a-=1,i+=s}}else for(a=this._currentCopies,i=0,s=1;a;)r=(e=this.elemsData[i].it)[e.length-1].transform.mProps.v.props,e[e.length-1].transform.mProps._mdf=!1,e[e.length-1].transform.op._mdf=!1,a-=1,i+=s},RepeaterModifier.prototype.addShape=function(){},ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeCollection.prototype.addShape=function(t){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=t,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var t;for(t=0;t<this._length;t+=1)shape_pool.release(this.shapes[t]);this._length=0},DashProperty.prototype.getValue=function(t){if((this.elem.globalData.frameId!==this.frameId||t)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||t,this._mdf)){var e=0,r=this.dataProps.length;for("svg"===this.renderer&&(this.dashStr=""),e=0;e<r;e+=1)"o"!=this.dataProps[e].n?"svg"===this.renderer?this.dashStr+=" "+this.dataProps[e].p.v:this.dashArray[e]=this.dataProps[e].p.v:this.dashoffset[0]=this.dataProps[e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty),GradientProperty.prototype.comparePoints=function(t,e){for(var r=0,i=this.o.length/2;r<i;){if(.01<Math.abs(t[4*r]-t[4*e+2*r]))return!1;r+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t<e;){if(!this.comparePoints(this.data.k.k[t].s,this.data.p))return!1;t+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(t){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||t){var e,r,i,s=4*this.data.p;for(e=0;e<s;e+=1)r=e%4==0?100:255,i=Math.round(this.prop.v[e]*r),this.c[e]!==i&&(this.c[e]=i,this._cmdf=!t);if(this.o.length)for(s=this.prop.v.length,e=4*this.data.p;e<s;e+=1)r=e%2==0?100:1,i=e%2==0?Math.round(100*this.prop.v[e]):this.prop.v[e],this.o[e-4*this.data.p]!==i&&(this.o[e-4*this.data.p]=i,this._omdf=!t);this._mdf=!t}},extendPrototype([DynamicPropertyContainer],GradientProperty);var buildShapeString=function(t,e,r,i){if(0===e)return"";var s,a=t.o,n=t.i,o=t.v,h=" M"+i.applyToPointStringified(o[0][0],o[0][1]);for(s=1;s<e;s+=1)h+=" C"+i.applyToPointStringified(a[s-1][0],a[s-1][1])+" "+i.applyToPointStringified(n[s][0],n[s][1])+" "+i.applyToPointStringified(o[s][0],o[s][1]);return r&&e&&(h+=" C"+i.applyToPointStringified(a[s-1][0],a[s-1][1])+" "+i.applyToPointStringified(n[0][0],n[0][1])+" "+i.applyToPointStringified(o[0][0],o[0][1]),h+="z"),h},ImagePreloader=function(){var s=function(){var t=createTag("canvas");t.width=1,t.height=1;var e=t.getContext("2d");return e.fillStyle="rgba(0,0,0,0)",e.fillRect(0,0,1,1),t}();function t(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function e(t){var e=function(t,e,r){var i="";if(t.e)i=t.p;else if(e){var s=t.p;-1!==s.indexOf("images/")&&(s=s.split("/")[1]),i=e+s}else i=r,i+=t.u?t.u:"",i+=t.p;return i}(t,this.assetsPath,this.path),r=createTag("img");r.crossOrigin="anonymous",r.addEventListener("load",this._imageLoaded.bind(this),!1),r.addEventListener("error",function(){i.img=s,this._imageLoaded()}.bind(this),!1),r.src=e;var i={img:r,assetData:t};return i}function r(t,e){this.imagesLoadedCb=e;var r,i=t.length;for(r=0;r<i;r+=1)t[r].layers||(this.totalImages+=1,this.images.push(this._createImageData(t[r])))}function i(t){this.path=t||""}function a(t){this.assetsPath=t||""}function n(t){for(var e=0,r=this.images.length;e<r;){if(this.images[e].assetData===t)return this.images[e].img;e+=1}}function o(){this.imagesLoadedCb=null,this.images.length=0}function h(){return this.totalImages===this.loadedAssets}return function(){this.loadAssets=r,this.setAssetsPath=a,this.setPath=i,this.loaded=h,this.destroy=o,this.getImage=n,this._createImageData=e,this._imageLoaded=t,this.assetsPath="",this.path="",this.totalImages=0,this.loadedAssets=0,this.imagesLoadedCb=null,this.images=[]}}(),featureSupport=(sw={maskType:!0},(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(sw.maskType=!1),sw),sw,filtersFactory=(tw={},tw.createFilter=function(t){var e=createNS("filter");return e.setAttribute("id",t),e.setAttribute("filterUnits","objectBoundingBox"),e.setAttribute("x","0%"),e.setAttribute("y","0%"),e.setAttribute("width","100%"),e.setAttribute("height","100%"),e},tw.createAlphaToLuminanceFilter=function(){var t=createNS("feColorMatrix");return t.setAttribute("type","matrix"),t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("values","0 0 0 1 0  0 0 0 1 0  0 0 0 1 0  0 0 0 1 1"),t},tw),tw,assetLoader=function(){function a(t){return t.response&&"object"==typeof t.response?t.response:t.response&&"string"==typeof t.response?JSON.parse(t.response):t.responseText?JSON.parse(t.responseText):void 0}return{load:function(t,e,r){var i,s=new XMLHttpRequest;s.open("GET",t,!0);try{s.responseType="json"}catch(t){}s.send(),s.onreadystatechange=function(){if(4==s.readyState)if(200==s.status)i=a(s),e(i);else try{i=a(s),e(i)}catch(t){r&&r(t)}}}}}();function TextAnimatorProperty(t,e,r){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=t,this._renderType=e,this._elem=r,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(r)}function TextAnimatorDataProperty(t,e,r){var i={propType:!1},s=PropertyFactory.getProp,a=e.a;this.a={r:a.r?s(t,a.r,0,degToRads,r):i,rx:a.rx?s(t,a.rx,0,degToRads,r):i,ry:a.ry?s(t,a.ry,0,degToRads,r):i,sk:a.sk?s(t,a.sk,0,degToRads,r):i,sa:a.sa?s(t,a.sa,0,degToRads,r):i,s:a.s?s(t,a.s,1,.01,r):i,a:a.a?s(t,a.a,1,0,r):i,o:a.o?s(t,a.o,0,.01,r):i,p:a.p?s(t,a.p,1,0,r):i,sw:a.sw?s(t,a.sw,0,0,r):i,sc:a.sc?s(t,a.sc,1,0,r):i,fc:a.fc?s(t,a.fc,1,0,r):i,fh:a.fh?s(t,a.fh,0,0,r):i,fs:a.fs?s(t,a.fs,0,.01,r):i,fb:a.fb?s(t,a.fb,0,.01,r):i,t:a.t?s(t,a.t,0,0,r):i},this.s=TextSelectorProp.getTextSelectorProp(t,e.s,r),this.s.t=e.s.t}function LetterProps(t,e,r,i,s,a){this.o=t,this.sw=e,this.sc=r,this.fc=i,this.m=s,this.p=a,this._mdf={o:!0,sw:!!e,sc:!!r,fc:!!i,m:!0,p:!0}}function TextProperty(t,e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,this.data=e,this.elem=t,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}TextAnimatorProperty.prototype.searchProperties=function(){var t,e,r=this._textData.a.length,i=PropertyFactory.getProp;for(t=0;t<r;t+=1)e=this._textData.a[t],this._animatorsData[t]=new TextAnimatorDataProperty(this._elem,e,this);this._textData.p&&"m"in this._textData.p?(this._pathData={f:i(this._elem,this._textData.p.f,0,0,this),l:i(this._elem,this._textData.p.l,0,0,this),r:this._textData.p.r,m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=i(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(t,e){if(this.lettersChangedFlag=e,this._mdf||this._isFirstFrame||e||this._hasMaskedPath&&this._pathData.m._mdf){this._isFirstFrame=!1;var r,i,s,a,n,o,h,l,p,m,f,c,d,u,y,g,v,b,E,x=this._moreOptions.alignment.v,S=this._animatorsData,P=this._textData,_=this.mHelper,A=this._renderType,C=this.renderedLetters.length,T=(this.data,t.l);if(this._hasMaskedPath){if(E=this._pathData.m,!this._pathData.n||this._pathData._mdf){var k,M=E.v;for(this._pathData.r&&(M=M.reverse()),n={tLength:0,segments:[]},a=M._length-1,s=g=0;s<a;s+=1)k=bez.buildBezierData(M.v[s],M.v[s+1],[M.o[s][0]-M.v[s][0],M.o[s][1]-M.v[s][1]],[M.i[s+1][0]-M.v[s+1][0],M.i[s+1][1]-M.v[s+1][1]]),n.tLength+=k.segmentLength,n.segments.push(k),g+=k.segmentLength;s=a,E.v.c&&(k=bez.buildBezierData(M.v[s],M.v[0],[M.o[s][0]-M.v[s][0],M.o[s][1]-M.v[s][1]],[M.i[0][0]-M.v[0][0],M.i[0][1]-M.v[0][1]]),n.tLength+=k.segmentLength,n.segments.push(k),g+=k.segmentLength),this._pathData.pi=n}if(n=this._pathData.pi,o=this._pathData.f.v,m=1,p=!(l=f=0),u=n.segments,o<0&&E.v.c)for(n.tLength<Math.abs(o)&&(o=-Math.abs(o)%n.tLength),m=(d=u[f=u.length-1].points).length-1;o<0;)o+=d[m].partialLength,(m-=1)<0&&(m=(d=u[f-=1].points).length-1);c=(d=u[f].points)[m-1],y=(h=d[m]).partialLength}a=T.length,i=r=0;var D,w,F,I,V=1.2*t.finalSize*.714,R=!0;F=S.length;var B,L,G,z,N,O,H,j,q,W,Y,X,$,K=-1,U=o,J=f,Z=m,Q=-1,tt="",et=this.defaultPropsArray;if(2===t.j||1===t.j){var rt=0,it=0,st=2===t.j?-.5:-1,at=0,nt=!0;for(s=0;s<a;s+=1)if(T[s].n){for(rt&&(rt+=it);at<s;)T[at].animatorJustifyOffset=rt,at+=1;nt=!(rt=0)}else{for(w=0;w<F;w+=1)(D=S[w].a).t.propType&&(nt&&2===t.j&&(it+=D.t.v*st),(B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars)).length?rt+=D.t.v*B[0]*st:rt+=D.t.v*B*st);nt=!1}for(rt&&(rt+=it);at<s;)T[at].animatorJustifyOffset=rt,at+=1}for(s=0;s<a;s+=1){if(_.reset(),N=1,T[s].n)r=0,i+=t.yOffset,i+=R?1:0,o=U,R=!1,0,this._hasMaskedPath&&(m=Z,c=(d=u[f=J].points)[m-1],y=(h=d[m]).partialLength,l=0),$=W=X=tt="",et=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Q!==T[s].line){switch(t.j){case 1:o+=g-t.lineWidths[T[s].line];break;case 2:o+=(g-t.lineWidths[T[s].line])/2}Q=T[s].line}K!==T[s].ind&&(T[K]&&(o+=T[K].extra),o+=T[s].an/2,K=T[s].ind),o+=x[0]*T[s].an/200;var ot=0;for(w=0;w<F;w+=1)(D=S[w].a).p.propType&&((B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars)).length?ot+=D.p.v[0]*B[0]:ot+=D.p.v[0]*B),D.a.propType&&((B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars)).length?ot+=D.a.v[0]*B[0]:ot+=D.a.v[0]*B);for(p=!0;p;)o+ot<=l+y||!d?(v=(o+ot-l)/h.partialLength,G=c.point[0]+(h.point[0]-c.point[0])*v,z=c.point[1]+(h.point[1]-c.point[1])*v,_.translate(-x[0]*T[s].an/200,-x[1]*V/100),p=!1):d&&(l+=h.partialLength,(m+=1)>=d.length&&(m=0,d=u[f+=1]?u[f].points:E.v.c?u[f=m=0].points:(l-=h.partialLength,null)),d&&(c=h,y=(h=d[m]).partialLength));L=T[s].an/2-T[s].add,_.translate(-L,0,0)}else L=T[s].an/2-T[s].add,_.translate(-L,0,0),_.translate(-x[0]*T[s].an/200,-x[1]*V/100,0);for(T[s].l/2,w=0;w<F;w+=1)(D=S[w].a).t.propType&&(B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars),0===r&&0===t.j||(this._hasMaskedPath?B.length?o+=D.t.v*B[0]:o+=D.t.v*B:B.length?r+=D.t.v*B[0]:r+=D.t.v*B));for(T[s].l/2,t.strokeWidthAnim&&(H=t.sw||0),t.strokeColorAnim&&(O=t.sc?[t.sc[0],t.sc[1],t.sc[2]]:[0,0,0]),t.fillColorAnim&&t.fc&&(j=[t.fc[0],t.fc[1],t.fc[2]]),w=0;w<F;w+=1)(D=S[w].a).a.propType&&((B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars)).length?_.translate(-D.a.v[0]*B[0],-D.a.v[1]*B[1],D.a.v[2]*B[2]):_.translate(-D.a.v[0]*B,-D.a.v[1]*B,D.a.v[2]*B));for(w=0;w<F;w+=1)(D=S[w].a).s.propType&&((B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars)).length?_.scale(1+(D.s.v[0]-1)*B[0],1+(D.s.v[1]-1)*B[1],1):_.scale(1+(D.s.v[0]-1)*B,1+(D.s.v[1]-1)*B,1));for(w=0;w<F;w+=1){if(D=S[w].a,B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars),D.sk.propType&&(B.length?_.skewFromAxis(-D.sk.v*B[0],D.sa.v*B[1]):_.skewFromAxis(-D.sk.v*B,D.sa.v*B)),D.r.propType&&(B.length?_.rotateZ(-D.r.v*B[2]):_.rotateZ(-D.r.v*B)),D.ry.propType&&(B.length?_.rotateY(D.ry.v*B[1]):_.rotateY(D.ry.v*B)),D.rx.propType&&(B.length?_.rotateX(D.rx.v*B[0]):_.rotateX(D.rx.v*B)),D.o.propType&&(B.length?N+=(D.o.v*B[0]-N)*B[0]:N+=(D.o.v*B-N)*B),t.strokeWidthAnim&&D.sw.propType&&(B.length?H+=D.sw.v*B[0]:H+=D.sw.v*B),t.strokeColorAnim&&D.sc.propType)for(q=0;q<3;q+=1)B.length?O[q]=O[q]+(D.sc.v[q]-O[q])*B[0]:O[q]=O[q]+(D.sc.v[q]-O[q])*B;if(t.fillColorAnim&&t.fc){if(D.fc.propType)for(q=0;q<3;q+=1)B.length?j[q]=j[q]+(D.fc.v[q]-j[q])*B[0]:j[q]=j[q]+(D.fc.v[q]-j[q])*B;D.fh.propType&&(j=B.length?addHueToRGB(j,D.fh.v*B[0]):addHueToRGB(j,D.fh.v*B)),D.fs.propType&&(j=B.length?addSaturationToRGB(j,D.fs.v*B[0]):addSaturationToRGB(j,D.fs.v*B)),D.fb.propType&&(j=B.length?addBrightnessToRGB(j,D.fb.v*B[0]):addBrightnessToRGB(j,D.fb.v*B))}}for(w=0;w<F;w+=1)(D=S[w].a).p.propType&&(B=S[w].s.getMult(T[s].anIndexes[w],P.a[w].s.totalChars),this._hasMaskedPath?B.length?_.translate(0,D.p.v[1]*B[0],-D.p.v[2]*B[1]):_.translate(0,D.p.v[1]*B,-D.p.v[2]*B):B.length?_.translate(D.p.v[0]*B[0],D.p.v[1]*B[1],-D.p.v[2]*B[2]):_.translate(D.p.v[0]*B,D.p.v[1]*B,-D.p.v[2]*B));if(t.strokeWidthAnim&&(W=H<0?0:H),t.strokeColorAnim&&(Y="rgb("+Math.round(255*O[0])+","+Math.round(255*O[1])+","+Math.round(255*O[2])+")"),t.fillColorAnim&&t.fc&&(X="rgb("+Math.round(255*j[0])+","+Math.round(255*j[1])+","+Math.round(255*j[2])+")"),this._hasMaskedPath){if(_.translate(0,-t.ls),_.translate(0,x[1]*V/100+i,0),P.p.p){b=(h.point[1]-c.point[1])/(h.point[0]-c.point[0]);var ht=180*Math.atan(b)/Math.PI;h.point[0]<c.point[0]&&(ht+=180),_.rotate(-ht*Math.PI/180)}_.translate(G,z,0),o-=x[0]*T[s].an/200,T[s+1]&&K!==T[s+1].ind&&(o+=T[s].an/2,o+=t.tr/1e3*t.finalSize)}else{switch(_.translate(r,i,0),t.ps&&_.translate(t.ps[0],t.ps[1]+t.ascent,0),t.j){case 1:_.translate(T[s].animatorJustifyOffset+t.justifyOffset+(t.boxWidth-t.lineWidths[T[s].line]),0,0);break;case 2:_.translate(T[s].animatorJustifyOffset+t.justifyOffset+(t.boxWidth-t.lineWidths[T[s].line])/2,0,0)}_.translate(0,-t.ls),_.translate(L,0,0),_.translate(x[0]*T[s].an/200,x[1]*V/100,0),r+=T[s].l+t.tr/1e3*t.finalSize}"html"===A?tt=_.toCSS():"svg"===A?tt=_.to2dCSS():et=[_.props[0],_.props[1],_.props[2],_.props[3],_.props[4],_.props[5],_.props[6],_.props[7],_.props[8],_.props[9],_.props[10],_.props[11],_.props[12],_.props[13],_.props[14],_.props[15]],$=N}this.lettersChangedFlag=C<=s?(I=new LetterProps($,W,Y,X,tt,et),this.renderedLetters.push(I),C+=1,!0):(I=this.renderedLetters[s]).update($,W,Y,X,tt,et)||this.lettersChangedFlag}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty),LetterProps.prototype.update=function(t,e,r,i,s,a){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1;var n=this._mdf.p=!1;return this.o!==t&&(this.o=t,n=this._mdf.o=!0),this.sw!==e&&(this.sw=e,n=this._mdf.sw=!0),this.sc!==r&&(this.sc=r,n=this._mdf.sc=!0),this.fc!==i&&(this.fc=i,n=this._mdf.fc=!0),this.m!==s&&(this.m=s,n=this._mdf.m=!0),!a.length||this.p[0]===a[0]&&this.p[1]===a[1]&&this.p[4]===a[4]&&this.p[5]===a[5]&&this.p[12]===a[12]&&this.p[13]===a[13]||(this.p=a,n=this._mdf.p=!0),n},TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t},TextProperty.prototype.setCurrentData=function(t){t.__complete||this.completeTextData(t),this.currentData=t,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=1<this.data.d.k.length,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||t){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,r=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{this.lock=!0,this._mdf=!1;var i,s=this.effectsSequence.length,a=t||this.data.d.k[this.keysIndex].s;for(i=0;i<s;i+=1)a=r!==this.keysIndex?this.effectsSequence[i](a,a.t):this.effectsSequence[i](this.currentData,a.t);e!==a&&this.setCurrentData(a),this.pv=this.v=this.currentData,this.lock=!1,this.frameId=this.elem.globalData.frameId}}},TextProperty.prototype.getKeyframeValue=function(){for(var t=this.data.d.k,e=this.elem.comp.renderedFrame,r=0,i=t.length;r<=i-1&&(t[r].s,!(r===i-1||t[r+1].t>e));)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e,r=FontManager.getCombinedCharacterCodes(),i=[],s=0,a=t.length;s<a;)e=t.charCodeAt(s),-1!==r.indexOf(e)?i[i.length-1]+=t.charAt(s):55296<=e&&e<=56319&&56320<=(e=t.charCodeAt(s+1))&&e<=57343?(i.push(t.substr(s,2)),++s):i.push(t.charAt(s)),s+=1;return i},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e,r,i,s,a,n,o,h=this.elem.globalData.fontManager,l=this.data,p=[],m=0,f=l.m.g,c=0,d=0,u=0,y=[],g=0,v=0,b=h.getFontByName(t.f),E=0,x=b.fStyle?b.fStyle.split(" "):[],S="normal",P="normal";for(r=x.length,e=0;e<r;e+=1)switch(x[e].toLowerCase()){case"italic":P="italic";break;case"bold":S="700";break;case"black":S="900";break;case"medium":S="500";break;case"regular":case"normal":S="400";break;case"light":case"thin":S="200"}t.fWeight=b.fWeight||S,t.fStyle=P,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),r=t.finalText.length,t.finalLineHeight=t.lh;var _,A=t.tr/1e3*t.finalSize;if(t.sz)for(var C,T,k=!0,M=t.sz[0],D=t.sz[1];k;){g=C=0,r=(T=this.buildFinalText(t.t)).length,A=t.tr/1e3*t.finalSize;var w=-1;for(e=0;e<r;e+=1)_=T[e].charCodeAt(0),i=!1," "===T[e]?w=e:13!==_&&3!==_||(i=!(g=0),C+=t.finalLineHeight||1.2*t.finalSize),M<g+(E=h.chars?(o=h.getCharData(T[e],b.fStyle,b.fFamily),i?0:o.w*t.finalSize/100):h.measureText(T[e],t.f,t.finalSize))&&" "!==T[e]?(-1===w?r+=1:e=w,C+=t.finalLineHeight||1.2*t.finalSize,T.splice(e,w===e?1:0,"\r"),w=-1,g=0):(g+=E,g+=A);C+=b.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&D<C?(t.finalSize-=1,t.finalLineHeight=t.finalSize*t.lh/t.s):(t.finalText=T,r=t.finalText.length,k=!1)}g=-A;var F,I=E=0;for(e=0;e<r;e+=1)if(i=!1,13===(_=(F=t.finalText[e]).charCodeAt(0))||3===_?(I=0,y.push(g),v=v<g?g:v,g=-2*A,i=!(s=""),u+=1):s=F,E=h.chars?(o=h.getCharData(F,b.fStyle,h.getFontByName(t.f).fFamily),i?0:o.w*t.finalSize/100):h.measureText(s,t.f,t.finalSize)," "===F?I+=E+A:(g+=E+A+I,I=0),p.push({l:E,an:E,add:c,n:i,anIndexes:[],val:s,line:u,animatorJustifyOffset:0}),2==f){if(c+=E,""===s||" "===s||e===r-1){for(""!==s&&" "!==s||(c-=E);d<=e;)p[d].an=c,p[d].ind=m,p[d].extra=E,d+=1;m+=1,c=0}}else if(3==f){if(c+=E,""===s||e===r-1){for(""===s&&(c-=E);d<=e;)p[d].an=c,p[d].ind=m,p[d].extra=E,d+=1;c=0,m+=1}}else p[m].ind=m,p[m].extra=0,m+=1;if(t.l=p,v=v<g?g:v,y.push(g),t.sz)t.boxWidth=t.sz[0],t.justifyOffset=0;else switch(t.boxWidth=v,t.j){case 1:t.justifyOffset=-t.boxWidth;break;case 2:t.justifyOffset=-t.boxWidth/2;break;default:t.justifyOffset=0}t.lineWidths=y;var V,R,B=l.a;n=B.length;var L,G,z=[];for(a=0;a<n;a+=1){for((V=B[a]).a.sc&&(t.strokeColorAnim=!0),V.a.sw&&(t.strokeWidthAnim=!0),(V.a.fc||V.a.fh||V.a.fs||V.a.fb)&&(t.fillColorAnim=!0),G=0,L=V.s.b,e=0;e<r;e+=1)(R=p[e]).anIndexes[a]=G,(1==L&&""!==R.val||2==L&&""!==R.val&&" "!==R.val||3==L&&(R.n||" "==R.val||e==r-1)||4==L&&(R.n||e==r-1))&&(1===V.s.rn&&z.push(G),G+=1);l.a[a].s.totalChars=G;var N,O=-1;if(1===V.s.rn)for(e=0;e<r;e+=1)O!=(R=p[e]).anIndexes[a]&&(O=R.anIndexes[a],N=z.splice(Math.floor(Math.random()*z.length),1)[0]),R.anIndexes[a]=N}t.yOffset=t.finalLineHeight||1.2*t.finalSize,t.ls=t.ls||0,t.ascent=b.ascent*t.finalSize/100},TextProperty.prototype.updateDocumentData=function(t,e){e=void 0===e?this.keysIndex:e;var r=this.copyData({},this.data.d.k[e].s);r=this.copyData(r,t),this.data.d.k[e].s=r,this.recalculate(e),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(t){var e=this.data.d.k[t].s;e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(e)},TextProperty.prototype.canResizeFont=function(t){this.canResize=t,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(t){this.minimumFontSize=Math.floor(t)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=function(){var c=Math.max,d=Math.min,u=Math.floor;function i(t,e){this._currentTextLength=-1,this.k=!1,this.data=e,this.elem=t,this.comp=t.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(t),this.s=PropertyFactory.getProp(t,e.s||{k:0},0,0,this),this.e="e"in e?PropertyFactory.getProp(t,e.e,0,0,this):{v:100},this.o=PropertyFactory.getProp(t,e.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(t,e.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(t,e.ne||{k:0},0,0,this),this.a=PropertyFactory.getProp(t,e.a,0,.01,this),this.dynamicProperties.length||this.getValue()}return i.prototype={getMult:function(t){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var e=0,r=0,i=1,s=1;0<this.ne.v?e=this.ne.v/100:r=-this.ne.v/100,0<this.xe.v?i=1-this.xe.v/100:s=1+this.xe.v/100;var a=BezierFactory.getBezierEasing(e,r,i,s).get,n=0,o=this.finalS,h=this.finalE,l=this.data.sh;if(2===l)n=a(n=h===o?h<=t?1:0:c(0,d(.5/(h-o)+(t-o)/(h-o),1)));else if(3===l)n=a(n=h===o?h<=t?0:1:1-c(0,d(.5/(h-o)+(t-o)/(h-o),1)));else if(4===l)h===o?n=0:(n=c(0,d(.5/(h-o)+(t-o)/(h-o),1)))<.5?n*=2:n=1-2*(n-.5),n=a(n);else if(5===l){if(h===o)n=0;else{var p=h-o,m=-p/2+(t=d(c(0,t+.5-o),h-o)),f=p/2;n=Math.sqrt(1-m*m/(f*f))}n=a(n)}else n=6===l?a(n=h===o?0:(t=d(c(0,t+.5-o),h-o),(1+Math.cos(Math.PI+2*Math.PI*t/(h-o)))/2)):(t>=u(o)&&(n=c(0,d(t-o<0?d(h,1)-(o-t):h-t,1))),a(n));return n*this.a.v},getValue:function(t){this.iterateDynamicProperties(),this._mdf=t||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,t&&2===this.data.r&&(this.e.v=this._currentTextLength);var e=2===this.data.r?1:100/this.data.totalChars,r=this.o.v/e,i=this.s.v/e+r,s=this.e.v/e+r;if(s<i){var a=i;i=s,s=a}this.finalS=i,this.finalE=s}},extendPrototype([DynamicPropertyContainer],i),{getTextSelectorProp:function(t,e,r){return new i(t,e,r)}}}(),pool_factory=function(t,e,r,i){var s=0,a=t,n=createSizedArray(a);function o(){return s?n[s-=1]:e()}return{newElement:o,release:function(t){s===a&&(n=pooling.double(n),a*=2),r&&r(t),n[s]=t,s+=1}}},pooling={double:function(t){return t.concat(createSizedArray(t.length))}},point_pool=pool_factory(8,function(){return createTypedArray("float32",2)}),shape_pool=(KA=pool_factory(4,function(){return new ShapePath},function(t){var e,r=t._length;for(e=0;e<r;e+=1)point_pool.release(t.v[e]),point_pool.release(t.i[e]),point_pool.release(t.o[e]),t.v[e]=null,t.i[e]=null,t.o[e]=null;t._length=0,t.c=!1}),KA.clone=function(t){var e,r=KA.newElement(),i=void 0===t._length?t.v.length:t._length;for(r.setLength(i),r.c=t.c,e=0;e<i;e+=1)r.setTripleAt(t.v[e][0],t.v[e][1],t.o[e][0],t.o[e][1],t.i[e][0],t.i[e][1],e);return r},KA),KA,shapeCollection_pool=(TA={newShapeCollection:function(){var t;t=UA?WA[UA-=1]:new ShapeCollection;return t},release:function(t){var e,r=t._length;for(e=0;e<r;e+=1)shape_pool.release(t.shapes[e]);t._length=0,UA===VA&&(WA=pooling.double(WA),VA*=2);WA[UA]=t,UA+=1}},UA=0,VA=4,WA=createSizedArray(VA),TA),TA,UA,VA,WA,segments_length_pool=pool_factory(8,function(){return{lengths:[],totalLength:0}},function(t){var e,r=t.lengths.length;for(e=0;e<r;e+=1)bezier_length_pool.release(t.lengths[e]);t.lengths.length=0}),bezier_length_pool=pool_factory(8,function(){return{addedLength:0,percents:createTypedArray("float32",defaultCurveSegments),lengths:createTypedArray("float32",defaultCurveSegments)}});function BaseRenderer(){}function SVGRenderer(t,e){this.animationItem=t,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var r="";if(e&&e.title){var i=createNS("title"),s=createElementID();i.setAttribute("id",s),i.textContent=e.title,this.svgElement.appendChild(i),r+=s}if(e&&e.description){var a=createNS("desc"),n=createElementID();a.setAttribute("id",n),a.textContent=e.description,this.svgElement.appendChild(a),r+=" "+n}r&&this.svgElement.setAttribute("aria-labelledby",r);var o=createNS("defs");this.svgElement.appendChild(o);var h=createNS("g");this.svgElement.appendChild(h),this.layerElement=h,this.renderConfig={preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",progressiveLoad:e&&e.progressiveLoad||!1,hideOnTransparent:!e||!1!==e.hideOnTransparent,viewBoxOnly:e&&e.viewBoxOnly||!1,viewBoxSize:e&&e.viewBoxSize||!1,className:e&&e.className||"",id:e&&e.id||"",focusable:e&&e.focusable,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"100%",height:e&&e.filterSize&&e.filterSize.height||"100%",x:e&&e.filterSize&&e.filterSize.x||"0%",y:e&&e.filterSize&&e.filterSize.y||"0%"}},this.globalData={_mdf:!1,frameNum:-1,defs:o,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig={clearCanvas:!e||void 0===e.clearCanvas||e.clearCanvas,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",className:e&&e.className||"",id:e&&e.id||""},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas"}function HybridRenderer(t,e){this.animationItem=t,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!e||!1!==e.hideOnTransparent,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}function MaskElement(t,e,r){this.data=t,this.element=e,this.globalData=r,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var i,s=this.globalData.defs,a=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(a),this.solidPath="";var n,o,h,l,p,m,f,c=this.masksProperties,d=0,u=[],y=createElementID(),g="clipPath",v="clip-path";for(i=0;i<a;i++)if(("a"!==c[i].mode&&"n"!==c[i].mode||c[i].inv||100!==c[i].o.k||c[i].o.x)&&(v=g="mask"),"s"!=c[i].mode&&"i"!=c[i].mode||0!==d?l=null:((l=createNS("rect")).setAttribute("fill","#ffffff"),l.setAttribute("width",this.element.comp.data.w||0),l.setAttribute("height",this.element.comp.data.h||0),u.push(l)),n=createNS("path"),"n"!=c[i].mode){var b;if(d+=1,n.setAttribute("fill","s"===c[i].mode?"#000000":"#ffffff"),n.setAttribute("clip-rule","nonzero"),0!==c[i].x.k?(v=g="mask",f=PropertyFactory.getProp(this.element,c[i].x,0,null,this.element),b=createElementID(),(p=createNS("filter")).setAttribute("id",b),(m=createNS("feMorphology")).setAttribute("operator","erode"),m.setAttribute("in","SourceGraphic"),m.setAttribute("radius","0"),p.appendChild(m),s.appendChild(p),n.setAttribute("stroke","s"===c[i].mode?"#000000":"#ffffff")):f=m=null,this.storedData[i]={elem:n,x:f,expan:m,lastPath:"",lastOperator:"",filterId:b,lastRadius:0},"i"==c[i].mode){h=u.length;var E=createNS("g");for(o=0;o<h;o+=1)E.appendChild(u[o]);var x=createNS("mask");x.setAttribute("mask-type","alpha"),x.setAttribute("id",y+"_"+d),x.appendChild(n),s.appendChild(x),E.setAttribute("mask","url("+locationHref+"#"+y+"_"+d+")"),u.length=0,u.push(E)}else u.push(n);c[i].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[i]={elem:n,lastPath:"",op:PropertyFactory.getProp(this.element,c[i].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,c[i],3),invRect:l},this.viewData[i].prop.k||this.drawPath(c[i],this.viewData[i].prop.v,this.viewData[i])}else this.viewData[i]={op:PropertyFactory.getProp(this.element,c[i].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,c[i],3),elem:n,lastPath:""},s.appendChild(n);for(this.maskElement=createNS(g),a=u.length,i=0;i<a;i+=1)this.maskElement.appendChild(u[i]);0<d&&(this.maskElement.setAttribute("id",y),this.element.maskedElement.setAttribute(v,"url("+locationHref+"#"+y+")"),s.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}function HierarchyElement(){}function FrameElement(){}function TransformElement(){}function RenderableElement(){}function RenderableDOMElement(){}function ProcessedElement(t,e){this.elem=t,this.pos=e}function SVGStyleData(t,e){this.data=t,this.type=t.ty,this.d="",this.lvl=e,this._mdf=!1,this.closed=!0===t.hd,this.pElem=createNS("path"),this.msElem=null}function SVGShapeData(t,e,r){this.caches=[],this.styles=[],this.transformers=t,this.lStr="",this.sh=r,this.lvl=e,this._isAnimated=!!r.k;for(var i=0,s=t.length;i<s;){if(t[i].mProps.dynamicProperties.length){this._isAnimated=!0;break}i+=1}}function SVGTransformData(t,e,r){this.transform={mProps:t,op:e,container:r},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}function SVGStrokeStyleData(t,e,r){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(t,e.o,0,.01,this),this.w=PropertyFactory.getProp(t,e.w,0,null,this),this.d=new DashProperty(t,e.d||{},"svg",this),this.c=PropertyFactory.getProp(t,e.c,1,255,this),this.style=r,this._isAnimated=!!this._isAnimated}function SVGFillStyleData(t,e,r){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(t,e.o,0,.01,this),this.c=PropertyFactory.getProp(t,e.c,1,255,this),this.style=r}function SVGGradientFillStyleData(t,e,r){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.initGradientData(t,e,r)}function SVGGradientStrokeStyleData(t,e,r){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(t,e.w,0,null,this),this.d=new DashProperty(t,e.d||{},"svg",this),this.initGradientData(t,e,r),this._isAnimated=!!this._isAnimated}function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}BaseRenderer.prototype.checkLayers=function(t){var e,r,i=this.layers.length;for(this.completeLayers=!0,e=i-1;0<=e;e--)this.elements[e]||(r=this.layers[e]).ip-r.st<=t-this.layers[e].st&&r.op-r.st>t-this.layers[e].st&&this.buildItem(e),this.completeLayers=!!this.elements[e]&&this.completeLayers;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 3:return this.createNull(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 13:return this.createCamera(t)}return this.createNull(t)},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;t<e;t+=1)this.buildItem(t);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(t){this.completeLayers=!1;var e,r,i=t.length,s=this.layers.length;for(e=0;e<i;e+=1)for(r=0;r<s;){if(this.layers[r].id==t[e].id){this.layers[r]=t[e];break}r+=1}},BaseRenderer.prototype.setProjectInterface=function(t){this.globalData.projectInterface=t},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(t,e,r){for(var i=this.elements,s=this.layers,a=0,n=s.length;a<n;)s[a].ind==e&&(i[a]&&!0!==i[a]?(r.push(i[a]),i[a].setAsParent(),void 0!==s[a].parent?this.buildElementParenting(t,s[a].parent,r):t.setHierarchy(r)):(this.buildItem(a),this.addPendingElement(t))),a+=1},BaseRenderer.prototype.addPendingElement=function(t){this.pendingElements.push(t)},BaseRenderer.prototype.searchExtraCompositions=function(t){var e,r=t.length;for(e=0;e<r;e+=1)if(t[e].xt){var i=this.createComp(t[e]);i.initExpressions(),this.globalData.projectInterface.registerComposition(i)}},BaseRenderer.prototype.setupGlobalData=function(t,e){this.globalData.fontManager=new FontManager,this.globalData.fontManager.addChars(t.chars),this.globalData.fontManager.addFonts(t.fonts,e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.frameId=0,this.globalData.frameRate=t.fr,this.globalData.nm=t.nm,this.globalData.compSize={w:t.w,h:t.h}},extendPrototype([BaseRenderer],SVGRenderer),SVGRenderer.prototype.createNull=function(t){return new NullElement(t,this.globalData,this)},SVGRenderer.prototype.createShape=function(t){return new SVGShapeElement(t,this.globalData,this)},SVGRenderer.prototype.createText=function(t){return new SVGTextElement(t,this.globalData,this)},SVGRenderer.prototype.createImage=function(t){return new IImageElement(t,this.globalData,this)},SVGRenderer.prototype.createComp=function(t){return new SVGCompElement(t,this.globalData,this)},SVGRenderer.prototype.createSolid=function(t){return new ISolidElement(t,this.globalData,this)},SVGRenderer.prototype.configAnimation=function(t){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+t.w+" "+t.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",t.w),this.svgElement.setAttribute("height",t.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)"),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),void 0!==this.renderConfig.focusable&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var e=this.globalData.defs;this.setupGlobalData(t,e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=t;var r=createNS("clipPath"),i=createNS("rect");i.setAttribute("width",t.w),i.setAttribute("height",t.h),i.setAttribute("x",0),i.setAttribute("y",0);var s=createElementID();r.setAttribute("id",s),r.appendChild(i),this.layerElement.setAttribute("clip-path","url("+locationHref+"#"+s+")"),e.appendChild(r),this.layers=t.layers,this.elements=createSizedArray(t.layers.length)},SVGRenderer.prototype.destroy=function(){this.animationItem.wrapper.innerHTML="",this.layerElement=null,this.globalData.defs=null;var t,e=this.layers?this.layers.length:0;for(t=0;t<e;t++)this.elements[t]&&this.elements[t].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRenderer.prototype.updateContainerSize=function(){},SVGRenderer.prototype.buildItem=function(t){var e=this.elements;if(!e[t]&&99!=this.layers[t].ty){e[t]=!0;var r=this.createItem(this.layers[t]);e[t]=r,expressionsPlugin&&(0===this.layers[t].ty&&this.globalData.projectInterface.registerComposition(r),r.initExpressions()),this.appendElementInPos(r,t),this.layers[t].tt&&(this.elements[t-1]&&!0!==this.elements[t-1]?r.setMatte(e[t-1].layerId):(this.buildItem(t-1),this.addPendingElement(r)))}},SVGRenderer.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();if(t.checkParenting(),t.data.tt)for(var e=0,r=this.elements.length;e<r;){if(this.elements[e]===t){t.setMatte(this.elements[e-1].layerId);break}e+=1}}},SVGRenderer.prototype.renderFrame=function(t){if(this.renderedFrame!==t&&!this.destroyed){null===t?t=this.renderedFrame:this.renderedFrame=t,this.globalData.frameNum=t,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=t,this.globalData._mdf=!1;var e,r=this.layers.length;for(this.completeLayers||this.checkLayers(t),e=r-1;0<=e;e--)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(t-this.layers[e].st);if(this.globalData._mdf)for(e=0;e<r;e+=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()}},SVGRenderer.prototype.appendElementInPos=function(t,e){var r=t.getBaseElement();if(r){for(var i,s=0;s<e;)this.elements[s]&&!0!==this.elements[s]&&this.elements[s].getBaseElement()&&(i=this.elements[s].getBaseElement()),s+=1;i?this.layerElement.insertBefore(r,i):this.layerElement.appendChild(r)}},SVGRenderer.prototype.hide=function(){this.layerElement.style.display="none"},SVGRenderer.prototype.show=function(){this.layerElement.style.display="block"},extendPrototype([BaseRenderer],CanvasRenderer),CanvasRenderer.prototype.createShape=function(t){return new CVShapeElement(t,this.globalData,this)},CanvasRenderer.prototype.createText=function(t){return new CVTextElement(t,this.globalData,this)},CanvasRenderer.prototype.createImage=function(t){return new CVImageElement(t,this.globalData,this)},CanvasRenderer.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)},CanvasRenderer.prototype.createSolid=function(t){return new CVSolidElement(t,this.globalData,this)},CanvasRenderer.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRenderer.prototype.ctxTransform=function(t){if(1!==t[0]||0!==t[1]||0!==t[4]||1!==t[5]||0!==t[12]||0!==t[13])if(this.renderConfig.clearCanvas){this.transformMat.cloneFromProps(t);var e=this.contextData.cTr.props;this.transformMat.transform(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]),this.contextData.cTr.cloneFromProps(this.transformMat.props);var r=this.contextData.cTr.props;this.canvasContext.setTransform(r[0],r[1],r[4],r[5],r[12],r[13])}else this.canvasContext.transform(t[0],t[1],t[4],t[5],t[12],t[13])},CanvasRenderer.prototype.ctxOpacity=function(t){if(!this.renderConfig.clearCanvas)return this.canvasContext.globalAlpha*=t<0?0:t,void(this.globalData.currentGlobalAlpha=this.contextData.cO);this.contextData.cO*=t<0?0:t,this.globalData.currentGlobalAlpha!==this.contextData.cO&&(this.canvasContext.globalAlpha=this.contextData.cO,this.globalData.currentGlobalAlpha=this.contextData.cO)},CanvasRenderer.prototype.reset=function(){this.renderConfig.clearCanvas?this.contextData.reset():this.canvasContext.restore()},CanvasRenderer.prototype.save=function(t){if(this.renderConfig.clearCanvas){t&&this.canvasContext.save();var e=this.contextData.cTr.props;this.contextData._length<=this.contextData.cArrPos&&this.contextData.duplicate();var r,i=this.contextData.saved[this.contextData.cArrPos];for(r=0;r<16;r+=1)i[r]=e[r];this.contextData.savedOp[this.contextData.cArrPos]=this.contextData.cO,this.contextData.cArrPos+=1}else this.canvasContext.save()},CanvasRenderer.prototype.restore=function(t){if(this.renderConfig.clearCanvas){t&&(this.canvasContext.restore(),this.globalData.blendMode="source-over"),this.contextData.cArrPos-=1;var e,r=this.contextData.saved[this.contextData.cArrPos],i=this.contextData.cTr.props;for(e=0;e<16;e+=1)i[e]=r[e];this.canvasContext.setTransform(r[0],r[1],r[4],r[5],r[12],r[13]),r=this.contextData.savedOp[this.contextData.cArrPos],this.contextData.cO=r,this.globalData.currentGlobalAlpha!==r&&(this.canvasContext.globalAlpha=r,this.globalData.currentGlobalAlpha=r)}else this.canvasContext.restore()},CanvasRenderer.prototype.configAnimation=function(t){this.animationItem.wrapper?(this.animationItem.container=createTag("canvas"),this.animationItem.container.style.width="100%",this.animationItem.container.style.height="100%",this.animationItem.container.style.transformOrigin=this.animationItem.container.style.mozTransformOrigin=this.animationItem.container.style.webkitTransformOrigin=this.animationItem.container.style["-webkit-transform"]="0px 0px 0px",this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)):this.canvasContext=this.renderConfig.context,this.data=t,this.layers=t.layers,this.transformCanvas={w:t.w,h:t.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(t,document.body),this.globalData.canvasContext=this.canvasContext,(this.globalData.renderer=this).globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(t.layers.length),this.updateContainerSize()},CanvasRenderer.prototype.updateContainerSize=function(){var t,e,r,i;if(this.reset(),this.animationItem.wrapper&&this.animationItem.container?(t=this.animationItem.wrapper.offsetWidth,e=this.animationItem.wrapper.offsetHeight,this.animationItem.container.setAttribute("width",t*this.renderConfig.dpr),this.animationItem.container.setAttribute("height",e*this.renderConfig.dpr)):(t=this.canvasContext.canvas.width*this.renderConfig.dpr,e=this.canvasContext.canvas.height*this.renderConfig.dpr),-1!==this.renderConfig.preserveAspectRatio.indexOf("meet")||-1!==this.renderConfig.preserveAspectRatio.indexOf("slice")){var s=this.renderConfig.preserveAspectRatio.split(" "),a=s[1]||"meet",n=s[0]||"xMidYMid",o=n.substr(0,4),h=n.substr(4);r=t/e,i=this.transformCanvas.w/this.transformCanvas.h,this.transformCanvas.sy=r<i&&"meet"===a||i<r&&"slice"===a?(this.transformCanvas.sx=t/(this.transformCanvas.w/this.renderConfig.dpr),t/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=e/(this.transformCanvas.h/this.renderConfig.dpr),e/(this.transformCanvas.h/this.renderConfig.dpr)),this.transformCanvas.tx="xMid"===o&&(i<r&&"meet"===a||r<i&&"slice"===a)?(t-this.transformCanvas.w*(e/this.transformCanvas.h))/2*this.renderConfig.dpr:"xMax"===o&&(i<r&&"meet"===a||r<i&&"slice"===a)?(t-this.transformCanvas.w*(e/this.transformCanvas.h))*this.renderConfig.dpr:0,this.transformCanvas.ty="YMid"===h&&(r<i&&"meet"===a||i<r&&"slice"===a)?(e-this.transformCanvas.h*(t/this.transformCanvas.w))/2*this.renderConfig.dpr:"YMax"===h&&(r<i&&"meet"===a||i<r&&"slice"===a)?(e-this.transformCanvas.h*(t/this.transformCanvas.w))*this.renderConfig.dpr:0}else"none"==this.renderConfig.preserveAspectRatio?(this.transformCanvas.sx=t/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=e/(this.transformCanvas.h/this.renderConfig.dpr)):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0;this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRenderer.prototype.destroy=function(){var t;for(this.renderConfig.clearCanvas&&(this.animationItem.wrapper.innerHTML=""),t=(this.layers?this.layers.length:0)-1;0<=t;t-=1)this.elements[t]&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRenderer.prototype.renderFrame=function(t,e){if((this.renderedFrame!==t||!0!==this.renderConfig.clearCanvas||e)&&!this.destroyed&&-1!==t){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(t),r=0;r<i;r++)(this.completeLayers||this.elements[r])&&this.elements[r].prepareFrame(t-this.layers[r].st);if(this.globalData._mdf){for(!0===this.renderConfig.clearCanvas?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),r=i-1;0<=r;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame();!0!==this.renderConfig.clearCanvas&&this.restore()}}},CanvasRenderer.prototype.buildItem=function(t){var e=this.elements;if(!e[t]&&99!=this.layers[t].ty){var r=this.createItem(this.layers[t],this,this.globalData);(e[t]=r).initExpressions()}},CanvasRenderer.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){this.pendingElements.pop().checkParenting()}},CanvasRenderer.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRenderer.prototype.show=function(){this.animationItem.container.style.display="block"},extendPrototype([BaseRenderer],HybridRenderer),HybridRenderer.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRenderer.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){this.pendingElements.pop().checkParenting()}},HybridRenderer.prototype.appendElementInPos=function(t,e){var r=t.getBaseElement();if(r){var i=this.layers[e];if(i.ddd&&this.supports3d)this.addTo3dContainer(r,e);else if(this.threeDElements)this.addTo3dContainer(r,e);else{for(var s,a,n=0;n<e;)this.elements[n]&&!0!==this.elements[n]&&this.elements[n].getBaseElement&&(a=this.elements[n],s=(this.layers[n].ddd?this.getThreeDContainerByPos(n):a.getBaseElement())||s),n+=1;s?i.ddd&&this.supports3d||this.layerElement.insertBefore(r,s):i.ddd&&this.supports3d||this.layerElement.appendChild(r)}}},HybridRenderer.prototype.createShape=function(t){return this.supports3d?new HShapeElement(t,this.globalData,this):new SVGShapeElement(t,this.globalData,this)},HybridRenderer.prototype.createText=function(t){return this.supports3d?new HTextElement(t,this.globalData,this):new SVGTextElement(t,this.globalData,this)},HybridRenderer.prototype.createCamera=function(t){return this.camera=new HCameraElement(t,this.globalData,this),this.camera},HybridRenderer.prototype.createImage=function(t){return this.supports3d?new HImageElement(t,this.globalData,this):new IImageElement(t,this.globalData,this)},HybridRenderer.prototype.createComp=function(t){return this.supports3d?new HCompElement(t,this.globalData,this):new SVGCompElement(t,this.globalData,this)},HybridRenderer.prototype.createSolid=function(t){return this.supports3d?new HSolidElement(t,this.globalData,this):new ISolidElement(t,this.globalData,this)},HybridRenderer.prototype.createNull=SVGRenderer.prototype.createNull,HybridRenderer.prototype.getThreeDContainerByPos=function(t){for(var e=0,r=this.threeDElements.length;e<r;){if(this.threeDElements[e].startPos<=t&&this.threeDElements[e].endPos>=t)return this.threeDElements[e].perspectiveElem;e+=1}},HybridRenderer.prototype.createThreeDContainer=function(t,e){var r=createTag("div");styleDiv(r);var i=createTag("div");styleDiv(i),"3d"===e&&(r.style.width=this.globalData.compSize.w+"px",r.style.height=this.globalData.compSize.h+"px",r.style.transformOrigin=r.style.mozTransformOrigin=r.style.webkitTransformOrigin="50% 50%",i.style.transform=i.style.webkitTransform="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)"),r.appendChild(i);var s={container:i,perspectiveElem:r,startPos:t,endPos:t,type:e};return this.threeDElements.push(s),s},HybridRenderer.prototype.build3dContainers=function(){var t,e,r=this.layers.length,i="";for(t=0;t<r;t+=1)this.layers[t].ddd&&3!==this.layers[t].ty?"3d"!==i&&(i="3d",e=this.createThreeDContainer(t,"3d")):"2d"!==i&&(i="2d",e=this.createThreeDContainer(t,"2d")),e.endPos=Math.max(e.endPos,t);for(t=(r=this.threeDElements.length)-1;0<=t;t--)this.resizerElem.appendChild(this.threeDElements[t].perspectiveElem)},HybridRenderer.prototype.addTo3dContainer=function(t,e){for(var r=0,i=this.threeDElements.length;r<i;){if(e<=this.threeDElements[r].endPos){for(var s,a=this.threeDElements[r].startPos;a<e;)this.elements[a]&&this.elements[a].getBaseElement&&(s=this.elements[a].getBaseElement()),a+=1;s?this.threeDElements[r].container.insertBefore(t,s):this.threeDElements[r].container.appendChild(t);break}r+=1}},HybridRenderer.prototype.configAnimation=function(t){var e=createTag("div"),r=this.animationItem.wrapper;e.style.width=t.w+"px",e.style.height=t.h+"px",styleDiv(this.resizerElem=e),e.style.transformStyle=e.style.webkitTransformStyle=e.style.mozTransformStyle="flat",this.renderConfig.className&&e.setAttribute("class",this.renderConfig.className),r.appendChild(e),e.style.overflow="hidden";var i=createNS("svg");i.setAttribute("width","1"),i.setAttribute("height","1"),styleDiv(i),this.resizerElem.appendChild(i);var s=createNS("defs");i.appendChild(s),this.data=t,this.setupGlobalData(t,i),this.globalData.defs=s,this.layers=t.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRenderer.prototype.destroy=function(){this.animationItem.wrapper.innerHTML="",this.animationItem.container=null,this.globalData.defs=null;var t,e=this.layers?this.layers.length:0;for(t=0;t<e;t++)this.elements[t].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRenderer.prototype.updateContainerSize=function(){var t,e,r,i,s=this.animationItem.wrapper.offsetWidth,a=this.animationItem.wrapper.offsetHeight;i=s/a<this.globalData.compSize.w/this.globalData.compSize.h?(t=s/this.globalData.compSize.w,e=s/this.globalData.compSize.w,r=0,(a-this.globalData.compSize.h*(s/this.globalData.compSize.w))/2):(t=a/this.globalData.compSize.h,e=a/this.globalData.compSize.h,r=(s-this.globalData.compSize.w*(a/this.globalData.compSize.h))/2,0),this.resizerElem.style.transform=this.resizerElem.style.webkitTransform="matrix3d("+t+",0,0,0,0,"+e+",0,0,0,0,1,0,"+r+","+i+",0,1)"},HybridRenderer.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRenderer.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRenderer.prototype.show=function(){this.resizerElem.style.display="block"},HybridRenderer.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var t,e=this.globalData.compSize.w,r=this.globalData.compSize.h,i=this.threeDElements.length;for(t=0;t<i;t+=1)this.threeDElements[t].perspectiveElem.style.perspective=this.threeDElements[t].perspectiveElem.style.webkitPerspective=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))+"px"}},HybridRenderer.prototype.searchExtraCompositions=function(t){var e,r=t.length,i=createTag("div");for(e=0;e<r;e+=1)if(t[e].xt){var s=this.createComp(t[e],i,this.globalData.comp,null);s.initExpressions(),this.globalData.projectInterface.registerComposition(s)}},MaskElement.prototype.getMaskProperty=function(t){return this.viewData[t].prop},MaskElement.prototype.renderFrame=function(t){var e,r=this.element.finalTransform.mat,i=this.masksProperties.length;for(e=0;e<i;e++)if((this.viewData[e].prop._mdf||t)&&this.drawPath(this.masksProperties[e],this.viewData[e].prop.v,this.viewData[e]),(this.viewData[e].op._mdf||t)&&this.viewData[e].elem.setAttribute("fill-opacity",this.viewData[e].op.v),"n"!==this.masksProperties[e].mode&&(this.viewData[e].invRect&&(this.element.finalTransform.mProp._mdf||t)&&this.viewData[e].invRect.setAttribute("transform",r.getInverseMatrix().to2dCSS()),this.storedData[e].x&&(this.storedData[e].x._mdf||t))){var s=this.storedData[e].expan;this.storedData[e].x.v<0?("erode"!==this.storedData[e].lastOperator&&(this.storedData[e].lastOperator="erode",this.storedData[e].elem.setAttribute("filter","url("+locationHref+"#"+this.storedData[e].filterId+")")),s.setAttribute("radius",-this.storedData[e].x.v)):("dilate"!==this.storedData[e].lastOperator&&(this.storedData[e].lastOperator="dilate",this.storedData[e].elem.setAttribute("filter",null)),this.storedData[e].elem.setAttribute("stroke-width",2*this.storedData[e].x.v))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var t="M0,0 ";return t+=" h"+this.globalData.compSize.w,t+=" v"+this.globalData.compSize.h,t+=" h-"+this.globalData.compSize.w,t+=" v-"+this.globalData.compSize.h+" "},MaskElement.prototype.drawPath=function(t,e,r){var i,s,a=" M"+e.v[0][0]+","+e.v[0][1];for(s=e._length,i=1;i<s;i+=1)a+=" C"+e.o[i-1][0]+","+e.o[i-1][1]+" "+e.i[i][0]+","+e.i[i][1]+" "+e.v[i][0]+","+e.v[i][1];if(e.c&&1<s&&(a+=" C"+e.o[i-1][0]+","+e.o[i-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),r.lastPath!==a){var n="";r.elem&&(e.c&&(n=t.inv?this.solidPath+a:a),r.elem.setAttribute("d",n)),r.lastPath=a}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null},HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(t){this.hierarchy=t},setAsParent:function(){this._isParent=!0},checkParenting:function(){void 0!==this.data.parent&&this.comp.buildElementParenting(this,this.data.parent,[])}},FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(t,e){var r,i=this.dynamicProperties.length;for(r=0;r<i;r+=1)(e||this._isParent&&"transform"===this.dynamicProperties[r].propType)&&(this.dynamicProperties[r].getValue(),this.dynamicProperties[r]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(t){-1===this.dynamicProperties.indexOf(t)&&this.dynamicProperties.push(t)}},TransformElement.prototype={initTransform:function(){this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_opMdf:!1,mat:new Matrix},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var t,e=this.finalTransform.mat,r=0,i=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;r<i;){if(this.hierarchy[r].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}r+=1}if(this.finalTransform._matMdf)for(t=this.finalTransform.mProp.v.props,e.cloneFromProps(t),r=0;r<i;r+=1)t=this.hierarchy[r].finalTransform.mProp.v.props,e.transform(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}},globalToLocal:function(t){var e=[];e.push(this.finalTransform);for(var r=!0,i=this.comp;r;)i.finalTransform?(i.data.hasMask&&e.splice(0,0,i.finalTransform),i=i.comp):r=!1;var s,a,n=e.length;for(s=0;s<n;s+=1)a=e[s].mat.applyToPointArray(0,0,0),t=[t[0]-a[0],t[1]-a[1],0];return t},mHelper:new Matrix},RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(t){-1===this.renderableComponents.indexOf(t)&&this.renderableComponents.push(t)},removeRenderableComponent:function(t){-1!==this.renderableComponents.indexOf(t)&&this.renderableComponents.splice(this.renderableComponents.indexOf(t),1)},prepareRenderableFrame:function(t){this.checkLayerLimits(t)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(t){this.data.ip-this.data.st<=t&&this.data.op-this.data.st>t?!0!==this.isInRange&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):!1!==this.isInRange&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var t,e=this.renderableComponents.length;for(t=0;t<e;t+=1)this.renderableComponents[t].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return 5===this.data.ty?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}},extendPrototype([RenderableElement,createProxyFunction({initElement:function(t,e,r){this.initFrame(),this.initBaseData(t,e,r),this.initTransform(t,e,r),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){this.hidden||this.isInRange&&!this.isTransparent||((this.baseElement||this.layerElement).style.display="none",this.hidden=!0)},show:function(){this.isInRange&&!this.isTransparent&&(this.data.hd||((this.baseElement||this.layerElement).style.display="block"),this.hidden=!1,this._isFirstFrame=!0)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(t){this._mdf=!1,this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}})],RenderableDOMElement),SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1},SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0},extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData),extendPrototype([DynamicPropertyContainer],SVGFillStyleData),SVGGradientFillStyleData.prototype.initGradientData=function(t,e,r){this.o=PropertyFactory.getProp(t,e.o,0,.01,this),this.s=PropertyFactory.getProp(t,e.s,1,null,this),this.e=PropertyFactory.getProp(t,e.e,1,null,this),this.h=PropertyFactory.getProp(t,e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(t,e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(t,e.g,this),this.style=r,this.stops=[],this.setGradientData(r.pElem,e),this.setGradientOpacity(e,r),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(t,e){var r=createElementID(),i=createNS(1===e.t?"linearGradient":"radialGradient");i.setAttribute("id",r),i.setAttribute("spreadMethod","pad"),i.setAttribute("gradientUnits","userSpaceOnUse");var s,a,n,o=[];for(n=4*e.g.p,a=0;a<n;a+=4)s=createNS("stop"),i.appendChild(s),o.push(s);t.setAttribute("gf"===e.ty?"fill":"stroke","url("+locationHref+"#"+r+")"),this.gf=i,this.cst=o},SVGGradientFillStyleData.prototype.setGradientOpacity=function(t,e){if(this.g._hasOpacity&&!this.g._collapsable){var r,i,s,a=createNS("mask"),n=createNS("path");a.appendChild(n);var o=createElementID(),h=createElementID();a.setAttribute("id",h);var l=createNS(1===t.t?"linearGradient":"radialGradient");l.setAttribute("id",o),l.setAttribute("spreadMethod","pad"),l.setAttribute("gradientUnits","userSpaceOnUse"),s=t.g.k.k[0].s?t.g.k.k[0].s.length:t.g.k.k.length;var p=this.stops;for(i=4*t.g.p;i<s;i+=2)(r=createNS("stop")).setAttribute("stop-color","rgb(255,255,255)"),l.appendChild(r),p.push(r);n.setAttribute("gf"===t.ty?"fill":"stroke","url("+locationHref+"#"+o+")"),this.of=l,this.ms=a,this.ost=p,this.maskId=h,e.msElem=n}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData),extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);var SVGElementsRenderer=function(){var y=new Matrix,g=new Matrix;function e(t,e,r){(r||e.transform.op._mdf)&&e.transform.container.setAttribute("opacity",e.transform.op.v),(r||e.transform.mProps._mdf)&&e.transform.container.setAttribute("transform",e.transform.mProps.v.to2dCSS())}function r(t,e,r){var i,s,a,n,o,h,l,p,m,f,c,d=e.styles.length,u=e.lvl;for(h=0;h<d;h+=1){if(n=e.sh._mdf||r,e.styles[h].lvl<u){for(p=g.reset(),f=u-e.styles[h].lvl,c=e.transformers.length-1;!n&&0<f;)n=e.transformers[c].mProps._mdf||n,f--,c--;if(n)for(f=u-e.styles[h].lvl,c=e.transformers.length-1;0<f;)m=e.transformers[c].mProps.v.props,p.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),f--,c--}else p=y;if(s=(l=e.sh.paths)._length,n){for(a="",i=0;i<s;i+=1)(o=l.shapes[i])&&o._length&&(a+=buildShapeString(o,o._length,o.c,p));e.caches[h]=a}else a=e.caches[h];e.styles[h].d+=!0===t.hd?"":a,e.styles[h]._mdf=n||e.styles[h]._mdf}}function i(t,e,r){var i=e.style;(e.c._mdf||r)&&i.pElem.setAttribute("fill","rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o._mdf||r)&&i.pElem.setAttribute("fill-opacity",e.o.v)}function s(t,e,r){a(t,e,r),n(t,e,r)}function a(t,e,r){var i,s,a,n,o,h=e.gf,l=e.g._hasOpacity,p=e.s.v,m=e.e.v;if(e.o._mdf||r){var f="gf"===t.ty?"fill-opacity":"stroke-opacity";e.style.pElem.setAttribute(f,e.o.v)}if(e.s._mdf||r){var c=1===t.t?"x1":"cx",d="x1"===c?"y1":"cy";h.setAttribute(c,p[0]),h.setAttribute(d,p[1]),l&&!e.g._collapsable&&(e.of.setAttribute(c,p[0]),e.of.setAttribute(d,p[1]))}if(e.g._cmdf||r){i=e.cst;var u=e.g.c;for(a=i.length,s=0;s<a;s+=1)(n=i[s]).setAttribute("offset",u[4*s]+"%"),n.setAttribute("stop-color","rgb("+u[4*s+1]+","+u[4*s+2]+","+u[4*s+3]+")")}if(l&&(e.g._omdf||r)){var y=e.g.o;for(a=(i=e.g._collapsable?e.cst:e.ost).length,s=0;s<a;s+=1)n=i[s],e.g._collapsable||n.setAttribute("offset",y[2*s]+"%"),n.setAttribute("stop-opacity",y[2*s+1])}if(1===t.t)(e.e._mdf||r)&&(h.setAttribute("x2",m[0]),h.setAttribute("y2",m[1]),l&&!e.g._collapsable&&(e.of.setAttribute("x2",m[0]),e.of.setAttribute("y2",m[1])));else if((e.s._mdf||e.e._mdf||r)&&(o=Math.sqrt(Math.pow(p[0]-m[0],2)+Math.pow(p[1]-m[1],2)),h.setAttribute("r",o),l&&!e.g._collapsable&&e.of.setAttribute("r",o)),e.e._mdf||e.h._mdf||e.a._mdf||r){o||(o=Math.sqrt(Math.pow(p[0]-m[0],2)+Math.pow(p[1]-m[1],2)));var g=Math.atan2(m[1]-p[1],m[0]-p[0]),v=o*(1<=e.h.v?.99:e.h.v<=-1?-.99:e.h.v),b=Math.cos(g+e.a.v)*v+p[0],E=Math.sin(g+e.a.v)*v+p[1];h.setAttribute("fx",b),h.setAttribute("fy",E),l&&!e.g._collapsable&&(e.of.setAttribute("fx",b),e.of.setAttribute("fy",E))}}function n(t,e,r){var i=e.style,s=e.d;s&&(s._mdf||r)&&s.dashStr&&(i.pElem.setAttribute("stroke-dasharray",s.dashStr),i.pElem.setAttribute("stroke-dashoffset",s.dashoffset[0])),e.c&&(e.c._mdf||r)&&i.pElem.setAttribute("stroke","rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o._mdf||r)&&i.pElem.setAttribute("stroke-opacity",e.o.v),(e.w._mdf||r)&&(i.pElem.setAttribute("stroke-width",e.w.v),i.msElem&&i.msElem.setAttribute("stroke-width",e.w.v))}return{createRenderFunction:function(t){t.ty;switch(t.ty){case"fl":return i;case"gf":return a;case"gs":return s;case"st":return n;case"sh":case"el":case"rc":case"sr":return r;case"tr":return e}}}}();function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}function CVShapeData(t,e,r,i){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;"rc"==e.ty?s=5:"el"==e.ty?s=6:"sr"==e.ty&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(t,e,s,t);var a,n,o=r.length;for(a=0;a<o;a+=1)r[a].closed||(n={transforms:i.addTransformSequence(r[a].transforms),trNodes:[]},this.styledShapes.push(n),r[a].elements.push(n))}function BaseElement(){}function NullElement(t,e,r){this.initFrame(),this.initBaseData(t,e,r),this.initFrame(),this.initTransform(t,e,r),this.initHierarchy()}function SVGBaseElement(){}function IShapeElement(){}function ITextElement(){}function ICompElement(){}function IImageElement(t,e,r){this.assetData=e.getAssetData(t.refId),this.initElement(t,e,r),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}function ISolidElement(t,e,r){this.initElement(t,e,r)}function SVGCompElement(t,e,r){this.layers=t.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(t,e,r),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}function SVGTextElement(t,e,r){this.textSpans=[],this.renderType="svg",this.initElement(t,e,r)}function SVGShapeElement(t,e,r){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(t,e,r),this.prevViewData=[]}function SVGTintFilter(t,e){this.filterManager=e;var r=createNS("feColorMatrix");if(r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","linearRGB"),r.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),r.setAttribute("result","f1"),t.appendChild(r),(r=createNS("feColorMatrix")).setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),r.setAttribute("result","f2"),t.appendChild(r),this.matrixFilter=r,100!==e.effectElements[2].p.v||e.effectElements[2].p.k){var i,s=createNS("feMerge");t.appendChild(s),(i=createNS("feMergeNode")).setAttribute("in","SourceGraphic"),s.appendChild(i),(i=createNS("feMergeNode")).setAttribute("in","f2"),s.appendChild(i)}}function SVGFillFilter(t,e){this.filterManager=e;var r=createNS("feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),t.appendChild(r),this.matrixFilter=r}function SVGGaussianBlurEffect(t,e){t.setAttribute("x","-100%"),t.setAttribute("y","-100%"),t.setAttribute("width","300%"),t.setAttribute("height","300%"),this.filterManager=e;var r=createNS("feGaussianBlur");t.appendChild(r),this.feGaussianBlur=r}function SVGStrokeEffect(t,e){this.initialized=!1,this.filterManager=e,this.elem=t,this.paths=[]}function SVGTritoneFilter(t,e){this.filterManager=e;var r=createNS("feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","linearRGB"),r.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),r.setAttribute("result","f1"),t.appendChild(r);var i=createNS("feComponentTransfer");i.setAttribute("color-interpolation-filters","sRGB"),t.appendChild(i),this.matrixFilter=i;var s=createNS("feFuncR");s.setAttribute("type","table"),i.appendChild(s),this.feFuncR=s;var a=createNS("feFuncG");a.setAttribute("type","table"),i.appendChild(a),this.feFuncG=a;var n=createNS("feFuncB");n.setAttribute("type","table"),i.appendChild(n),this.feFuncB=n}function SVGProLevelsFilter(t,e){this.filterManager=e;var r=this.filterManager.effectElements,i=createNS("feComponentTransfer");(r[10].p.k||0!==r[10].p.v||r[11].p.k||1!==r[11].p.v||r[12].p.k||1!==r[12].p.v||r[13].p.k||0!==r[13].p.v||r[14].p.k||1!==r[14].p.v)&&(this.feFuncR=this.createFeFunc("feFuncR",i)),(r[17].p.k||0!==r[17].p.v||r[18].p.k||1!==r[18].p.v||r[19].p.k||1!==r[19].p.v||r[20].p.k||0!==r[20].p.v||r[21].p.k||1!==r[21].p.v)&&(this.feFuncG=this.createFeFunc("feFuncG",i)),(r[24].p.k||0!==r[24].p.v||r[25].p.k||1!==r[25].p.v||r[26].p.k||1!==r[26].p.v||r[27].p.k||0!==r[27].p.v||r[28].p.k||1!==r[28].p.v)&&(this.feFuncB=this.createFeFunc("feFuncB",i)),(r[31].p.k||0!==r[31].p.v||r[32].p.k||1!==r[32].p.v||r[33].p.k||1!==r[33].p.v||r[34].p.k||0!==r[34].p.v||r[35].p.k||1!==r[35].p.v)&&(this.feFuncA=this.createFeFunc("feFuncA",i)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(i.setAttribute("color-interpolation-filters","sRGB"),t.appendChild(i),i=createNS("feComponentTransfer")),(r[3].p.k||0!==r[3].p.v||r[4].p.k||1!==r[4].p.v||r[5].p.k||1!==r[5].p.v||r[6].p.k||0!==r[6].p.v||r[7].p.k||1!==r[7].p.v)&&(i.setAttribute("color-interpolation-filters","sRGB"),t.appendChild(i),this.feFuncRComposed=this.createFeFunc("feFuncR",i),this.feFuncGComposed=this.createFeFunc("feFuncG",i),this.feFuncBComposed=this.createFeFunc("feFuncB",i))}function SVGDropShadowEffect(t,e){var r=e.container.globalData.renderConfig.filterSize;t.setAttribute("x",r.x),t.setAttribute("y",r.y),t.setAttribute("width",r.width),t.setAttribute("height",r.height),this.filterManager=e;var i=createNS("feGaussianBlur");i.setAttribute("in","SourceAlpha"),i.setAttribute("result","drop_shadow_1"),i.setAttribute("stdDeviation","0"),this.feGaussianBlur=i,t.appendChild(i);var s=createNS("feOffset");s.setAttribute("dx","25"),s.setAttribute("dy","0"),s.setAttribute("in","drop_shadow_1"),s.setAttribute("result","drop_shadow_2"),this.feOffset=s,t.appendChild(s);var a=createNS("feFlood");a.setAttribute("flood-color","#00ff00"),a.setAttribute("flood-opacity","1"),a.setAttribute("result","drop_shadow_3"),this.feFlood=a,t.appendChild(a);var n=createNS("feComposite");n.setAttribute("in","drop_shadow_3"),n.setAttribute("in2","drop_shadow_2"),n.setAttribute("operator","in"),n.setAttribute("result","drop_shadow_4"),t.appendChild(n);var o,h=createNS("feMerge");t.appendChild(h),o=createNS("feMergeNode"),h.appendChild(o),(o=createNS("feMergeNode")).setAttribute("in","SourceGraphic"),this.feMergeNode=o,this.feMerge=h,this.originalNodeAdded=!1,h.appendChild(o)}ShapeTransformManager.prototype={addTransformSequence:function(t){var e,r=t.length,i="_";for(e=0;e<r;e+=1)i+=t[e].transform.key+"_";var s=this.sequences[i];return s||(s={transforms:[].concat(t),finalTransform:new Matrix,_mdf:!1},this.sequences[i]=s,this.sequenceList.push(s)),s},processSequence:function(t,e){for(var r,i=0,s=t.transforms.length,a=e;i<s&&!e;){if(t.transforms[i].transform.mProps._mdf){a=!0;break}i+=1}if(a)for(t.finalTransform.reset(),i=s-1;0<=i;i-=1)r=t.transforms[i].transform.mProps.v.props,t.finalTransform.transform(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15]);t._mdf=a},processSequences:function(t){var e,r=this.sequenceList.length;for(e=0;e<r;e+=1)this.processSequence(this.sequenceList[e],t)},getNewKey:function(){return"_"+this.transform_key_count++}},CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated,BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var t=0,e=this.data.masksProperties.length;t<e;){if("n"!==this.data.masksProperties[t].mode&&!1!==this.data.masksProperties[t].cl)return!0;t+=1}return!1},initExpressions:function(){this.layerInterface=LayerExpressionInterface(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var t=EffectsExpressionInterface.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(t),0===this.data.ty||this.data.xt?this.compInterface=CompExpressionInterface(this):4===this.data.ty?(this.layerInterface.shapeInterface=ShapeExpressionInterface(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):5===this.data.ty&&(this.layerInterface.textInterface=TextExpressionInterface(this),this.layerInterface.text=this.layerInterface.textInterface)},setBlendMode:function(){var t=getBlendMode(this.data.bm);(this.baseElement||this.layerElement).style["mix-blend-mode"]=t},initBaseData:function(t,e,r){this.globalData=e,this.comp=r,this.data=t,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}},NullElement.prototype.prepareFrame=function(t){this.prepareProperties(t,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement),SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var t,e,r,i=null;if(this.data.td){if(3==this.data.td||1==this.data.td){var s=createNS("mask");s.setAttribute("id",this.layerId),s.setAttribute("mask-type",3==this.data.td?"luminance":"alpha"),s.appendChild(this.layerElement),i=s,this.globalData.defs.appendChild(s),featureSupport.maskType||1!=this.data.td||(s.setAttribute("mask-type","luminance"),t=createElementID(),e=filtersFactory.createFilter(t),this.globalData.defs.appendChild(e),e.appendChild(filtersFactory.createAlphaToLuminanceFilter()),(r=createNS("g")).appendChild(this.layerElement),i=r,s.appendChild(r),r.setAttribute("filter","url("+locationHref+"#"+t+")"))}else if(2==this.data.td){var a=createNS("mask");a.setAttribute("id",this.layerId),a.setAttribute("mask-type","alpha");var n=createNS("g");a.appendChild(n),t=createElementID(),e=filtersFactory.createFilter(t);var o=createNS("feComponentTransfer");o.setAttribute("in","SourceGraphic"),e.appendChild(o);var h=createNS("feFuncA");h.setAttribute("type","table"),h.setAttribute("tableValues","1.0 0.0"),o.appendChild(h),this.globalData.defs.appendChild(e);var l=createNS("rect");l.setAttribute("width",this.comp.data.w),l.setAttribute("height",this.comp.data.h),l.setAttribute("x","0"),l.setAttribute("y","0"),l.setAttribute("fill","#ffffff"),l.setAttribute("opacity","0"),n.setAttribute("filter","url("+locationHref+"#"+t+")"),n.appendChild(l),n.appendChild(this.layerElement),i=n,featureSupport.maskType||(a.setAttribute("mask-type","luminance"),e.appendChild(filtersFactory.createAlphaToLuminanceFilter()),r=createNS("g"),n.appendChild(l),r.appendChild(this.layerElement),i=r,n.appendChild(r)),this.globalData.defs.appendChild(a)}}else this.data.tt?(this.matteElement.appendChild(this.layerElement),i=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),0===this.data.ty&&!this.data.hd){var p=createNS("clipPath"),m=createNS("path");m.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var f=createElementID();if(p.setAttribute("id",f),p.appendChild(m),this.globalData.defs.appendChild(p),this.checkMasks()){var c=createNS("g");c.setAttribute("clip-path","url("+locationHref+"#"+f+")"),c.appendChild(this.layerElement),this.transformedElement=c,i?i.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+locationHref+"#"+f+")")}0!==this.data.bm&&this.setBlendMode()},renderElement:function(){this.finalTransform._matMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.mat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.mProp.o.v)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this)},setMatte:function(t){this.matteElement&&this.matteElement.setAttribute("mask","url("+locationHref+"#"+t+")")}},IShapeElement.prototype={addShapeToModifiers:function(t){var e,r=this.shapeModifiers.length;for(e=0;e<r;e+=1)this.shapeModifiers[e].addShape(t)},isShapeInAnimatedModifiers:function(t){for(var e=this.shapeModifiers.length;0<e;)if(this.shapeModifiers[0].isAnimatedWithShape(t))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var t,e=this.shapes.length;for(t=0;t<e;t+=1)this.shapes[t].sh.reset();for(t=(e=this.shapeModifiers.length)-1;0<=t;t-=1)this.shapeModifiers[t].processShapes(this._isFirstFrame)}},lcEnum:{1:"butt",2:"round",3:"square"},ljEnum:{1:"miter",2:"round",3:"bevel"},searchProcessedElement:function(t){for(var e=this.processedElements,r=0,i=e.length;r<i;){if(e[r].elem===t)return e[r].pos;r+=1}return 0},addProcessedElement:function(t,e){for(var r=this.processedElements,i=r.length;i;)if(r[i-=1].elem===t)return void(r[i].pos=e);r.push(new ProcessedElement(t,e))},prepareFrame:function(t){this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange)}},ITextElement.prototype.initElement=function(t,e,r){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(t,e,r),this.textProperty=new TextProperty(this,t.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(t.t,this.renderType,this),this.initTransform(t,e,r),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(t){this._mdf=!1,this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange),(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)},ITextElement.prototype.createPathShape=function(t,e){var r,i,s=e.length,a="";for(r=0;r<s;r+=1)i=e[r].ks.k,a+=buildShapeString(i,i.i.length,!0,t);return a},ITextElement.prototype.updateDocumentData=function(t,e){this.textProperty.updateDocumentData(t,e)},ITextElement.prototype.canResizeFont=function(t){this.textProperty.canResizeFont(t)},ITextElement.prototype.setMinimumFontSize=function(t){this.textProperty.setMinimumFontSize(t)},ITextElement.prototype.applyTextPropertiesToMatrix=function(t,e,r,i,s){switch(t.ps&&e.translate(t.ps[0],t.ps[1]+t.ascent,0),e.translate(0,-t.ls,0),t.j){case 1:e.translate(t.justifyOffset+(t.boxWidth-t.lineWidths[r]),0,0);break;case 2:e.translate(t.justifyOffset+(t.boxWidth-t.lineWidths[r])/2,0,0)}e.translate(i,s,0)},ITextElement.prototype.buildColor=function(t){return"rgb("+Math.round(255*t[0])+","+Math.round(255*t[1])+","+Math.round(255*t[2])+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(t,e,r){this.initFrame(),this.initBaseData(t,e,r),this.initTransform(t,e,r),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),!this.data.xt&&e.progressiveLoad||this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(t){if(this._mdf=!1,this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange),this.isInRange||this.data.xt){if(this.tm._placeholder)this.renderedFrame=t/this.data.sr;else{var e=this.tm.v;e===this.data.op&&(e=this.data.op-1),this.renderedFrame=e}var r,i=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),r=i-1;0<=r;r-=1)(this.completeLayers||this.elements[r])&&(this.elements[r].prepareFrame(this.renderedFrame-this.layers[r].st),this.elements[r]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var t,e=this.layers.length;for(t=0;t<e;t+=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},ICompElement.prototype.setElements=function(t){this.elements=t},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var t,e=this.layers.length;for(t=0;t<e;t+=1)this.elements[t]&&this.elements[t].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()},extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var t=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",t),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect},extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var t=createNS("rect");t.setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.layerElement.appendChild(t)},extendPrototype([SVGRenderer,ICompElement,SVGBaseElement],SVGCompElement),extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextElement),SVGTextElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextElement.prototype.buildTextContents=function(t){for(var e=0,r=t.length,i=[],s="";e<r;)t[e]===String.fromCharCode(13)||t[e]===String.fromCharCode(3)?(i.push(s),s=""):s+=t[e],e+=1;return i.push(s),i},SVGTextElement.prototype.buildNewText=function(){var t,e,r=this.textProperty.currentData;this.renderedLetters=createSizedArray(r?r.l.length:0),r.fc?this.layerElement.setAttribute("fill",this.buildColor(r.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),r.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(r.sc)),this.layerElement.setAttribute("stroke-width",r.sw)),this.layerElement.setAttribute("font-size",r.finalSize);var i=this.globalData.fontManager.getFontByName(r.f);if(i.fClass)this.layerElement.setAttribute("class",i.fClass);else{this.layerElement.setAttribute("font-family",i.fFamily);var s=r.fWeight,a=r.fStyle;this.layerElement.setAttribute("font-style",a),this.layerElement.setAttribute("font-weight",s)}this.layerElement.setAttribute("aria-label",r.t);var n,o=r.l||[],h=!!this.globalData.fontManager.chars;e=o.length;var l,p=this.mHelper,m="",f=this.data.singleShape,c=0,d=0,u=!0,y=r.tr/1e3*r.finalSize;if(!f||h||r.sz){var g,v,b=this.textSpans.length;for(t=0;t<e;t+=1)h&&f&&0!==t||(n=t<b?this.textSpans[t]:createNS(h?"path":"text"),b<=t&&(n.setAttribute("stroke-linecap","butt"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("stroke-miterlimit","4"),this.textSpans[t]=n,this.layerElement.appendChild(n)),n.style.display="inherit"),p.reset(),p.scale(r.finalSize/100,r.finalSize/100),f&&(o[t].n&&(c=-y,d+=r.yOffset,d+=u?1:0,u=!1),this.applyTextPropertiesToMatrix(r,p,o[t].line,c,d),c+=o[t].l||0,c+=y),h?(l=(g=(v=this.globalData.fontManager.getCharData(r.finalText[t],i.fStyle,this.globalData.fontManager.getFontByName(r.f).fFamily))&&v.data||{}).shapes?g.shapes[0].it:[],f?m+=this.createPathShape(p,l):n.setAttribute("d",this.createPathShape(p,l))):(f&&n.setAttribute("transform","translate("+p.props[12]+","+p.props[13]+")"),n.textContent=o[t].val,n.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"));f&&n&&n.setAttribute("d",m)}else{var E=this.textContainer,x="start";switch(r.j){case 1:x="end";break;case 2:x="middle"}E.setAttribute("text-anchor",x),E.setAttribute("letter-spacing",y);var S=this.buildTextContents(r.finalText);for(e=S.length,d=r.ps?r.ps[1]+r.ascent:0,t=0;t<e;t+=1)(n=this.textSpans[t]||createNS("tspan")).textContent=S[t],n.setAttribute("x",0),n.setAttribute("y",d),n.style.display="inherit",E.appendChild(n),this.textSpans[t]=n,d+=r.finalLineHeight;this.layerElement.appendChild(E)}for(;t<this.textSpans.length;)this.textSpans[t].style.display="none",t+=1;this._sizeChanged=!0},SVGTextElement.prototype.sourceRectAtTime=function(t){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var e=this.layerElement.getBBox();this.bbox={top:e.y,left:e.x,width:e.width,height:e.height}}return this.bbox},SVGTextElement.prototype.renderInnerContent=function(){if(!this.data.singleShape&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){var t,e;this._sizeChanged=!0;var r,i,s=this.textAnimator.renderedLetters,a=this.textProperty.currentData.l;for(e=a.length,t=0;t<e;t+=1)a[t].n||(r=s[t],i=this.textSpans[t],r._mdf.m&&i.setAttribute("transform",r.m),r._mdf.o&&i.setAttribute("opacity",r.o),r._mdf.sw&&i.setAttribute("stroke-width",r.sw),r._mdf.sc&&i.setAttribute("stroke",r.sc),r._mdf.fc&&i.setAttribute("fill",r.fc))}},extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var t,e,r,i,s=this.shapes.length,a=this.stylesList.length,n=[],o=!1;for(r=0;r<a;r+=1){for(i=this.stylesList[r],o=!1,t=n.length=0;t<s;t+=1)-1!==(e=this.shapes[t]).styles.indexOf(i)&&(n.push(e),o=e._isAnimated||o);1<n.length&&o&&this.setShapesAsAnimated(n)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;e<r;e+=1)t[e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(t,e){var r,i=new SVGStyleData(t,e),s=i.pElem;if("st"===t.ty)r=new SVGStrokeStyleData(this,t,i);else if("fl"===t.ty)r=new SVGFillStyleData(this,t,i);else if("gf"===t.ty||"gs"===t.ty){r=new("gf"===t.ty?SVGGradientFillStyleData:SVGGradientStrokeStyleData)(this,t,i),this.globalData.defs.appendChild(r.gf),r.maskId&&(this.globalData.defs.appendChild(r.ms),this.globalData.defs.appendChild(r.of),s.setAttribute("mask","url("+locationHref+"#"+r.maskId+")"))}return"st"!==t.ty&&"gs"!==t.ty||(s.setAttribute("stroke-linecap",this.lcEnum[t.lc]||"round"),s.setAttribute("stroke-linejoin",this.ljEnum[t.lj]||"round"),s.setAttribute("fill-opacity","0"),1===t.lj&&s.setAttribute("stroke-miterlimit",t.ml)),2===t.r&&s.setAttribute("fill-rule","evenodd"),t.ln&&s.setAttribute("id",t.ln),t.cl&&s.setAttribute("class",t.cl),t.bm&&(s.style["mix-blend-mode"]=getBlendMode(t.bm)),this.stylesList.push(i),this.addToAnimatedContents(t,r),r},SVGShapeElement.prototype.createGroupElement=function(t){var e=new ShapeGroupData;return t.ln&&e.gr.setAttribute("id",t.ln),t.cl&&e.gr.setAttribute("class",t.cl),t.bm&&(e.gr.style["mix-blend-mode"]=getBlendMode(t.bm)),e},SVGShapeElement.prototype.createTransformElement=function(t,e){var r=TransformPropertyFactory.getTransformProperty(this,t,this),i=new SVGTransformData(r,r.o,e);return this.addToAnimatedContents(t,i),i},SVGShapeElement.prototype.createShapeElement=function(t,e,r){var i=4;"rc"===t.ty?i=5:"el"===t.ty?i=6:"sr"===t.ty&&(i=7);var s=new SVGShapeData(e,r,ShapePropertyFactory.getShapeProp(this,t,i,this));return this.shapes.push(s),this.addShapeToModifiers(s),this.addToAnimatedContents(t,s),s},SVGShapeElement.prototype.addToAnimatedContents=function(t,e){for(var r=0,i=this.animatedContents.length;r<i;){if(this.animatedContents[r].element===e)return;r+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(t),element:e,data:t})},SVGShapeElement.prototype.setElementStyles=function(t){var e,r=t.styles,i=this.stylesList.length;for(e=0;e<i;e+=1)this.stylesList[e].closed||r.push(this.stylesList[e])},SVGShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var t,e=this.itemsData.length;for(t=0;t<e;t+=1)this.prevViewData[t]=this.itemsData[t];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),e=this.dynamicProperties.length,t=0;t<e;t+=1)this.dynamicProperties[t].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(t,e,r,i,s,a,n){var o,h,l,p,m,f,c=[].concat(a),d=t.length-1,u=[],y=[];for(o=d;0<=o;o-=1){if((f=this.searchProcessedElement(t[o]))?e[o]=r[f-1]:t[o]._render=n,"fl"==t[o].ty||"st"==t[o].ty||"gf"==t[o].ty||"gs"==t[o].ty)f?e[o].style.closed=!1:e[o]=this.createStyleElement(t[o],s),t[o]._render&&i.appendChild(e[o].style.pElem),u.push(e[o].style);else if("gr"==t[o].ty){if(f)for(l=e[o].it.length,h=0;h<l;h+=1)e[o].prevViewData[h]=e[o].it[h];else e[o]=this.createGroupElement(t[o]);this.searchShapes(t[o].it,e[o].it,e[o].prevViewData,e[o].gr,s+1,c,n),t[o]._render&&i.appendChild(e[o].gr)}else"tr"==t[o].ty?(f||(e[o]=this.createTransformElement(t[o],i)),p=e[o].transform,c.push(p)):"sh"==t[o].ty||"rc"==t[o].ty||"el"==t[o].ty||"sr"==t[o].ty?(f||(e[o]=this.createShapeElement(t[o],c,s)),this.setElementStyles(e[o])):"tm"==t[o].ty||"rd"==t[o].ty||"ms"==t[o].ty?(f?(m=e[o]).closed=!1:((m=ShapeModifiers.getModifier(t[o].ty)).init(this,t[o]),e[o]=m,this.shapeModifiers.push(m)),y.push(m)):"rp"==t[o].ty&&(f?(m=e[o]).closed=!0:(m=ShapeModifiers.getModifier(t[o].ty),(e[o]=m).init(this,t,o,e),this.shapeModifiers.push(m),n=!1),y.push(m));this.addProcessedElement(t[o],o+1)}for(d=u.length,o=0;o<d;o+=1)u[o].closed=!0;for(d=y.length,o=0;o<d;o+=1)y[o].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){this.renderModifiers();var t,e=this.stylesList.length;for(t=0;t<e;t+=1)this.stylesList[t].reset();for(this.renderShape(),t=0;t<e;t+=1)(this.stylesList[t]._mdf||this._isFirstFrame)&&(this.stylesList[t].msElem&&(this.stylesList[t].msElem.setAttribute("d",this.stylesList[t].d),this.stylesList[t].d="M0 0"+this.stylesList[t].d),this.stylesList[t].pElem.setAttribute("d",this.stylesList[t].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var t,e,r=this.animatedContents.length;for(t=0;t<r;t+=1)e=this.animatedContents[t],(this._isFirstFrame||e.element._isAnimated)&&!0!==e.data&&e.fn(e.data,e.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null},SVGTintFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,r=this.filterManager.effectElements[1].p.v,i=this.filterManager.effectElements[2].p.v/100;this.matrixFilter.setAttribute("values",r[0]-e[0]+" 0 0 0 "+e[0]+" "+(r[1]-e[1])+" 0 0 0 "+e[1]+" "+(r[2]-e[2])+" 0 0 0 "+e[2]+" 0 0 0 "+i+" 0")}},SVGFillFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=this.filterManager.effectElements[2].p.v,r=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+e[0]+" 0 0 0 0 "+e[1]+" 0 0 0 0 "+e[2]+" 0 0 0 "+r+" 0")}},SVGGaussianBlurEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=.3*this.filterManager.effectElements[0].p.v,r=this.filterManager.effectElements[1].p.v,i=3==r?0:e,s=2==r?0:e;this.feGaussianBlur.setAttribute("stdDeviation",i+" "+s);var a=1==this.filterManager.effectElements[2].p.v?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",a)}},SVGStrokeEffect.prototype.initialize=function(){var t,e,r,i,s=this.elem.layerElement.children||this.elem.layerElement.childNodes;for(1===this.filterManager.effectElements[1].p.v?(i=this.elem.maskManager.masksProperties.length,r=0):i=(r=this.filterManager.effectElements[0].p.v-1)+1,(e=createNS("g")).setAttribute("fill","none"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-dashoffset",1);r<i;r+=1)t=createNS("path"),e.appendChild(t),this.paths.push({p:t,m:r});if(3===this.filterManager.effectElements[10].p.v){var a=createNS("mask"),n=createElementID();a.setAttribute("id",n),a.setAttribute("mask-type","alpha"),a.appendChild(e),this.elem.globalData.defs.appendChild(a);var o=createNS("g");for(o.setAttribute("mask","url("+locationHref+"#"+n+")");s[0];)o.appendChild(s[0]);this.elem.layerElement.appendChild(o),this.masker=a,e.setAttribute("stroke","#fff")}else if(1===this.filterManager.effectElements[10].p.v||2===this.filterManager.effectElements[10].p.v){if(2===this.filterManager.effectElements[10].p.v)for(s=this.elem.layerElement.children||this.elem.layerElement.childNodes;s.length;)this.elem.layerElement.removeChild(s[0]);this.elem.layerElement.appendChild(e),this.elem.layerElement.removeAttribute("mask"),e.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=e},SVGStrokeEffect.prototype.renderFrame=function(t){this.initialized||this.initialize();var e,r,i,s=this.paths.length;for(e=0;e<s;e+=1)if(-1!==this.paths[e].m&&(r=this.elem.maskManager.viewData[this.paths[e].m],i=this.paths[e].p,(t||this.filterManager._mdf||r.prop._mdf)&&i.setAttribute("d",r.lastPath),t||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||r.prop._mdf)){var a;if(0!==this.filterManager.effectElements[7].p.v||100!==this.filterManager.effectElements[8].p.v){var n=Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)/100,o=Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)/100,h=i.getTotalLength();a="0 0 0 "+h*n+" ";var l,p=h*(o-n),m=1+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v/100,f=Math.floor(p/m);for(l=0;l<f;l+=1)a+="1 "+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v/100+" ";a+="0 "+10*h+" 0 0"}else a="1 "+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v/100;i.setAttribute("stroke-dasharray",a)}if((t||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",2*this.filterManager.effectElements[4].p.v),(t||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(1===this.filterManager.effectElements[10].p.v||2===this.filterManager.effectElements[10].p.v)&&(t||this.filterManager.effectElements[3].p._mdf)){var c=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bm_floor(255*c[0])+","+bm_floor(255*c[1])+","+bm_floor(255*c[2])+")")}},SVGTritoneFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,r=this.filterManager.effectElements[1].p.v,i=this.filterManager.effectElements[2].p.v,s=i[0]+" "+r[0]+" "+e[0],a=i[1]+" "+r[1]+" "+e[1],n=i[2]+" "+r[2]+" "+e[2];this.feFuncR.setAttribute("tableValues",s),this.feFuncG.setAttribute("tableValues",a),this.feFuncB.setAttribute("tableValues",n)}},SVGProLevelsFilter.prototype.createFeFunc=function(t,e){var r=createNS(t);return r.setAttribute("type","table"),e.appendChild(r),r},SVGProLevelsFilter.prototype.getTableValue=function(t,e,r,i,s){for(var a,n,o=0,h=Math.min(t,e),l=Math.max(t,e),p=Array.call(null,{length:256}),m=0,f=s-i,c=e-t;o<=256;)n=(a=o/256)<=h?c<0?s:i:l<=a?c<0?i:s:i+f*Math.pow((a-t)/c,1/r),p[m++]=n,o+=256/255;return p.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e,r=this.filterManager.effectElements;this.feFuncRComposed&&(t||r[3].p._mdf||r[4].p._mdf||r[5].p._mdf||r[6].p._mdf||r[7].p._mdf)&&(e=this.getTableValue(r[3].p.v,r[4].p.v,r[5].p.v,r[6].p.v,r[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(t||r[10].p._mdf||r[11].p._mdf||r[12].p._mdf||r[13].p._mdf||r[14].p._mdf)&&(e=this.getTableValue(r[10].p.v,r[11].p.v,r[12].p.v,r[13].p.v,r[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(t||r[17].p._mdf||r[18].p._mdf||r[19].p._mdf||r[20].p._mdf||r[21].p._mdf)&&(e=this.getTableValue(r[17].p.v,r[18].p.v,r[19].p.v,r[20].p.v,r[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(t||r[24].p._mdf||r[25].p._mdf||r[26].p._mdf||r[27].p._mdf||r[28].p._mdf)&&(e=this.getTableValue(r[24].p.v,r[25].p.v,r[26].p.v,r[27].p.v,r[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(t||r[31].p._mdf||r[32].p._mdf||r[33].p._mdf||r[34].p._mdf||r[35].p._mdf)&&(e=this.getTableValue(r[31].p.v,r[32].p.v,r[33].p.v,r[34].p.v,r[35].p.v),this.feFuncA.setAttribute("tableValues",e))}},SVGDropShadowEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){if((t||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),t||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(255*e[0]),Math.round(255*e[1]),Math.round(255*e[2])))}if((t||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),t||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var r=this.filterManager.effectElements[3].p.v,i=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=r*Math.cos(i),a=r*Math.sin(i);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",a)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(t,e,r){this.initialized=!1,this.filterManager=e,this.filterElem=t,(this.elem=r).matteElement=createNS("g"),r.matteElement.appendChild(r.layerElement),r.matteElement.appendChild(r.transformedElement),r.baseElement=r.matteElement}function SVGEffects(t){var e,r,i=t.data.ef?t.data.ef.length:0,s=createElementID(),a=filtersFactory.createFilter(s),n=0;for(this.filters=[],e=0;e<i;e+=1)r=null,20===t.data.ef[e].ty?(n+=1,r=new SVGTintFilter(a,t.effectsManager.effectElements[e])):21===t.data.ef[e].ty?(n+=1,r=new SVGFillFilter(a,t.effectsManager.effectElements[e])):22===t.data.ef[e].ty?r=new SVGStrokeEffect(t,t.effectsManager.effectElements[e]):23===t.data.ef[e].ty?(n+=1,r=new SVGTritoneFilter(a,t.effectsManager.effectElements[e])):24===t.data.ef[e].ty?(n+=1,r=new SVGProLevelsFilter(a,t.effectsManager.effectElements[e])):25===t.data.ef[e].ty?(n+=1,r=new SVGDropShadowEffect(a,t.effectsManager.effectElements[e])):28===t.data.ef[e].ty?r=new SVGMatte3Effect(a,t.effectsManager.effectElements[e],t):29===t.data.ef[e].ty&&(n+=1,r=new SVGGaussianBlurEffect(a,t.effectsManager.effectElements[e])),r&&this.filters.push(r);n&&(t.globalData.defs.appendChild(a),t.layerElement.setAttribute("filter","url("+locationHref+"#"+s+")")),this.filters.length&&t.addRenderableComponent(this)}function CVContextData(){this.saved=[],this.cArrPos=0,this.cTr=new Matrix,this.cO=1;var t;for(this.savedOp=createTypedArray("float32",15),t=0;t<15;t+=1)this.saved[t]=createTypedArray("float32",16);this._length=15}function CVBaseElement(){}function CVImageElement(t,e,r){this.assetData=e.getAssetData(t.refId),this.img=e.imageLoader.getImage(this.assetData),this.initElement(t,e,r)}function CVCompElement(t,e,r){this.completeLayers=!1,this.layers=t.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(t,e,r),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}function CVMaskElement(t,e){this.data=t,this.element=e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var r,i=this.masksProperties.length,s=!1;for(r=0;r<i;r++)"n"!==this.masksProperties[r].mode&&(s=!0),this.viewData[r]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[r],3);(this.hasMasks=s)&&this.element.addRenderableComponent(this)}function CVShapeElement(t,e,r){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(t,e,r)}function CVSolidElement(t,e,r){this.initElement(t,e,r)}function CVTextElement(t,e,r){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(t,e,r)}function CVEffects(){}function HBaseElement(t,e,r){}function HSolidElement(t,e,r){this.initElement(t,e,r)}function HCompElement(t,e,r){this.layers=t.layers,this.supports3d=!t.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(t,e,r),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}function HShapeElement(t,e,r){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(t,e,r),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}function HTextElement(t,e,r){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(t,e,r)}function HImageElement(t,e,r){this.assetData=e.getAssetData(t.refId),this.initElement(t,e,r)}function HCameraElement(t,e,r){this.initFrame(),this.initBaseData(t,e,r),this.initHierarchy();var i=PropertyFactory.getProp;if(this.pe=i(this,t.pe,0,0,this),t.ks.p.s?(this.px=i(this,t.ks.p.x,1,0,this),this.py=i(this,t.ks.p.y,1,0,this),this.pz=i(this,t.ks.p.z,1,0,this)):this.p=i(this,t.ks.p,1,0,this),t.ks.a&&(this.a=i(this,t.ks.a,1,0,this)),t.ks.or.k.length&&t.ks.or.k[0].to){var s,a=t.ks.or.k.length;for(s=0;s<a;s+=1)t.ks.or.k[s].to=null,t.ks.or.k[s].ti=null}this.or=i(this,t.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=i(this,t.ks.rx,0,degToRads,this),this.ry=i(this,t.ks.ry,0,degToRads,this),this.rz=i(this,t.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}function HEffects(){}SVGMatte3Effect.prototype.findSymbol=function(t){for(var e=0,r=_svgMatteSymbols.length;e<r;){if(_svgMatteSymbols[e]===t)return _svgMatteSymbols[e];e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(t,e){var r=t.layerElement.parentNode;if(r){for(var i,s=r.children,a=0,n=s.length;a<n&&s[a]!==t.layerElement;)a+=1;a<=n-2&&(i=s[a+1]);var o=createNS("use");o.setAttribute("href","#"+e),i?r.insertBefore(o,i):r.appendChild(o)}},SVGMatte3Effect.prototype.setElementAsMask=function(t,e){if(!this.findSymbol(e)){var r=createElementID(),i=createNS("mask");i.setAttribute("id",e.layerId),i.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(e);var s=t.globalData.defs;s.appendChild(i);var a=createNS("symbol");a.setAttribute("id",r),this.replaceInParent(e,r),a.appendChild(e.layerElement),s.appendChild(a);var n=createNS("use");n.setAttribute("href","#"+r),i.appendChild(n),e.data.hd=!1,e.show()}t.setMatte(e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var t=this.filterManager.effectElements[0].p.v,e=this.elem.comp.elements,r=0,i=e.length;r<i;)e[r]&&e[r].data.ind===t&&this.setElementAsMask(this.elem,e[r]),r+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()},SVGEffects.prototype.renderFrame=function(t){var e,r=this.filters.length;for(e=0;e<r;e+=1)this.filters[e].renderFrame(t)},CVContextData.prototype.duplicate=function(){var t=2*this._length,e=this.savedOp;this.savedOp=createTypedArray("float32",t),this.savedOp.set(e);var r=0;for(r=this._length;r<t;r+=1)this.saved[r]=createTypedArray("float32",16);this._length=t},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.cO=1},CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){this.canvasContext=this.globalData.canvasContext,this.renderableEffectsManager=new CVEffects(this)},createContent:function(){},setBlendMode:function(){var t=this.globalData;if(t.blendMode!==this.data.bm){t.blendMode=this.data.bm;var e=getBlendMode(this.data.bm);t.canvasContext.globalCompositeOperation=e}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this)},hideElement:function(){this.hidden||this.isInRange&&!this.isTransparent||(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},renderFrame:function(){if(!this.hidden&&!this.data.hd){this.renderTransform(),this.renderRenderable(),this.setBlendMode();var t=0===this.data.ty;this.globalData.renderer.save(t),this.globalData.renderer.ctxTransform(this.finalTransform.mat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v),this.renderInnerContent(),this.globalData.renderer.restore(t),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement,extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var t=createTag("canvas");t.width=this.assetData.w,t.height=this.assetData.h;var e,r,i=t.getContext("2d"),s=this.img.width,a=this.img.height,n=s/a,o=this.assetData.w/this.assetData.h,h=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;o<n&&"xMidYMid slice"===h||n<o&&"xMidYMid slice"!==h?e=(r=a)*o:r=(e=s)/o,i.drawImage(this.img,(s-e)/2,(a-r)/2,e,r,0,0,this.assetData.w,this.assetData.h),this.img=t}},CVImageElement.prototype.renderInnerContent=function(t){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null},extendPrototype([CanvasRenderer,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var t,e=this.canvasContext;for(e.beginPath(),e.moveTo(0,0),e.lineTo(this.data.w,0),e.lineTo(this.data.w,this.data.h),e.lineTo(0,this.data.h),e.lineTo(0,0),e.clip(),t=this.layers.length-1;0<=t;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},CVCompElement.prototype.destroy=function(){var t;for(t=this.layers.length-1;0<=t;t-=1)this.elements[t]&&this.elements[t].destroy();this.layers=null,this.elements=null},CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var t,e,r,i,s=this.element.finalTransform.mat,a=this.element.canvasContext,n=this.masksProperties.length;for(a.beginPath(),t=0;t<n;t++)if("n"!==this.masksProperties[t].mode){this.masksProperties[t].inv&&(a.moveTo(0,0),a.lineTo(this.element.globalData.compSize.w,0),a.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),a.lineTo(0,this.element.globalData.compSize.h),a.lineTo(0,0)),i=this.viewData[t].v,e=s.applyToPointArray(i.v[0][0],i.v[0][1],0),a.moveTo(e[0],e[1]);var o,h=i._length;for(o=1;o<h;o++)r=s.applyToTriplePoints(i.o[o-1],i.i[o],i.v[o]),a.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);r=s.applyToTriplePoints(i.o[o-1],i.i[0],i.v[0]),a.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5])}this.element.globalData.renderer.save(!0),a.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null},extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(t,e){var r={data:t,type:t.ty,preTransforms:this.transformsManager.addTransformSequence(e),transforms:[],elements:[],closed:!0===t.hd},i={};if("fl"==t.ty||"st"==t.ty?(i.c=PropertyFactory.getProp(this,t.c,1,255,this),i.c.k||(r.co="rgb("+bm_floor(i.c.v[0])+","+bm_floor(i.c.v[1])+","+bm_floor(i.c.v[2])+")")):"gf"!==t.ty&&"gs"!==t.ty||(i.s=PropertyFactory.getProp(this,t.s,1,null,this),i.e=PropertyFactory.getProp(this,t.e,1,null,this),i.h=PropertyFactory.getProp(this,t.h||{k:0},0,.01,this),i.a=PropertyFactory.getProp(this,t.a||{k:0},0,degToRads,this),i.g=new GradientProperty(this,t.g,this)),i.o=PropertyFactory.getProp(this,t.o,0,.01,this),"st"==t.ty||"gs"==t.ty){if(r.lc=this.lcEnum[t.lc]||"round",r.lj=this.ljEnum[t.lj]||"round",1==t.lj&&(r.ml=t.ml),i.w=PropertyFactory.getProp(this,t.w,0,null,this),i.w.k||(r.wi=i.w.v),t.d){var s=new DashProperty(this,t.d,"canvas",this);i.d=s,i.d.k||(r.da=i.d.dashArray,r.do=i.d.dashoffset[0])}}else r.r=2===t.r?"evenodd":"nonzero";return this.stylesList.push(r),i.style=r,i},CVShapeElement.prototype.createGroupElement=function(t){return{it:[],prevViewData:[]}},CVShapeElement.prototype.createTransformElement=function(t){return{transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,t.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,t,this)}}},CVShapeElement.prototype.createShapeElement=function(t){var e=new CVShapeData(this,t,this.stylesList,this.transformsManager);return this.shapes.push(e),this.addShapeToModifiers(e),e},CVShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var t,e=this.itemsData.length;for(t=0;t<e;t+=1)this.prevViewData[t]=this.itemsData[t];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),e=this.dynamicProperties.length,t=0;t<e;t+=1)this.dynamicProperties[t].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(t){var e,r=this.stylesList.length;for(e=0;e<r;e+=1)this.stylesList[e].closed||this.stylesList[e].transforms.push(t)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var t,e=this.stylesList.length;for(t=0;t<e;t+=1)this.stylesList[t].closed||this.stylesList[t].transforms.pop()},CVShapeElement.prototype.closeStyles=function(t){var e,r=t.length;for(e=0;e<r;e+=1)t[e].closed=!0},CVShapeElement.prototype.searchShapes=function(t,e,r,i,s){var a,n,o,h,l,p,m=t.length-1,f=[],c=[],d=[].concat(s);for(a=m;0<=a;a-=1){if((h=this.searchProcessedElement(t[a]))?e[a]=r[h-1]:t[a]._shouldRender=i,"fl"==t[a].ty||"st"==t[a].ty||"gf"==t[a].ty||"gs"==t[a].ty)h?e[a].style.closed=!1:e[a]=this.createStyleElement(t[a],d),f.push(e[a].style);else if("gr"==t[a].ty){if(h)for(o=e[a].it.length,n=0;n<o;n+=1)e[a].prevViewData[n]=e[a].it[n];else e[a]=this.createGroupElement(t[a]);this.searchShapes(t[a].it,e[a].it,e[a].prevViewData,i,d)}else"tr"==t[a].ty?(h||(p=this.createTransformElement(t[a]),e[a]=p),d.push(e[a]),this.addTransformToStyleList(e[a])):"sh"==t[a].ty||"rc"==t[a].ty||"el"==t[a].ty||"sr"==t[a].ty?h||(e[a]=this.createShapeElement(t[a])):"tm"==t[a].ty||"rd"==t[a].ty?(h?(l=e[a]).closed=!1:((l=ShapeModifiers.getModifier(t[a].ty)).init(this,t[a]),e[a]=l,this.shapeModifiers.push(l)),c.push(l)):"rp"==t[a].ty&&(h?(l=e[a]).closed=!0:(l=ShapeModifiers.getModifier(t[a].ty),(e[a]=l).init(this,t,a,e),this.shapeModifiers.push(l),i=!1),c.push(l));this.addProcessedElement(t[a],a+1)}for(this.removeTransformFromStyleList(),this.closeStyles(f),m=c.length,a=0;a<m;a+=1)c[a].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(t,e){(t._opMdf||e.op._mdf||this._isFirstFrame)&&(e.opacity=t.opacity,e.opacity*=e.op.v,e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var t,e,r,i,s,a,n,o,h,l=this.stylesList.length,p=this.globalData.renderer,m=this.globalData.canvasContext;for(t=0;t<l;t+=1)if(("st"!==(o=(h=this.stylesList[t]).type)&&"gs"!==o||0!==h.wi)&&h.data._shouldRender&&0!==h.coOp&&0!==this.globalData.currentGlobalAlpha){for(p.save(),a=h.elements,"st"===o||"gs"===o?(m.strokeStyle="st"===o?h.co:h.grd,m.lineWidth=h.wi,m.lineCap=h.lc,m.lineJoin=h.lj,m.miterLimit=h.ml||0):m.fillStyle="fl"===o?h.co:h.grd,p.ctxOpacity(h.coOp),"st"!==o&&"gs"!==o&&m.beginPath(),p.ctxTransform(h.preTransforms.finalTransform.props),r=a.length,e=0;e<r;e+=1){for("st"!==o&&"gs"!==o||(m.beginPath(),h.da&&(m.setLineDash(h.da),m.lineDashOffset=h.do)),s=(n=a[e].trNodes).length,i=0;i<s;i+=1)"m"==n[i].t?m.moveTo(n[i].p[0],n[i].p[1]):"c"==n[i].t?m.bezierCurveTo(n[i].pts[0],n[i].pts[1],n[i].pts[2],n[i].pts[3],n[i].pts[4],n[i].pts[5]):m.closePath();"st"!==o&&"gs"!==o||(m.stroke(),h.da&&m.setLineDash(this.dashResetter))}"st"!==o&&"gs"!==o&&m.fill(h.r),p.restore()}},CVShapeElement.prototype.renderShape=function(t,e,r,i){var s,a;for(a=t,s=e.length-1;0<=s;s-=1)"tr"==e[s].ty?(a=r[s].transform,this.renderShapeTransform(t,a)):"sh"==e[s].ty||"el"==e[s].ty||"rc"==e[s].ty||"sr"==e[s].ty?this.renderPath(e[s],r[s]):"fl"==e[s].ty?this.renderFill(e[s],r[s],a):"st"==e[s].ty?this.renderStroke(e[s],r[s],a):"gf"==e[s].ty||"gs"==e[s].ty?this.renderGradientFill(e[s],r[s],a):"gr"==e[s].ty?this.renderShape(a,e[s].it,r[s].it):e[s].ty;i&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(t,e){if(this._isFirstFrame||e._mdf||t.transforms._mdf){var r,i,s,a=t.trNodes,n=e.paths,o=n._length;a.length=0;var h=t.transforms.finalTransform;for(s=0;s<o;s+=1){var l=n.shapes[s];if(l&&l.v){for(i=l._length,r=1;r<i;r+=1)1===r&&a.push({t:"m",p:h.applyToPointArray(l.v[0][0],l.v[0][1],0)}),a.push({t:"c",pts:h.applyToTriplePoints(l.o[r-1],l.i[r],l.v[r])});1===i&&a.push({t:"m",p:h.applyToPointArray(l.v[0][0],l.v[0][1],0)}),l.c&&i&&(a.push({t:"c",pts:h.applyToTriplePoints(l.o[r-1],l.i[0],l.v[0])}),a.push({t:"z"}))}}t.trNodes=a}},CVShapeElement.prototype.renderPath=function(t,e){if(!0!==t.hd&&t._shouldRender){var r,i=e.styledShapes.length;for(r=0;r<i;r+=1)this.renderStyledShape(e.styledShapes[r],e.sh)}},CVShapeElement.prototype.renderFill=function(t,e,r){var i=e.style;(e.c._mdf||this._isFirstFrame)&&(i.co="rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o._mdf||r._opMdf||this._isFirstFrame)&&(i.coOp=e.o.v*r.opacity)},CVShapeElement.prototype.renderGradientFill=function(t,e,r){var i=e.style;if(!i.grd||e.g._mdf||e.s._mdf||e.e._mdf||1!==t.t&&(e.h._mdf||e.a._mdf)){var s=this.globalData.canvasContext,a=e.s.v,n=e.e.v;if(1===t.t)f=s.createLinearGradient(a[0],a[1],n[0],n[1]);else var o=Math.sqrt(Math.pow(a[0]-n[0],2)+Math.pow(a[1]-n[1],2)),h=Math.atan2(n[1]-a[1],n[0]-a[0]),l=o*(1<=e.h.v?.99:e.h.v<=-1?-.99:e.h.v),p=Math.cos(h+e.a.v)*l+a[0],m=Math.sin(h+e.a.v)*l+a[1],f=s.createRadialGradient(p,m,0,a[0],a[1],o);var c,d=t.g.p,u=e.g.c,y=1;for(c=0;c<d;c+=1)e.g._hasOpacity&&e.g._collapsable&&(y=e.g.o[2*c+1]),f.addColorStop(u[4*c]/100,"rgba("+u[4*c+1]+","+u[4*c+2]+","+u[4*c+3]+","+y+")");i.grd=f}i.coOp=e.o.v*r.opacity},CVShapeElement.prototype.renderStroke=function(t,e,r){var i=e.style,s=e.d;s&&(s._mdf||this._isFirstFrame)&&(i.da=s.dashArray,i.do=s.dashoffset[0]),(e.c._mdf||this._isFirstFrame)&&(i.co="rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o._mdf||r._opMdf||this._isFirstFrame)&&(i.coOp=e.o.v*r.opacity),(e.w._mdf||this._isFirstFrame)&&(i.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){var t=this.canvasContext;t.fillStyle=this.data.sc,t.fillRect(0,0,this.data.sw,this.data.sh)},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var t=this.textProperty.currentData;this.renderedLetters=createSizedArray(t.l?t.l.length:0);var e=!1;t.fc?(e=!0,this.values.fill=this.buildColor(t.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var r=!1;t.sc&&(r=!0,this.values.stroke=this.buildColor(t.sc),this.values.sWidth=t.sw);var i,s,a=this.globalData.fontManager.getFontByName(t.f),n=t.l,o=this.mHelper;this.stroke=r,this.values.fValue=t.finalSize+"px "+this.globalData.fontManager.getFontByName(t.f).fFamily,s=t.finalText.length;var h,l,p,m,f,c,d,u,y,g,v=this.data.singleShape,b=t.tr/1e3*t.finalSize,E=0,x=0,S=!0,P=0;for(i=0;i<s;i+=1){for(l=(h=this.globalData.fontManager.getCharData(t.finalText[i],a.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily))&&h.data||{},o.reset(),v&&n[i].n&&(E=-b,x+=t.yOffset,x+=S?1:0,S=!1),d=(f=l.shapes?l.shapes[0].it:[]).length,o.scale(t.finalSize/100,t.finalSize/100),v&&this.applyTextPropertiesToMatrix(t,o,n[i].line,E,x),y=createSizedArray(d),c=0;c<d;c+=1){for(m=f[c].ks.k.i.length,u=f[c].ks.k,g=[],p=1;p<m;p+=1)1==p&&g.push(o.applyToX(u.v[0][0],u.v[0][1],0),o.applyToY(u.v[0][0],u.v[0][1],0)),g.push(o.applyToX(u.o[p-1][0],u.o[p-1][1],0),o.applyToY(u.o[p-1][0],u.o[p-1][1],0),o.applyToX(u.i[p][0],u.i[p][1],0),o.applyToY(u.i[p][0],u.i[p][1],0),o.applyToX(u.v[p][0],u.v[p][1],0),o.applyToY(u.v[p][0],u.v[p][1],0));g.push(o.applyToX(u.o[p-1][0],u.o[p-1][1],0),o.applyToY(u.o[p-1][0],u.o[p-1][1],0),o.applyToX(u.i[0][0],u.i[0][1],0),o.applyToY(u.i[0][0],u.i[0][1],0),o.applyToX(u.v[0][0],u.v[0][1],0),o.applyToY(u.v[0][0],u.v[0][1],0)),y[c]=g}v&&(E+=n[i].l,E+=b),this.textSpans[P]?this.textSpans[P].elem=y:this.textSpans[P]={elem:y},P+=1}},CVTextElement.prototype.renderInnerContent=function(){var t,e,r,i,s,a,n=this.canvasContext;this.finalTransform.mat.props;n.font=this.values.fValue,n.lineCap="butt",n.lineJoin="miter",n.miterLimit=4,this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var o,h=this.textAnimator.renderedLetters,l=this.textProperty.currentData.l;e=l.length;var p,m,f=null,c=null,d=null;for(t=0;t<e;t+=1)if(!l[t].n){if((o=h[t])&&(this.globalData.renderer.save(),this.globalData.renderer.ctxTransform(o.p),this.globalData.renderer.ctxOpacity(o.o)),this.fill){for(o&&o.fc?f!==o.fc&&(f=o.fc,n.fillStyle=o.fc):f!==this.values.fill&&(f=this.values.fill,n.fillStyle=this.values.fill),i=(p=this.textSpans[t].elem).length,this.globalData.canvasContext.beginPath(),r=0;r<i;r+=1)for(a=(m=p[r]).length,this.globalData.canvasContext.moveTo(m[0],m[1]),s=2;s<a;s+=6)this.globalData.canvasContext.bezierCurveTo(m[s],m[s+1],m[s+2],m[s+3],m[s+4],m[s+5]);this.globalData.canvasContext.closePath(),this.globalData.canvasContext.fill()}if(this.stroke){for(o&&o.sw?d!==o.sw&&(d=o.sw,n.lineWidth=o.sw):d!==this.values.sWidth&&(d=this.values.sWidth,n.lineWidth=this.values.sWidth),o&&o.sc?c!==o.sc&&(c=o.sc,n.strokeStyle=o.sc):c!==this.values.stroke&&(c=this.values.stroke,n.strokeStyle=this.values.stroke),i=(p=this.textSpans[t].elem).length,this.globalData.canvasContext.beginPath(),r=0;r<i;r+=1)for(a=(m=p[r]).length,this.globalData.canvasContext.moveTo(m[0],m[1]),s=2;s<a;s+=6)this.globalData.canvasContext.bezierCurveTo(m[s],m[s+1],m[s+2],m[s+3],m[s+4],m[s+5]);this.globalData.canvasContext.closePath(),this.globalData.canvasContext.stroke()}o&&this.globalData.renderer.restore()}},CVEffects.prototype.renderFrame=function(){},HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),0!==this.data.bm&&this.setBlendMode()},renderElement:function(){this.finalTransform._matMdf&&(this.transformedElement.style.transform=this.transformedElement.style.webkitTransform=this.finalTransform.mat.toCSS()),this.finalTransform._opMdf&&(this.transformedElement.style.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=HybridRenderer.prototype.buildElementParenting,extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var t;this.data.hasMask?((t=createNS("rect")).setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):((t=createTag("div")).style.width=this.data.sw+"px",t.style.height=this.data.sh+"px",t.style.backgroundColor=this.data.sc),this.layerElement.appendChild(t)},extendPrototype([HybridRenderer,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(t,e){for(var r,i=0;i<e;)this.elements[i]&&this.elements[i].getBaseElement&&(r=this.elements[i].getBaseElement()),i+=1;r?this.layerElement.insertBefore(t,r):this.layerElement.appendChild(t)},extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var t;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),t=this.svgElement;else{t=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;t.setAttribute("width",e.w),t.setAttribute("height",e.h),t.appendChild(this.shapesContainer),this.layerElement.appendChild(t)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=t},HShapeElement.prototype.getTransformedPoint=function(t,e){var r,i=t.length;for(r=0;r<i;r+=1)e=t[r].mProps.v.applyToPointArray(e[0],e[1],0);return e},HShapeElement.prototype.calculateShapeBoundingBox=function(t,e){var r,i,s,a,n,o=t.sh.v,h=t.transformers,l=o._length;if(!(l<=1)){for(r=0;r<l-1;r+=1)i=this.getTransformedPoint(h,o.v[r]),s=this.getTransformedPoint(h,o.o[r]),a=this.getTransformedPoint(h,o.i[r+1]),n=this.getTransformedPoint(h,o.v[r+1]),this.checkBounds(i,s,a,n,e);o.c&&(i=this.getTransformedPoint(h,o.v[r]),s=this.getTransformedPoint(h,o.o[r]),a=this.getTransformedPoint(h,o.i[0]),n=this.getTransformedPoint(h,o.v[0]),this.checkBounds(i,s,a,n,e))}},HShapeElement.prototype.checkBounds=function(t,e,r,i,s){this.getBoundsOfCurve(t,e,r,i);var a=this.shapeBoundingBox;s.x=bm_min(a.left,s.x),s.xMax=bm_max(a.right,s.xMax),s.y=bm_min(a.top,s.y),s.yMax=bm_max(a.bottom,s.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(t,e,r,i){for(var s,a,n,o,h,l,p,m=[[t[0],i[0]],[t[1],i[1]]],f=0;f<2;++f)if(a=6*t[f]-12*e[f]+6*r[f],s=-3*t[f]+9*e[f]-9*r[f]+3*i[f],n=3*e[f]-3*t[f],a|=0,n|=0,0!==(s|=0))(h=a*a-4*n*s)<0||(0<(l=(-a+bm_sqrt(h))/(2*s))&&l<1&&m[f].push(this.calculateF(l,t,e,r,i,f)),0<(p=(-a-bm_sqrt(h))/(2*s))&&p<1&&m[f].push(this.calculateF(p,t,e,r,i,f)));else{if(0===a)continue;0<(o=-n/a)&&o<1&&m[f].push(this.calculateF(o,t,e,r,i,f))}this.shapeBoundingBox.left=bm_min.apply(null,m[0]),this.shapeBoundingBox.top=bm_min.apply(null,m[1]),this.shapeBoundingBox.right=bm_max.apply(null,m[0]),this.shapeBoundingBox.bottom=bm_max.apply(null,m[1])},HShapeElement.prototype.calculateF=function(t,e,r,i,s,a){return bm_pow(1-t,3)*e[a]+3*bm_pow(1-t,2)*t*r[a]+3*(1-t)*bm_pow(t,2)*i[a]+bm_pow(t,3)*s[a]},HShapeElement.prototype.calculateBoundingBox=function(t,e){var r,i=t.length;for(r=0;r<i;r+=1)t[r]&&t[r].sh?this.calculateShapeBoundingBox(t[r],e):t[r]&&t[r].it&&this.calculateBoundingBox(t[r].it,e)},HShapeElement.prototype.currentBoxContains=function(t){return this.currentBBox.x<=t.x&&this.currentBBox.y<=t.y&&this.currentBBox.width+this.currentBBox.x>=t.x+t.width&&this.currentBBox.height+this.currentBBox.y>=t.y+t.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var t=this.tempBoundingBox,e=999999;if(t.x=e,t.xMax=-e,t.y=e,t.yMax=-e,this.calculateBoundingBox(this.itemsData,t),t.width=t.xMax<t.x?0:t.xMax-t.x,t.height=t.yMax<t.y?0:t.yMax-t.y,this.currentBoxContains(t))return;var r=!1;this.currentBBox.w!==t.width&&(this.currentBBox.w=t.width,this.shapeCont.setAttribute("width",t.width),r=!0),this.currentBBox.h!==t.height&&(this.currentBBox.h=t.height,this.shapeCont.setAttribute("height",t.height),r=!0),(r||this.currentBBox.x!==t.x||this.currentBBox.y!==t.y)&&(this.currentBBox.w=t.width,this.currentBBox.h=t.height,this.currentBBox.x=t.x,this.currentBBox.y=t.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),this.shapeCont.style.transform=this.shapeCont.style.webkitTransform="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)")}},extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var t=createNS("g");this.maskedElement.appendChild(t),this.innerElem=t}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var t=this.textProperty.currentData;this.renderedLetters=createSizedArray(t.l?t.l.length:0);var e=this.innerElem.style;e.color=e.fill=t.fc?this.buildColor(t.fc):"rgba(0,0,0,0)",t.sc&&(e.stroke=this.buildColor(t.sc),e.strokeWidth=t.sw+"px");var r,i,s=this.globalData.fontManager.getFontByName(t.f);if(!this.globalData.fontManager.chars)if(e.fontSize=t.finalSize+"px",e.lineHeight=t.finalSize+"px",s.fClass)this.innerElem.className=s.fClass;else{e.fontFamily=s.fFamily;var a=t.fWeight,n=t.fStyle;e.fontStyle=n,e.fontWeight=a}var o,h,l,p=t.l;i=p.length;var m,f=this.mHelper,c="",d=0;for(r=0;r<i;r+=1){if(this.globalData.fontManager.chars?(this.textPaths[d]?o=this.textPaths[d]:((o=createNS("path")).setAttribute("stroke-linecap","butt"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[d]?l=(h=this.textSpans[d]).children[0]:((h=createTag("div")).style.lineHeight=0,(l=createNS("svg")).appendChild(o),styleDiv(h)))):this.isMasked?o=this.textPaths[d]?this.textPaths[d]:createNS("text"):this.textSpans[d]?(h=this.textSpans[d],o=this.textPaths[d]):(styleDiv(h=createTag("span")),styleDiv(o=createTag("span")),h.appendChild(o)),this.globalData.fontManager.chars){var u,y=this.globalData.fontManager.getCharData(t.finalText[r],s.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily);if(u=y?y.data:null,f.reset(),u&&u.shapes&&(m=u.shapes[0].it,f.scale(t.finalSize/100,t.finalSize/100),c=this.createPathShape(f,m),o.setAttribute("d",c)),this.isMasked)this.innerElem.appendChild(o);else{if(this.innerElem.appendChild(h),u&&u.shapes){document.body.appendChild(l);var g=l.getBBox();l.setAttribute("width",g.width+2),l.setAttribute("height",g.height+2),l.setAttribute("viewBox",g.x-1+" "+(g.y-1)+" "+(g.width+2)+" "+(g.height+2)),l.style.transform=l.style.webkitTransform="translate("+(g.x-1)+"px,"+(g.y-1)+"px)",p[r].yOffset=g.y-1}else l.setAttribute("width",1),l.setAttribute("height",1);h.appendChild(l)}}else o.textContent=p[r].val,o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked?this.innerElem.appendChild(o):(this.innerElem.appendChild(h),o.style.transform=o.style.webkitTransform="translate3d(0,"+-t.finalSize/1.2+"px,0)");this.isMasked?this.textSpans[d]=o:this.textSpans[d]=h,this.textSpans[d].style.display="block",this.textPaths[d]=o,d+=1}for(;d<this.textSpans.length;)this.textSpans[d].style.display="none",d+=1},HTextElement.prototype.renderInnerContent=function(){if(this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;this.isMasked&&this.finalTransform._matMdf&&(this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),this.svgElement.style.transform=this.svgElement.style.webkitTransform="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)")}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag){var t,e,r,i,s,a=0,n=this.textAnimator.renderedLetters,o=this.textProperty.currentData.l;for(e=o.length,t=0;t<e;t+=1)o[t].n?a+=1:(i=this.textSpans[t],s=this.textPaths[t],r=n[a],a+=1,r._mdf.m&&(this.isMasked?i.setAttribute("transform",r.m):i.style.transform=i.style.webkitTransform=r.m),i.style.opacity=r.o,r.sw&&r._mdf.sw&&s.setAttribute("stroke-width",r.sw),r.sc&&r._mdf.sc&&s.setAttribute("stroke",r.sc),r.fc&&r._mdf.fc&&(s.setAttribute("fill",r.fc),s.style.color=r.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var h=this.innerElem.getBBox();this.currentBBox.w!==h.width&&(this.currentBBox.w=h.width,this.svgElement.setAttribute("width",h.width)),this.currentBBox.h!==h.height&&(this.currentBBox.h=h.height,this.svgElement.setAttribute("height",h.height));this.currentBBox.w===h.width+2&&this.currentBBox.h===h.height+2&&this.currentBBox.x===h.x-1&&this.currentBBox.y===h.y-1||(this.currentBBox.w=h.width+2,this.currentBBox.h=h.height+2,this.currentBBox.x=h.x-1,this.currentBBox.y=h.y-1,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),this.svgElement.style.transform=this.svgElement.style.webkitTransform="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)")}}},extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var t=this.globalData.getAssetsPath(this.assetData),e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",t),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(e),e.src=t,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)},extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var t,e,r=this.comp.threeDElements.length;for(t=0;t<r;t+=1)"3d"===(e=this.comp.threeDElements[t]).type&&(e.perspectiveElem.style.perspective=e.perspectiveElem.style.webkitPerspective=this.pe.v+"px",e.container.style.transformOrigin=e.container.style.mozTransformOrigin=e.container.style.webkitTransformOrigin="0px 0px 0px",e.perspectiveElem.style.transform=e.perspectiveElem.style.webkitTransform="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)")},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var t,e,r=this._isFirstFrame;if(this.hierarchy)for(e=this.hierarchy.length,t=0;t<e;t+=1)r=this.hierarchy[t].finalTransform.mProp._mdf||r;if(r||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(t=e=this.hierarchy.length-1;0<=t;t-=1){var i=this.hierarchy[t].finalTransform.mProp;this.mat.translate(-i.p.v[0],-i.p.v[1],i.p.v[2]),this.mat.rotateX(-i.or.v[0]).rotateY(-i.or.v[1]).rotateZ(i.or.v[2]),this.mat.rotateX(-i.rx.v).rotateY(-i.ry.v).rotateZ(i.rz.v),this.mat.scale(1/i.s.v[0],1/i.s.v[1],1/i.s.v[2]),this.mat.translate(i.a.v[0],i.a.v[1],i.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;s=this.p?[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var a=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),n=[s[0]/a,s[1]/a,s[2]/a],o=Math.sqrt(n[2]*n[2]+n[0]*n[0]),h=Math.atan2(n[1],o),l=Math.atan2(n[0],-n[2]);this.mat.rotateY(l).rotateX(-h)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var p=!this._prevMat.equals(this.mat);if((p||this.pe._mdf)&&this.comp.threeDElements){var m;for(e=this.comp.threeDElements.length,t=0;t<e;t+=1)"3d"===(m=this.comp.threeDElements[t]).type&&(p&&(m.container.style.transform=m.container.style.webkitTransform=this.mat.toCSS()),this.pe._mdf&&(m.perspectiveElem.style.perspective=m.perspectiveElem.style.webkitPerspective=this.pe.v+"px"));this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(t){this.prepareProperties(t,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null},HEffects.prototype.renderFrame=function(){};var animationManager=function(){var t={},s=[],i=0,a=0,n=0,o=!0,h=!1;function r(t){for(var e=0,r=t.target;e<a;)s[e].animation===r&&(s.splice(e,1),e-=1,a-=1,r.isPaused||m()),e+=1}function l(t,e){if(!t)return null;for(var r=0;r<a;){if(s[r].elem==t&&null!==s[r].elem)return s[r].animation;r+=1}var i=new AnimationItem;return f(i,t),i.setData(t,e),i}function p(){n+=1,d()}function m(){n-=1}function f(t,e){t.addEventListener("destroy",r),t.addEventListener("_active",p),t.addEventListener("_idle",m),s.push({elem:e,animation:t}),a+=1}function c(t){var e,r=t-i;for(e=0;e<a;e+=1)s[e].animation.advanceTime(r);i=t,n&&!h?window.requestAnimationFrame(c):o=!0}function e(t){i=t,window.requestAnimationFrame(c)}function d(){!h&&n&&o&&(window.requestAnimationFrame(e),o=!1)}return t.registerAnimation=l,t.loadAnimation=function(t){var e=new AnimationItem;return f(e,null),e.setParams(t),e},t.setSpeed=function(t,e){var r;for(r=0;r<a;r+=1)s[r].animation.setSpeed(t,e)},t.setDirection=function(t,e){var r;for(r=0;r<a;r+=1)s[r].animation.setDirection(t,e)},t.play=function(t){var e;for(e=0;e<a;e+=1)s[e].animation.play(t)},t.pause=function(t){var e;for(e=0;e<a;e+=1)s[e].animation.pause(t)},t.stop=function(t){var e;for(e=0;e<a;e+=1)s[e].animation.stop(t)},t.togglePause=function(t){var e;for(e=0;e<a;e+=1)s[e].animation.togglePause(t)},t.searchAnimations=function(t,e,r){var i,s=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),a=s.length;for(i=0;i<a;i+=1)r&&s[i].setAttribute("data-bm-type",r),l(s[i],t);if(e&&0===a){r||(r="svg");var n=document.getElementsByTagName("body")[0];n.innerHTML="";var o=createTag("div");o.style.width="100%",o.style.height="100%",o.setAttribute("data-bm-type",r),n.appendChild(o),l(o,t)}},t.resize=function(){var t;for(t=0;t<a;t+=1)s[t].animation.resize()},t.goToAndStop=function(t,e,r){var i;for(i=0;i<a;i+=1)s[i].animation.goToAndStop(t,e,r)},t.destroy=function(t){var e;for(e=a-1;0<=e;e-=1)s[e].animation.destroy(t)},t.freeze=function(){h=!0},t.unfreeze=function(){h=!1,d()},t.getRegisteredAnimations=function(){var t,e=s.length,r=[];for(t=0;t<e;t+=1)r.push(s[t].animation);return r},t}(),AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.subframeEnabled=subframeEnabled,this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(t){t.context&&(this.context=t.context),(t.wrapper||t.container)&&(this.wrapper=t.wrapper||t.container);var e=t.animType?t.animType:t.renderer?t.renderer:"svg";switch(e){case"canvas":this.renderer=new CanvasRenderer(this,t.rendererSettings);break;case"svg":this.renderer=new SVGRenderer(this,t.rendererSettings);break;default:this.renderer=new HybridRenderer(this,t.rendererSettings)}this.renderer.setProjectInterface(this.projectInterface),this.animType=e,""===t.loop||null===t.loop||(!1===t.loop?this.loop=!1:!0===t.loop?this.loop=!0:this.loop=parseInt(t.loop)),this.autoplay=!("autoplay"in t)||t.autoplay,this.name=t.name?t.name:"",this.autoloadSegments=!t.hasOwnProperty("autoloadSegments")||t.autoloadSegments,this.assetsPath=t.assetsPath,this.initialSegment=t.initialSegment,t.animationData?this.configAnimation(t.animationData):t.path&&(-1!==t.path.lastIndexOf("\\")?this.path=t.path.substr(0,t.path.lastIndexOf("\\")+1):this.path=t.path.substr(0,t.path.lastIndexOf("/")+1),this.fileName=t.path.substr(t.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),assetLoader.load(t.path,this.configAnimation.bind(this),function(){this.trigger("data_failed")}.bind(this)))},AnimationItem.prototype.setData=function(t,e){var r={wrapper:t,animationData:e?"object"==typeof e?e:JSON.parse(e):null},i=t.attributes;r.path=i.getNamedItem("data-animation-path")?i.getNamedItem("data-animation-path").value:i.getNamedItem("data-bm-path")?i.getNamedItem("data-bm-path").value:i.getNamedItem("bm-path")?i.getNamedItem("bm-path").value:"",r.animType=i.getNamedItem("data-anim-type")?i.getNamedItem("data-anim-type").value:i.getNamedItem("data-bm-type")?i.getNamedItem("data-bm-type").value:i.getNamedItem("bm-type")?i.getNamedItem("bm-type").value:i.getNamedItem("data-bm-renderer")?i.getNamedItem("data-bm-renderer").value:i.getNamedItem("bm-renderer")?i.getNamedItem("bm-renderer").value:"canvas";var s=i.getNamedItem("data-anim-loop")?i.getNamedItem("data-anim-loop").value:i.getNamedItem("data-bm-loop")?i.getNamedItem("data-bm-loop").value:i.getNamedItem("bm-loop")?i.getNamedItem("bm-loop").value:"";""===s||(r.loop="false"!==s&&("true"===s||parseInt(s)));var a=i.getNamedItem("data-anim-autoplay")?i.getNamedItem("data-anim-autoplay").value:i.getNamedItem("data-bm-autoplay")?i.getNamedItem("data-bm-autoplay").value:!i.getNamedItem("bm-autoplay")||i.getNamedItem("bm-autoplay").value;r.autoplay="false"!==a,r.name=i.getNamedItem("data-name")?i.getNamedItem("data-name").value:i.getNamedItem("data-bm-name")?i.getNamedItem("data-bm-name").value:i.getNamedItem("bm-name")?i.getNamedItem("bm-name").value:"","false"===(i.getNamedItem("data-anim-prerender")?i.getNamedItem("data-anim-prerender").value:i.getNamedItem("data-bm-prerender")?i.getNamedItem("data-bm-prerender").value:i.getNamedItem("bm-prerender")?i.getNamedItem("bm-prerender").value:"")&&(r.prerender=!1),this.setParams(r)},AnimationItem.prototype.includeLayers=function(t){t.op>this.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e,r,i=this.animationData.layers,s=i.length,a=t.layers,n=a.length;for(r=0;r<n;r+=1)for(e=0;e<s;){if(i[e].id==a[r].id){i[e]=a[r];break}e+=1}if((t.chars||t.fonts)&&(this.renderer.globalData.fontManager.addChars(t.chars),this.renderer.globalData.fontManager.addFonts(t.fonts,this.renderer.globalData.defs)),t.assets)for(s=t.assets.length,e=0;e<s;e+=1)this.animationData.assets.push(t.assets[e]);this.animationData.__complete=!1,dataManager.completeData(this.animationData,this.renderer.globalData.fontManager),this.renderer.includeLayers(t.layers),expressionsPlugin&&expressionsPlugin.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var t=this.animationData.segments;if(!t||0===t.length||!this.autoloadSegments)return this.trigger("data_ready"),void(this.timeCompleted=this.totalFrames);var e=t.shift();this.timeCompleted=e.time*this.frameRate;var r=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,assetLoader.load(r,this.includeLayers.bind(this),function(){this.trigger("data_failed")}.bind(this))},AnimationItem.prototype.loadSegments=function(){this.animationData.segments||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(t){if(this.renderer)try{this.animationData=t,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(t),t.assets||(t.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(t.assets),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded()}catch(t){this.triggerConfigError(t)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.loaded()?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){this.isLoaded||!this.renderer.globalData.fontManager.loaded()||!this.imagePreloader.loaded()&&"canvas"===this.renderer.rendererType||(this.isLoaded=!0,dataManager.completeData(this.animationData,this.renderer.globalData.fontManager),expressionsPlugin&&expressionsPlugin.initExpressions(this),this.renderer.initItems(),setTimeout(function(){this.trigger("DOMLoaded")}.bind(this),0),this.gotoFrame(),this.autoplay&&this.play())},AnimationItem.prototype.resize=function(){this.renderer.updateContainerSize()},AnimationItem.prototype.setSubframe=function(t){this.subframeEnabled=!!t},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.subframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame()},AnimationItem.prototype.renderFrame=function(){if(!1!==this.isLoaded)try{this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}},AnimationItem.prototype.play=function(t){t&&this.name!=t||!0===this.isPaused&&(this.isPaused=!1,this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(t){t&&this.name!=t||!1===this.isPaused&&(this.isPaused=!0,this._idle=!0,this.trigger("_idle"))},AnimationItem.prototype.togglePause=function(t){t&&this.name!=t||(!0===this.isPaused?this.play():this.pause())},AnimationItem.prototype.stop=function(t){t&&this.name!=t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.goToAndStop=function(t,e,r){r&&this.name!=r||(e?this.setCurrentRawFrameValue(t):this.setCurrentRawFrameValue(t*this.frameModifier),this.pause())},AnimationItem.prototype.goToAndPlay=function(t,e,r){this.goToAndStop(t,e,r),this.play()},AnimationItem.prototype.advanceTime=function(t){if(!0!==this.isPaused&&!1!==this.isLoaded){var e=this.currentRawFrame+t*this.frameModifier,r=!1;e>=this.totalFrames-1&&0<this.frameModifier?this.loop&&this.playCount!==this.loop?e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(r=!0,e=this.totalFrames-1):e<0?this.checkSegments(e%this.totalFrames)||(!this.loop||this.playCount--<=0&&!0!==this.loop?(r=!0,e=0):(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(e),r&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]<t[0]?(0<this.frameModifier&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.timeCompleted=this.totalFrames=t[0]-t[1],this.firstFrame=t[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):t[1]>t[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.timeCompleted=this.totalFrames=t[1]-t[0],this.firstFrame=t[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(t,e){var r=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<t?r=t:this.currentRawFrame+this.firstFrame>e&&(r=e-t)),this.firstFrame=t,this.timeCompleted=this.totalFrames=e-t,-1!==r&&this.goToAndStop(r,!0)},AnimationItem.prototype.playSegments=function(t,e){if(e&&(this.segments.length=0),"object"==typeof t[0]){var r,i=t.length;for(r=0;r<i;r+=1)this.segments.push(t[r])}else this.segments.push(t);this.segments.length&&e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(t){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),t&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(t){return!!this.segments.length&&(this.adjustSegment(this.segments.shift(),t),!0)},AnimationItem.prototype.destroy=function(t){t&&this.name!=t||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=this.onLoopComplete=this.onComplete=this.onSegmentStart=this.onDestroy=null,this.renderer=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(t){this.currentRawFrame=t,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(t){this.playSpeed=t,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(t){this.playDirection=t<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(t){var e="";if(t.e)e=t.p;else if(this.assetsPath){var r=t.p;-1!==r.indexOf("images/")&&(r=r.split("/")[1]),e=this.assetsPath+r}else e=this.path,e+=t.u?t.u:"",e+=t.p;return e},AnimationItem.prototype.getAssetData=function(t){for(var e=0,r=this.assets.length;e<r;){if(t==this.assets[e].id)return this.assets[e];e+=1}},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(t){return t?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.trigger=function(t){if(this._cbs&&this._cbs[t])switch(t){case"enterFrame":this.triggerEvent(t,new BMEnterFrameEvent(t,this.currentFrame,this.totalFrames,this.frameModifier));break;case"loopComplete":this.triggerEvent(t,new BMCompleteLoopEvent(t,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(t,new BMCompleteEvent(t,this.frameMult));break;case"segmentStart":this.triggerEvent(t,new BMSegmentStartEvent(t,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(t,new BMDestroyEvent(t,this));break;default:this.triggerEvent(t)}"enterFrame"===t&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(t,this.currentFrame,this.totalFrames,this.frameMult)),"loopComplete"===t&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(t,this.loop,this.playCount,this.frameMult)),"complete"===t&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(t,this.frameMult)),"segmentStart"===t&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(t,this.firstFrame,this.totalFrames)),"destroy"===t&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(t,this))},AnimationItem.prototype.triggerRenderFrameError=function(t){var e=new BMRenderFrameErrorEvent(t,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)},AnimationItem.prototype.triggerConfigError=function(t){var e=new BMConfigErrorEvent(t,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)};var Expressions=(IW={},IW.initExpressions=function(t){var e=0,r=[];function i(){var t,e=r.length;for(t=0;t<e;t+=1)r[t].release();r.length=0}t.renderer.compInterface=CompExpressionInterface(t.renderer),t.renderer.globalData.projectInterface.registerComposition(t.renderer),t.renderer.globalData.pushExpression=function(){e+=1},t.renderer.globalData.popExpression=function(){0==(e-=1)&&i()},t.renderer.globalData.registerExpressionProperty=function(t){-1===r.indexOf(t)&&r.push(t)}},IW),IW;expressionsPlugin=Expressions;var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null;function $bm_isInstanceOfArray(t){return t.constructor===Array||t.constructor===Float32Array}function isNumerable(t,e){return"number"===t||"boolean"===t||"string"===t||e instanceof Number}function $bm_neg(t){var e=typeof t;if("number"===e||"boolean"===e||t instanceof Number)return-t;if($bm_isInstanceOfArray(t)){var r,i=t.length,s=[];for(r=0;r<i;r+=1)s[r]=-t[r];return s}return t.propType?t.v:void 0}var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(t,e){var r=typeof t,i=typeof e;if("string"===r||"string"===i)return t+e;if(isNumerable(r,t)&&isNumerable(i,e))return t+e;if($bm_isInstanceOfArray(t)&&isNumerable(i,e))return(t=t.slice(0))[0]=t[0]+e,t;if(isNumerable(r,t)&&$bm_isInstanceOfArray(e))return(e=e.slice(0))[0]=t+e[0],e;if($bm_isInstanceOfArray(t)&&$bm_isInstanceOfArray(e)){for(var s=0,a=t.length,n=e.length,o=[];s<a||s<n;)("number"==typeof t[s]||t[s]instanceof Number)&&("number"==typeof e[s]||e[s]instanceof Number)?o[s]=t[s]+e[s]:o[s]=void 0===e[s]?t[s]:t[s]||e[s],s+=1;return o}return 0}var add=sum;function sub(t,e){var r=typeof t,i=typeof e;if(isNumerable(r,t)&&isNumerable(i,e))return"string"===r&&(t=parseInt(t)),"string"===i&&(e=parseInt(e)),t-e;if($bm_isInstanceOfArray(t)&&isNumerable(i,e))return(t=t.slice(0))[0]=t[0]-e,t;if(isNumerable(r,t)&&$bm_isInstanceOfArray(e))return(e=e.slice(0))[0]=t-e[0],e;if($bm_isInstanceOfArray(t)&&$bm_isInstanceOfArray(e)){for(var s=0,a=t.length,n=e.length,o=[];s<a||s<n;)("number"==typeof t[s]||t[s]instanceof Number)&&("number"==typeof e[s]||e[s]instanceof Number)?o[s]=t[s]-e[s]:o[s]=void 0===e[s]?t[s]:t[s]||e[s],s+=1;return o}return 0}function mul(t,e){var r,i,s,a=typeof t,n=typeof e;if(isNumerable(a,t)&&isNumerable(n,e))return t*e;if($bm_isInstanceOfArray(t)&&isNumerable(n,e)){for(s=t.length,r=createTypedArray("float32",s),i=0;i<s;i+=1)r[i]=t[i]*e;return r}if(isNumerable(a,t)&&$bm_isInstanceOfArray(e)){for(s=e.length,r=createTypedArray("float32",s),i=0;i<s;i+=1)r[i]=t*e[i];return r}return 0}function div(t,e){var r,i,s,a=typeof t,n=typeof e;if(isNumerable(a,t)&&isNumerable(n,e))return t/e;if($bm_isInstanceOfArray(t)&&isNumerable(n,e)){for(s=t.length,r=createTypedArray("float32",s),i=0;i<s;i+=1)r[i]=t[i]/e;return r}if(isNumerable(a,t)&&$bm_isInstanceOfArray(e)){for(s=e.length,r=createTypedArray("float32",s),i=0;i<s;i+=1)r[i]=t/e[i];return r}return 0}function mod(t,e){return"string"==typeof t&&(t=parseInt(t)),"string"==typeof e&&(e=parseInt(e)),t%e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(t,e,r){if(r<e){var i=r;r=e,e=i}return Math.min(Math.max(t,e),r)}function radiansToDegrees(t){return t/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(t){return t*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(t,e){if("number"==typeof t||t instanceof Number)return e=e||0,Math.abs(t-e);e||(e=helperLengthArray);var r,i=Math.min(t.length,e.length),s=0;for(r=0;r<i;r+=1)s+=Math.pow(e[r]-t[r],2);return Math.sqrt(s)}function normalize(t){return div(t,length(t))}function rgbToHsl(t){var e,r,i=t[0],s=t[1],a=t[2],n=Math.max(i,s,a),o=Math.min(i,s,a),h=(n+o)/2;if(n==o)e=r=0;else{var l=n-o;switch(r=.5<h?l/(2-n-o):l/(n+o),n){case i:e=(s-a)/l+(s<a?6:0);break;case s:e=(a-i)/l+2;break;case a:e=(i-s)/l+4}e/=6}return[e,r,h,t[3]]}function hue2rgb(t,e,r){return r<0&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function hslToRgb(t){var e,r,i,s=t[0],a=t[1],n=t[2];if(0===a)e=r=i=n;else{var o=n<.5?n*(1+a):n+a-n*a,h=2*n-o;e=hue2rgb(h,o,s+1/3),r=hue2rgb(h,o,s),i=hue2rgb(h,o,s-1/3)}return[e,r,i,t[3]]}function linear(t,e,r,i,s){if(void 0!==i&&void 0!==s||(i=e,s=r,e=0,r=1),r<e){var a=r;r=e,e=a}if(t<=e)return i;if(r<=t)return s;var n=r===e?0:(t-e)/(r-e);if(!i.length)return i+(s-i)*n;var o,h=i.length,l=createTypedArray("float32",h);for(o=0;o<h;o+=1)l[o]=i[o]+(s[o]-i[o])*n;return l}function random(t,e){if(void 0===e&&(void 0===t?(t=0,e=1):(e=t,t=void 0)),e.length){var r,i=e.length;t||(t=createTypedArray("float32",i));var s=createTypedArray("float32",i),a=BMMath.random();for(r=0;r<i;r+=1)s[r]=t[r]+a*(e[r]-t[r]);return s}return void 0===t&&(t=0),t+BMMath.random()*(e-t)}function createPath(t,e,r,i){var s,a=t.length,n=shape_pool.newElement();n.setPathData(!!i,a);var o,h,l=[0,0];for(s=0;s<a;s+=1)o=e&&e[s]?e[s]:l,h=r&&r[s]?r[s]:l,n.setTripleAt(t[s][0],t[s][1],h[0]+t[s][0],h[1]+t[s][1],o[0]+t[s][0],o[1]+t[s][1],s,!0);return n}function initiateExpression(elem,data,property){var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=-1!==val.indexOf("random"),elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,__expression_functions=[],scoped_bm_rt;if(data.xf){var i,len=data.xf.length;for(i=0;i<len;i+=1)__expression_functions[i]=eval("(function(){ return "+data.xf[i]+"}())")}var expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||!0!==this.data.hd,wiggle=function(t,e){var r,i,s=this.pv.length?this.pv.length:1,a=createTypedArray("float32",s);var n=Math.floor(5*time);for(i=r=0;r<n;){for(i=0;i<s;i+=1)a[i]+=-e+2*e*BMMath.random();r+=1}var o=5*time,h=o-Math.floor(o),l=createTypedArray("float32",s);if(1<s){for(i=0;i<s;i+=1)l[i]=this.pv[i]+a[i]+(-e+2*e*BMMath.random())*h;return l}return this.pv+a[0]+(-e+2*e*BMMath.random())*h}.bind(this);function loopInDuration(t,e){return loopIn(t,e,!0)}function loopOutDuration(t,e){return loopOut(t,e,!0)}thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty)),this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface),time,velocity,value,text,textIndex,textTotal,selectorValue;function lookAt(t,e){var r=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],i=Math.atan2(r[0],Math.sqrt(r[1]*r[1]+r[2]*r[2]))/degToRads;return[-Math.atan2(r[1],r[2])/degToRads,i,0]}function easeOut(t,e,r,i,s){return applyEase(easeOutBez,t,e,r,i,s)}function easeIn(t,e,r,i,s){return applyEase(easeInBez,t,e,r,i,s)}function ease(t,e,r,i,s){return applyEase(easeInOutBez,t,e,r,i,s)}function applyEase(t,e,r,i,s,a){void 0===s?(s=r,a=i):e=(e-r)/(i-r);var n=t(e=1<e?1:e<0?0:e);if($bm_isInstanceOfArray(s)){var o,h=s.length,l=createTypedArray("float32",h);for(o=0;o<h;o+=1)l[o]=(a[o]-s[o])*n+s[o];return l}return(a-s)*n+s}function nearestKey(t){var e,r,i,s=data.k.length;if(data.k.length&&"number"!=typeof data.k[0])if(r=-1,(t*=elem.comp.globalData.frameRate)<data.k[0].t)r=1,i=data.k[0].t;else{for(e=0;e<s-1;e+=1){if(t===data.k[e].t){r=e+1,i=data.k[e].t;break}if(t>data.k[e].t&&t<data.k[e+1].t){i=t-data.k[e].t>data.k[e+1].t-t?(r=e+2,data.k[e+1].t):(r=e+1,data.k[e].t);break}}-1===r&&(r=e+1,i=data.k[e].t)}else i=r=0;var a={};return a.index=r,a.time=i/elem.comp.globalData.frameRate,a}function key(t){var e,r,i;if(!data.k.length||"number"==typeof data.k[0])throw new Error("The property has no keyframe at index "+t);t-=1,e={time:data.k[t].t/elem.comp.globalData.frameRate,value:[]};var s=data.k[t].hasOwnProperty("s")?data.k[t].s:data.k[t-1].e;for(i=s.length,r=0;r<i;r+=1)e[r]=s[r],e.value[r]=s[r];return e}function framesToTime(t,e){return e||(e=elem.comp.globalData.frameRate),t/e}function timeToFrames(t,e){return t||0===t||(t=time),e||(e=elem.comp.globalData.frameRate),t*e}function seedRandom(t){BMMath.seedrandom(randSeed+t)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(t,e){return"string"==typeof value?void 0===e?value.substring(t):value.substring(t,e):""}function substr(t,e){return"string"==typeof value?void 0===e?value.substr(t):value.substr(t,e):""}function posterizeTime(t){time=0===t?0:Math.floor(time*t)/t,value=valueAtTime(time)}var index=elem.data.ind,hasParent=!(!elem.hierarchy||!elem.hierarchy.length),parent,randSeed=Math.floor(1e6*Math.random()),globalData=elem.globalData;function executeExpression(t){return value=t,_needsRandom&&seedRandom(randSeed),this.frameExpressionId===elem.globalData.frameId&&"textSelector"!==this.propType?value:("textSelector"===this.propType&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),($bm_transform=transform)&&(anchorPoint=transform.anchorPoint)),4!==elemType||content||(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),(hasParent=!(!elem.hierarchy||!elem.hierarchy.length))&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,"shape"===scoped_bm_rt.propType&&(scoped_bm_rt=scoped_bm_rt.v),scoped_bm_rt)}return executeExpression}return ob.initiateExpression=initiateExpression,ob}(),expressionHelpers={searchExpressions:function(t,e,r){e.x&&(r.k=!0,r.x=!0,r.initiateExpression=ExpressionManager.initiateExpression,r.effectsSequence.push(r.initiateExpression(t,e,r).bind(r)))},getSpeedAtTime:function(t){var e=this.getValueAtTime(t),r=this.getValueAtTime(t+-.01),i=0;if(e.length){var s;for(s=0;s<e.length;s+=1)i+=Math.pow(r[s]-e[s],2);i=100*Math.sqrt(i)}else i=0;return i},getVelocityAtTime:function(t){if(void 0!==this.vel)return this.vel;var e,r,i=this.getValueAtTime(t),s=this.getValueAtTime(t+-.001);if(i.length)for(e=createTypedArray("float32",i.length),r=0;r<i.length;r+=1)e[r]=(s[r]-i[r])/-.001;else e=(s-i)/-.001;return e},getValueAtTime:function(t){return t*=this.elem.globalData.frameRate,(t-=this.offsetTime)!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<t?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(t,this._cachingAtTime),this._cachingAtTime.lastFrame=t),this._cachingAtTime.value},getStaticValueAtTime:function(){return this.pv},setGroupProperty:function(t){this.propertyGroup=t}};!function(){function o(t,e,r){if(!this.k||!this.keyframes)return this.pv;t=t?t.toLowerCase():"";var i,s,a,n,o,h=this.comp.renderedFrame,l=this.keyframes,p=l[l.length-1].t;if(h<=p)return this.pv;if(r?s=p-(i=e?Math.abs(p-elem.comp.globalData.frameRate*e):Math.max(0,p-this.elem.data.ip)):((!e||e>l.length-1)&&(e=l.length-1),i=p-(s=l[l.length-1-e].t)),"pingpong"===t){if(Math.floor((h-s)/i)%2!=0)return this.getValueAtTime((i-(h-s)%i+s)/this.comp.globalData.frameRate,0)}else{if("offset"===t){var m=this.getValueAtTime(s/this.comp.globalData.frameRate,0),f=this.getValueAtTime(p/this.comp.globalData.frameRate,0),c=this.getValueAtTime(((h-s)%i+s)/this.comp.globalData.frameRate,0),d=Math.floor((h-s)/i);if(this.pv.length){for(n=(o=new Array(m.length)).length,a=0;a<n;a+=1)o[a]=(f[a]-m[a])*d+c[a];return o}return(f-m)*d+c}if("continue"===t){var u=this.getValueAtTime(p/this.comp.globalData.frameRate,0),y=this.getValueAtTime((p-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(n=(o=new Array(u.length)).length,a=0;a<n;a+=1)o[a]=u[a]+(u[a]-y[a])*((h-p)/this.comp.globalData.frameRate)/5e-4;return o}return u+(h-p)/.001*(u-y)}}return this.getValueAtTime(((h-s)%i+s)/this.comp.globalData.frameRate,0)}function h(t,e,r){if(!this.k)return this.pv;t=t?t.toLowerCase():"";var i,s,a,n,o,h=this.comp.renderedFrame,l=this.keyframes,p=l[0].t;if(p<=h)return this.pv;if(r?s=p+(i=e?Math.abs(elem.comp.globalData.frameRate*e):Math.max(0,this.elem.data.op-p)):((!e||e>l.length-1)&&(e=l.length-1),i=(s=l[e].t)-p),"pingpong"===t){if(Math.floor((p-h)/i)%2==0)return this.getValueAtTime(((p-h)%i+p)/this.comp.globalData.frameRate,0)}else{if("offset"===t){var m=this.getValueAtTime(p/this.comp.globalData.frameRate,0),f=this.getValueAtTime(s/this.comp.globalData.frameRate,0),c=this.getValueAtTime((i-(p-h)%i+p)/this.comp.globalData.frameRate,0),d=Math.floor((p-h)/i)+1;if(this.pv.length){for(n=(o=new Array(m.length)).length,a=0;a<n;a+=1)o[a]=c[a]-(f[a]-m[a])*d;return o}return c-(f-m)*d}if("continue"===t){var u=this.getValueAtTime(p/this.comp.globalData.frameRate,0),y=this.getValueAtTime((p+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(n=(o=new Array(u.length)).length,a=0;a<n;a+=1)o[a]=u[a]+(u[a]-y[a])*(p-h)/.001;return o}return u+(u-y)*(p-h)/.001}}return this.getValueAtTime((i-(p-h)%i+p)/this.comp.globalData.frameRate,0)}function l(t,e){if(!this.k)return this.pv;if(t=.5*(t||.4),(e=Math.floor(e||5))<=1)return this.pv;var r,i,s=this.comp.renderedFrame/this.comp.globalData.frameRate,a=s-t,n=1<e?(s+t-a)/(e-1):1,o=0,h=0;for(r=this.pv.length?createTypedArray("float32",this.pv.length):0;o<e;){if(i=this.getValueAtTime(a+o*n),this.pv.length)for(h=0;h<this.pv.length;h+=1)r[h]+=i[h];else r+=i;o+=1}if(this.pv.length)for(h=0;h<this.pv.length;h+=1)r[h]/=e;else r/=e;return r}var s=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(t,e,r){var i=s(t,e,r);return i.dynamicProperties.length?i.getValueAtTime=function(t){console.warn("Transform at time not supported")}.bind(i):i.getValueAtTime=function(t){}.bind(i),i.setGroupProperty=expressionHelpers.setGroupProperty,i};var p=PropertyFactory.getProp;PropertyFactory.getProp=function(t,e,r,i,s){var a=p(t,e,r,i,s);a.kf?a.getValueAtTime=expressionHelpers.getValueAtTime.bind(a):a.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(a),a.setGroupProperty=expressionHelpers.setGroupProperty,a.loopOut=o,a.loopIn=h,a.smooth=l,a.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(a),a.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(a),a.numKeys=1===e.a?e.k.length:0,a.propertyIndex=e.ix;var n=0;return 0!==r&&(n=createTypedArray("float32",1===e.a?e.k[0].s.length:e.k.length)),a._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:n},expressionHelpers.searchExpressions(t,e,a),a.k&&s.addDynamicProperty(a),a};var t=ShapePropertyFactory.getConstructorFunction(),e=ShapePropertyFactory.getKeyframedConstructorFunction();function r(){}r.prototype={vertices:function(t,e){this.k&&this.getValue();var r=this.v;void 0!==e&&(r=this.getValueAtTime(e,0));var i,s=r._length,a=r[t],n=r.v,o=createSizedArray(s);for(i=0;i<s;i+=1)o[i]="i"===t||"o"===t?[a[i][0]-n[i][0],a[i][1]-n[i][1]]:[a[i][0],a[i][1]];return o},points:function(t){return this.vertices("v",t)},inTangents:function(t){return this.vertices("i",t)},outTangents:function(t){return this.vertices("o",t)},isClosed:function(){return this.v.c},pointOnPath:function(t,e){var r=this.v;void 0!==e&&(r=this.getValueAtTime(e,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(r));for(var i,s=this._segmentsLength,a=s.lengths,n=s.totalLength*t,o=0,h=a.length,l=0;o<h;){if(l+a[o].addedLength>n){var p=o,m=r.c&&o===h-1?0:o+1,f=(n-l)/a[o].addedLength;i=bez.getPointInSegment(r.v[p],r.v[m],r.o[p],r.i[m],f,a[o]);break}l+=a[o].addedLength,o+=1}return i||(i=r.c?[r.v[0][0],r.v[0][1]]:[r.v[r._length-1][0],r.v[r._length-1][1]]),i},vectorOnPath:function(t,e,r){t=1==t?this.v.c?0:.999:t;var i=this.pointOnPath(t,e),s=this.pointOnPath(t+.001,e),a=s[0]-i[0],n=s[1]-i[1],o=Math.sqrt(Math.pow(a,2)+Math.pow(n,2));return 0===o?[0,0]:"tangent"===r?[a/o,n/o]:[-n/o,a/o]},tangentOnPath:function(t,e){return this.vectorOnPath(t,e,"tangent")},normalOnPath:function(t,e){return this.vectorOnPath(t,e,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([r],t),extendPrototype([r],e),e.prototype.getValueAtTime=function(t){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shape_pool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),t*=this.elem.globalData.frameRate,(t-=this.offsetTime)!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<t?this._caching.lastIndex:0,this._cachingAtTime.lastTime=t,this.interpolateShape(t,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue},e.prototype.initiateExpression=ExpressionManager.initiateExpression;var n=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(t,e,r,i,s){var a=n(t,e,r,i,s);return a.propertyIndex=e.ix,a.lock=!1,3===r?expressionHelpers.searchExpressions(t,e.pt,a):4===r&&expressionHelpers.searchExpressions(t,e.ks,a),a.k&&t.addDynamicProperty(a),a}}(),TextProperty.prototype.getExpressionValue=function(t,e){var r=this.calculateExpression(e);if(t.t===r)return t;var i={};return this.copyData(i,t),i.t=r.toString(),i.__complete=!1,i},TextProperty.prototype.searchProperty=function(){var t=this.searchKeyframes(),e=this.searchExpressions();return this.kf=t||e,this.kf},TextProperty.prototype.searchExpressions=function(){if(this.data.d.x)return this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0};var ShapeExpressionInterface=function(){function m(t,e,r){var i,s=[],a=t?t.length:0;for(i=0;i<a;i+=1)"gr"==t[i].ty?s.push(n(t[i],e[i],r)):"fl"==t[i].ty?s.push(o(t[i],e[i],r)):"st"==t[i].ty?s.push(h(t[i],e[i],r)):"tm"==t[i].ty?s.push(l(t[i],e[i],r)):"tr"==t[i].ty||("el"==t[i].ty?s.push(p(t[i],e[i],r)):"sr"==t[i].ty?s.push(f(t[i],e[i],r)):"sh"==t[i].ty?s.push(y(t[i],e[i],r)):"rc"==t[i].ty?s.push(c(t[i],e[i],r)):"rd"==t[i].ty?s.push(d(t[i],e[i],r)):"rp"==t[i].ty&&s.push(u(t[i],e[i],r)));return s}function n(t,e,r){var i=function(t){switch(t){case"ADBE Vectors Group":case"Contents":case 2:return i.content;default:return i.transform}};i.propertyGroup=function(t){return 1===t?i:r(t-1)};var s,a,n,o,h,l=(s=t,a=e,n=i.propertyGroup,(h=function(t){for(var e=0,r=o.length;e<r;){if(o[e]._name===t||o[e].mn===t||o[e].propertyIndex===t||o[e].ix===t||o[e].ind===t)return o[e];e+=1}if("number"==typeof t)return o[t-1]}).propertyGroup=function(t){return 1===t?h:n(t-1)},o=m(s.it,a.it,h.propertyGroup),h.numProperties=o.length,h.propertyIndex=s.cix,h._name=s.nm,h),p=function(e,t,r){function i(t){return 1==t?s:r(--t)}t.transform.mProps.o.setGroupProperty(i),t.transform.mProps.p.setGroupProperty(i),t.transform.mProps.a.setGroupProperty(i),t.transform.mProps.s.setGroupProperty(i),t.transform.mProps.r.setGroupProperty(i),t.transform.mProps.sk&&(t.transform.mProps.sk.setGroupProperty(i),t.transform.mProps.sa.setGroupProperty(i));function s(t){return e.a.ix===t||"Anchor Point"===t?s.anchorPoint:e.o.ix===t||"Opacity"===t?s.opacity:e.p.ix===t||"Position"===t?s.position:e.r.ix===t||"Rotation"===t||"ADBE Vector Rotation"===t?s.rotation:e.s.ix===t||"Scale"===t?s.scale:e.sk&&e.sk.ix===t||"Skew"===t?s.skew:e.sa&&e.sa.ix===t||"Skew Axis"===t?s.skewAxis:void 0}return t.transform.op.setGroupProperty(i),Object.defineProperties(s,{opacity:{get:ExpressionPropertyInterface(t.transform.mProps.o)},position:{get:ExpressionPropertyInterface(t.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(t.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(t.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(t.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(t.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(t.transform.mProps.sa)},_name:{value:e.nm}}),s.ty="tr",s.mn=e.mn,s.propertyGroup=r,s}(t.it[t.it.length-1],e.it[e.it.length-1],i.propertyGroup);return i.content=l,i.transform=p,Object.defineProperty(i,"_name",{get:function(){return t.nm}}),i.numProperties=t.np,i.propertyIndex=t.ix,i.nm=t.nm,i.mn=t.mn,i}function o(t,e,r){function i(t){return"Color"===t||"color"===t?i.color:"Opacity"===t||"opacity"===t?i.opacity:void 0}return Object.defineProperties(i,{color:{get:ExpressionPropertyInterface(e.c)},opacity:{get:ExpressionPropertyInterface(e.o)},_name:{value:t.nm},mn:{value:t.mn}}),e.c.setGroupProperty(r),e.o.setGroupProperty(r),i}function h(t,e,r){function i(t){return 1===t?ob:r(t-1)}function s(t){return 1===t?h:i(t-1)}var a,n,o=t.d?t.d.length:0,h={};for(a=0;a<o;a+=1)n=a,Object.defineProperty(h,t.d[n].nm,{get:ExpressionPropertyInterface(e.d.dataProps[n].p)}),e.d.dataProps[a].p.setGroupProperty(s);function l(t){return"Color"===t||"color"===t?l.color:"Opacity"===t||"opacity"===t?l.opacity:"Stroke Width"===t||"stroke width"===t?l.strokeWidth:void 0}return Object.defineProperties(l,{color:{get:ExpressionPropertyInterface(e.c)},opacity:{get:ExpressionPropertyInterface(e.o)},strokeWidth:{get:ExpressionPropertyInterface(e.w)},dash:{get:function(){return h}},_name:{value:t.nm},mn:{value:t.mn}}),e.c.setGroupProperty(i),e.o.setGroupProperty(i),e.w.setGroupProperty(i),l}function l(e,t,r){function i(t){return 1==t?s:r(--t)}function s(t){return t===e.e.ix||"End"===t||"end"===t?s.end:t===e.s.ix?s.start:t===e.o.ix?s.offset:void 0}return s.propertyIndex=e.ix,t.s.setGroupProperty(i),t.e.setGroupProperty(i),t.o.setGroupProperty(i),s.propertyIndex=e.ix,s.propertyGroup=r,Object.defineProperties(s,{start:{get:ExpressionPropertyInterface(t.s)},end:{get:ExpressionPropertyInterface(t.e)},offset:{get:ExpressionPropertyInterface(t.o)},_name:{value:e.nm}}),s.mn=e.mn,s}function p(e,t,r){function i(t){return 1==t?a:r(--t)}a.propertyIndex=e.ix;var s="tm"===t.sh.ty?t.sh.prop:t.sh;function a(t){return e.p.ix===t?a.position:e.s.ix===t?a.size:void 0}return s.s.setGroupProperty(i),s.p.setGroupProperty(i),Object.defineProperties(a,{size:{get:ExpressionPropertyInterface(s.s)},position:{get:ExpressionPropertyInterface(s.p)},_name:{value:e.nm}}),a.mn=e.mn,a}function f(e,t,r){function i(t){return 1==t?a:r(--t)}var s="tm"===t.sh.ty?t.sh.prop:t.sh;function a(t){return e.p.ix===t?a.position:e.r.ix===t?a.rotation:e.pt.ix===t?a.points:e.or.ix===t||"ADBE Vector Star Outer Radius"===t?a.outerRadius:e.os.ix===t?a.outerRoundness:!e.ir||e.ir.ix!==t&&"ADBE Vector Star Inner Radius"!==t?e.is&&e.is.ix===t?a.innerRoundness:void 0:a.innerRadius}return a.propertyIndex=e.ix,s.or.setGroupProperty(i),s.os.setGroupProperty(i),s.pt.setGroupProperty(i),s.p.setGroupProperty(i),s.r.setGroupProperty(i),e.ir&&(s.ir.setGroupProperty(i),s.is.setGroupProperty(i)),Object.defineProperties(a,{position:{get:ExpressionPropertyInterface(s.p)},rotation:{get:ExpressionPropertyInterface(s.r)},points:{get:ExpressionPropertyInterface(s.pt)},outerRadius:{get:ExpressionPropertyInterface(s.or)},outerRoundness:{get:ExpressionPropertyInterface(s.os)},innerRadius:{get:ExpressionPropertyInterface(s.ir)},innerRoundness:{get:ExpressionPropertyInterface(s.is)},_name:{value:e.nm}}),a.mn=e.mn,a}function c(e,t,r){function i(t){return 1==t?a:r(--t)}var s="tm"===t.sh.ty?t.sh.prop:t.sh;function a(t){return e.p.ix===t?a.position:e.r.ix===t?a.roundness:e.s.ix===t||"Size"===t||"ADBE Vector Rect Size"===t?a.size:void 0}return a.propertyIndex=e.ix,s.p.setGroupProperty(i),s.s.setGroupProperty(i),s.r.setGroupProperty(i),Object.defineProperties(a,{position:{get:ExpressionPropertyInterface(s.p)},roundness:{get:ExpressionPropertyInterface(s.r)},size:{get:ExpressionPropertyInterface(s.s)},_name:{value:e.nm}}),a.mn=e.mn,a}function d(e,t,r){var i=t;function s(t){if(e.r.ix===t||"Round Corners 1"===t)return s.radius}return s.propertyIndex=e.ix,i.rd.setGroupProperty(function(t){return 1==t?s:r(--t)}),Object.defineProperties(s,{radius:{get:ExpressionPropertyInterface(i.rd)},_name:{value:e.nm}}),s.mn=e.mn,s}function u(e,t,r){function i(t){return 1==t?a:r(--t)}var s=t;function a(t){return e.c.ix===t||"Copies"===t?a.copies:e.o.ix===t||"Offset"===t?a.offset:void 0}return a.propertyIndex=e.ix,s.c.setGroupProperty(i),s.o.setGroupProperty(i),Object.defineProperties(a,{copies:{get:ExpressionPropertyInterface(s.c)},offset:{get:ExpressionPropertyInterface(s.o)},_name:{value:e.nm}}),a.mn=e.mn,a}function y(t,e,r){var i=e.sh;function s(t){if("Shape"===t||"shape"===t||"Path"===t||"path"===t||"ADBE Vector Shape"===t||2===t)return s.path}return i.setGroupProperty(function(t){return 1==t?s:r(--t)}),Object.defineProperties(s,{path:{get:function(){return i.k&&i.getValue(),i}},shape:{get:function(){return i.k&&i.getValue(),i}},_name:{value:t.nm},ix:{value:t.ix},propertyIndex:{value:t.ix},mn:{value:t.mn}}),s}return function(t,e,r){var i;function s(t){if("number"==typeof t)return i[t-1];for(var e=0,r=i.length;e<r;){if(i[e]._name===t)return i[e];e+=1}}return s.propertyGroup=r,i=m(t,e,s),s.numProperties=i.length,s}}(),TextExpressionInterface=function(e){var r;function t(){}return Object.defineProperty(t,"sourceText",{get:function(){e.textProperty.getValue();var t=e.textProperty.currentData.t;return void 0!==t&&(e.textProperty.currentData.t=void 0,(r=new String(t)).value=t||new String(t)),r}}),t},LayerExpressionInterface=function(){function s(t,e){var r=new Matrix;if(r.reset(),this._elem.finalTransform.mProp.applyToMatrix(r),this._elem.hierarchy&&this._elem.hierarchy.length){var i,s=this._elem.hierarchy.length;for(i=0;i<s;i+=1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(r);return r.applyToPointArray(t[0],t[1],t[2]||0)}return r.applyToPointArray(t[0],t[1],t[2]||0)}function a(t,e){var r=new Matrix;if(r.reset(),this._elem.finalTransform.mProp.applyToMatrix(r),this._elem.hierarchy&&this._elem.hierarchy.length){var i,s=this._elem.hierarchy.length;for(i=0;i<s;i+=1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(r);return r.inversePoint(t)}return r.inversePoint(t)}function n(t){var e=new Matrix;if(e.reset(),this._elem.finalTransform.mProp.applyToMatrix(e),this._elem.hierarchy&&this._elem.hierarchy.length){var r,i=this._elem.hierarchy.length;for(r=0;r<i;r+=1)this._elem.hierarchy[r].finalTransform.mProp.applyToMatrix(e);return e.inversePoint(t)}return e.inversePoint(t)}function o(){return[1,1,1,1]}return function(e){var r;function i(t){switch(t){case"ADBE Root Vectors Group":case"Contents":case 2:return i.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return r;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return i.effect}}i.toWorld=s,i.fromWorld=a,i.toComp=s,i.fromComp=n,i.sampleImage=o,i.sourceRectAtTime=e.sourceRectAtTime.bind(e);var t=getDescriptor(r=TransformExpressionInterface((i._elem=e).finalTransform.mProp),"anchorPoint");return Object.defineProperties(i,{hasParent:{get:function(){return e.hierarchy.length}},parent:{get:function(){return e.hierarchy[0].layerInterface}},rotation:getDescriptor(r,"rotation"),scale:getDescriptor(r,"scale"),position:getDescriptor(r,"position"),opacity:getDescriptor(r,"opacity"),anchorPoint:t,anchor_point:t,transform:{get:function(){return r}},active:{get:function(){return e.isInRange}}}),i.startTime=e.data.st,i.index=e.data.ind,i.source=e.data.refId,i.height=0===e.data.ty?e.data.h:100,i.width=0===e.data.ty?e.data.w:100,i.inPoint=e.data.ip/e.comp.globalData.frameRate,i.outPoint=e.data.op/e.comp.globalData.frameRate,i._name=e.data.nm,i.registerMaskInterface=function(t){i.mask=new MaskManagerInterface(t,e)},i.registerEffectsInterface=function(t){i.effect=t},i}}(),CompExpressionInterface=function(i){function t(t){for(var e=0,r=i.layers.length;e<r;){if(i.layers[e].nm===t||i.layers[e].ind===t)return i.elements[e].layerInterface;e+=1}return null}return Object.defineProperty(t,"_name",{value:i.data.nm}),(t.layer=t).pixelAspect=1,t.height=i.data.h||i.globalData.compSize.h,t.width=i.data.w||i.globalData.compSize.w,t.pixelAspect=1,t.frameDuration=1/i.globalData.frameRate,t.displayStartTime=0,t.numLayers=i.layers.length,t},TransformExpressionInterface=function(t){function e(t){switch(t){case"scale":case"Scale":case"ADBE Scale":case 6:return e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return e.rotation;case"ADBE Rotate X":return e.xRotation;case"ADBE Rotate Y":return e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return e.position;case"ADBE Position_0":return e.xPosition;case"ADBE Position_1":return e.yPosition;case"ADBE Position_2":return e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return e.anchorPoint;case"opacity":case"Opacity":case 11:return e.opacity}}if(Object.defineProperty(e,"rotation",{get:ExpressionPropertyInterface(t.r||t.rz)}),Object.defineProperty(e,"zRotation",{get:ExpressionPropertyInterface(t.rz||t.r)}),Object.defineProperty(e,"xRotation",{get:ExpressionPropertyInterface(t.rx)}),Object.defineProperty(e,"yRotation",{get:ExpressionPropertyInterface(t.ry)}),Object.defineProperty(e,"scale",{get:ExpressionPropertyInterface(t.s)}),t.p)var r=ExpressionPropertyInterface(t.p);return Object.defineProperty(e,"position",{get:function(){return t.p?r():[t.px.v,t.py.v,t.pz?t.pz.v:0]}}),Object.defineProperty(e,"xPosition",{get:ExpressionPropertyInterface(t.px)}),Object.defineProperty(e,"yPosition",{get:ExpressionPropertyInterface(t.py)}),Object.defineProperty(e,"zPosition",{get:ExpressionPropertyInterface(t.pz)}),Object.defineProperty(e,"anchorPoint",{get:ExpressionPropertyInterface(t.a)}),Object.defineProperty(e,"opacity",{get:ExpressionPropertyInterface(t.o)}),Object.defineProperty(e,"skew",{get:ExpressionPropertyInterface(t.sk)}),Object.defineProperty(e,"skewAxis",{get:ExpressionPropertyInterface(t.sa)}),Object.defineProperty(e,"orientation",{get:ExpressionPropertyInterface(t.or)}),e},ProjectInterface=function(){function e(t){this.compositions.push(t)}return function(){function t(t){for(var e=0,r=this.compositions.length;e<r;){if(this.compositions[e].data&&this.compositions[e].data.nm===t)return this.compositions[e].prepareFrame&&this.compositions[e].data.xt&&this.compositions[e].prepareFrame(this.currentFrame),this.compositions[e].compInterface;e+=1}}return t.compositions=[],t.currentFrame=0,t.registerComposition=e,t}}(),EffectsExpressionInterface=function(){function l(s,t,e,r){var i,a=[],n=s.ef.length;for(i=0;i<n;i+=1)5===s.ef[i].ty?a.push(l(s.ef[i],t.effectElements[i],t.effectElements[i].propertyGroup,r)):a.push(p(t.effectElements[i],s.ef[i].ty,r,o));function o(t){return 1===t?h:e(t-1)}var h=function(t){for(var e=s.ef,r=0,i=e.length;r<i;){if(t===e[r].nm||t===e[r].mn||t===e[r].ix)return 5===e[r].ty?a[r]:a[r]();r+=1}return a[0]()};return h.propertyGroup=o,"ADBE Color Control"===s.mn&&Object.defineProperty(h,"color",{get:function(){return a[0]()}}),Object.defineProperty(h,"numProperties",{get:function(){return s.np}}),h.active=h.enabled=0!==s.en,h}function p(t,e,r,i){var s=ExpressionPropertyInterface(t.p);return t.p.setGroupProperty&&t.p.setGroupProperty(i),function(){return 10===e?r.comp.compInterface(t.p.v):s()}}return{createEffectsInterface:function(s,t){if(s.effectsManager){var e,a=[],r=s.data.ef,i=s.effectsManager.effectElements.length;for(e=0;e<i;e+=1)a.push(l(r[e],s.effectsManager.effectElements[e],t,s));return function(t){for(var e=s.data.ef||[],r=0,i=e.length;r<i;){if(t===e[r].nm||t===e[r].mn||t===e[r].ix)return a[r];r+=1}}}}}}(),MaskManagerInterface=function(){function a(t,e){this._mask=t,this._data=e}Object.defineProperty(a.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(a.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),100*this._mask.op.v}});return function(e,t){var r,i=createSizedArray(e.viewData.length),s=e.viewData.length;for(r=0;r<s;r+=1)i[r]=new a(e.viewData[r],e.masksProperties[r]);return function(t){for(r=0;r<s;){if(e.masksProperties[r].nm===t)return i[r];r+=1}}}}(),ExpressionPropertyInterface=function(){var s={pv:0,v:0,mult:1},n={pv:[0,0,0],v:[0,0,0],mult:1};function o(i,s,a){Object.defineProperty(i,"velocity",{get:function(){return s.getVelocityAtTime(s.comp.currentFrame)}}),i.numKeys=s.keyframes?s.keyframes.length:0,i.key=function(t){if(i.numKeys){var e="";e="s"in s.keyframes[t-1]?s.keyframes[t-1].s:"e"in s.keyframes[t-2]?s.keyframes[t-2].e:s.keyframes[t-2].s;var r="unidimensional"===a?new Number(e):Object.assign({},e);return r.time=s.keyframes[t-1].t/s.elem.comp.globalData.frameRate,r}return 0},i.valueAtTime=s.getValueAtTime,i.speedAtTime=s.getSpeedAtTime,i.velocityAtTime=s.getVelocityAtTime,i.propertyGroup=s.propertyGroup}function e(){return s}return function(t){return t?"unidimensional"===t.propType?function(t){t&&"pv"in t||(t=s);var e=1/t.mult,r=t.pv*e,i=new Number(r);return i.value=r,o(i,t,"unidimensional"),function(){return t.k&&t.getValue(),r=t.v*e,i.value!==r&&((i=new Number(r)).value=r,o(i,t,"unidimensional")),i}}(t):function(e){e&&"pv"in e||(e=n);var r=1/e.mult,i=e.pv.length,s=createTypedArray("float32",i),a=createTypedArray("float32",i);return s.value=a,o(s,e,"multidimensional"),function(){e.k&&e.getValue();for(var t=0;t<i;t+=1)s[t]=a[t]=e.v[t]*r;return s}}(t):e}}(),r5,s5;function SliderEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,0,0,r)}function AngleEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,0,0,r)}function ColorEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,1,0,r)}function PointEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,1,0,r)}function LayerIndexEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,0,0,r)}function MaskIndexEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,0,0,r)}function CheckboxEffect(t,e,r){this.p=PropertyFactory.getProp(e,t.v,0,0,r)}function NoValueEffect(){this.p={}}function EffectsManager(){}function EffectsManager(t,e){var r=t.ef||[];this.effectElements=[];var i,s,a=r.length;for(i=0;i<a;i++)s=new GroupEffect(r[i],e),this.effectElements.push(s)}function GroupEffect(t,e){this.init(t,e)}r5=function(){function r(t,e){return this.textIndex=t+1,this.textTotal=e,this.v=this.getValue()*this.mult,this.v}return function(t,e){this.pv=1,this.comp=t.comp,this.elem=t,this.mult=.01,this.propType="textSelector",this.textTotal=e.totalChars,this.selectorValue=100,this.lastValue=[1,1,1],this.k=!0,this.x=!0,this.getValue=ExpressionManager.initiateExpression.bind(this)(t,e,this),this.getMult=r,this.getVelocityAtTime=expressionHelpers.getVelocityAtTime,this.kf?this.getValueAtTime=expressionHelpers.getValueAtTime.bind(this):this.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(this),this.setGroupProperty=expressionHelpers.setGroupProperty}}(),s5=TextSelectorProp.getTextSelectorProp,TextSelectorProp.getTextSelectorProp=function(t,e,r){return 1===e.t?new r5(t,e,r):s5(t,e,r)},extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(t,e){this.data=t,this.effectElements=[],this.initDynamicPropertyContainer(e);var r,i,s=this.data.ef.length,a=this.data.ef;for(r=0;r<s;r+=1){switch(i=null,a[r].ty){case 0:i=new SliderEffect(a[r],e,this);break;case 1:i=new AngleEffect(a[r],e,this);break;case 2:i=new ColorEffect(a[r],e,this);break;case 3:i=new PointEffect(a[r],e,this);break;case 4:case 7:i=new CheckboxEffect(a[r],e,this);break;case 10:i=new LayerIndexEffect(a[r],e,this);break;case 11:i=new MaskIndexEffect(a[r],e,this);break;case 5:i=new EffectsManager(a[r],e,this);break;default:i=new NoValueEffect(a[r],e,this)}i&&this.effectElements.push(i)}};var lottie={},_isFrozen=!1;function setLocationHref(t){locationHref=t}function searchAnimations(){!0===standalone?animationManager.searchAnimations(animationData,standalone,renderer):animationManager.searchAnimations()}function setSubframeRendering(t){subframeEnabled=t}function loadAnimation(t){return!0===standalone&&(t.animationData=JSON.parse(animationData)),animationManager.loadAnimation(t)}function setQuality(t){if("string"==typeof t)switch(t){case"high":defaultCurveSegments=200;break;case"medium":defaultCurveSegments=50;break;case"low":defaultCurveSegments=10}else!isNaN(t)&&1<t&&(defaultCurveSegments=t);roundValues(!(50<=defaultCurveSegments))}function inBrowser(){return"undefined"!=typeof navigator}function installPlugin(t,e){"expressions"===t&&(expressionsPlugin=e)}function getFactory(t){switch(t){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix}}function checkReady(){"complete"===document.readyState&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(t){for(var e=queryString.split("&"),r=0;r<e.length;r++){var i=e[r].split("=");if(decodeURIComponent(i[0])==t)return decodeURIComponent(i[1])}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocationHref,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.__getFactory=getFactory,lottie.version="5.6.8";var standalone="__[STANDALONE]__",animationData="__[ANIMATIONDATA]__",renderer="";if(standalone){var scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""},queryString=myScript.src.replace(/^[^\?]+\??/,"");renderer=getQueryVariable("renderer")}var readyStateCheckInterval=setInterval(checkReady,100);
return lottie;
}));
!function(t){var o=function(o,s){var i,e,n,r,a=!1,c=!1,f=!1,p={},l={to:"top",offset:0,effectsOffset:0,parent:!1,classes:{sticky:"sticky",stickyActive:"sticky-active",stickyEffects:"sticky-effects",spacer:"sticky-spacer"},isRTL:!1,handleScrollbarWidth:!1},d=function(t,o,s){var i={},e=t[0].style;s.forEach((function(t){i[t]=void 0!==e[t]?e[t]:""})),t.data("css-backup-"+o,i)},m=function(t,o){return t.data("css-backup-"+o)};const u=()=>{if(r=b(i,"width"),n=i.offset().left,e.isRTL){const t=e.handleScrollbarWidth?window.innerWidth:document.body.offsetWidth;n=Math.max(t-r-n,0)}};var h=function(){p.$spacer=i.clone().addClass(e.classes.spacer).css({visibility:"hidden",transition:"none",animation:"none"}),i.after(p.$spacer)},y=function(){p.$spacer.remove()},k=function(){d(i,"unsticky",["position","width","margin-top","margin-bottom","top","bottom","inset-inline-start"]);const t={position:"fixed",width:r,marginTop:0,marginBottom:0};t[e.to]=e.offset,t["top"===e.to?"bottom":"top"]="",n&&(t["inset-inline-start"]=n+"px"),i.css(t).addClass(e.classes.stickyActive)},v=function(){i.css(m(i,"unsticky")).removeClass(e.classes.stickyActive)},b=function(t,o,s){var i=getComputedStyle(t[0]),e=parseFloat(i[o]),n="height"===o?["top","bottom"]:["left","right"],r=[];return"border-box"!==i.boxSizing&&r.push("border","padding"),s&&r.push("margin"),r.forEach((function(t){n.forEach((function(o){e+=parseFloat(i[t+"-"+o])}))})),e},w=function(t){var o=p.$window.scrollTop(),s=b(t,"height"),i=innerHeight,e=t.offset().top-o,n=e-i;return{top:{fromTop:e,fromBottom:n},bottom:{fromTop:e+s,fromBottom:n+s}}},g=function(){v(),y(),a=!1,i.trigger("sticky:unstick")},$=function(){var t=w(i),o="top"===e.to;if(c){(o?t.top.fromTop>e.offset:t.bottom.fromBottom<-e.offset)&&(p.$parent.css(m(p.$parent,"childNotFollowing")),i.css(m(i,"notFollowing")),c=!1)}else{var s=w(p.$parent),a=getComputedStyle(p.$parent[0]),f=parseFloat(a[o?"borderBottomWidth":"borderTopWidth"]),l=o?s.bottom.fromTop-f:s.top.fromBottom+f;(o?l<=t.bottom.fromTop:l>=t.top.fromBottom)&&function(){d(p.$parent,"childNotFollowing",["position"]),p.$parent.css("position","relative"),d(i,"notFollowing",["position","inset-inline-start","top","bottom"]);const t={position:"absolute"};if(n=p.$spacer.position().left,e.isRTL){const t=i.parent().outerWidth(),o=p.$spacer.position().left;r=p.$spacer.outerWidth(),n=Math.max(t-r-o,0)}t["inset-inline-start"]=n+"px",t[e.to]="",t["top"===e.to?"bottom":"top"]=0,i.css(t),c=!0}()}},T=function(){var t,o=e.offset;if(a){var s=w(p.$spacer);t="top"===e.to?s.top.fromTop-o:-s.bottom.fromBottom-o,e.parent&&$(),t>0&&g()}else{var n=w(i);(t="top"===e.to?n.top.fromTop-o:-n.bottom.fromBottom-o)<=0&&(u(),h(),k(),a=!0,i.trigger("sticky:stick"),e.parent&&$())}!function(t){f&&-t<e.effectsOffset?(i.removeClass(e.classes.stickyEffects),f=!1):!f&&-t>=e.effectsOffset&&(i.addClass(e.classes.stickyEffects),f=!0)}(t)},B=function(){T()},C=function(){a&&(v(),y(),u(),h(),k(),e.parent&&(c=!1,$()))};this.destroy=function(){a&&g(),p.$window.off("scroll",B).off("resize",C),i.removeClass(e.classes.sticky)},e=jQuery.extend(!0,l,s),i=t(o).addClass(e.classes.sticky),p.$window=t(window),e.parent&&(p.$parent=i.parent(),"parent"!==e.parent&&(p.$parent=p.$parent.closest(e.parent))),p.$window.on({scroll:B,resize:C}),T()};t.fn.sticky=function(s){var i="string"==typeof s;return this.each((function(){var e=t(this);if(i){var n=e.data("sticky");if(!n)throw Error("Trying to perform the `"+s+"` method prior to initialization");if(!n[s])throw ReferenceError("Method `"+s+"` not found in sticky instance");n[s].apply(n,Array.prototype.slice.call(arguments,1)),"destroy"===s&&e.removeData("sticky")}else e.data("sticky",new o(this,s))})),this},window.Sticky=o}(jQuery);
const upgradeToProLink=document.querySelector('.toplevel_page_rtmkit > ul.wp-submenu a[href="admin.php?page=rtmkit-upgrade-to-pro"]'
);
if(upgradeToProLink){
upgradeToProLink.onclick=(e)=> {
e.preventDefault();
window.open("https://rometheme.net/plugins/rtmkit/pricing/", "_blank");
};};
jQuery(window).on("elementor/frontend/init", function (){
elementorFrontend.hooks.addAction("frontend/element_ready/global",
function ($scope, $){
$scope.find("div.rtmkit-wrapper-link").on("click", function (e){
e.preventDefault();
const url=$(this).data("url");
const target=$(this).data("target")||"_self";
const rel=$(this).data("rel")||"";
window.open(url, target, rel);
});
$scope.filter(".rtmkit-wrapper-link").on("click", function (e){
e.preventDefault();
const url=$(this).data("url");
const target=$(this).data("target")||"_self";
const rel=$(this).data("rel")||"";
window.open(url, target, rel);
});
},
);
});
(function (e){
function r(t){
var n=t||window.event,
r=[].slice.call(arguments, 1),
i=0,
s=true,
o=0,
u=0;
t=e.event.fix(n);
t.type="mousewheel";
if(n.wheelDelta){
i=n.wheelDelta / 120;
}
if(n.detail){
i=-n.detail / 3;
}
u=i;
if(n.axis!==undefined&&n.axis===n.HORIZONTAL_AXIS){
u=0;
o=-1 * i;
}
if(n.wheelDeltaY!==undefined){
u=n.wheelDeltaY / 120;
}
if(n.wheelDeltaX!==undefined){
o=(-1 * n.wheelDeltaX) / 120;
}
r.unshift(t, i, o, u);
return (e.event.dispatch||e.event.handle).apply(this, r);
}
var t=["DOMMouseScroll", "mousewheel"];
if(e.event.fixHooks){
for (var n=t.length; n;){
e.event.fixHooks[t[--n]]=e.event.mouseHooks;
}}
e.event.special.mousewheel={
setup: function (){
if(this.addEventListener){
for (var e=t.length; e;){
this.addEventListener(t[--e], r, false);
}}else{
this.onmousewheel=r;
}},
teardown: function (){
if(this.removeEventListener){
for (var e=t.length; e;){
this.removeEventListener(t[--e], r, false);
}}else{
this.onmousewheel=null;
}},
};
e.fn.extend({
mousewheel: function (e){
return e ? this.bind("mousewheel", e):this.trigger("mousewheel");
},
unmousewheel: function (e){
return this.unbind("mousewheel", e);
},
});
})(jQuery);
!(function (a){
"function"==typeof define&&define.amd
? define(["jquery"], a)
: a("object"==typeof exports ? require("jquery"):jQuery);
})(function (a){
var b=(function (){
if(a&&a.fn&&a.fn.mselect2&&a.fn.mselect2.amd) var b=a.fn.mselect2.amd;
var b;
return (
(function (){
if(!b||!b.requirejs){
b ? (c=b):(b={});
var a, c, d;
!(function (b){
function e(a, b){
return u.call(a, b);
}
function f(a, b){
var c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n=b&&b.split("/"),
o=s.map,
p=(o&&o["*"])||{};
if(a&&"."===a.charAt(0))
if(b){
for (
a=a.split("/"),
g=a.length - 1,
s.nodeIdCompat &&
w.test(a[g]) &&
(a[g]=a[g].replace(w, "")),
a=n.slice(0, n.length - 1).concat(a),
k=0;
k < a.length;
k +=1
)
if(((m=a[k]), "."===m)) a.splice(k, 1), (k -=1);
else if(".."===m){
if(1===k&&(".."===a[2]||".."===a[0]))
break;
k > 0&&(a.splice(k - 1, 2), (k -=2));
}
a=a.join("/");
} else 0===a.indexOf("./")&&(a=a.substring(2));
if((n||p)&&o){
for (c=a.split("/"), k=c.length; k > 0; k -=1){
if(((d=c.slice(0, k).join("/")), n))
for (l=n.length; l > 0; l -=1)
if(((e=o[n.slice(0, l).join("/")]),
e&&(e=e[d]))
){
(f=e), (h=k);
break;
}
if(f) break;
!i&&p && p[d]&&((i=p[d]), (j=k));
}
!f&&i && ((f=i), (h=j)),
f&&(c.splice(0, h, f), (a=c.join("/")));
}
return a;
}
function g(a, c){
return function (){
var d=v.call(arguments, 0);
return (
"string"!=typeof d[0]&&1===d.length&&d.push(null),
n.apply(b, d.concat([a, c]))
);
};}
function h(a){
return function (b){
return f(b, a);
};}
function i(a){
return function (b){
q[a]=b;
};}
function j(a){
if(e(r, a)){
var c=r[a];
delete r[a], (t[a] = !0), m.apply(b, c);
}
if(!e(q, a)&&!e(t, a)) throw new Error("No " + a);
return q[a];
}
function k(a){
var b,
c=a ? a.indexOf("!"):-1;
return (
c > -1 &&
((b=a.substring(0, c)),
(a=a.substring(c + 1, a.length))),
[b, a]
);
}
function l(a){
return function (){
return (s&&s.config&&s.config[a])||{};};
}
var m,
n,
o,
p,
q={},
r={},
s={},
t={},
u=Object.prototype.hasOwnProperty,
v=[].slice,
w=/\.js$/;
(o=function (a, b){
var c,
d=k(a),
e=d[0];
return (
(a=d[1]),
e&&((e=f(e, b)), (c=j(e))),
e
? (a=c&&c.normalize ? c.normalize(a, h(b)):f(a, b))
: ((a=f(a, b)),
(d=k(a)),
(e=d[0]),
(a=d[1]),
e&&(c=j(e))),
{ f: e ? e + "!" + a:a, n: a, pr: e, p: c }
);
}),
(p={
require: function (a){
return g(a);
},
exports: function (a){
var b=q[a];
return "undefined"!=typeof b ? b:(q[a]={});
},
module: function (a){
return { id: a, uri: "", exports: q[a], config: l(a) };},
}),
(m=function (a, c, d, f){
var h,
k,
l,
m,
n,
s,
u=[],
v=typeof d;
if(((f=f||a), "undefined"===v||"function"===v)){
for (
c =
!c.length&&d.length
? ["require", "exports", "module"]
: c,
n=0;
n < c.length;
n +=1
)
if(((m=o(c[n], f)), (k=m.f), "require"===k))
u[n]=p.require(a);
else if("exports"===k)
(u[n]=p.exports(a)), (s = !0);
else if("module"===k) h=u[n]=p.module(a);
else if(e(q, k)||e(r, k)||e(t, k)) u[n]=j(k);
else {
if(!m.p) throw new Error(a + " missing " + k);
m.p.load(m.n, g(f, !0), i(k), {}), (u[n]=q[k]);
}
(l=d ? d.apply(q[a], u):void 0),
a &&
(h&&h.exports!==b&&h.exports!==q[a]
? (q[a]=h.exports)
: (l===b&&s)||(q[a]=l));
} else a&&(q[a]=d);
}),
(a=c = n=function (a, c, d, e, f){
if("string"==typeof a) return p[a] ? p[a](c):j(o(a, c).f);
if(!a.splice){
if(((s=a), s.deps&&n(s.deps, s.callback), !c)) return;
c.splice ? ((a=c), (c=d), (d=null)):(a=b);
}
return (
(c=c||function (){}),
"function"==typeof d&&((d=e), (e=f)),
e
? m(b, a, c, d)
: setTimeout(function (){
m(b, a, c, d);
}, 4),
n
);
}),
(n.config=function (a){
return n(a);
}),
(a._defined=q),
(d=function (a, b, c){
if("string"!=typeof a)
throw new Error(
"See almond README: incorrect module build, no module name"
);
b.splice||((c=b), (b=[])),
e(q, a)||e(r, a)||(r[a]=[a, b, c]);
}),
(d.amd={ jQuery: !0 });
})(),
(b.requirejs=a),
(b.require=c),
(b.define=d);
}})(),
b.define("almond", function (){}),
b.define("jquery", [], function (){
var b=a||$;
return (
null==b &&
console &&
console.error &&
console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."
),
b
);
}),
b.define("select2/utils", ["jquery"], function (a){
function b(a){
var b=a.prototype,
c=[];
for (var d in b){
var e=b[d];
"function"==typeof e&&"constructor"!==d&&c.push(d);
}
return c;
}
var c={};
(c.Extend=function (a, b){
function c(){
this.constructor=a;
}
var d={}.hasOwnProperty;
for (var e in b) d.call(b, e)&&(a[e]=b[e]);
return (
(c.prototype=b.prototype),
(a.prototype=new c()),
(a.__super__=b.prototype),
a
);
}),
(c.Decorate=function (a, c){
function d(){
var b=Array.prototype.unshift,
d=c.prototype.constructor.length,
e=a.prototype.constructor;
d > 0 &&
(b.call(arguments, a.prototype.constructor),
(e=c.prototype.constructor)),
e.apply(this, arguments);
}
function e(){
this.constructor=d;
}
var f=b(c),
g=b(a);
(c.displayName=a.displayName), (d.prototype=new e());
for (var h=0; h < g.length; h++){
var i=g[h];
d.prototype[i]=a.prototype[i];
}
for (
var j=function (a){
var b=function (){};
(a in d.prototype)&&(b=d.prototype[a]);
var e=c.prototype[a];
return function (){
var a=Array.prototype.unshift;
return a.call(arguments, b), e.apply(this, arguments);
};},
k=0;
k < f.length;
k++
){
var l=f[k];
d.prototype[l]=j(l);
}
return d;
});
var d=function (){
this.listeners={};};
return (
(d.prototype.on=function (a, b){
(this.listeners=this.listeners||{}),
a in this.listeners
? this.listeners[a].push(b)
: (this.listeners[a]=[b]);
}),
(d.prototype.trigger=function (a){
var b=Array.prototype.slice,
c=b.call(arguments, 1);
(this.listeners=this.listeners||{}),
null==c&&(c=[]),
0===c.length&&c.push({}),
(c[0]._type=a),
a in this.listeners &&
this.invoke(this.listeners[a], b.call(arguments, 1)),
"*" in this.listeners &&
this.invoke(this.listeners["*"], arguments);
}),
(d.prototype.invoke=function (a, b){
for (var c=0, d=a.length; d > c; c++) a[c].apply(this, b);
}),
(c.Observable=d),
(c.generateChars=function (a){
for (var b="", c=0; a > c; c++){
var d=Math.floor(36 * Math.random());
b +=d.toString(36);
}
return b;
}),
(c.bind=function (a, b){
return function (){
a.apply(b, arguments);
};}),
(c._convertData=function (a){
for (var b in a){
var c=b.split("-"),
d=a;
if(1!==c.length){
for (var e=0; e < c.length; e++){
var f=c[e];
(f=f.substring(0, 1).toLowerCase() + f.substring(1)),
f in d||(d[f]={}),
e==c.length - 1&&(d[f]=a[b]),
(d=d[f]);
}
delete a[b];
}}
return a;
}),
(c.hasScroll=function (b, c){
var d=a(c),
e=c.style.overflowX,
f=c.style.overflowY;
return e!==f||("hidden"!==f&&"visible"!==f)
? "scroll"===e||"scroll"===f
? !0
: d.innerHeight() < c.scrollHeight ||
d.innerWidth() < c.scrollWidth
: !1;
}),
(c.escapeMarkup=function (a){
var b={
"\\": "&#92;",
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#47;",
};
return "string"!=typeof a
? a
: String(a).replace(/[&<>"'\/\\]/g, function (a){
return b[a];
});
}),
(c.appendMany=function (b, c){
if("1.7"===a.fn.jquery.substr(0, 3)){
var d=a();
a.map(c, function (a){
d=d.add(a);
}),
(c=d);
}
b.append(c);
}),
c
);
}),
b.define("select2/results", ["jquery", "./utils"], function (a, b){
function c(a, b, d){
(this.$element=a),
(this.data=d),
(this.options=b),
c.__super__.constructor.call(this);
}
return (
b.Extend(c, b.Observable),
(c.prototype.render=function (){
var b=a('<ul class="select2-results__options" role="tree"></ul>');
return (
this.options.get("multiple") &&
b.attr("aria-multiselectable", "true"),
(this.$results=b),
b
);
}),
(c.prototype.clear=function (){
this.$results.empty();
}),
(c.prototype.displayMessage=function (b){
var c=this.options.get("escapeMarkup");
this.clear(), this.hideLoading();
var d=a(
'<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'
),
e=this.options.get("translations").get(b.message);
d.append(c(e(b.args))),
(d[0].className +=" select2-results__message"),
this.$results.append(d);
}),
(c.prototype.hideMessages=function (){
this.$results.find(".select2-results__message").remove();
}),
(c.prototype.append=function (a){
this.hideLoading();
var b=[];
if(null==a.results||0===a.results.length)
return void (
0===this.$results.children().length &&
this.trigger("results:message", { message: "noResults" })
);
a.results=this.sort(a.results);
for (var c=0; c < a.results.length; c++){
var d=a.results[c],
e=this.option(d);
b.push(e);
}
this.$results.append(b);
}),
(c.prototype.position=function (a, b){
var c=b.find(".select2-results");
c.append(a);
}),
(c.prototype.sort=function (a){
var b=this.options.get("sorter");
return b(a);
}),
(c.prototype.highlightFirstItem=function (){
var a=this.$results.find(".select2-results__option[aria-selected]"),
b=a.filter("[aria-selected=true]");
b.length > 0
? b.first().trigger("mouseenter")
: a.first().trigger("mouseenter"),
this.ensureHighlightVisible();
}),
(c.prototype.setClasses=function (){
var b=this;
this.data.current(function (c){
var d=a.map(c, function (a){
return a.id.toString();
}),
e=b.$results.find(".select2-results__option[aria-selected]");
e.each(function (){
var b=a(this),
c=a.data(this, "data"),
e="" + c.id;
(null!=c.element&&c.element.selected) ||
(null==c.element&&a.inArray(e, d) > -1)
? b.attr("aria-selected", "true")
: b.attr("aria-selected", "false");
});
});
}),
(c.prototype.showLoading=function (a){
this.hideLoading();
var b=this.options.get("translations").get("searching"),
c={ disabled: !0, loading: !0, text: b(a) },
d=this.option(c);
(d.className +=" loading-results"), this.$results.prepend(d);
}),
(c.prototype.hideLoading=function (){
this.$results.find(".loading-results").remove();
}),
(c.prototype.option=function (b){
var c=document.createElement("li");
c.className="select2-results__option";
var d={ role: "treeitem", "aria-selected": "false" };
b.disabled &&
(delete d["aria-selected"], (d["aria-disabled"]="true")),
null==b.id&&delete d["aria-selected"],
null!=b._resultId&&(c.id=b._resultId),
b.title&&(c.title=b.title),
b.children &&
((d.role="group"),
(d["aria-label"]=b.text),
delete d["aria-selected"]);
for (var e in d){
var f=d[e];
c.setAttribute(e, f);
}
if(b.children){
var g=a(c),
h=document.createElement("strong");
h.className="select2-results__group";
a(h);
this.template(b, h);
for (var i=[], j=0; j < b.children.length; j++){
var k=b.children[j],
l=this.option(k);
i.push(l);
}
var m=a("<ul></ul>", {
class:
"select2-results__options select2-results__options--nested",
});
m.append(i), g.append(h), g.append(m);
} else this.template(b, c);
return a.data(c, "data", b), c;
}),
(c.prototype.bind=function (b, c){
var d=this,
e=b.id + "-results";
this.$results.attr("id", e),
b.on("results:all", function (a){
d.clear(),
d.append(a.data),
b.isOpen()&&(d.setClasses(), d.highlightFirstItem());
}),
b.on("results:append", function (a){
d.append(a.data), b.isOpen()&&d.setClasses();
}),
b.on("query", function (a){
d.hideMessages(), d.showLoading(a);
}),
b.on("select", function (){
b.isOpen()&&(d.setClasses(), d.highlightFirstItem());
}),
b.on("unselect", function (){
b.isOpen()&&(d.setClasses(), d.highlightFirstItem());
}),
b.on("open", function (){
d.$results.attr("aria-expanded", "true"),
d.$results.attr("aria-hidden", "false"),
d.setClasses(),
d.ensureHighlightVisible();
}),
b.on("close", function (){
d.$results.attr("aria-expanded", "false"),
d.$results.attr("aria-hidden", "true"),
d.$results.removeAttr("aria-activedescendant");
}),
b.on("results:toggle", function (){
var a=d.getHighlightedResults();
0!==a.length&&a.trigger("mouseup");
}),
b.on("results:select", function (){
var a=d.getHighlightedResults();
if(0!==a.length){
var b=a.data("data");
"true"==a.attr("aria-selected")
? d.trigger("close", {})
: d.trigger("select", { data: b });
}}),
b.on("results:previous", function (){
var a=d.getHighlightedResults(),
b=d.$results.find("[aria-selected]"),
c=b.index(a);
if(0!==c){
var e=c - 1;
0===a.length&&(e=0);
var f=b.eq(e);
f.trigger("mouseenter");
var g=d.$results.offset().top,
h=f.offset().top,
i=d.$results.scrollTop() + (h - g);
0===e
? d.$results.scrollTop(0)
: 0 > h - g&&d.$results.scrollTop(i);
}}),
b.on("results:next", function (){
var a=d.getHighlightedResults(),
b=d.$results.find("[aria-selected]"),
c=b.index(a),
e=c + 1;
if(!(e >=b.length)){
var f=b.eq(e);
f.trigger("mouseenter");
var g =
d.$results.offset().top +
d.$results.outerHeight(!1),
h=f.offset().top + f.outerHeight(!1),
i=d.$results.scrollTop() + h - g;
0===e
? d.$results.scrollTop(0)
: h > g&&d.$results.scrollTop(i);
}}),
b.on("results:focus", function (a){
a.element.addClass("select2-results__option--highlighted");
}),
b.on("results:message", function (a){
d.displayMessage(a);
}),
a.fn.mousewheel &&
this.$results.on("mousewheel", function (a){
var b=d.$results.scrollTop(),
c=d.$results.get(0).scrollHeight - b + a.deltaY,
e=a.deltaY > 0&&b - a.deltaY <=0,
f=a.deltaY < 0&&c <=d.$results.height();
e
? (d.$results.scrollTop(0),
a.preventDefault(),
a.stopPropagation())
: f &&
(d.$results.scrollTop(d.$results.get(0).scrollHeight -
d.$results.height()
),
a.preventDefault(),
a.stopPropagation());
}),
this.$results.on("mouseup",
".select2-results__option[aria-selected]",
function (b){
var c=a(this),
e=c.data("data");
return "true"===c.attr("aria-selected")
? void (d.options.get("multiple")
? d.trigger("unselect", {
originalEvent: b,
data: e,
})
: d.trigger("close", {}))
: void d.trigger("select", {
originalEvent: b,
data: e,
});
}
),
this.$results.on("mouseenter",
".select2-results__option[aria-selected]",
function (b){
var c=a(this).data("data");
d
.getHighlightedResults()
.removeClass("select2-results__option--highlighted"),
d.trigger("results:focus", {
data: c,
element: a(this),
});
}
);
}),
(c.prototype.getHighlightedResults=function (){
var a=this.$results.find(".select2-results__option--highlighted");
return a;
}),
(c.prototype.destroy=function (){
this.$results.remove();
}),
(c.prototype.ensureHighlightVisible=function (){
var a=this.getHighlightedResults();
if(0!==a.length){
var b=this.$results.find("[aria-selected]"),
c=b.index(a),
d=this.$results.offset().top,
e=a.offset().top,
f=this.$results.scrollTop() + (e - d),
g=e - d;
(f -=2 * a.outerHeight(!1)),
2 >=c
? this.$results.scrollTop(0)
: (g > this.$results.outerHeight()||0 > g) &&
this.$results.scrollTop(f);
}}),
(c.prototype.template=function (b, c){
var d=this.options.get("templateResult"),
e=this.options.get("escapeMarkup"),
f=d(b, c);
null==f
? (c.style.display="none")
: "string"==typeof f
? (c.innerHTML=e(f))
: a(c).append(f);
}),
c
);
}),
b.define("select2/keys", [], function (){
var a={
BACKSPACE: 8,
TAB: 9,
ENTER: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DELETE: 46,
};
return a;
}),
b.define("select2/selection/base",
["jquery", "../utils", "../keys"],
function (a, b, c){
function d(a, b){
(this.$element=a),
(this.options=b),
d.__super__.constructor.call(this);
}
return (
b.Extend(d, b.Observable),
(d.prototype.render=function (){
var b=a(
'<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"></span>'
);
return (
(this._tabindex=0),
null!=this.$element.data("old-tabindex")
? (this._tabindex=this.$element.data("old-tabindex"))
: null!=this.$element.attr("tabindex") &&
(this._tabindex=this.$element.attr("tabindex")),
b.attr("title", this.$element.attr("title")),
b.attr("tabindex", this._tabindex),
(this.$selection=b),
b
);
}),
(d.prototype.bind=function (a, b){
var d=this,
e=(a.id + "-container", a.id + "-results");
(this.container=a),
this.$selection.on("focus", function (a){
d.trigger("focus", a);
}),
this.$selection.on("blur", function (a){
d._handleBlur(a);
}),
this.$selection.on("keydown", function (a){
d.trigger("keypress", a),
a.which===c.SPACE&&a.preventDefault();
}),
a.on("results:focus", function (a){
d.$selection.attr("aria-activedescendant",
a.data._resultId
);
}),
a.on("selection:update", function (a){
d.update(a.data);
}),
a.on("open", function (){
d.$selection.attr("aria-expanded", "true"),
d.$selection.attr("aria-owns", e),
d._attachCloseHandler(a);
}),
a.on("close", function (){
d.$selection.attr("aria-expanded", "false"),
d.$selection.removeAttr("aria-activedescendant"),
d.$selection.removeAttr("aria-owns"),
d.$selection.focus(),
d._detachCloseHandler(a);
}),
a.on("enable", function (){
d.$selection.attr("tabindex", d._tabindex);
}),
a.on("disable", function (){
d.$selection.attr("tabindex", "-1");
});
}),
(d.prototype._handleBlur=function (b){
var c=this;
window.setTimeout(function (){
document.activeElement==c.$selection[0] ||
a.contains(c.$selection[0], document.activeElement) ||
c.trigger("blur", b);
}, 1);
}),
(d.prototype._attachCloseHandler=function (b){
a(document.body).on("mousedown.select2." + b.id, function (b){
var c=a(b.target),
d=c.closest(".select2"),
e=a(".select2.select2-container--open");
e.each(function (){
var b=a(this);
if(this!=d[0]){
var c=b.data("element");
c.mselect2("close");
}});
});
}),
(d.prototype._detachCloseHandler=function (b){
a(document.body).off("mousedown.select2." + b.id);
}),
(d.prototype.position=function (a, b){
var c=b.find(".selection");
c.append(a);
}),
(d.prototype.destroy=function (){
this._detachCloseHandler(this.container);
}),
(d.prototype.update=function (a){
throw new Error(
"The `update` method must be defined in child classes."
);
}),
d
);
}
),
b.define("select2/selection/single",
["jquery", "./base", "../utils", "../keys"],
function (a, b, c, d){
function e(){
e.__super__.constructor.apply(this, arguments);
}
return (
c.Extend(e, b),
(e.prototype.render=function (){
var a=e.__super__.render.call(this);
return (
a.addClass("select2-selection--single"),
a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'
),
a
);
}),
(e.prototype.bind=function (a, b){
var c=this;
e.__super__.bind.apply(this, arguments);
var d=a.id + "-container";
this.$selection.find(".select2-selection__rendered").attr("id", d),
this.$selection.attr("aria-labelledby", d),
this.$selection.on("mousedown", function (a){
1===a.which&&c.trigger("toggle", { originalEvent: a });
}),
this.$selection.on("focus", function (a){}),
this.$selection.on("blur", function (a){}),
a.on("focus", function (b){
a.isOpen()||c.$selection.focus();
}),
a.on("selection:update", function (a){
c.update(a.data);
});
}),
(e.prototype.clear=function (){
this.$selection.find(".select2-selection__rendered").empty();
}),
(e.prototype.display=function (a, b){
var c=this.options.get("templateSelection"),
d=this.options.get("escapeMarkup");
return d(c(a, b));
}),
(e.prototype.selectionContainer=function (){
return a("<span></span>");
}),
(e.prototype.update=function (a){
if(0===a.length) return void this.clear();
var b=a[0],
c=this.$selection.find(".select2-selection__rendered"),
d=this.display(b, c);
c.empty().append(d), c.prop("title", b.title||b.text);
}),
e
);
}
),
b.define("select2/selection/multiple",
["jquery", "./base", "../utils"],
function (a, b, c){
function d(a, b){
d.__super__.constructor.apply(this, arguments);
}
return (
c.Extend(d, b),
(d.prototype.render=function (){
var a=d.__super__.render.call(this);
return (
a.addClass("select2-selection--multiple"),
a.html('<ul class="select2-selection__rendered"></ul>'),
a
);
}),
(d.prototype.bind=function (b, c){
var e=this;
d.__super__.bind.apply(this, arguments),
this.$selection.on("click", function (a){
e.trigger("toggle", { originalEvent: a });
}),
this.$selection.on("click",
".select2-selection__choice__remove",
function (b){
if(!e.options.get("disabled")){
var c=a(this),
d=c.parent(),
f=d.data("data");
e.trigger("unselect", {
originalEvent: b,
data: f,
});
}}
);
}),
(d.prototype.clear=function (){
this.$selection.find(".select2-selection__rendered").empty();
}),
(d.prototype.display=function (a, b){
var c=this.options.get("templateSelection"),
d=this.options.get("escapeMarkup");
return d(c(a, b));
}),
(d.prototype.selectionContainer=function (){
var b=a(
'<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>'
);
return b;
}),
(d.prototype.update=function (a){
if((this.clear(), 0!==a.length)){
for (var b=[], d=0; d < a.length; d++){
var e=a[d],
f=this.selectionContainer(),
g=this.display(e, f);
f.append(g),
f.prop("title", e.title||e.text),
f.data("data", e),
b.push(f);
}
var h=this.$selection.find(".select2-selection__rendered");
c.appendMany(h, b);
}}),
d
);
}
),
b.define("select2/selection/placeholder", ["../utils"], function (a){
function b(a, b, c){
(this.placeholder=this.normalizePlaceholder(c.get("placeholder"))),
a.call(this, b, c);
}
return (
(b.prototype.normalizePlaceholder=function (a, b){
return "string"==typeof b&&(b={ id: "", text: b }), b;
}),
(b.prototype.createPlaceholder=function (a, b){
var c=this.selectionContainer();
return (
c.html(this.display(b)),
c
.addClass("select2-selection__placeholder")
.removeClass("select2-selection__choice"),
c
);
}),
(b.prototype.update=function (a, b){
var c=1==b.length&&b[0].id!=this.placeholder.id,
d=b.length > 1;
if(d||c) return a.call(this, b);
this.clear();
var e=this.createPlaceholder(this.placeholder);
this.$selection.find(".select2-selection__rendered").append(e);
}),
b
);
}),
b.define("select2/selection/allowClear", ["jquery", "../keys"], function (a, b){
function c(){}
return (
(c.prototype.bind=function (a, b, c){
var d=this;
a.call(this, b, c),
null==this.placeholder &&
this.options.get("debug") &&
window.console &&
console.error &&
console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."
),
this.$selection.on("mousedown",
".select2-selection__clear",
function (a){
d._handleClear(a);
}
),
b.on("keypress", function (a){
d._handleKeyboardClear(a, b);
});
}),
(c.prototype._handleClear=function (a, b){
if(!this.options.get("disabled")){
var c=this.$selection.find(".select2-selection__clear");
if(0!==c.length){
b.stopPropagation();
for (var d=c.data("data"), e=0; e < d.length; e++){
var f={ data: d[e] };
if((this.trigger("unselect", f), f.prevented)) return;
}
this.$element.val(this.placeholder.id).trigger("change"),
this.trigger("toggle", {});
}}
}),
(c.prototype._handleKeyboardClear=function (a, c, d){
d.isOpen() ||
((c.which==b.DELETE||c.which==b.BACKSPACE) &&
this._handleClear(c));
}),
(c.prototype.update=function (b, c){
if((b.call(this, c),
!(
this.$selection.find(".select2-selection__placeholder").length >
0||0===c.length
))
){
var d=a('<span class="select2-selection__clear">&times;</span>');
d.data("data", c),
this.$selection.find(".select2-selection__rendered").prepend(d);
}}),
c
);
}),
b.define("select2/selection/search",
["jquery", "../utils", "../keys"],
function (a, b, c){
function d(a, b, c){
a.call(this, b, c);
}
return (
(d.prototype.render=function (b){
var c=a(
'<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>'
);
(this.$searchContainer=c), (this.$search=c.find("input"));
var d=b.call(this);
return this._transferTabIndex(), d;
}),
(d.prototype.bind=function (a, b, d){
var e=this;
a.call(this, b, d),
b.on("open", function (){
e.$search.trigger("focus");
}),
b.on("close", function (){
e.$search.val(""),
e.$search.removeAttr("aria-activedescendant"),
e.$search.trigger("focus");
}),
b.on("enable", function (){
e.$search.prop("disabled", !1), e._transferTabIndex();
}),
b.on("disable", function (){
e.$search.prop("disabled", !0);
}),
b.on("focus", function (a){
e.$search.trigger("focus");
}),
b.on("results:focus", function (a){
e.$search.attr("aria-activedescendant", a.id);
}),
this.$selection.on("focusin",
".select2-search--inline",
function (a){
e.trigger("focus", a);
}
),
this.$selection.on("focusout",
".select2-search--inline",
function (a){
e._handleBlur(a);
}
),
this.$selection.on("keydown",
".select2-search--inline",
function (a){
a.stopPropagation(),
e.trigger("keypress", a),
(e._keyUpPrevented=a.isDefaultPrevented());
var b=a.which;
if(b===c.BACKSPACE&&""===e.$search.val()){
var d=e.$searchContainer.prev(".select2-selection__choice"
);
if(d.length > 0){
var f=d.data("data");
e.searchRemoveChoice(f), a.preventDefault();
}}
}
);
var f=document.documentMode,
g=f&&11 >=f;
this.$selection.on("input.searchcheck",
".select2-search--inline",
function (a){
return g
? void e.$selection.off("input.search input.searchcheck"
)
: void e.$selection.off("keyup.search");
}
),
this.$selection.on("keyup.search input.search",
".select2-search--inline",
function (a){
if(g&&"input"===a.type)
return void e.$selection.off("input.search input.searchcheck"
);
var b=a.which;
b!=c.SHIFT &&
b!=c.CTRL &&
b!=c.ALT &&
b!=c.TAB &&
e.handleSearch(a);
}
);
}),
(d.prototype._transferTabIndex=function (a){
this.$search.attr("tabindex", this.$selection.attr("tabindex")),
this.$selection.attr("tabindex", "-1");
}),
(d.prototype.createPlaceholder=function (a, b){
this.$search.attr("placeholder", b.text);
}),
(d.prototype.update=function (a, b){
var c=this.$search[0]==document.activeElement;
this.$search.attr("placeholder", ""),
a.call(this, b),
this.$selection
.find(".select2-selection__rendered")
.append(this.$searchContainer),
this.resizeSearch(),
c&&this.$search.focus();
}),
(d.prototype.handleSearch=function (){
if((this.resizeSearch(), !this._keyUpPrevented)){
var a=this.$search.val();
this.trigger("query", { term: a });
}
this._keyUpPrevented = !1;
}),
(d.prototype.searchRemoveChoice=function (a, b){
this.trigger("unselect", { data: b }),
this.$search.val(b.text),
this.handleSearch();
}),
(d.prototype.resizeSearch=function (){
this.$search.css("width", "25px");
var a="";
if(""!==this.$search.attr("placeholder"))
a=this.$selection
.find(".select2-selection__rendered")
.innerWidth();
else {
var b=this.$search.val().length + 1;
a=0.75 * b + "em";
}
this.$search.css("width", a);
}),
d
);
}
),
b.define("select2/selection/eventRelay", ["jquery"], function (a){
function b(){}
return (
(b.prototype.bind=function (b, c, d){
var e=this,
f=[
"open",
"opening",
"close",
"closing",
"select",
"selecting",
"unselect",
"unselecting",
],
g=["opening", "closing", "selecting", "unselecting"];
b.call(this, c, d),
c.on("*", function (b, c){
if(-1!==a.inArray(b, f)){
c=c||{};
var d=a.Event("select2:" + b, { params: c });
e.$element.trigger(d),
-1!==a.inArray(b, g) &&
(c.prevented=d.isDefaultPrevented());
}});
}),
b
);
}),
b.define("select2/translation", ["jquery", "require"], function (a, b){
function c(a){
this.dict=a||{};}
return (
(c.prototype.all=function (){
return this.dict;
}),
(c.prototype.get=function (a){
return this.dict[a];
}),
(c.prototype.extend=function (b){
this.dict=a.extend({}, b.all(), this.dict);
}),
(c._cache={}),
(c.loadPath=function (a){
if(!(a in c._cache)){
var d=b(a);
c._cache[a]=d;
}
return new c(c._cache[a]);
}),
c
);
}),
b.define("select2/diacritics", [], function (){
var a={
"Ⓐ": "A",
Ａ: "A",
À: "A",
Á: "A",
Â: "A",
Ầ: "A",
Ấ: "A",
Ẫ: "A",
Ẩ: "A",
Ã: "A",
Ā: "A",
Ă: "A",
Ằ: "A",
Ắ: "A",
Ẵ: "A",
Ẳ: "A",
Ȧ: "A",
Ǡ: "A",
Ä: "A",
Ǟ: "A",
Ả: "A",
Å: "A",
Ǻ: "A",
Ǎ: "A",
Ȁ: "A",
Ȃ: "A",
Ạ: "A",
Ậ: "A",
Ặ: "A",
Ḁ: "A",
Ą: "A",
Ⱥ: "A",
Ɐ: "A",
Ꜳ: "AA",
Æ: "AE",
Ǽ: "AE",
Ǣ: "AE",
Ꜵ: "AO",
Ꜷ: "AU",
Ꜹ: "AV",
Ꜻ: "AV",
Ꜽ: "AY",
"Ⓑ": "B",
Ｂ: "B",
Ḃ: "B",
Ḅ: "B",
Ḇ: "B",
Ƀ: "B",
Ƃ: "B",
Ɓ: "B",
"Ⓒ": "C",
Ｃ: "C",
Ć: "C",
Ĉ: "C",
Ċ: "C",
Č: "C",
Ç: "C",
Ḉ: "C",
Ƈ: "C",
Ȼ: "C",
Ꜿ: "C",
"Ⓓ": "D",
Ｄ: "D",
Ḋ: "D",
Ď: "D",
Ḍ: "D",
Ḑ: "D",
Ḓ: "D",
Ḏ: "D",
Đ: "D",
Ƌ: "D",
Ɗ: "D",
Ɖ: "D",
Ꝺ: "D",
Ǳ: "DZ",
Ǆ: "DZ",
ǲ: "Dz",
ǅ: "Dz",
"Ⓔ": "E",
Ｅ: "E",
È: "E",
É: "E",
Ê: "E",
Ề: "E",
Ế: "E",
Ễ: "E",
Ể: "E",
Ẽ: "E",
Ē: "E",
Ḕ: "E",
Ḗ: "E",
Ĕ: "E",
Ė: "E",
Ë: "E",
Ẻ: "E",
Ě: "E",
Ȅ: "E",
Ȇ: "E",
Ẹ: "E",
Ệ: "E",
Ȩ: "E",
Ḝ: "E",
Ę: "E",
Ḙ: "E",
Ḛ: "E",
Ɛ: "E",
Ǝ: "E",
"Ⓕ": "F",
Ｆ: "F",
Ḟ: "F",
Ƒ: "F",
Ꝼ: "F",
"Ⓖ": "G",
Ｇ: "G",
Ǵ: "G",
Ĝ: "G",
Ḡ: "G",
Ğ: "G",
Ġ: "G",
Ǧ: "G",
Ģ: "G",
Ǥ: "G",
Ɠ: "G",
Ꞡ: "G",
Ᵹ: "G",
Ꝿ: "G",
"Ⓗ": "H",
Ｈ: "H",
Ĥ: "H",
Ḣ: "H",
Ḧ: "H",
Ȟ: "H",
Ḥ: "H",
Ḩ: "H",
Ḫ: "H",
Ħ: "H",
Ⱨ: "H",
Ⱶ: "H",
Ɥ: "H",
"Ⓘ": "I",
Ｉ: "I",
Ì: "I",
Í: "I",
Î: "I",
Ĩ: "I",
Ī: "I",
Ĭ: "I",
İ: "I",
Ï: "I",
Ḯ: "I",
Ỉ: "I",
Ǐ: "I",
Ȉ: "I",
Ȋ: "I",
Ị: "I",
Į: "I",
Ḭ: "I",
Ɨ: "I",
"Ⓙ": "J",
Ｊ: "J",
Ĵ: "J",
Ɉ: "J",
"Ⓚ": "K",
Ｋ: "K",
Ḱ: "K",
Ǩ: "K",
Ḳ: "K",
Ķ: "K",
Ḵ: "K",
Ƙ: "K",
Ⱪ: "K",
Ꝁ: "K",
Ꝃ: "K",
Ꝅ: "K",
Ꞣ: "K",
"Ⓛ": "L",
Ｌ: "L",
Ŀ: "L",
Ĺ: "L",
Ľ: "L",
Ḷ: "L",
Ḹ: "L",
Ļ: "L",
Ḽ: "L",
Ḻ: "L",
Ł: "L",
Ƚ: "L",
Ɫ: "L",
Ⱡ: "L",
Ꝉ: "L",
Ꝇ: "L",
Ꞁ: "L",
Ǉ: "LJ",
ǈ: "Lj",
"Ⓜ": "M",
Ｍ: "M",
Ḿ: "M",
Ṁ: "M",
Ṃ: "M",
Ɱ: "M",
Ɯ: "M",
"Ⓝ": "N",
Ｎ: "N",
Ǹ: "N",
Ń: "N",
Ñ: "N",
Ṅ: "N",
Ň: "N",
Ṇ: "N",
Ņ: "N",
Ṋ: "N",
Ṉ: "N",
Ƞ: "N",
Ɲ: "N",
Ꞑ: "N",
Ꞥ: "N",
Ǌ: "NJ",
ǋ: "Nj",
"Ⓞ": "O",
Ｏ: "O",
Ò: "O",
Ó: "O",
Ô: "O",
Ồ: "O",
Ố: "O",
Ỗ: "O",
Ổ: "O",
Õ: "O",
Ṍ: "O",
Ȭ: "O",
Ṏ: "O",
Ō: "O",
Ṑ: "O",
Ṓ: "O",
Ŏ: "O",
Ȯ: "O",
Ȱ: "O",
Ö: "O",
Ȫ: "O",
Ỏ: "O",
Ő: "O",
Ǒ: "O",
Ȍ: "O",
Ȏ: "O",
Ơ: "O",
Ờ: "O",
Ớ: "O",
Ỡ: "O",
Ở: "O",
Ợ: "O",
Ọ: "O",
Ộ: "O",
Ǫ: "O",
Ǭ: "O",
Ø: "O",
Ǿ: "O",
Ɔ: "O",
Ɵ: "O",
Ꝋ: "O",
Ꝍ: "O",
Ƣ: "OI",
Ꝏ: "OO",
Ȣ: "OU",
"Ⓟ": "P",
Ｐ: "P",
Ṕ: "P",
Ṗ: "P",
Ƥ: "P",
Ᵽ: "P",
Ꝑ: "P",
Ꝓ: "P",
Ꝕ: "P",
"Ⓠ": "Q",
Ｑ: "Q",
Ꝗ: "Q",
Ꝙ: "Q",
Ɋ: "Q",
"Ⓡ": "R",
Ｒ: "R",
Ŕ: "R",
Ṙ: "R",
Ř: "R",
Ȑ: "R",
Ȓ: "R",
Ṛ: "R",
Ṝ: "R",
Ŗ: "R",
Ṟ: "R",
Ɍ: "R",
Ɽ: "R",
Ꝛ: "R",
Ꞧ: "R",
Ꞃ: "R",
"Ⓢ": "S",
Ｓ: "S",
ẞ: "S",
Ś: "S",
Ṥ: "S",
Ŝ: "S",
Ṡ: "S",
Š: "S",
Ṧ: "S",
Ṣ: "S",
Ṩ: "S",
Ș: "S",
Ş: "S",
Ȿ: "S",
Ꞩ: "S",
Ꞅ: "S",
"Ⓣ": "T",
Ｔ: "T",
Ṫ: "T",
Ť: "T",
Ṭ: "T",
Ț: "T",
Ţ: "T",
Ṱ: "T",
Ṯ: "T",
Ŧ: "T",
Ƭ: "T",
Ʈ: "T",
Ⱦ: "T",
Ꞇ: "T",
Ꜩ: "TZ",
"Ⓤ": "U",
Ｕ: "U",
Ù: "U",
Ú: "U",
Û: "U",
Ũ: "U",
Ṹ: "U",
Ū: "U",
Ṻ: "U",
Ŭ: "U",
Ü: "U",
Ǜ: "U",
Ǘ: "U",
Ǖ: "U",
Ǚ: "U",
Ủ: "U",
Ů: "U",
Ű: "U",
Ǔ: "U",
Ȕ: "U",
Ȗ: "U",
Ư: "U",
Ừ: "U",
Ứ: "U",
Ữ: "U",
Ử: "U",
Ự: "U",
Ụ: "U",
Ṳ: "U",
Ų: "U",
Ṷ: "U",
Ṵ: "U",
Ʉ: "U",
"Ⓥ": "V",
Ｖ: "V",
Ṽ: "V",
Ṿ: "V",
Ʋ: "V",
Ꝟ: "V",
Ʌ: "V",
Ꝡ: "VY",
"Ⓦ": "W",
Ｗ: "W",
Ẁ: "W",
Ẃ: "W",
Ŵ: "W",
Ẇ: "W",
Ẅ: "W",
Ẉ: "W",
Ⱳ: "W",
"Ⓧ": "X",
Ｘ: "X",
Ẋ: "X",
Ẍ: "X",
"Ⓨ": "Y",
Ｙ: "Y",
Ỳ: "Y",
Ý: "Y",
Ŷ: "Y",
Ỹ: "Y",
Ȳ: "Y",
Ẏ: "Y",
Ÿ: "Y",
Ỷ: "Y",
Ỵ: "Y",
Ƴ: "Y",
Ɏ: "Y",
Ỿ: "Y",
"Ⓩ": "Z",
Ｚ: "Z",
Ź: "Z",
Ẑ: "Z",
Ż: "Z",
Ž: "Z",
Ẓ: "Z",
Ẕ: "Z",
Ƶ: "Z",
Ȥ: "Z",
Ɀ: "Z",
Ⱬ: "Z",
Ꝣ: "Z",
"ⓐ": "a",
ａ: "a",
ẚ: "a",
à: "a",
á: "a",
â: "a",
ầ: "a",
ấ: "a",
ẫ: "a",
ẩ: "a",
ã: "a",
ā: "a",
ă: "a",
ằ: "a",
ắ: "a",
ẵ: "a",
ẳ: "a",
ȧ: "a",
ǡ: "a",
ä: "a",
ǟ: "a",
ả: "a",
å: "a",
ǻ: "a",
ǎ: "a",
ȁ: "a",
ȃ: "a",
ạ: "a",
ậ: "a",
ặ: "a",
ḁ: "a",
ą: "a",
ⱥ: "a",
ɐ: "a",
ꜳ: "aa",
æ: "ae",
ǽ: "ae",
ǣ: "ae",
ꜵ: "ao",
ꜷ: "au",
ꜹ: "av",
ꜻ: "av",
ꜽ: "ay",
"ⓑ": "b",
ｂ: "b",
ḃ: "b",
ḅ: "b",
ḇ: "b",
ƀ: "b",
ƃ: "b",
ɓ: "b",
"ⓒ": "c",
ｃ: "c",
ć: "c",
ĉ: "c",
ċ: "c",
č: "c",
ç: "c",
ḉ: "c",
ƈ: "c",
ȼ: "c",
ꜿ: "c",
ↄ: "c",
"ⓓ": "d",
ｄ: "d",
ḋ: "d",
ď: "d",
ḍ: "d",
ḑ: "d",
ḓ: "d",
ḏ: "d",
đ: "d",
ƌ: "d",
ɖ: "d",
ɗ: "d",
ꝺ: "d",
ǳ: "dz",
ǆ: "dz",
"ⓔ": "e",
ｅ: "e",
è: "e",
é: "e",
ê: "e",
ề: "e",
ế: "e",
ễ: "e",
ể: "e",
ẽ: "e",
ē: "e",
ḕ: "e",
ḗ: "e",
ĕ: "e",
ė: "e",
ë: "e",
ẻ: "e",
ě: "e",
ȅ: "e",
ȇ: "e",
ẹ: "e",
ệ: "e",
ȩ: "e",
ḝ: "e",
ę: "e",
ḙ: "e",
ḛ: "e",
ɇ: "e",
ɛ: "e",
ǝ: "e",
"ⓕ": "f",
ｆ: "f",
ḟ: "f",
ƒ: "f",
ꝼ: "f",
"ⓖ": "g",
ｇ: "g",
ǵ: "g",
ĝ: "g",
ḡ: "g",
ğ: "g",
ġ: "g",
ǧ: "g",
ģ: "g",
ǥ: "g",
ɠ: "g",
ꞡ: "g",
ᵹ: "g",
ꝿ: "g",
"ⓗ": "h",
ｈ: "h",
ĥ: "h",
ḣ: "h",
ḧ: "h",
ȟ: "h",
ḥ: "h",
ḩ: "h",
ḫ: "h",
ẖ: "h",
ħ: "h",
ⱨ: "h",
ⱶ: "h",
ɥ: "h",
ƕ: "hv",
"ⓘ": "i",
ｉ: "i",
ì: "i",
í: "i",
î: "i",
ĩ: "i",
ī: "i",
ĭ: "i",
ï: "i",
ḯ: "i",
ỉ: "i",
ǐ: "i",
ȉ: "i",
ȋ: "i",
ị: "i",
į: "i",
ḭ: "i",
ɨ: "i",
ı: "i",
"ⓙ": "j",
ｊ: "j",
ĵ: "j",
ǰ: "j",
ɉ: "j",
"ⓚ": "k",
ｋ: "k",
ḱ: "k",
ǩ: "k",
ḳ: "k",
ķ: "k",
ḵ: "k",
ƙ: "k",
ⱪ: "k",
ꝁ: "k",
ꝃ: "k",
ꝅ: "k",
ꞣ: "k",
"ⓛ": "l",
ｌ: "l",
ŀ: "l",
ĺ: "l",
ľ: "l",
ḷ: "l",
ḹ: "l",
ļ: "l",
ḽ: "l",
ḻ: "l",
ſ: "l",
ł: "l",
ƚ: "l",
ɫ: "l",
ⱡ: "l",
ꝉ: "l",
ꞁ: "l",
ꝇ: "l",
ǉ: "lj",
"ⓜ": "m",
ｍ: "m",
ḿ: "m",
ṁ: "m",
ṃ: "m",
ɱ: "m",
ɯ: "m",
"ⓝ": "n",
ｎ: "n",
ǹ: "n",
ń: "n",
ñ: "n",
ṅ: "n",
ň: "n",
ṇ: "n",
ņ: "n",
ṋ: "n",
ṉ: "n",
ƞ: "n",
ɲ: "n",
ŉ: "n",
ꞑ: "n",
ꞥ: "n",
ǌ: "nj",
"ⓞ": "o",
ｏ: "o",
ò: "o",
ó: "o",
ô: "o",
ồ: "o",
ố: "o",
ỗ: "o",
ổ: "o",
õ: "o",
ṍ: "o",
ȭ: "o",
ṏ: "o",
ō: "o",
ṑ: "o",
ṓ: "o",
ŏ: "o",
ȯ: "o",
ȱ: "o",
ö: "o",
ȫ: "o",
ỏ: "o",
ő: "o",
ǒ: "o",
ȍ: "o",
ȏ: "o",
ơ: "o",
ờ: "o",
ớ: "o",
ỡ: "o",
ở: "o",
ợ: "o",
ọ: "o",
ộ: "o",
ǫ: "o",
ǭ: "o",
ø: "o",
ǿ: "o",
ɔ: "o",
ꝋ: "o",
ꝍ: "o",
ɵ: "o",
ƣ: "oi",
ȣ: "ou",
ꝏ: "oo",
"ⓟ": "p",
ｐ: "p",
ṕ: "p",
ṗ: "p",
ƥ: "p",
ᵽ: "p",
ꝑ: "p",
ꝓ: "p",
ꝕ: "p",
"ⓠ": "q",
ｑ: "q",
ɋ: "q",
ꝗ: "q",
ꝙ: "q",
"ⓡ": "r",
ｒ: "r",
ŕ: "r",
ṙ: "r",
ř: "r",
ȑ: "r",
ȓ: "r",
ṛ: "r",
ṝ: "r",
ŗ: "r",
ṟ: "r",
ɍ: "r",
ɽ: "r",
ꝛ: "r",
ꞧ: "r",
ꞃ: "r",
"ⓢ": "s",
ｓ: "s",
ß: "s",
ś: "s",
ṥ: "s",
ŝ: "s",
ṡ: "s",
š: "s",
ṧ: "s",
ṣ: "s",
ṩ: "s",
ș: "s",
ş: "s",
ȿ: "s",
ꞩ: "s",
ꞅ: "s",
ẛ: "s",
"ⓣ": "t",
ｔ: "t",
ṫ: "t",
ẗ: "t",
ť: "t",
ṭ: "t",
ț: "t",
ţ: "t",
ṱ: "t",
ṯ: "t",
ŧ: "t",
ƭ: "t",
ʈ: "t",
ⱦ: "t",
ꞇ: "t",
ꜩ: "tz",
"ⓤ": "u",
ｕ: "u",
ù: "u",
ú: "u",
û: "u",
ũ: "u",
ṹ: "u",
ū: "u",
ṻ: "u",
ŭ: "u",
ü: "u",
ǜ: "u",
ǘ: "u",
ǖ: "u",
ǚ: "u",
ủ: "u",
ů: "u",
ű: "u",
ǔ: "u",
ȕ: "u",
ȗ: "u",
ư: "u",
ừ: "u",
ứ: "u",
ữ: "u",
ử: "u",
ự: "u",
ụ: "u",
ṳ: "u",
ų: "u",
ṷ: "u",
ṵ: "u",
ʉ: "u",
"ⓥ": "v",
ｖ: "v",
ṽ: "v",
ṿ: "v",
ʋ: "v",
ꝟ: "v",
ʌ: "v",
ꝡ: "vy",
"ⓦ": "w",
ｗ: "w",
ẁ: "w",
ẃ: "w",
ŵ: "w",
ẇ: "w",
ẅ: "w",
ẘ: "w",
ẉ: "w",
ⱳ: "w",
"ⓧ": "x",
ｘ: "x",
ẋ: "x",
ẍ: "x",
"ⓨ": "y",
ｙ: "y",
ỳ: "y",
ý: "y",
ŷ: "y",
ỹ: "y",
ȳ: "y",
ẏ: "y",
ÿ: "y",
ỷ: "y",
ẙ: "y",
ỵ: "y",
ƴ: "y",
ɏ: "y",
ỿ: "y",
"ⓩ": "z",
ｚ: "z",
ź: "z",
ẑ: "z",
ż: "z",
ž: "z",
ẓ: "z",
ẕ: "z",
ƶ: "z",
ȥ: "z",
ɀ: "z",
ⱬ: "z",
ꝣ: "z",
Ά: "Α",
Έ: "Ε",
Ή: "Η",
Ί: "Ι",
Ϊ: "Ι",
Ό: "Ο",
Ύ: "Υ",
Ϋ: "Υ",
Ώ: "Ω",
ά: "α",
έ: "ε",
ή: "η",
ί: "ι",
ϊ: "ι",
ΐ: "ι",
ό: "ο",
ύ: "υ",
ϋ: "υ",
ΰ: "υ",
ω: "ω",
ς: "σ",
};
return a;
}),
b.define("select2/data/base", ["../utils"], function (a){
function b(a, c){
b.__super__.constructor.call(this);
}
return (
a.Extend(b, a.Observable),
(b.prototype.current=function (a){
throw new Error(
"The `current` method must be defined in child classes."
);
}),
(b.prototype.query=function (a, b){
throw new Error("The `query` method must be defined in child classes.");
}),
(b.prototype.bind=function (a, b){}),
(b.prototype.destroy=function (){}),
(b.prototype.generateResultId=function (b, c){
var d=b.id + "-result-";
return (
(d +=a.generateChars(4)),
(d +=
null!=c.id ? "-" + c.id.toString():"-" + a.generateChars(4))
);
}),
b
);
}),
b.define("select2/data/select",
["./base", "../utils", "jquery"],
function (a, b, c){
function d(a, b){
(this.$element=a),
(this.options=b),
d.__super__.constructor.call(this);
}
return (
b.Extend(d, a),
(d.prototype.current=function (a){
var b=[],
d=this;
this.$element.find(":selected").each(function (){
var a=c(this),
e=d.item(a);
b.push(e);
}),
a(b);
}),
(d.prototype.select=function (a){
var b=this;
if(((a.selected = !0), c(a.element).is("option")))
return (
(a.element.selected = !0),
void this.$element.trigger("change")
);
if(this.$element.prop("multiple"))
this.current(function (d){
var e=[];
(a=[a]), a.push.apply(a, d);
for (var f=0; f < a.length; f++){
var g=a[f].id;
-1===c.inArray(g, e)&&e.push(g);
}
b.$element.val(e), b.$element.trigger("change");
});
else {
var d=a.id;
this.$element.val(d), this.$element.trigger("change");
}}),
(d.prototype.unselect=function (a){
var b=this;
if(this.$element.prop("multiple"))
return (
(a.selected = !1),
c(a.element).is("option")
? ((a.element.selected = !1),
void this.$element.trigger("change"))
: void this.current(function (d){
for (var e=[], f=0; f < d.length; f++){
var g=d[f].id;
g!==a.id &&
-1===c.inArray(g, e) &&
e.push(g);
}
b.$element.val(e), b.$element.trigger("change");
})
);
}),
(d.prototype.bind=function (a, b){
var c=this;
(this.container=a),
a.on("select", function (a){
c.select(a.data);
}),
a.on("unselect", function (a){
c.unselect(a.data);
});
}),
(d.prototype.destroy=function (){
this.$element.find("*").each(function (){
c.removeData(this, "data");
});
}),
(d.prototype.query=function (a, b){
var d=[],
e=this,
f=this.$element.children();
f.each(function (){
var b=c(this);
if(b.is("option")||b.is("optgroup")){
var f=e.item(b),
g=e.matches(a, f);
null!==g&&d.push(g);
}}),
b({ results: d });
}),
(d.prototype.addOptions=function (a){
b.appendMany(this.$element, a);
}),
(d.prototype.option=function (a){
var b;
a.children
? ((b=document.createElement("optgroup")), (b.label=a.text))
: ((b=document.createElement("option")),
void 0!==b.textContent
? (b.textContent=a.text)
: (b.innerText=a.text)),
a.id&&(b.value=a.id),
a.disabled&&(b.disabled = !0),
a.selected&&(b.selected = !0),
a.title&&(b.title=a.title);
var d=c(b),
e=this._normalizeItem(a);
return (e.element=b), c.data(b, "data", e), d;
}),
(d.prototype.item=function (a){
var b={};
if(((b=c.data(a[0], "data")), null!=b)) return b;
if(a.is("option"))
b={
id: a.val(),
text: a.text(),
disabled: a.prop("disabled"),
selected: a.prop("selected"),
title: a.prop("title"),
};
else if(a.is("optgroup")){
b={
text: a.prop("label"),
children: [],
title: a.prop("title"),
};
for (
var d=a.children("option"), e=[], f=0;
f < d.length;
f++
){
var g=c(d[f]),
h=this.item(g);
e.push(h);
}
b.children=e;
}
return (
(b=this._normalizeItem(b)),
(b.element=a[0]),
c.data(a[0], "data", b),
b
);
}),
(d.prototype._normalizeItem=function (a){
c.isPlainObject(a)||(a={ id: a, text: a }),
(a=c.extend({}, { text: "" }, a));
var b={ selected: !1, disabled: !1 };
return (
null!=a.id&&(a.id=a.id.toString()),
null!=a.text&&(a.text=a.text.toString()),
null==a._resultId &&
a.id &&
null!=this.container &&
(a._resultId=this.generateResultId(this.container, a)),
c.extend({}, b, a)
);
}),
(d.prototype.matches=function (a, b){
var c=this.options.get("matcher");
return c(a, b);
}),
d
);
}
),
b.define("select2/data/array",
["./select", "../utils", "jquery"],
function (a, b, c){
function d(a, b){
var c=b.get("data")||[];
d.__super__.constructor.call(this, a, b),
this.addOptions(this.convertToOptions(c));
}
return (
b.Extend(d, a),
(d.prototype.select=function (a){
var b=this.$element.find("option").filter(function (b, c){
return c.value==a.id.toString();
});
0===b.length&&((b=this.option(a)), this.addOptions(b)),
d.__super__.select.call(this, a);
}),
(d.prototype.convertToOptions=function (a){
function d(a){
return function (){
return c(this).val()==a.id;
};}
for (
var e=this,
f=this.$element.find("option"),
g=f
.map(function (){
return e.item(c(this)).id;
})
.get(),
h=[],
i=0;
i < a.length;
i++
){
var j=this._normalizeItem(a[i]);
if(c.inArray(j.id, g) >=0){
var k=f.filter(d(j)),
l=this.item(k),
m=c.extend(!0, {}, j, l),
n=this.option(m);
k.replaceWith(n);
}else{
var o=this.option(j);
if(j.children){
var p=this.convertToOptions(j.children);
b.appendMany(o, p);
}
h.push(o);
}}
return h;
}),
d
);
}
),
b.define("select2/data/ajax",
["./array", "../utils", "jquery"],
function (a, b, c){
function d(a, b){
(this.ajaxOptions=this._applyDefaults(b.get("ajax"))),
null!=this.ajaxOptions.processResults &&
(this.processResults=this.ajaxOptions.processResults),
d.__super__.constructor.call(this, a, b);
}
return (
b.Extend(d, a),
(d.prototype._applyDefaults=function (a){
var b={
data: function (a){
return c.extend({}, a, { q: a.term });
},
transport: function (a, b, d){
var e=c.ajax(a);
return e.then(b), e.fail(d), e;
},
};
return c.extend({}, b, a, !0);
}),
(d.prototype.processResults=function (a){
return a;
}),
(d.prototype.query=function (a, b){
function d(){
var d=f.transport(f,
function (d){
var f=e.processResults(d, a);
e.options.get("debug") &&
window.console &&
console.error &&
((f&&f.results&&c.isArray(f.results)) ||
console.error("Select2: The AJAX results did not return an array in the `results` key of the response."
)),
b(f);
},
function (){
(d.status&&"0"===d.status) ||
e.trigger("results:message", {
message: "errorLoading",
});
}
);
e._request=d;
}
var e=this;
null!=this._request &&
(c.isFunction(this._request.abort)&&this._request.abort(),
(this._request=null));
var f=c.extend({ type: "GET" }, this.ajaxOptions);
"function"==typeof f.url &&
(f.url=f.url.call(this.$element, a)),
"function"==typeof f.data &&
(f.data=f.data.call(this.$element, a)),
this.ajaxOptions.delay&&null!=a.term
? (this._queryTimeout &&
window.clearTimeout(this._queryTimeout),
(this._queryTimeout=window.setTimeout(d,
this.ajaxOptions.delay
)))
: d();
}),
d
);
}
),
b.define("select2/data/tags", ["jquery"], function (a){
function b(b, c, d){
var e=d.get("tags"),
f=d.get("createTag");
void 0!==f&&(this.createTag=f);
var g=d.get("insertTag");
if((void 0!==g&&(this.insertTag=g), b.call(this, c, d), a.isArray(e))
)
for (var h=0; h < e.length; h++){
var i=e[h],
j=this._normalizeItem(i),
k=this.option(j);
this.$element.append(k);
}}
return (
(b.prototype.query=function (a, b, c){
function d(a, f){
for (var g=a.results, h=0; h < g.length; h++){
var i=g[h],
j=null!=i.children&&!d({ results: i.children }, !0),
k=i.text===b.term;
if(k||j) return f ? !1:((a.data=g), void c(a));
}
if(f) return !0;
var l=e.createTag(b);
if(null!=l){
var m=e.option(l);
m.attr("data-select2-tag", !0),
e.addOptions([m]),
e.insertTag(g, l);
}
(a.results=g), c(a);
}
var e=this;
return (
this._removeOldTags(),
null==b.term||null!=b.page
? void a.call(this, b, c)
: void a.call(this, b, d)
);
}),
(b.prototype.createTag=function (b, c){
var d=a.trim(c.term);
return ""===d ? null:{ id: d, text: d };}),
(b.prototype.insertTag=function (a, b, c){
b.unshift(c);
}),
(b.prototype._removeOldTags=function (b){
var c=(this._lastTag, this.$element.find("option[data-select2-tag]"));
c.each(function (){
this.selected||a(this).remove();
});
}),
b
);
}),
b.define("select2/data/tokenizer", ["jquery"], function (a){
function b(a, b, c){
var d=c.get("tokenizer");
void 0!==d&&(this.tokenizer=d), a.call(this, b, c);
}
return (
(b.prototype.bind=function (a, b, c){
a.call(this, b, c),
(this.$search =
b.dropdown.$search ||
b.selection.$search ||
c.find(".select2-search__field"));
}),
(b.prototype.query=function (b, c, d){
function e(b){
var c=g._normalizeItem(b),
d=g.$element.find("option").filter(function (){
return a(this).val()===c.id;
});
if(!d.length){
var e=g.option(c);
e.attr("data-select2-tag", !0),
g._removeOldTags(),
g.addOptions([e]);
}
f(c);
}
function f(a){
g.trigger("select", { data: a });
}
var g=this;
c.term=c.term||"";
var h=this.tokenizer(c, this.options, e);
h.term!==c.term &&
(this.$search.length &&
(this.$search.val(h.term), this.$search.focus()),
(c.term=h.term)),
b.call(this, c, d);
}),
(b.prototype.tokenizer=function (b, c, d, e){
for (
var f=d.get("tokenSeparators")||[],
g=c.term,
h=0,
i =
this.createTag ||
function (a){
return { id: a.term, text: a.term };};
h < g.length;
){
var j=g[h];
if(-1!==a.inArray(j, f)){
var k=g.substr(0, h),
l=a.extend({}, c, { term: k }),
m=i(l);
null!=m ? (e(m), (g=g.substr(h + 1)||""), (h=0)):h++;
} else h++;
}
return { term: g };}),
b
);
}),
b.define("select2/data/minimumInputLength", [], function (){
function a(a, b, c){
(this.minimumInputLength=c.get("minimumInputLength")), a.call(this, b, c);
}
return (
(a.prototype.query=function (a, b, c){
return (
(b.term=b.term||""),
b.term.length < this.minimumInputLength
? void this.trigger("results:message", {
message: "inputTooShort",
args: {
minimum: this.minimumInputLength,
input: b.term,
params: b,
},
})
: void a.call(this, b, c)
);
}),
a
);
}),
b.define("select2/data/maximumInputLength", [], function (){
function a(a, b, c){
(this.maximumInputLength=c.get("maximumInputLength")), a.call(this, b, c);
}
return (
(a.prototype.query=function (a, b, c){
return (
(b.term=b.term||""),
this.maximumInputLength > 0 &&
b.term.length > this.maximumInputLength
? void this.trigger("results:message", {
message: "inputTooLong",
args: {
maximum: this.maximumInputLength,
input: b.term,
params: b,
},
})
: void a.call(this, b, c)
);
}),
a
);
}),
b.define("select2/data/maximumSelectionLength", [], function (){
function a(a, b, c){
(this.maximumSelectionLength=c.get("maximumSelectionLength")),
a.call(this, b, c);
}
return (
(a.prototype.query=function (a, b, c){
var d=this;
this.current(function (e){
var f=null!=e ? e.length:0;
return d.maximumSelectionLength > 0&&f >=d.maximumSelectionLength
? void d.trigger("results:message", {
message: "maximumSelected",
args: { maximum: d.maximumSelectionLength },
})
: void a.call(d, b, c);
});
}),
a
);
}),
b.define("select2/dropdown", ["jquery", "./utils"], function (a, b){
function c(a, b){
(this.$element=a), (this.options=b), c.__super__.constructor.call(this);
}
return (
b.Extend(c, b.Observable),
(c.prototype.render=function (){
var b=a(
'<span class="select2-dropdown"><span class="select2-results"></span></span>'
);
return b.attr("dir", this.options.get("dir")), (this.$dropdown=b), b;
}),
(c.prototype.bind=function (){}),
(c.prototype.position=function (a, b){}),
(c.prototype.destroy=function (){
this.$dropdown.remove();
}),
c
);
}),
b.define("select2/dropdown/search", ["jquery", "../utils"], function (a, b){
function c(){}
return (
(c.prototype.render=function (b){
var c=b.call(this),
d=a(
'<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>'
);
return (
(this.$searchContainer=d),
(this.$search=d.find("input")),
c.prepend(d),
c
);
}),
(c.prototype.bind=function (b, c, d){
var e=this;
b.call(this, c, d),
this.$search.on("keydown", function (a){
e.trigger("keypress", a),
(e._keyUpPrevented=a.isDefaultPrevented());
}),
this.$search.on("input", function (b){
a(this).off("keyup");
}),
this.$search.on("keyup input", function (a){
e.handleSearch(a);
}),
c.on("open", function (){
e.$search.attr("tabindex", 0),
e.$search.focus(),
window.setTimeout(function (){
e.$search.focus();
}, 0);
}),
c.on("close", function (){
e.$search.attr("tabindex", -1), e.$search.val("");
}),
c.on("focus", function (){
c.isOpen()&&e.$search.focus();
}),
c.on("results:all", function (a){
if(null==a.query.term||""===a.query.term){
var b=e.showSearch(a);
b
? e.$searchContainer.removeClass("select2-search--hide")
: e.$searchContainer.addClass("select2-search--hide");
}});
}),
(c.prototype.handleSearch=function (a){
if(!this._keyUpPrevented){
var b=this.$search.val();
this.trigger("query", { term: b });
}
this._keyUpPrevented = !1;
}),
(c.prototype.showSearch=function (a, b){
return !0;
}),
c
);
}),
b.define("select2/dropdown/hidePlaceholder", [], function (){
function a(a, b, c, d){
(this.placeholder=this.normalizePlaceholder(c.get("placeholder"))),
a.call(this, b, c, d);
}
return (
(a.prototype.append=function (a, b){
(b.results=this.removePlaceholder(b.results)), a.call(this, b);
}),
(a.prototype.normalizePlaceholder=function (a, b){
return "string"==typeof b&&(b={ id: "", text: b }), b;
}),
(a.prototype.removePlaceholder=function (a, b){
for (var c=b.slice(0), d=b.length - 1; d >=0; d--){
var e=b[d];
this.placeholder.id===e.id&&c.splice(d, 1);
}
return c;
}),
a
);
}),
b.define("select2/dropdown/infiniteScroll", ["jquery"], function (a){
function b(a, b, c, d){
(this.lastParams={}),
a.call(this, b, c, d),
(this.$loadingMore=this.createLoadingMore()),
(this.loading = !1);
}
return (
(b.prototype.append=function (a, b){
this.$loadingMore.remove(),
(this.loading = !1),
a.call(this, b),
this.showLoadingMore(b)&&this.$results.append(this.$loadingMore);
}),
(b.prototype.bind=function (b, c, d){
var e=this;
b.call(this, c, d),
c.on("query", function (a){
(e.lastParams=a), (e.loading = !0);
}),
c.on("query:append", function (a){
(e.lastParams=a), (e.loading = !0);
}),
this.$results.on("scroll", function (){
var b=a.contains(document.documentElement, e.$loadingMore[0]);
if(!e.loading&&b){
var c =
e.$results.offset().top +
e.$results.outerHeight(!1),
d =
e.$loadingMore.offset().top +
e.$loadingMore.outerHeight(!1);
c + 50 >=d&&e.loadMore();
}});
}),
(b.prototype.loadMore=function (){
this.loading = !0;
var b=a.extend({}, { page: 1 }, this.lastParams);
b.page++, this.trigger("query:append", b);
}),
(b.prototype.showLoadingMore=function (a, b){
return b.pagination&&b.pagination.more;
}),
(b.prototype.createLoadingMore=function (){
var b=a(
'<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'
),
c=this.options.get("translations").get("loadingMore");
return b.html(c(this.lastParams)), b;
}),
b
);
}),
b.define("select2/dropdown/attachBody", ["jquery", "../utils"], function (a, b){
function c(b, c, d){
(this.$dropdownParent=d.get("dropdownParent")||a(document.body)),
b.call(this, c, d);
}
return (
(c.prototype.bind=function (a, b, c){
var d=this,
e = !1;
a.call(this, b, c),
b.on("open", function (){
d._showDropdown(),
d._attachPositioningHandler(b),
e ||
((e = !0),
b.on("results:all", function (){
d._positionDropdown(), d._resizeDropdown();
}),
b.on("results:append", function (){
d._positionDropdown(), d._resizeDropdown();
}));
}),
b.on("close", function (){
d._hideDropdown(), d._detachPositioningHandler(b);
}),
this.$dropdownContainer.on("mousedown", function (a){
a.stopPropagation();
});
}),
(c.prototype.destroy=function (a){
a.call(this), this.$dropdownContainer.remove();
}),
(c.prototype.position=function (a, b, c){
b.attr("class", c.attr("class")),
b.removeClass("select2"),
b.addClass("select2-container--open"),
b.css({ position: "absolute", top: -999999 }),
(this.$container=c);
}),
(c.prototype.render=function (b){
var c=a("<span></span>"),
d=b.call(this);
return c.append(d), (this.$dropdownContainer=c), c;
}),
(c.prototype._hideDropdown=function (a){
this.$dropdownContainer.detach();
}),
(c.prototype._attachPositioningHandler=function (c, d){
var e=this,
f="scroll.select2." + d.id,
g="resize.select2." + d.id,
h="orientationchange.select2." + d.id,
i=this.$container.parents().filter(b.hasScroll);
i.each(function (){
a(this).data("select2-scroll-position", {
x: a(this).scrollLeft(),
y: a(this).scrollTop(),
});
}),
i.on(f, function (b){
var c=a(this).data("select2-scroll-position");
a(this).scrollTop(c.y);
}),
a(window).on(f + " " + g + " " + h, function (a){
e._positionDropdown(), e._resizeDropdown();
});
}),
(c.prototype._detachPositioningHandler=function (c, d){
var e="scroll.select2." + d.id,
f="resize.select2." + d.id,
g="orientationchange.select2." + d.id,
h=this.$container.parents().filter(b.hasScroll);
h.off(e), a(window).off(e + " " + f + " " + g);
}),
(c.prototype._positionDropdown=function (){
var b=a(window),
c=this.$dropdown.hasClass("select2-dropdown--above"),
d=this.$dropdown.hasClass("select2-dropdown--below"),
e=null,
f=this.$container.offset();
f.bottom=f.top + this.$container.outerHeight(!1);
var g={ height: this.$container.outerHeight(!1) };
(g.top=f.top), (g.bottom=f.top + g.height);
var h={ height: this.$dropdown.outerHeight(!1) },
i={ top: b.scrollTop(), bottom: b.scrollTop() + b.height() },
j=i.top < f.top - h.height,
k=i.bottom > f.bottom + h.height,
l={ left: f.left, top: g.bottom },
m=this.$dropdownParent;
"static"===m.css("position")&&(m=m.offsetParent());
var n=m.offset();
(l.top -=n.top),
(l.left -=n.left),
c||d || (e="below"),
k||!j||c ? !j&&k && c&&(e="below"):(e="above"),
("above"==e||(c&&"below"!==e)) &&
(l.top=g.top - n.top - h.height),
null!=e &&
(this.$dropdown
.removeClass("select2-dropdown--below select2-dropdown--above"
)
.addClass("select2-dropdown--" + e),
this.$container
.removeClass("select2-container--below select2-container--above"
)
.addClass("select2-container--" + e)),
this.$dropdownContainer.css(l);
}),
(c.prototype._resizeDropdown=function (){
var a={ width: this.$container.outerWidth(!1) + "px" };
this.options.get("dropdownAutoWidth") &&
((a.minWidth=a.width),
(a.position="relative"),
(a.width="auto")),
this.$dropdown.css(a);
}),
(c.prototype._showDropdown=function (a){
this.$dropdownContainer.appendTo(this.$dropdownParent),
this._positionDropdown(),
this._resizeDropdown();
}),
c
);
}),
b.define("select2/dropdown/minimumResultsForSearch", [], function (){
function a(b){
for (var c=0, d=0; d < b.length; d++){
var e=b[d];
e.children ? (c +=a(e.children)):c++;
}
return c;
}
function b(a, b, c, d){
(this.minimumResultsForSearch=c.get("minimumResultsForSearch")),
this.minimumResultsForSearch < 0 &&
(this.minimumResultsForSearch=1 / 0),
a.call(this, b, c, d);
}
return (
(b.prototype.showSearch=function (b, c){
return a(c.data.results) < this.minimumResultsForSearch
? !1
: b.call(this, c);
}),
b
);
}),
b.define("select2/dropdown/selectOnClose", [], function (){
function a(){}
return (
(a.prototype.bind=function (a, b, c){
var d=this;
a.call(this, b, c),
b.on("close", function (a){
d._handleSelectOnClose(a);
});
}),
(a.prototype._handleSelectOnClose=function (a, b){
if(b&&null!=b.originalSelect2Event){
var c=b.originalSelect2Event;
if("select"===c._type||"unselect"===c._type) return;
}
var d=this.getHighlightedResults();
if(!(d.length < 1)){
var e=d.data("data");
(null!=e.element&&e.element.selected) ||
(null==e.element&&e.selected) ||
this.trigger("select", { data: e });
}}),
a
);
}),
b.define("select2/dropdown/closeOnSelect", [], function (){
function a(){}
return (
(a.prototype.bind=function (a, b, c){
var d=this;
a.call(this, b, c),
b.on("select", function (a){
d._selectTriggered(a);
}),
b.on("unselect", function (a){
d._selectTriggered(a);
});
}),
(a.prototype._selectTriggered=function (a, b){
var c=b.originalEvent;
(c&&c.ctrlKey) ||
this.trigger("close", {
originalEvent: c,
originalSelect2Event: b,
});
}),
a
);
}),
b.define("select2/i18n/en", [], function (){
return {
errorLoading: function (){
return "The results could not be loaded.";
},
inputTooLong: function (a){
var b=a.input.length - a.maximum,
c="Please delete " + b + " character";
return 1!=b&&(c +="s"), c;
},
inputTooShort: function (a){
var b=a.minimum - a.input.length,
c="Please enter " + b + " or more characters";
return c;
},
loadingMore: function (){
return "Loading more results…";
},
maximumSelected: function (a){
var b="You can only select " + a.maximum + " item";
return 1!=a.maximum&&(b +="s"), b;
},
noResults: function (){
return "No results found";
},
searching: function (){
return "Searching…";
},
};}),
b.define("select2/defaults",
[
"jquery",
"require",
"./results",
"./selection/single",
"./selection/multiple",
"./selection/placeholder",
"./selection/allowClear",
"./selection/search",
"./selection/eventRelay",
"./utils",
"./translation",
"./diacritics",
"./data/select",
"./data/array",
"./data/ajax",
"./data/tags",
"./data/tokenizer",
"./data/minimumInputLength",
"./data/maximumInputLength",
"./data/maximumSelectionLength",
"./dropdown",
"./dropdown/search",
"./dropdown/hidePlaceholder",
"./dropdown/infiniteScroll",
"./dropdown/attachBody",
"./dropdown/minimumResultsForSearch",
"./dropdown/selectOnClose",
"./dropdown/closeOnSelect",
"./i18n/en",
],
function (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z,
A,
B,
C
){
function D(){
this.reset();
}
(D.prototype.apply=function (l){
if(((l=a.extend(!0, {}, this.defaults, l)), null==l.dataAdapter)){
if((null!=l.ajax
? (l.dataAdapter=o)
: null!=l.data
? (l.dataAdapter=n)
: (l.dataAdapter=m),
l.minimumInputLength > 0 &&
(l.dataAdapter=j.Decorate(l.dataAdapter, r)),
l.maximumInputLength > 0 &&
(l.dataAdapter=j.Decorate(l.dataAdapter, s)),
l.maximumSelectionLength > 0 &&
(l.dataAdapter=j.Decorate(l.dataAdapter, t)),
l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter, p)),
(null!=l.tokenSeparators||null!=l.tokenizer) &&
(l.dataAdapter=j.Decorate(l.dataAdapter, q)),
null!=l.query)
){
var C=b(l.amdBase + "compat/query");
l.dataAdapter=j.Decorate(l.dataAdapter, C);
}
if(null!=l.initSelection){
var D=b(l.amdBase + "compat/initSelection");
l.dataAdapter=j.Decorate(l.dataAdapter, D);
}}
if((null==l.resultsAdapter &&
((l.resultsAdapter=c),
null!=l.ajax &&
(l.resultsAdapter=j.Decorate(l.resultsAdapter, x)),
null!=l.placeholder &&
(l.resultsAdapter=j.Decorate(l.resultsAdapter, w)),
l.selectOnClose &&
(l.resultsAdapter=j.Decorate(l.resultsAdapter, A))),
null==l.dropdownAdapter)
){
if(l.multiple) l.dropdownAdapter=u;
else {
var E=j.Decorate(u, v);
l.dropdownAdapter=E;
}
if((0!==l.minimumResultsForSearch &&
(l.dropdownAdapter=j.Decorate(l.dropdownAdapter, z)),
l.closeOnSelect &&
(l.dropdownAdapter=j.Decorate(l.dropdownAdapter, B)),
null!=l.dropdownCssClass ||
null!=l.dropdownCss ||
null!=l.adaptDropdownCssClass)
){
var F=b(l.amdBase + "compat/dropdownCss");
l.dropdownAdapter=j.Decorate(l.dropdownAdapter, F);
}
l.dropdownAdapter=j.Decorate(l.dropdownAdapter, y);
}
if(null==l.selectionAdapter){
if((l.multiple
? (l.selectionAdapter=e)
: (l.selectionAdapter=d),
null!=l.placeholder &&
(l.selectionAdapter=j.Decorate(l.selectionAdapter, f)),
l.allowClear &&
(l.selectionAdapter=j.Decorate(l.selectionAdapter, g)),
l.multiple &&
(l.selectionAdapter=j.Decorate(l.selectionAdapter, h)),
null!=l.containerCssClass ||
null!=l.containerCss ||
null!=l.adaptContainerCssClass)
){
var G=b(l.amdBase + "compat/containerCss");
l.selectionAdapter=j.Decorate(l.selectionAdapter, G);
}
l.selectionAdapter=j.Decorate(l.selectionAdapter, i);
}
if("string"==typeof l.language)
if(l.language.indexOf("-") > 0){
var H=l.language.split("-"),
I=H[0];
l.language=[l.language, I];
} else l.language=[l.language];
if(a.isArray(l.language)){
var J=new k();
l.language.push("en");
for (var K=l.language, L=0; L < K.length; L++){
var M=K[L],
N={};
try {
N=k.loadPath(M);
} catch (O){
try {
(M=this.defaults.amdLanguageBase + M),
(N=k.loadPath(M));
} catch (P){
l.debug &&
window.console &&
console.warn &&
console.warn('Select2: The language file for "' +
M +
'" could not be automatically loaded. A fallback will be used instead.'
);
continue;
}}
J.extend(N);
}
l.translations=J;
}else{
var Q=k.loadPath(this.defaults.amdLanguageBase + "en"),
R=new k(l.language);
R.extend(Q), (l.translations=R);
}
return l;
}),
(D.prototype.reset=function (){
function b(a){
function b(a){
return l[a]||a;
}
return a.replace(/[^\u0000-\u007E]/g, b);
}
function c(d, e){
if(""===a.trim(d.term)) return e;
if(e.children&&e.children.length > 0){
for (
var f=a.extend(!0, {}, e), g=e.children.length - 1;
g >=0;
g--
){
var h=e.children[g],
i=c(d, h);
null==i&&f.children.splice(g, 1);
}
return f.children.length > 0 ? f:c(d, f);
}
var j=b(e.text).toUpperCase(),
k=b(d.term).toUpperCase();
return j.indexOf(k) > -1 ? e:null;
}
this.defaults={
amdBase: "./",
amdLanguageBase: "./i18n/",
closeOnSelect: !0,
debug: !1,
dropdownAutoWidth: !1,
escapeMarkup: j.escapeMarkup,
language: C,
matcher: c,
minimumInputLength: 0,
maximumInputLength: 0,
maximumSelectionLength: 0,
minimumResultsForSearch: 0,
selectOnClose: !1,
sorter: function (a){
return a;
},
templateResult: function (a){
return a.text;
},
templateSelection: function (a){
return a.text;
},
theme: "default",
width: "resolve",
};}),
(D.prototype.set=function (b, c){
var d=a.camelCase(b),
e={};
e[d]=c;
var f=j._convertData(e);
a.extend(this.defaults, f);
});
var E=new D();
return E;
}
),
b.define("select2/options",
["require", "jquery", "./defaults", "./utils"],
function (a, b, c, d){
function e(b, e){
if(((this.options=b),
null!=e&&this.fromElement(e),
(this.options=c.apply(this.options)),
e&&e.is("input"))
){
var f=a(this.get("amdBase") + "compat/inputData");
this.options.dataAdapter=d.Decorate(this.options.dataAdapter, f);
}}
return (
(e.prototype.fromElement=function (a){
var c=["select2"];
null==this.options.multiple &&
(this.options.multiple=a.prop("multiple")),
null==this.options.disabled &&
(this.options.disabled=a.prop("disabled")),
null==this.options.language &&
(a.prop("lang")
? (this.options.language=a.prop("lang").toLowerCase())
: a.closest("[lang]").prop("lang") &&
(this.options.language=a
.closest("[lang]")
.prop("lang"))),
null==this.options.dir &&
(a.prop("dir")
? (this.options.dir=a.prop("dir"))
: a.closest("[dir]").prop("dir")
? (this.options.dir=a.closest("[dir]").prop("dir"))
: (this.options.dir="ltr")),
a.prop("disabled", this.options.disabled),
a.prop("multiple", this.options.multiple),
a.data("select2Tags") &&
(this.options.debug &&
window.console &&
console.warn &&
console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'
),
a.data("data", a.data("select2Tags")),
a.data("tags", !0)),
a.data("ajaxUrl") &&
(this.options.debug &&
window.console &&
console.warn &&
console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."
),
a.attr("ajax--url", a.data("ajaxUrl")),
a.data("ajax--url", a.data("ajaxUrl")));
var e={};
e =
b.fn.jquery&&"1."==b.fn.jquery.substr(0, 2)&&a[0].dataset
? b.extend(!0, {}, a[0].dataset, a.data())
: a.data();
var f=b.extend(!0, {}, e);
f=d._convertData(f);
for (var g in f)
b.inArray(g, c) > -1 ||
(b.isPlainObject(this.options[g])
? b.extend(this.options[g], f[g])
: (this.options[g]=f[g]));
return this;
}),
(e.prototype.get=function (a){
return this.options[a];
}),
(e.prototype.set=function (a, b){
this.options[a]=b;
}),
e
);
}
),
b.define("select2/core",
["jquery", "./options", "./utils", "./keys"],
function (a, b, c, d){
var e=function (a, c){
null!=a.data("select2")&&a.data("select2").destroy(),
(this.$element=a),
(this.id=this._generateId(a)),
(c=c||{}),
(this.options=new b(c, a)),
e.__super__.constructor.call(this);
var d=a.attr("tabindex")||0;
a.data("old-tabindex", d), a.attr("tabindex", "-1");
var f=this.options.get("dataAdapter");
this.dataAdapter=new f(a, this.options);
var g=this.render();
this._placeContainer(g);
var h=this.options.get("selectionAdapter");
(this.selection=new h(a, this.options)),
(this.$selection=this.selection.render()),
this.selection.position(this.$selection, g);
var i=this.options.get("dropdownAdapter");
(this.dropdown=new i(a, this.options)),
(this.$dropdown=this.dropdown.render()),
this.dropdown.position(this.$dropdown, g);
var j=this.options.get("resultsAdapter");
(this.results=new j(a, this.options, this.dataAdapter)),
(this.$results=this.results.render()),
this.results.position(this.$results, this.$dropdown);
var k=this;
this._bindAdapters(),
this._registerDomEvents(),
this._registerDataEvents(),
this._registerSelectionEvents(),
this._registerDropdownEvents(),
this._registerResultsEvents(),
this._registerEvents(),
this.dataAdapter.current(function (a){
k.trigger("selection:update", { data: a });
}),
a.addClass("select2-hidden-accessible"),
a.attr("aria-hidden", "true"),
this._syncAttributes(),
a.data("select2", this);
};
return (
c.Extend(e, c.Observable),
(e.prototype._generateId=function (a){
var b="";
return (
(b =
null!=a.attr("id")
? a.attr("id")
: null!=a.attr("name")
? a.attr("name") + "-" + c.generateChars(2)
: c.generateChars(4)),
(b=b.replace(/(:|\.|\[|\]|,)/g, "")),
(b="select2-" + b)
);
}),
(e.prototype._placeContainer=function (a){
a.insertAfter(this.$element);
var b=this._resolveWidth(this.$element,
this.options.get("width")
);
null!=b&&a.css("width", b);
}),
(e.prototype._resolveWidth=function (a, b){
var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
if("resolve"==b){
var d=this._resolveWidth(a, "style");
return null!=d ? d:this._resolveWidth(a, "element");
}
if("element"==b){
var e=a.outerWidth(!1);
return 0 >=e ? "auto":e + "px";
}
if("style"==b){
var f=a.attr("style");
if("string"!=typeof f) return null;
for (var g=f.split(";"), h=0, i=g.length; i > h; h +=1){
var j=g[h].replace(/\s/g, ""),
k=j.match(c);
if(null!==k&&k.length >=1) return k[1];
}
return null;
}
return b;
}),
(e.prototype._bindAdapters=function (){
this.dataAdapter.bind(this, this.$container),
this.selection.bind(this, this.$container),
this.dropdown.bind(this, this.$container),
this.results.bind(this, this.$container);
}),
(e.prototype._registerDomEvents=function (){
var b=this;
this.$element.on("change.select2", function (){
b.dataAdapter.current(function (a){
b.trigger("selection:update", { data: a });
});
}),
this.$element.on("focus.select2", function (a){
b.trigger("focus", a);
}),
(this._syncA=c.bind(this._syncAttributes, this)),
(this._syncS=c.bind(this._syncSubtree, this)),
this.$element[0].attachEvent &&
this.$element[0].attachEvent("onpropertychange",
this._syncA
);
var d =
window.MutationObserver ||
window.WebKitMutationObserver ||
window.MozMutationObserver;
null!=d
? ((this._observer=new d(function (c){
a.each(c, b._syncA), a.each(c, b._syncS);
})),
this._observer.observe(this.$element[0], {
attributes: !0,
childList: !0,
subtree: !1,
}))
: this.$element[0].addEventListener &&
(this.$element[0].addEventListener("DOMAttrModified",
b._syncA,
!1
),
this.$element[0].addEventListener("DOMNodeInserted",
b._syncS,
!1
),
this.$element[0].addEventListener("DOMNodeRemoved",
b._syncS,
!1
));
}),
(e.prototype._registerDataEvents=function (){
var a=this;
this.dataAdapter.on("*", function (b, c){
a.trigger(b, c);
});
}),
(e.prototype._registerSelectionEvents=function (){
var b=this,
c=["toggle", "focus"];
this.selection.on("toggle", function (){
b.toggleDropdown();
}),
this.selection.on("focus", function (a){
b.focus(a);
}),
this.selection.on("*", function (d, e){
-1===a.inArray(d, c)&&b.trigger(d, e);
});
}),
(e.prototype._registerDropdownEvents=function (){
var a=this;
this.dropdown.on("*", function (b, c){
a.trigger(b, c);
});
}),
(e.prototype._registerResultsEvents=function (){
var a=this;
this.results.on("*", function (b, c){
a.trigger(b, c);
});
}),
(e.prototype._registerEvents=function (){
var a=this;
this.on("open", function (){
a.$container.addClass("select2-container--open");
}),
this.on("close", function (){
a.$container.removeClass("select2-container--open");
}),
this.on("enable", function (){
a.$container.removeClass("select2-container--disabled");
}),
this.on("disable", function (){
a.$container.addClass("select2-container--disabled");
}),
this.on("blur", function (){
a.$container.removeClass("select2-container--focus");
}),
this.on("query", function (b){
a.isOpen()||a.trigger("open", {}),
this.dataAdapter.query(b, function (c){
a.trigger("results:all", { data: c, query: b });
});
}),
this.on("query:append", function (b){
this.dataAdapter.query(b, function (c){
a.trigger("results:append", { data: c, query: b });
});
}),
this.on("keypress", function (b){
var c=b.which;
if(c===d.ENTER&&(b.ctrlKey||b.metaKey))
a.close()||MapSVG.formBuilder.save();
if(c===d.ESC&&!a.isOpen())
a.close()||MapSVG.formBuilder.close();
a.isOpen()
? c===d.ESC||c===d.TAB||(c===d.UP&&b.altKey)
? (a.close(), b.preventDefault())
: c===d.ENTER&&!b.ctrlKey&&!b.metaKey
? (a.trigger("results:select", {}),
b.preventDefault())
: c===d.SPACE&&b.ctrlKey
? (a.trigger("results:toggle", {}),
b.preventDefault())
: c===d.UP
? (a.trigger("results:previous", {}),
b.preventDefault())
: c===d.DOWN &&
(a.trigger("results:next", {}),
b.preventDefault())
: (c===(d.ENTER&&!b.ctrlKey&&!b.metaKey) ||
c===d.SPACE ||
(c===d.DOWN&&b.altKey)) &&
(a.open(), b.preventDefault());
});
}),
(e.prototype._syncAttributes=function (){
this.options.set("disabled", this.$element.prop("disabled")),
this.options.get("disabled")
? (this.isOpen()&&this.close(),
this.trigger("disable", {}))
: this.trigger("enable", {});
}),
(e.prototype._syncSubtree=function (a, b){
var c = !1,
d=this;
if(!a ||
!a.target ||
"OPTION"===a.target.nodeName ||
"OPTGROUP"===a.target.nodeName
){
if(b)
if(b.addedNodes&&b.addedNodes.length > 0)
for (var e=0; e < b.addedNodes.length; e++){
var f=b.addedNodes[e];
f.selected&&(c = !0);
}
else
b.removedNodes&&b.removedNodes.length > 0&&(c = !0);
else c = !0;
c &&
this.dataAdapter.current(function (a){
d.trigger("selection:update", { data: a });
});
}}),
(e.prototype.trigger=function (a, b){
var c=e.__super__.trigger,
d={
open: "opening",
close: "closing",
select: "selecting",
unselect: "unselecting",
};
if((void 0===b&&(b={}), a in d)){
var f=d[a],
g={ prevented: !1, name: a, args: b };
if((c.call(this, f, g), g.prevented))
return void (b.prevented = !0);
}
c.call(this, a, b);
}),
(e.prototype.toggleDropdown=function (){
this.options.get("disabled") ||
(this.isOpen() ? this.close():this.open());
}),
(e.prototype.open=function (){
this.isOpen()||this.trigger("query", {});
}),
(e.prototype.close=function (){
this.isOpen()&&this.trigger("close", {});
}),
(e.prototype.isOpen=function (){
return this.$container.hasClass("select2-container--open");
}),
(e.prototype.hasFocus=function (){
return this.$container.hasClass("select2-container--focus");
}),
(e.prototype.focus=function (a){
this.hasFocus() ||
(this.$container.addClass("select2-container--focus"),
this.trigger("focus", {}));
}),
(e.prototype.enable=function (a){
this.options.get("debug") &&
window.console &&
console.warn &&
console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'
),
(null==a||0===a.length)&&(a=[!0]);
var b = !a[0];
this.$element.prop("disabled", b);
}),
(e.prototype.data=function (){
this.options.get("debug") &&
arguments.length > 0 &&
window.console &&
console.warn &&
console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.'
);
var a=[];
return (
this.dataAdapter.current(function (b){
a=b;
}),
a
);
}),
(e.prototype.val=function (b){
if((this.options.get("debug") &&
window.console &&
console.warn &&
console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'
),
null==b||0===b.length)
)
return this.$element.val();
var c=b[0];
a.isArray(c) &&
(c=a.map(c, function (a){
return a.toString();
})),
this.$element.val(c).trigger("change");
}),
(e.prototype.destroy=function (){
this.$container.remove(),
this.$element[0].detachEvent &&
this.$element[0].detachEvent("onpropertychange",
this._syncA
),
null!=this._observer
? (this._observer.disconnect(), (this._observer=null))
: this.$element[0].removeEventListener &&
(this.$element[0].removeEventListener("DOMAttrModified",
this._syncA,
!1
),
this.$element[0].removeEventListener("DOMNodeInserted",
this._syncS,
!1
),
this.$element[0].removeEventListener("DOMNodeRemoved",
this._syncS,
!1
)),
(this._syncA=null),
(this._syncS=null),
this.$element.off(".select2"),
this.$element.attr("tabindex",
this.$element.data("old-tabindex")
),
this.$element.removeClass("select2-hidden-accessible"),
this.$element.attr("aria-hidden", "false"),
this.$element.removeData("select2"),
this.dataAdapter.destroy(),
this.selection.destroy(),
this.dropdown.destroy(),
this.results.destroy(),
(this.dataAdapter=null),
(this.selection=null),
(this.dropdown=null),
(this.results=null);
}),
(e.prototype.render=function (){
var b=a(
'<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>'
);
return (
b.attr("dir", this.options.get("dir")),
(this.$container=b),
this.$container.addClass("select2-container--" + this.options.get("theme")
),
b.data("element", this.$element),
b
);
}),
e
);
}
),
b.define("select2/compat/utils", ["jquery"], function (a){
function b(b, c, d){
var e,
f,
g=[];
(e=a.trim(b.attr("class"))),
e &&
((e="" + e),
a(e.split(/\s+/)).each(function (){
0===this.indexOf("select2-")&&g.push(this);
})),
(e=a.trim(c.attr("class"))),
e &&
((e="" + e),
a(e.split(/\s+/)).each(function (){
0!==this.indexOf("select2-") &&
((f=d(this)), null!=f&&g.push(f));
})),
b.attr("class", g.join(" "));
}
return { syncCssClasses: b };}),
b.define("select2/compat/containerCss", ["jquery", "./utils"], function (a, b){
function c(a){
return null;
}
function d(){}
return (
(d.prototype.render=function (d){
var e=d.call(this),
f=this.options.get("containerCssClass")||"";
a.isFunction(f)&&(f=f(this.$element));
var g=this.options.get("adaptContainerCssClass");
if(((g=g||c), -1!==f.indexOf(":all:"))){
f=f.replace(":all:", "");
var h=g;
g=function (a){
var b=h(a);
return null!=b ? b + " " + a:a;
};}
var i=this.options.get("containerCss")||{};
return (
a.isFunction(i)&&(i=i(this.$element)),
b.syncCssClasses(e, this.$element, g),
e.css(i),
e.addClass(f),
e
);
}),
d
);
}),
b.define("select2/compat/dropdownCss", ["jquery", "./utils"], function (a, b){
function c(a){
return null;
}
function d(){}
return (
(d.prototype.render=function (d){
var e=d.call(this),
f=this.options.get("dropdownCssClass")||"";
a.isFunction(f)&&(f=f(this.$element));
var g=this.options.get("adaptDropdownCssClass");
if(((g=g||c), -1!==f.indexOf(":all:"))){
f=f.replace(":all:", "");
var h=g;
g=function (a){
var b=h(a);
return null!=b ? b + " " + a:a;
};}
var i=this.options.get("dropdownCss")||{};
return (
a.isFunction(i)&&(i=i(this.$element)),
b.syncCssClasses(e, this.$element, g),
e.css(i),
e.addClass(f),
e
);
}),
d
);
}),
b.define("select2/compat/initSelection", ["jquery"], function (a){
function b(a, b, c){
c.get("debug") &&
window.console &&
console.warn &&
console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"
),
(this.initSelection=c.get("initSelection")),
(this._isInitialized = !1),
a.call(this, b, c);
}
return (
(b.prototype.current=function (b, c){
var d=this;
return this._isInitialized
? void b.call(this, c)
: void this.initSelection.call(null, this.$element, function (b){
(d._isInitialized = !0), a.isArray(b)||(b=[b]), c(b);
});
}),
b
);
}),
b.define("select2/compat/inputData", ["jquery"], function (a){
function b(a, b, c){
(this._currentData=[]),
(this._valueSeparator=c.get("valueSeparator")||","),
"hidden"===b.prop("type") &&
c.get("debug") &&
console &&
console.warn &&
console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."
),
a.call(this, b, c);
}
return (
(b.prototype.current=function (b, c){
function d(b, c){
var e=[];
return (
b.selected||-1!==a.inArray(b.id, c)
? ((b.selected = !0), e.push(b))
: (b.selected = !1),
b.children&&e.push.apply(e, d(b.children, c)),
e
);
}
for (var e=[], f=0; f < this._currentData.length; f++){
var g=this._currentData[f];
e.push.apply(e,
d(g, this.$element.val().split(this._valueSeparator))
);
}
c(e);
}),
(b.prototype.select=function (b, c){
if(this.options.get("multiple")){
var d=this.$element.val();
(d +=this._valueSeparator + c.id),
this.$element.val(d),
this.$element.trigger("change");
} else
this.current(function (b){
a.map(b, function (a){
a.selected = !1;
});
}),
this.$element.val(c.id),
this.$element.trigger("change");
}),
(b.prototype.unselect=function (a, b){
var c=this;
(b.selected = !1),
this.current(function (a){
for (var d=[], e=0; e < a.length; e++){
var f=a[e];
b.id!=f.id&&d.push(f.id);
}
c.$element.val(d.join(c._valueSeparator)),
c.$element.trigger("change");
});
}),
(b.prototype.query=function (a, b, c){
for (var d=[], e=0; e < this._currentData.length; e++){
var f=this._currentData[e],
g=this.matches(b, f);
null!==g&&d.push(g);
}
c({ results: d });
}),
(b.prototype.addOptions=function (b, c){
var d=a.map(c, function (b){
return a.data(b[0], "data");
});
this._currentData.push.apply(this._currentData, d);
}),
b
);
}),
b.define("select2/compat/matcher", ["jquery"], function (a){
function b(b){
function c(c, d){
var e=a.extend(!0, {}, d);
if(null==c.term||""===a.trim(c.term)) return e;
if(d.children){
for (var f=d.children.length - 1; f >=0; f--){
var g=d.children[f],
h=b(c.term, g.text, g);
h||e.children.splice(f, 1);
}
if(e.children.length > 0) return e;
}
return b(c.term, d.text, d) ? e:null;
}
return c;
}
return b;
}),
b.define("select2/compat/query", [], function (){
function a(a, b, c){
c.get("debug") &&
window.console &&
console.warn &&
console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."
),
a.call(this, b, c);
}
return (
(a.prototype.query=function (a, b, c){
b.callback=c;
var d=this.options.get("query");
d.call(null, b);
}),
a
);
}),
b.define("select2/dropdown/attachContainer", [], function (){
function a(a, b, c){
a.call(this, b, c);
}
return (
(a.prototype.position=function (a, b, c){
var d=c.find(".dropdown-wrapper");
d.append(b),
b.addClass("select2-dropdown--below"),
c.addClass("select2-container--below");
}),
a
);
}),
b.define("select2/dropdown/stopPropagation", [], function (){
function a(){}
return (
(a.prototype.bind=function (a, b, c){
a.call(this, b, c);
var d=[
"blur",
"change",
"click",
"dblclick",
"focus",
"focusin",
"focusout",
"input",
"keydown",
"keyup",
"keypress",
"mousedown",
"mouseenter",
"mouseleave",
"mousemove",
"mouseover",
"mouseup",
"search",
"touchend",
"touchstart",
];
this.$dropdown.on(d.join(" "), function (a){
a.stopPropagation();
});
}),
a
);
}),
b.define("select2/selection/stopPropagation", [], function (){
function a(){}
return (
(a.prototype.bind=function (a, b, c){
a.call(this, b, c);
var d=[
"blur",
"change",
"click",
"dblclick",
"focus",
"focusin",
"focusout",
"input",
"keydown",
"keyup",
"keypress",
"mousedown",
"mouseenter",
"mouseleave",
"mousemove",
"mouseover",
"mouseup",
"search",
"touchend",
"touchstart",
];
this.$selection.on(d.join(" "), function (a){
a.stopPropagation();
});
}),
a
);
}),
(function (c){
"function"==typeof b.define&&b.define.amd
? b.define("jquery-mousewheel", ["jquery"], c)
: "object"==typeof exports
? (module.exports=c)
: c(a);
})(function (a){
function b(b){
var g=b||window.event,
h=i.call(arguments, 1),
j=0,
l=0,
m=0,
n=0,
o=0,
p=0;
if(((b=a.event.fix(g)),
(b.type="mousewheel"),
"detail" in g&&(m=-1 * g.detail),
"wheelDelta" in g&&(m=g.wheelDelta),
"wheelDeltaY" in g&&(m=g.wheelDeltaY),
"wheelDeltaX" in g&&(l=-1 * g.wheelDeltaX),
"axis" in g&&g.axis===g.HORIZONTAL_AXIS&&((l=-1 * m), (m=0)),
(j=0===m ? l:m),
"deltaY" in g&&((m=-1 * g.deltaY), (j=m)),
"deltaX" in g&&((l=g.deltaX), 0===m&&(j=-1 * l)),
0!==m||0!==l)
){
if(1===g.deltaMode){
var q=a.data(this, "mousewheel-line-height");
(j *=q), (m *=q), (l *=q);
}else if(2===g.deltaMode){
var r=a.data(this, "mousewheel-page-height");
(j *=r), (m *=r), (l *=r);
}
if(((n=Math.max(Math.abs(m), Math.abs(l))),
(!f||f > n)&&((f=n), d(g, n)&&(f /=40)),
d(g, n)&&((j /=40), (l /=40), (m /=40)),
(j=Math[j >=1 ? "floor":"ceil"](j / f)),
(l=Math[l >=1 ? "floor":"ceil"](l / f)),
(m=Math[m >=1 ? "floor":"ceil"](m / f)),
k.settings.normalizeOffset&&this.getBoundingClientRect)
){
var s=this.getBoundingClientRect();
(o=b.clientX - s.left), (p=b.clientY - s.top);
}
return (
(b.deltaX=l),
(b.deltaY=m),
(b.deltaFactor=f),
(b.offsetX=o),
(b.offsetY=p),
(b.deltaMode=0),
h.unshift(b, j, l, m),
e&&clearTimeout(e),
(e=setTimeout(c, 200)),
(a.event.dispatch||a.event.handle).apply(this, h)
);
}}
function c(){
f=null;
}
function d(a, b){
return (
k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b % 120===0
);
}
var e,
f,
g=["wheel", "mousewheel", "DOMMouseScroll", "MozMousePixelScroll"],
h =
"onwheel" in document||document.documentMode >=9
? ["wheel"]
: ["mousewheel", "DomMouseScroll", "MozMousePixelScroll"],
i=Array.prototype.slice;
if(a.event.fixHooks)
for (var j=g.length; j;) a.event.fixHooks[g[--j]]=a.event.mouseHooks;
var k=(a.event.special.mousewheel={
version: "3.1.12",
setup: function (){
if(this.addEventListener)
for (var c=h.length; c;) this.addEventListener(h[--c], b, !1);
else this.onmousewheel=b;
a.data(this, "mousewheel-line-height", k.getLineHeight(this)),
a.data(this, "mousewheel-page-height", k.getPageHeight(this));
},
teardown: function (){
if(this.removeEventListener)
for (var c=h.length; c;) this.removeEventListener(h[--c], b, !1);
else this.onmousewheel=null;
a.removeData(this, "mousewheel-line-height"),
a.removeData(this, "mousewheel-page-height");
},
getLineHeight: function (b){
var c=a(b),
d=c["offsetParent" in a.fn ? "offsetParent":"parent"]();
return (
d.length||(d=a("body")),
parseInt(d.css("fontSize"), 10) ||
parseInt(c.css("fontSize"), 10) ||
16
);
},
getPageHeight: function (b){
return a(b).height();
},
settings: { adjustOldDeltas: !0, normalizeOffset: !0 },
});
a.fn.extend({
mousewheel: function (a){
return a ? this.bind("mousewheel", a):this.trigger("mousewheel");
},
unmousewheel: function (a){
return this.unbind("mousewheel", a);
},
});
}),
b.define("jquery.select2",
["jquery", "jquery-mousewheel", "./select2/core", "./select2/defaults"],
function (a, b, c, d){
if(null==a.fn.mselect2){
var e=["open", "close", "destroy"];
a.fn.mselect2=function (b){
if(((b=b||{}), "object"==typeof b))
return (
this.each(function (){
var d=a.extend(!0, {}, b);
new c(a(this), d);
}),
this
);
if("string"==typeof b){
var d,
f=Array.prototype.slice.call(arguments, 1);
return (
this.each(function (){
var c=a(this).data("select2");
null==c &&
window.console &&
console.error &&
console.error("The select2('" +
b +
"') method was called on an element that is not using Select2."
),
(d=c[b].apply(c, f));
}),
a.inArray(b, e) > -1 ? this:d
);
}
throw new Error("Invalid arguments for Select2: " + b);
};}
return null==a.fn.mselect2.defaults&&(a.fn.mselect2.defaults=d), c;
}
),
{ define: b.define, require: b.require }
);
})(),
c=b.require("jquery.select2");
return (a.fn.mselect2.amd=b), c;
});
!(function (a){
return "function"==typeof define&&define.amd
? define(["jquery"], function (b){
return a(b, window, document);
})
: "object"==typeof exports
? (module.exports=a(require("jquery"), window, document))
: a(jQuery, window, document);
})(function (a, b, c){
"use strict";
var d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H;
(z={
paneClass: "nano-pane",
sliderClass: "nano-slider",
contentClass: "nano-content",
enabledClass: "has-scrollbar",
flashedClass: "flashed",
activeClass: "active",
iOSNativeScrolling: !1,
preventPageScrolling: !1,
disableResize: !1,
alwaysVisible: !1,
flashDelay: 1500,
sliderMinHeight: 20,
sliderMaxHeight: null,
documentContext: null,
windowContext: null,
}),
(u="scrollbar"),
(t="scroll"),
(l="mousedown"),
(m="mouseenter"),
(n="mousemove"),
(p="mousewheel"),
(o="mouseup"),
(s="resize"),
(h="drag"),
(i="enter"),
(w="up"),
(r="panedown"),
(f="DOMMouseScroll"),
(g="down"),
(x="wheel"),
(j="keydown"),
(k="keyup"),
(v="touchmove"),
(d =
"Microsoft Internet Explorer"===b.navigator.appName &&
/msie 7./i.test(b.navigator.appVersion) &&
b.ActiveXObject),
(e=null),
(D=b.requestAnimationFrame),
(y=b.cancelAnimationFrame),
(F=c.createElement("div").style),
(H=(function (){
var a, b, c, d, e, f;
for (d=["t", "webkitT", "MozT", "msT", "OT"], a=e = 0, f=d.length; f > e; a=++e)
if(((c=d[a]), (b=d[a] + "ransform"), b in F))
return d[a].substr(0, d[a].length - 1);
return !1;
})()),
(G=function (a){
return H===!1 ? !1:""===H ? a:H + a.charAt(0).toUpperCase() + a.substr(1);
}),
(E=G("transform")),
(B=E!==!1),
(A=function (){
var a, b, d;
return (
(a=c.createElement("div")),
(b=a.style),
(b.position="absolute"),
(b.width="100px"),
(b.height="100px"),
(b.overflow=t),
(b.top="-9999px"),
c.body.appendChild(a),
(d=a.offsetWidth - a.clientWidth),
c.body.removeChild(a),
d
);
}),
(C=function (){
var a, c, d;
return (
(c=b.navigator.userAgent),
(a=/(?=.+Mac OS X)(?=.+Firefox)/.test(c))
? ((d=/Firefox\/\d{2}\./.exec(c)),
d&&(d=d[0].replace(/\D+/g, "")),
a&&+d > 23)
: !1
);
}),
(q=(function (){
function j(d, f){
(this.el=d),
(this.options=f),
e||(e=A()),
(this.$el=a(this.el)),
(this.doc=a(this.options.documentContext||c)),
(this.win=a(this.options.windowContext||b)),
(this.body=this.doc.find("body")),
(this.$content=this.$el.children("." + this.options.contentClass)),
this.$content.attr("tabindex", this.options.tabIndex||0),
(this.content=this.$content[0]),
(this.previousPosition=0),
this.options.iOSNativeScrolling&&null!=this.el.style.WebkitOverflowScrolling
? this.nativeScrolling()
: this.generate(),
this.createEvents(),
this.addEvents(),
this.reset();
}
return (
(j.prototype.preventScrolling=function (a, b){
if(this.isActive)
if(a.type===f)
((b===g&&a.originalEvent.detail > 0) ||
(b===w&&a.originalEvent.detail < 0)) &&
a.preventDefault();
else if(a.type===p){
if(!a.originalEvent||!a.originalEvent.wheelDelta) return;
((b===g&&a.originalEvent.wheelDelta < 0) ||
(b===w&&a.originalEvent.wheelDelta > 0)) &&
a.preventDefault();
}}),
(j.prototype.nativeScrolling=function (){
this.$content.css({ WebkitOverflowScrolling: "touch" }),
(this.iOSNativeScrolling = !0),
(this.isActive = !0);
}),
(j.prototype.updateScrollValues=function (){
var a, b;
(a=this.content),
(this.maxScrollTop=a.scrollHeight - a.clientHeight),
(this.prevScrollTop=this.contentScrollTop||0),
(this.contentScrollTop=a.scrollTop),
(b =
this.contentScrollTop > this.previousPosition
? "down"
: this.contentScrollTop < this.previousPosition
? "up"
: "same"),
(this.previousPosition=this.contentScrollTop),
"same"!==b &&
this.$el.trigger("update", {
position: this.contentScrollTop,
maximum: this.maxScrollTop,
direction: b,
}),
this.iOSNativeScrolling ||
((this.maxSliderTop=this.paneHeight - this.sliderHeight),
(this.sliderTop =
0===this.maxScrollTop
? 0
: (this.contentScrollTop * this.maxSliderTop) /
this.maxScrollTop));
}),
(j.prototype.setOnScrollStyles=function (){
var a;
B
? ((a={}), (a[E]="translate(0, " + this.sliderTop + "px)"))
: (a={ top: this.sliderTop }),
D
? (y&&this.scrollRAF&&y(this.scrollRAF),
(this.scrollRAF=D(
(function (b){
return function (){
return (b.scrollRAF=null), b.slider.css(a);
};})(this)
)))
: this.slider.css(a);
}),
(j.prototype.createEvents=function (){
this.events={
down: (function (a){
return function (b){
return (
(a.isBeingDragged = !0),
(a.offsetY=b.pageY - a.slider.offset().top),
a.slider.is(b.target)||(a.offsetY=0),
a.pane.addClass(a.options.activeClass),
a.doc.bind(n, a.events[h]).bind(o, a.events[w]),
a.body.bind(m, a.events[i]),
!1
);
};})(this),
drag: (function (a){
return function (b){
return (
(a.sliderY =
b.pageY -
a.$el.offset().top -
a.paneTop -
(a.offsetY||0.5 * a.sliderHeight)),
a.scroll(),
a.contentScrollTop >=a.maxScrollTop &&
a.prevScrollTop!==a.maxScrollTop
? a.$el.trigger("scrollend")
: 0===a.contentScrollTop &&
0!==a.prevScrollTop &&
a.$el.trigger("scrolltop"),
!1
);
};})(this),
up: (function (a){
return function (b){
return (
(a.isBeingDragged = !1),
a.pane.removeClass(a.options.activeClass),
a.doc.unbind(n, a.events[h]).unbind(o, a.events[w]),
a.body.unbind(m, a.events[i]),
!1
);
};})(this),
resize: (function (a){
return function (b){
a.reset();
};})(this),
panedown: (function (a){
return function (b){
return (
(a.sliderY =
(b.offsetY||b.originalEvent.layerY) -
0.5 * a.sliderHeight),
a.scroll(),
a.events.down(b),
!1
);
};})(this),
scroll: (function (a){
return function (b){
a.updateScrollValues(),
a.isBeingDragged ||
(a.iOSNativeScrolling ||
((a.sliderY=a.sliderTop), a.setOnScrollStyles()),
null!=b &&
(a.contentScrollTop >=a.maxScrollTop
? (a.options.preventPageScrolling &&
a.preventScrolling(b, g),
a.prevScrollTop!==a.maxScrollTop &&
a.$el.trigger("scrollend"))
: 0===a.contentScrollTop &&
(a.options.preventPageScrolling &&
a.preventScrolling(b, w),
0!==a.prevScrollTop &&
a.$el.trigger("scrolltop"))));
};})(this),
wheel: (function (a){
return function (b){
var c;
if(null!=b)
return (
(c =
b.delta ||
b.wheelDelta ||
(b.originalEvent&&b.originalEvent.wheelDelta) ||
-b.detail ||
(b.originalEvent&&-b.originalEvent.detail)),
c&&(a.sliderY +=-c / 3),
a.scroll(),
!1
);
};})(this),
enter: (function (a){
return function (b){
var c;
if(a.isBeingDragged)
return 1!==(b.buttons||b.which)
? (c=a.events)[w].apply(c, arguments)
: void 0;
};})(this),
};}),
(j.prototype.addEvents=function (){
var a;
this.removeEvents(),
(a=this.events),
this.options.disableResize||this.win.bind(s, a[s]),
this.iOSNativeScrolling ||
(this.slider.bind(l, a[g]),
this.pane.bind(l, a[r]).bind("" + p + " " + f, a[x])),
this.$content.bind("" + t + " " + p + " " + f + " " + v, a[t]);
}),
(j.prototype.removeEvents=function (){
var a;
(a=this.events),
this.win.unbind(s, a[s]),
this.iOSNativeScrolling||(this.slider.unbind(), this.pane.unbind()),
this.$content.unbind("" + t + " " + p + " " + f + " " + v, a[t]);
}),
(j.prototype.generate=function (){
var a, c, d, f, g, h, i;
return (
(f=this.options),
(h=f.paneClass),
(i=f.sliderClass),
(a=f.contentClass),
(g=this.$el.children("." + h)).length ||
g.children("." + i).length ||
this.$el.append('<div class="' + h + '"><div class="' + i + '" /></div>'
),
(this.pane=this.$el.children("." + h)),
(this.slider=this.pane.find("." + i)),
0===e&&C()
? ((d=b
.getComputedStyle(this.content, null)
.getPropertyValue("padding-right")
.replace(/[^0-9.]+/g, "")),
(c={ right: -14, paddingRight: +d + 14 }))
: e&&((c={ right: -e }), this.$el.addClass(f.enabledClass)),
null!=c&&this.$content.css(c),
this
);
}),
(j.prototype.restore=function (){
(this.stopped = !1),
this.iOSNativeScrolling||this.pane.show(),
this.addEvents();
}),
(j.prototype.reset=function (){
var a, b, c, f, g, h, i, j, k, l, m, n;
return this.iOSNativeScrolling
? void (this.contentHeight=this.content.scrollHeight)
: (this.$el.find("." + this.options.paneClass).length ||
this.generate().stop(),
this.stopped&&this.restore(),
(a=this.content),
(f=a.style),
(g=f.overflowY),
d&&this.$content.css({ height: this.$content.height() }),
(b=a.scrollHeight + e),
(l=parseInt(this.$el.css("max-height"), 10)),
l > 0 &&
(this.$el.height(""),
this.$el.height(a.scrollHeight > l ? l:a.scrollHeight)),
(i=this.pane.outerHeight(!1)),
(k=parseInt(this.pane.css("top"), 10)),
(h=parseInt(this.pane.css("bottom"), 10)),
(j=i + k + h),
(n=Math.round((j / b) * i)),
n < this.options.sliderMinHeight
? (n=this.options.sliderMinHeight)
: null!=this.options.sliderMaxHeight &&
n > this.options.sliderMaxHeight &&
(n=this.options.sliderMaxHeight),
g===t&&f.overflowX!==t&&(n +=e),
(this.maxSliderTop=j - n),
(this.contentHeight=b),
(this.paneHeight=i),
(this.paneOuterHeight=j),
(this.sliderHeight=n),
(this.paneTop=k),
this.slider.height(n),
this.events.scroll(),
this.pane.show(),
(this.isActive = !0),
a.scrollHeight===a.clientHeight ||
(this.pane.outerHeight(!0) >=a.scrollHeight&&g!==t)
? (this.pane.hide(), (this.isActive = !1))
: this.el.clientHeight===a.scrollHeight&&g===t
? this.slider.hide()
: this.slider.show(),
this.pane.css({
opacity: this.options.alwaysVisible ? 1:"",
visibility: this.options.alwaysVisible ? "visible":"",
}),
(c=this.$content.css("position")),
("static"===c||"relative"===c) &&
((m=parseInt(this.$content.css("right"), 10)),
m&&this.$content.css({ right: "", marginRight: m })),
this);
}),
(j.prototype.scroll=function (){
return this.isActive
? ((this.sliderY=Math.max(0, this.sliderY)),
(this.sliderY=Math.min(this.maxSliderTop, this.sliderY)),
this.$content.scrollTop((this.maxScrollTop * this.sliderY) / this.maxSliderTop
),
this.iOSNativeScrolling ||
(this.updateScrollValues(), this.setOnScrollStyles()),
this)
: void 0;
}),
(j.prototype.scrollBottom=function (a){
return this.isActive
? (this.$content
.scrollTop(this.contentHeight - this.$content.height() - a)
.trigger(p),
this.stop().restore(),
this)
: void 0;
}),
(j.prototype.scrollTop=function (a){
return this.isActive
? (this.$content.scrollTop(+a).trigger(p), this.stop().restore(), this)
: void 0;
}),
(j.prototype.scrollTo=function (a){
return this.isActive
? (this.scrollTop(this.$el.find(a).get(0).offsetTop), this)
: void 0;
}),
(j.prototype.stop=function (){
return (
y&&this.scrollRAF&&(y(this.scrollRAF), (this.scrollRAF=null)),
(this.stopped = !0),
this.removeEvents(),
this.iOSNativeScrolling||this.pane.hide(),
this
);
}),
(j.prototype.destroy=function (){
return (
this.stopped||this.stop(),
!this.iOSNativeScrolling&&this.pane.length&&this.pane.remove(),
d&&this.$content.height(""),
this.$content.removeAttr("tabindex"),
this.$el.hasClass(this.options.enabledClass) &&
(this.$el.removeClass(this.options.enabledClass),
this.$content.css({ right: "" })),
this
);
}),
(j.prototype.flash=function (){
return !this.iOSNativeScrolling&&this.isActive
? (this.reset(),
this.pane.addClass(this.options.flashedClass),
setTimeout(
(function (a){
return function (){
a.pane.removeClass(a.options.flashedClass);
};})(this),
this.options.flashDelay
),
this)
: void 0;
}),
j
);
})()),
(a.fn.nanoScroller=function (b){
return this.each(function (){
var c, d;
if(((d=this.nanoscroller) ||
((c=a.extend({}, z, b)), (this.nanoscroller=d = new q(this, c))),
b&&"object"==typeof b)
){
if((a.extend(d.options, b), null!=b.scrollBottom))
return d.scrollBottom(b.scrollBottom);
if(null!=b.scrollTop) return d.scrollTop(b.scrollTop);
if(b.scrollTo) return d.scrollTo(b.scrollTo);
if("bottom"===b.scroll) return d.scrollBottom(0);
if("top"===b.scroll) return d.scrollTop(0);
if(b.scroll&&b.scroll instanceof a) return d.scrollTo(b.scroll);
if(b.stop) return d.stop();
if(b.destroy) return d.destroy();
if(b.flash) return d.flash();
}
return d.reset();
});
}),
(a.fn.nanoScroller.Constructor=q);
});
(function (root, factory){
if(typeof define==="function"&&define.amd){
define("typeahead.js", ["jquery"], function (a0){
return factory(a0);
});
}else if(typeof exports==="object"){
module.exports=factory(require("jquery"));
}else{
factory(jQuery);
}})(this, function ($){
var _=(function (){
"use strict";
return {
isMsie: function (){
return /(msie|trident)/i.test(navigator.userAgent)
? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]
: false;
},
isBlankString: function (str){
return !str||/^\s*$/.test(str);
},
escapeRegExChars: function (str){
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
isString: function (obj){
return typeof obj==="string";
},
isNumber: function (obj){
return typeof obj==="number";
},
isArray: $.isArray,
isFunction: $.isFunction,
isObject: $.isPlainObject,
isUndefined: function (obj){
return typeof obj==="undefined";
},
isElement: function (obj){
return !!(obj&&obj.nodeType===1);
},
isJQuery: function (obj){
return obj instanceof $;
},
toStr: function toStr(s){
return _.isUndefined(s)||s===null ? "":s + "";
},
bind: $.proxy,
each: function (collection, cb){
$.each(collection, reverseArgs);
function reverseArgs(index, value){
return cb(value, index);
}},
map: $.map,
filter: $.grep,
every: function (obj, test){
var result=true;
if(!obj){
return result;
}
$.each(obj, function (key, val){
if(!(result=test.call(null, val, key, obj))){
return false;
}});
return !!result;
},
some: function (obj, test){
var result=false;
if(!obj){
return result;
}
$.each(obj, function (key, val){
if((result=test.call(null, val, key, obj))){
return false;
}});
return !!result;
},
mixin: $.extend,
identity: function (x){
return x;
},
clone: function (obj){
return $.extend(true, {}, obj);
},
getIdGenerator: function (){
var counter=0;
return function (){
return counter++;
};},
templatify: function templatify(obj){
return $.isFunction(obj) ? obj:template;
function template(){
return String(obj);
}},
defer: function (fn){
setTimeout(fn, 0);
},
debounce: function (func, wait, immediate){
var timeout, result;
return function (){
var context=this,
args=arguments,
later,
callNow;
later=function (){
timeout=null;
if(!immediate){
result=func.apply(context, args);
}};
callNow=immediate&&!timeout;
clearTimeout(timeout);
timeout=setTimeout(later, wait);
if(callNow){
result=func.apply(context, args);
}
return result;
};},
throttle: function (func, wait){
var context, args, timeout, result, previous, later;
previous=0;
later=function (){
previous=new Date();
timeout=null;
result=func.apply(context, args);
};
return function (){
var now=new Date(),
remaining=wait - (now - previous);
context=this;
args=arguments;
if(remaining <=0){
clearTimeout(timeout);
timeout=null;
previous=now;
result=func.apply(context, args);
}else if(!timeout){
timeout=setTimeout(later, remaining);
}
return result;
};},
stringify: function (val){
return _.isString(val) ? val:JSON.stringify(val);
},
noop: function (){},
};})();
var WWW=(function (){
"use strict";
var defaultClassNames={
wrapper: "twitter-typeahead",
input: "tt-input",
hint: "tt-hint",
menu: "tt-menu",
dataset: "tt-dataset",
suggestion: "tt-suggestion",
selectable: "tt-selectable",
empty: "tt-empty",
open: "tt-open",
cursor: "tt-cursor",
highlight: "tt-highlight",
};
return build;
function build(o){
var www, classes;
classes=_.mixin({}, defaultClassNames, o);
www={
css: buildCss(),
classes: classes,
html: buildHtml(classes),
selectors: buildSelectors(classes),
};
return {
css: www.css,
html: www.html,
classes: www.classes,
selectors: www.selectors,
mixin: function (o){
_.mixin(o, www);
},
};}
function buildHtml(c){
return {
wrapper: '<span class="' + c.wrapper + '"></span>',
menu: '<div class="' + c.menu + '"></div>',
};}
function buildSelectors(classes){
var selectors={};
_.each(classes, function (v, k){
selectors[k]="." + v;
});
return selectors;
}
function buildCss(){
var css={
wrapper: {
position: "relative",
display: "inline-block",
},
hint: {
position: "absolute",
top: "0",
left: "0",
borderColor: "transparent",
boxShadow: "none",
opacity: "1",
},
input: {
position: "relative",
verticalAlign: "top",
backgroundColor: "transparent",
},
inputWithNoHint: {
position: "relative",
verticalAlign: "top",
},
menu: {
position: "absolute",
top: "100%",
left: "0",
zIndex: "100",
display: "none",
},
ltr: {
left: "0",
right: "auto",
},
rtl: {
left: "auto",
right: " 0",
},
};
if(_.isMsie()){
_.mixin(css.input, {
backgroundImage:
"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)",
});
}
return css;
}})();
var EventBus=(function (){
"use strict";
var namespace, deprecationMap;
namespace="typeahead:";
deprecationMap={
render: "rendered",
cursorchange: "cursorchanged",
select: "selected",
autocomplete: "autocompleted",
};
function EventBus(o){
if(!o||!o.el){
$.error("EventBus initialized without el");
}
this.$el=$(o.el);
}
_.mixin(EventBus.prototype, {
_trigger: function (type, args){
var $e;
$e=$.Event(namespace + type);
(args=args||[]).unshift($e);
this.$el.trigger.apply(this.$el, args);
return $e;
},
before: function (type){
var args, $e;
args=[].slice.call(arguments, 1);
$e=this._trigger("before" + type, args);
return $e.isDefaultPrevented();
},
trigger: function (type){
var deprecatedType;
this._trigger(type, [].slice.call(arguments, 1));
if((deprecatedType=deprecationMap[type])){
this._trigger(deprecatedType, [].slice.call(arguments, 1));
}},
});
return EventBus;
})();
var EventEmitter=(function (){
"use strict";
var splitter=/\s+/,
nextTick=getNextTick();
return {
onSync: onSync,
onAsync: onAsync,
off: off,
trigger: trigger,
};
function on(method, types, cb, context){
var type;
if(!cb){
return this;
}
types=types.split(splitter);
cb=context ? bindContext(cb, context):cb;
this._callbacks=this._callbacks||{};
while ((type=types.shift())){
this._callbacks[type]=this._callbacks[type]||{
sync: [],
async: [],
};
this._callbacks[type][method].push(cb);
}
return this;
}
function onAsync(types, cb, context){
return on.call(this, "async", types, cb, context);
}
function onSync(types, cb, context){
return on.call(this, "sync", types, cb, context);
}
function off(types){
var type;
if(!this._callbacks){
return this;
}
types=types.split(splitter);
while ((type=types.shift())){
delete this._callbacks[type];
}
return this;
}
function trigger(types){
var type, callbacks, args, syncFlush, asyncFlush;
if(!this._callbacks){
return this;
}
types=types.split(splitter);
args=[].slice.call(arguments, 1);
while ((type=types.shift())&&(callbacks=this._callbacks[type])){
syncFlush=getFlush(callbacks.sync, this, [type].concat(args));
asyncFlush=getFlush(callbacks.async, this, [type].concat(args));
syncFlush()&&nextTick(asyncFlush);
}
return this;
}
function getFlush(callbacks, context, args){
return flush;
function flush(){
var cancelled;
for (var i=0, len=callbacks.length; !cancelled&&i < len; i +=1){
cancelled=callbacks[i].apply(context, args)===false;
}
return !cancelled;
}}
function getNextTick(){
var nextTickFn;
if(window.setImmediate){
nextTickFn=function nextTickSetImmediate(fn){
setImmediate(function (){
fn();
});
};}else{
nextTickFn=function nextTickSetTimeout(fn){
setTimeout(function (){
fn();
}, 0);
};}
return nextTickFn;
}
function bindContext(fn, context){
return fn.bind
? fn.bind(context)
: function (){
fn.apply(context, [].slice.call(arguments, 0));
};}})();
var highlight=(function (doc){
"use strict";
var defaults={
node: null,
pattern: null,
tagName: "strong",
className: null,
wordsOnly: false,
caseSensitive: false,
};
return function hightlight(o){
var regex;
o=_.mixin({}, defaults, o);
if(!o.node||!o.pattern){
return;
}
o.pattern=_.isArray(o.pattern) ? o.pattern:[o.pattern];
regex=getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
traverse(o.node, hightlightTextNode);
function hightlightTextNode(textNode){
var match, patternNode, wrapperNode;
if((match=regex.exec(textNode.data))){
wrapperNode=doc.createElement(o.tagName);
o.className&&(wrapperNode.className=o.className);
patternNode=textNode.splitText(match.index);
patternNode.splitText(match[0].length);
wrapperNode.appendChild(patternNode.cloneNode(true));
textNode.parentNode.replaceChild(wrapperNode, patternNode);
}
return !!match;
}
function traverse(el, hightlightTextNode){
var childNode,
TEXT_NODE_TYPE=3;
for (var i=0; i < el.childNodes.length; i++){
childNode=el.childNodes[i];
if(childNode.nodeType===TEXT_NODE_TYPE){
i +=hightlightTextNode(childNode) ? 1:0;
}else{
traverse(childNode, hightlightTextNode);
}}
}};
function getRegex(patterns, caseSensitive, wordsOnly){
var escapedPatterns=[],
regexStr;
for (var i=0, len=patterns.length; i < len; i++){
escapedPatterns.push(_.escapeRegExChars(patterns[i]));
}
regexStr=wordsOnly
? "\\b(" + escapedPatterns.join("|") + ")\\b"
: "(" + escapedPatterns.join("|") + ")";
return caseSensitive ? new RegExp(regexStr):new RegExp(regexStr, "i");
}})(window.document);
var Input=(function (){
"use strict";
var specialKeyCodeMap;
specialKeyCodeMap={
9: "tab",
27: "esc",
37: "left",
39: "right",
13: "enter",
38: "up",
40: "down",
};
function Input(o, www){
o=o||{};
if(!o.input){
$.error("input is missing");
}
www.mixin(this);
this.$hint=$(o.hint);
this.$input=$(o.input);
this.query=this.$input.val();
this.queryWhenFocused=this.hasFocus() ? this.query:null;
this.$overflowHelper=buildOverflowHelper(this.$input);
this._checkLanguageDirection();
if(this.$hint.length===0){
this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=_.noop;
}}
Input.normalizeQuery=function (str){
return _.toStr(str)
.replace(/^\s*/g, "")
.replace(/\s{2,}/g, " ");
};
_.mixin(Input.prototype, EventEmitter, {
_onBlur: function onBlur(){
this.resetInputValue();
this.trigger("blurred");
},
_onFocus: function onFocus(){
this.queryWhenFocused=this.query;
this.trigger("focused");
},
_onKeydown: function onKeydown($e){
var keyName=specialKeyCodeMap[$e.which||$e.keyCode];
this._managePreventDefault(keyName, $e);
if(keyName&&this._shouldTrigger(keyName, $e)){
this.trigger(keyName + "Keyed", $e);
}},
_onInput: function onInput(){
this._setQuery(this.getInputValue());
this.clearHintIfInvalid();
this._checkLanguageDirection();
},
_managePreventDefault: function managePreventDefault(keyName, $e){
var preventDefault;
switch (keyName){
case "up":
case "down":
preventDefault = !withModifier($e);
break;
default:
preventDefault=false;
}
preventDefault&&$e.preventDefault();
},
_shouldTrigger: function shouldTrigger(keyName, $e){
var trigger;
switch (keyName){
case "tab":
trigger = !withModifier($e);
break;
default:
trigger=true;
}
return trigger;
},
_checkLanguageDirection: function checkLanguageDirection(){
var dir=(this.$input.css("direction")||"ltr").toLowerCase();
if(this.dir!==dir){
this.dir=dir;
this.$hint.attr("dir", dir);
this.trigger("langDirChanged", dir);
}},
_setQuery: function setQuery(val, silent){
var areEquivalent, hasDifferentWhitespace;
areEquivalent=areQueriesEquivalent(val, this.query);
hasDifferentWhitespace=areEquivalent ? this.query.length!==val.length:false;
this.query=val;
if(!silent&&!areEquivalent){
this.trigger("queryChanged", this.query);
}else if(!silent&&hasDifferentWhitespace){
this.trigger("whitespaceChanged", this.query);
}},
bind: function (){
var that=this,
onBlur,
onFocus,
onKeydown,
onInput;
onBlur=_.bind(this._onBlur, this);
onFocus=_.bind(this._onFocus, this);
onKeydown=_.bind(this._onKeydown, this);
onInput=_.bind(this._onInput, this);
this.$input
.on("blur.tt", onBlur)
.on("focus.tt", onFocus)
.on("keydown.tt", onKeydown);
if(!_.isMsie()||_.isMsie() > 9){
this.$input.on("input.tt", onInput);
}else{
this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function ($e){
if(specialKeyCodeMap[$e.which||$e.keyCode]){
return;
}
_.defer(_.bind(that._onInput, that, $e));
});
}
return this;
},
focus: function focus(){
this.$input.focus();
},
blur: function blur(){
this.$input.blur();
},
getLangDir: function getLangDir(){
return this.dir;
},
getQuery: function getQuery(){
return this.query||"";
},
setQuery: function setQuery(val, silent){
this.setInputValue(val);
this._setQuery(val, silent);
},
hasQueryChangedSinceLastFocus: function hasQueryChangedSinceLastFocus(){
return this.query!==this.queryWhenFocused;
},
getInputValue: function getInputValue(){
return this.$input.val();
},
setInputValue: function setInputValue(value){
this.$input.val(value);
this.clearHintIfInvalid();
this._checkLanguageDirection();
},
resetInputValue: function resetInputValue(){
this.setInputValue(this.query);
},
getHint: function getHint(){
return this.$hint.val();
},
setHint: function setHint(value){
this.$hint.val(value);
},
clearHint: function clearHint(){
this.setHint("");
},
clearHintIfInvalid: function clearHintIfInvalid(){
var val, hint, valIsPrefixOfHint, isValid;
val=this.getInputValue();
hint=this.getHint();
valIsPrefixOfHint=val!==hint&&hint.indexOf(val)===0;
isValid=val!==""&&valIsPrefixOfHint&&!this.hasOverflow();
!isValid&&this.clearHint();
},
hasFocus: function hasFocus(){
return this.$input.is(":focus");
},
hasOverflow: function hasOverflow(){
var constraint=this.$input.width() - 2;
this.$overflowHelper.text(this.getInputValue());
return this.$overflowHelper.width() >=constraint;
},
isCursorAtEnd: function (){
var valueLength, selectionStart, range;
valueLength=this.$input.val().length;
selectionStart=this.$input[0].selectionStart;
if(_.isNumber(selectionStart)){
return selectionStart===valueLength;
}else if(document.selection){
range=document.selection.createRange();
range.moveStart("character", -valueLength);
return valueLength===range.text.length;
}
return true;
},
destroy: function destroy(){
this.$hint.off(".tt");
this.$input.off(".tt");
this.$overflowHelper.remove();
this.$hint=this.$input=this.$overflowHelper=$("<div>");
},
});
return Input;
function buildOverflowHelper($input){
return $('<pre aria-hidden="true"></pre>')
.css({
position: "absolute",
visibility: "hidden",
whiteSpace: "pre",
fontFamily: $input.css("font-family"),
fontSize: $input.css("font-size"),
fontStyle: $input.css("font-style"),
fontVariant: $input.css("font-variant"),
fontWeight: $input.css("font-weight"),
wordSpacing: $input.css("word-spacing"),
letterSpacing: $input.css("letter-spacing"),
textIndent: $input.css("text-indent"),
textRendering: $input.css("text-rendering"),
textTransform: $input.css("text-transform"),
})
.insertAfter($input);
}
function areQueriesEquivalent(a, b){
return Input.normalizeQuery(a)===Input.normalizeQuery(b);
}
function withModifier($e){
return $e.altKey||$e.ctrlKey||$e.metaKey||$e.shiftKey;
}})();
var Dataset=(function (){
"use strict";
var keys, nameGenerator;
keys={
val: "tt-selectable-display",
obj: "tt-selectable-object",
};
nameGenerator=_.getIdGenerator();
function Dataset(o, www){
o=o||{};
o.templates=o.templates||{};
o.templates.notFound=o.templates.notFound||o.templates.empty;
if(!o.source){
$.error("missing source");
}
if(!o.node){
$.error("missing node");
}
if(o.name&&!isValidName(o.name)){
$.error("invalid dataset name: " + o.name);
}
www.mixin(this);
this.highlight = !!o.highlight;
this.name=o.name||nameGenerator();
this.limit=o.limit||5;
this.displayFn=getDisplayFn(o.display||o.displayKey);
this.templates=getTemplates(o.templates, this.displayFn);
this.source=o.source.__ttAdapter ? o.source.__ttAdapter():o.source;
this.async=_.isUndefined(o.async) ? this.source.length > 2:!!o.async;
this._resetLastSuggestion();
this.$el=$(o.node)
.addClass(this.classes.dataset)
.addClass(this.classes.dataset + "-" + this.name);
}
Dataset.extractData=function extractData(el){
var $el=$(el);
if($el.data(keys.obj)){
return {
val: $el.data(keys.val)||"",
obj: $el.data(keys.obj)||null,
};}
return null;
};
_.mixin(Dataset.prototype, EventEmitter, {
_overwrite: function overwrite(query, suggestions){
suggestions=suggestions||[];
if(suggestions.length){
this._renderSuggestions(query, suggestions);
}else if(this.async&&this.templates.pending){
this._renderPending(query);
}else if(!this.async&&this.templates.notFound){
this._renderNotFound(query);
}else{
this._empty();
}
this.trigger("rendered", this.name, suggestions, false);
},
_append: function append(query, suggestions){
suggestions=suggestions||[];
if(suggestions.length&&this.$lastSuggestion.length){
this._appendSuggestions(query, suggestions);
}else if(suggestions.length){
this._renderSuggestions(query, suggestions);
}else if(!this.$lastSuggestion.length&&this.templates.notFound){
this._renderNotFound(query);
}
this.trigger("rendered", this.name, suggestions, true);
},
_renderSuggestions: function renderSuggestions(query, suggestions){
var $fragment;
$fragment=this._getSuggestionsFragment(query, suggestions);
this.$lastSuggestion=$fragment.children().last();
this.$el
.html($fragment)
.prepend(this._getHeader(query, suggestions))
.append(this._getFooter(query, suggestions));
},
_appendSuggestions: function appendSuggestions(query, suggestions){
var $fragment, $lastSuggestion;
$fragment=this._getSuggestionsFragment(query, suggestions);
$lastSuggestion=$fragment.children().last();
this.$lastSuggestion.after($fragment);
this.$lastSuggestion=$lastSuggestion;
},
_renderPending: function renderPending(query){
var template=this.templates.pending;
this._resetLastSuggestion();
template &&
this.$el.html(template({
query: query,
dataset: this.name,
})
);
},
_renderNotFound: function renderNotFound(query){
var template=this.templates.notFound;
this._resetLastSuggestion();
template &&
this.$el.html(template({
query: query,
dataset: this.name,
})
);
},
_empty: function empty(){
this.$el.empty();
this._resetLastSuggestion();
},
_getSuggestionsFragment: function getSuggestionsFragment(query, suggestions){
var that=this,
fragment;
fragment=document.createDocumentFragment();
_.each(suggestions, function getSuggestionNode(suggestion){
var $el, context;
context=that._injectQuery(query, suggestion);
$el=$(that.templates.suggestion(context))
.data(keys.obj, suggestion)
.data(keys.val, that.displayFn(suggestion))
.addClass(that.classes.suggestion + " " + that.classes.selectable);
fragment.appendChild($el[0]);
});
this.highlight &&
highlight({
className: this.classes.highlight,
node: fragment,
pattern: query,
});
return $(fragment);
},
_getFooter: function getFooter(query, suggestions){
return this.templates.footer
? this.templates.footer({
query: query,
suggestions: suggestions,
dataset: this.name,
})
: null;
},
_getHeader: function getHeader(query, suggestions){
return this.templates.header
? this.templates.header({
query: query,
suggestions: suggestions,
dataset: this.name,
})
: null;
},
_resetLastSuggestion: function resetLastSuggestion(){
this.$lastSuggestion=$();
},
_injectQuery: function injectQuery(query, obj){
return _.isObject(obj)
? _.mixin({
_query: query,
},
obj
)
: obj;
},
update: function update(query){
var that=this,
canceled=false,
syncCalled=false,
rendered=0;
this.cancel();
this.cancel=function cancel(){
canceled=true;
that.cancel=$.noop;
that.async&&that.trigger("asyncCanceled", query);
};
this.source(query, sync, async);
!syncCalled&&sync([]);
function sync(suggestions){
if(syncCalled){
return;
}
syncCalled=true;
suggestions=(suggestions||[]).slice(0, that.limit);
rendered=suggestions.length;
that._overwrite(query, suggestions);
if(rendered < that.limit&&that.async){
that.trigger("asyncRequested", query);
}}
function async(suggestions){
suggestions=suggestions||[];
if(!canceled&&rendered < that.limit){
that.cancel=$.noop;
rendered +=suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
that.async&&that.trigger("asyncReceived", query);
}}
},
cancel: $.noop,
clear: function clear(){
this._empty();
this.cancel();
this.trigger("cleared");
},
isEmpty: function isEmpty(){
return this.$el.is(":empty");
},
destroy: function destroy(){
this.$el=$("<div>");
},
});
return Dataset;
function getDisplayFn(display){
display=display||_.stringify;
return _.isFunction(display) ? display:displayFn;
function displayFn(obj){
return obj[display];
}}
function getTemplates(templates, displayFn){
return {
notFound: templates.notFound&&_.templatify(templates.notFound),
pending: templates.pending&&_.templatify(templates.pending),
header: templates.header&&_.templatify(templates.header),
footer: templates.footer&&_.templatify(templates.footer),
suggestion: templates.suggestion||suggestionTemplate,
};
function suggestionTemplate(context){
return $("<div>").text(displayFn(context));
}}
function isValidName(str){
return /^[_a-zA-Z0-9-]+$/.test(str);
}})();
var Menu=(function (){
"use strict";
function Menu(o, www){
var that=this;
o=o||{};
if(!o.node){
$.error("node is required");
}
www.mixin(this);
this.$node=$(o.node);
this.query=null;
this.datasets=_.map(o.datasets, initializeDataset);
function initializeDataset(oDataset){
var node=that.$node.find(oDataset.node).first();
oDataset.node=node.length ? node:$("<div>").appendTo(that.$node);
return new Dataset(oDataset, www);
}}
_.mixin(Menu.prototype, EventEmitter, {
_onSelectableClick: function onSelectableClick($e){
this.trigger("selectableClicked", $($e.currentTarget));
},
_onRendered: function onRendered(type, dataset, suggestions, async){
this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty());
this.trigger("datasetRendered", dataset, suggestions, async);
},
_onCleared: function onCleared(){
this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty());
this.trigger("datasetCleared");
},
_propagate: function propagate(){
this.trigger.apply(this, arguments);
},
_allDatasetsEmpty: function allDatasetsEmpty(){
return _.every(this.datasets, isDatasetEmpty);
function isDatasetEmpty(dataset){
return dataset.isEmpty();
}},
_getSelectables: function getSelectables(){
return this.$node.find(this.selectors.selectable);
},
_removeCursor: function _removeCursor(){
var $selectable=this.getActiveSelectable();
$selectable&&$selectable.removeClass(this.classes.cursor);
},
_ensureVisible: function ensureVisible($el){
var elTop, elBottom, nodeScrollTop, nodeHeight;
elTop=$el.position().top;
elBottom=elTop + $el.outerHeight(true);
nodeScrollTop=this.$node.scrollTop();
nodeHeight =
this.$node.height() +
parseInt(this.$node.css("paddingTop"), 10) +
parseInt(this.$node.css("paddingBottom"), 10);
if(elTop < 0){
this.$node.scrollTop(nodeScrollTop + elTop);
}else if(nodeHeight < elBottom){
this.$node.scrollTop(nodeScrollTop + (elBottom - nodeHeight));
}},
bind: function (){
var that=this,
onSelectableClick;
onSelectableClick=_.bind(this._onSelectableClick, this);
this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
_.each(this.datasets, function (dataset){
dataset
.onSync("asyncRequested", that._propagate, that)
.onSync("asyncCanceled", that._propagate, that)
.onSync("asyncReceived", that._propagate, that)
.onSync("rendered", that._onRendered, that)
.onSync("cleared", that._onCleared, that);
});
return this;
},
isOpen: function isOpen(){
return this.$node.hasClass(this.classes.open);
},
open: function open(){
this.$node.addClass(this.classes.open);
},
close: function close(){
this.$node.removeClass(this.classes.open);
this._removeCursor();
},
setLanguageDirection: function setLanguageDirection(dir){
this.$node.attr("dir", dir);
},
selectableRelativeToCursor: function selectableRelativeToCursor(delta){
var $selectables, $oldCursor, oldIndex, newIndex;
$oldCursor=this.getActiveSelectable();
$selectables=this._getSelectables();
oldIndex=$oldCursor ? $selectables.index($oldCursor):-1;
newIndex=oldIndex + delta;
newIndex=((newIndex + 1) % ($selectables.length + 1)) - 1;
newIndex=newIndex < -1 ? $selectables.length - 1:newIndex;
return newIndex===-1 ? null:$selectables.eq(newIndex);
},
setCursor: function setCursor($selectable){
this._removeCursor();
if(($selectable=$selectable&&$selectable.first())){
$selectable.addClass(this.classes.cursor);
this._ensureVisible($selectable);
}},
getSelectableData: function getSelectableData($el){
return $el&&$el.length ? Dataset.extractData($el):null;
},
getActiveSelectable: function getActiveSelectable(){
var $selectable=this._getSelectables().filter(this.selectors.cursor).first();
return $selectable.length ? $selectable:null;
},
getTopSelectable: function getTopSelectable(){
var $selectable=this._getSelectables().first();
return $selectable.length ? $selectable:null;
},
update: function update(query){
var isValidUpdate=query!==this.query;
if(isValidUpdate){
this.query=query;
_.each(this.datasets, updateDataset);
}
return isValidUpdate;
function updateDataset(dataset){
dataset.update(query);
}},
empty: function empty(){
_.each(this.datasets, clearDataset);
this.query=null;
this.$node.addClass(this.classes.empty);
function clearDataset(dataset){
dataset.clear();
}},
destroy: function destroy(){
this.$node.off(".tt");
this.$node=$("<div>");
_.each(this.datasets, destroyDataset);
function destroyDataset(dataset){
dataset.destroy();
}},
});
return Menu;
})();
var DefaultMenu=(function (){
"use strict";
var s=Menu.prototype;
function DefaultMenu(){
Menu.apply(this, [].slice.call(arguments, 0));
}
_.mixin(DefaultMenu.prototype, Menu.prototype, {
open: function open(){
!this._allDatasetsEmpty()&&this._show();
return s.open.apply(this, [].slice.call(arguments, 0));
},
close: function close(){
this._hide();
return s.close.apply(this, [].slice.call(arguments, 0));
},
_onRendered: function onRendered(){
if(this._allDatasetsEmpty()){
this._hide();
}else{
this.isOpen()&&this._show();
}
return s._onRendered.apply(this, [].slice.call(arguments, 0));
},
_onCleared: function onCleared(){
if(this._allDatasetsEmpty()){
this._hide();
}else{
this.isOpen()&&this._show();
}
return s._onCleared.apply(this, [].slice.call(arguments, 0));
},
setLanguageDirection: function setLanguageDirection(dir){
this.$node.css(dir==="ltr" ? this.css.ltr:this.css.rtl);
return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0));
},
_hide: function hide(){
this.$node.hide();
},
_show: function show(){
this.$node.css("display", "block");
},
});
return DefaultMenu;
})();
var Typeahead=(function (){
"use strict";
function Typeahead(o, www){
var onFocused,
onBlurred,
onEnterKeyed,
onTabKeyed,
onEscKeyed,
onUpKeyed,
onDownKeyed,
onLeftKeyed,
onRightKeyed,
onQueryChanged,
onWhitespaceChanged;
o=o||{};
if(!o.input){
$.error("missing input");
}
if(!o.menu){
$.error("missing menu");
}
if(!o.eventBus){
$.error("missing event bus");
}
www.mixin(this);
this.eventBus=o.eventBus;
this.minLength=_.isNumber(o.minLength) ? o.minLength:1;
this.input=o.input;
this.menu=o.menu;
this.enabled=true;
this.active=false;
this.input.hasFocus()&&this.activate();
this.dir=this.input.getLangDir();
this._hacks();
this.menu
.bind()
.onSync("selectableClicked", this._onSelectableClicked, this)
.onSync("asyncRequested", this._onAsyncRequested, this)
.onSync("asyncCanceled", this._onAsyncCanceled, this)
.onSync("asyncReceived", this._onAsyncReceived, this)
.onSync("datasetRendered", this._onDatasetRendered, this)
.onSync("datasetCleared", this._onDatasetCleared, this);
onFocused=c(this, "activate", "open", "_onFocused");
onBlurred=c(this, "deactivate", "_onBlurred");
onEnterKeyed=c(this, "isActive", "isOpen", "_onEnterKeyed");
onTabKeyed=c(this, "isActive", "isOpen", "_onTabKeyed");
onEscKeyed=c(this, "isActive", "_onEscKeyed");
onUpKeyed=c(this, "isActive", "open", "_onUpKeyed");
onDownKeyed=c(this, "isActive", "open", "_onDownKeyed");
onLeftKeyed=c(this, "isActive", "isOpen", "_onLeftKeyed");
onRightKeyed=c(this, "isActive", "isOpen", "_onRightKeyed");
onQueryChanged=c(this, "_openIfActive", "_onQueryChanged");
onWhitespaceChanged=c(this, "_openIfActive", "_onWhitespaceChanged");
this.input
.bind()
.onSync("focused", onFocused, this)
.onSync("blurred", onBlurred, this)
.onSync("enterKeyed", onEnterKeyed, this)
.onSync("tabKeyed", onTabKeyed, this)
.onSync("escKeyed", onEscKeyed, this)
.onSync("upKeyed", onUpKeyed, this)
.onSync("downKeyed", onDownKeyed, this)
.onSync("leftKeyed", onLeftKeyed, this)
.onSync("rightKeyed", onRightKeyed, this)
.onSync("queryChanged", onQueryChanged, this)
.onSync("whitespaceChanged", onWhitespaceChanged, this)
.onSync("langDirChanged", this._onLangDirChanged, this);
}
_.mixin(Typeahead.prototype, {
_hacks: function hacks(){
var $input, $menu;
$input=this.input.$input||$("<div>");
$menu=this.menu.$node||$("<div>");
$input.on("blur.tt", function ($e){
var active, isActive, hasActive;
active=document.activeElement;
isActive=$menu.is(active);
hasActive=$menu.has(active).length > 0;
if(_.isMsie()&&(isActive||hasActive)){
$e.preventDefault();
$e.stopImmediatePropagation();
_.defer(function (){
$input.focus();
});
}});
$menu.on("mousedown.tt", function ($e){
$e.preventDefault();
});
},
_onSelectableClicked: function onSelectableClicked(type, $el){
this.select($el);
},
_onDatasetCleared: function onDatasetCleared(){
this._updateHint();
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async){
this._updateHint();
this.eventBus.trigger("render", suggestions, async, dataset);
},
_onAsyncRequested: function onAsyncRequested(type, dataset, query){
this.eventBus.trigger("asyncrequest", query, dataset);
},
_onAsyncCanceled: function onAsyncCanceled(type, dataset, query){
this.eventBus.trigger("asynccancel", query, dataset);
},
_onAsyncReceived: function onAsyncReceived(type, dataset, query){
this.eventBus.trigger("asyncreceive", query, dataset);
},
_onFocused: function onFocused(){
this._minLengthMet()&&this.menu.update(this.input.getQuery());
},
_onBlurred: function onBlurred(){
if(this.input.hasQueryChangedSinceLastFocus()){
this.eventBus.trigger("change", this.input.getQuery());
}},
_onEnterKeyed: function onEnterKeyed(type, $e){
var $selectable;
if(($selectable=this.menu.getActiveSelectable())){
this.select($selectable)&&$e.preventDefault();
}},
_onTabKeyed: function onTabKeyed(type, $e){
var $selectable;
if(($selectable=this.menu.getActiveSelectable())){
this.select($selectable)&&$e.preventDefault();
}else if(($selectable=this.menu.getTopSelectable())){
this.autocomplete($selectable)&&$e.preventDefault();
}},
_onEscKeyed: function onEscKeyed(){
this.close();
},
_onUpKeyed: function onUpKeyed(){
this.moveCursor(-1);
},
_onDownKeyed: function onDownKeyed(){
this.moveCursor(+1);
},
_onLeftKeyed: function onLeftKeyed(){
if(this.dir==="rtl"&&this.input.isCursorAtEnd()){
this.autocomplete(this.menu.getTopSelectable());
}},
_onRightKeyed: function onRightKeyed(){
if(this.dir==="ltr"&&this.input.isCursorAtEnd()){
this.autocomplete(this.menu.getTopSelectable());
}},
_onQueryChanged: function onQueryChanged(e, query){
this._minLengthMet(query) ? this.menu.update(query):this.menu.empty();
},
_onWhitespaceChanged: function onWhitespaceChanged(){
this._updateHint();
},
_onLangDirChanged: function onLangDirChanged(e, dir){
if(this.dir!==dir){
this.dir=dir;
this.menu.setLanguageDirection(dir);
}},
_openIfActive: function openIfActive(){
this.isActive()&&this.open();
},
_minLengthMet: function minLengthMet(query){
query=_.isString(query) ? query:this.input.getQuery()||"";
return query.length >=this.minLength;
},
_updateHint: function updateHint(){
var $selectable, data, val, query, escapedQuery, frontMatchRegEx, match;
$selectable=this.menu.getTopSelectable();
data=this.menu.getSelectableData($selectable);
val=this.input.getInputValue();
if(data&&!_.isBlankString(val)&&!this.input.hasOverflow()){
query=Input.normalizeQuery(val);
escapedQuery=_.escapeRegExChars(query);
frontMatchRegEx=new RegExp("^(?:" + escapedQuery + ")(.+$)", "i");
match=frontMatchRegEx.exec(data.val);
match&&this.input.setHint(val + match[1]);
}else{
this.input.clearHint();
}},
isEnabled: function isEnabled(){
return this.enabled;
},
enable: function enable(){
this.enabled=true;
},
disable: function disable(){
this.enabled=false;
},
isActive: function isActive(){
return this.active;
},
activate: function activate(){
if(this.isActive()){
return true;
}else if(!this.isEnabled()||this.eventBus.before("active")){
return false;
}else{
this.active=true;
this.eventBus.trigger("active");
return true;
}},
deactivate: function deactivate(){
if(!this.isActive()){
return true;
}else if(this.eventBus.before("idle")){
return false;
}else{
this.active=false;
this.close();
this.eventBus.trigger("idle");
return true;
}},
isOpen: function isOpen(){
return this.menu.isOpen();
},
open: function open(){
if(!this.isOpen()&&!this.eventBus.before("open")){
this.menu.open();
this._updateHint();
this.eventBus.trigger("open");
}
return this.isOpen();
},
close: function close(){
if(this.isOpen()&&!this.eventBus.before("close")){
this.menu.close();
this.input.clearHint();
this.input.resetInputValue();
this.eventBus.trigger("close");
}
return !this.isOpen();
},
setVal: function setVal(val){
this.input.setQuery(_.toStr(val));
},
getVal: function getVal(){
return this.input.getQuery();
},
select: function select($selectable){
var data=this.menu.getSelectableData($selectable);
if(data&&!this.eventBus.before("select", data.obj)){
this.input.setQuery(data.val, true);
this.eventBus.trigger("select", data.obj);
this.close();
return true;
}
return false;
},
autocomplete: function autocomplete($selectable){
var query, data, isValid;
query=this.input.getQuery();
data=this.menu.getSelectableData($selectable);
isValid=data&&query!==data.val;
if(isValid&&!this.eventBus.before("autocomplete", data.obj)){
this.input.setQuery(data.val);
this.eventBus.trigger("autocomplete", data.obj);
return true;
}
return false;
},
moveCursor: function moveCursor(delta){
var query, $candidate, data, payload, cancelMove;
query=this.input.getQuery();
$candidate=this.menu.selectableRelativeToCursor(delta);
data=this.menu.getSelectableData($candidate);
payload=data ? data.obj:null;
cancelMove=this._minLengthMet()&&this.menu.update(query);
if(!cancelMove&&!this.eventBus.before("cursorchange", payload)){
this.menu.setCursor($candidate);
if(data){
this.input.setInputValue(data.val);
}else{
this.input.resetInputValue();
this._updateHint();
}
this.eventBus.trigger("cursorchange", payload);
return true;
}
return false;
},
destroy: function destroy(){
this.input.destroy();
this.menu.destroy();
},
});
return Typeahead;
function c(ctx){
var methods=[].slice.call(arguments, 1);
return function (){
var args=[].slice.call(arguments);
_.each(methods, function (method){
return ctx[method].apply(ctx, args);
});
};}})();
(function (){
"use strict";
var old, keys, methods;
old=$.fn.typeahead;
keys={
www: "tt-www",
attrs: "tt-attrs",
typeahead: "tt-typeahead",
};
methods={
initialize: function initialize(o, datasets){
var www;
datasets=_.isArray(datasets) ? datasets:[].slice.call(arguments, 1);
o=o||{};
www=WWW(o.classNames);
return this.each(attach);
function attach(){
var $input,
$wrapper,
$hint,
$menu,
defaultHint,
defaultMenu,
eventBus,
input,
menu,
typeahead,
MenuConstructor;
_.each(datasets, function (d){
d.highlight = !!o.highlight;
});
$input=$(this);
$wrapper=$(www.html.wrapper);
$hint=$elOrNull(o.hint);
$menu=$elOrNull(o.menu);
defaultHint=o.hint!==false&&!$hint;
defaultMenu=o.menu!==false&&!$menu;
defaultHint&&($hint=buildHintFromInput($input, www));
defaultMenu&&($menu=$(www.html.menu).css(www.css.menu));
$hint&&$hint.val("");
$input=prepInput($input, www);
if(defaultHint||defaultMenu){
$wrapper.css(www.css.wrapper);
$input.css(defaultHint ? www.css.input:www.css.inputWithNoHint);
$input
.wrap($wrapper)
.parent()
.prepend(defaultHint ? $hint:null)
.append(defaultMenu ? $menu:null);
}
MenuConstructor=defaultMenu ? DefaultMenu:Menu;
eventBus=new EventBus({
el: $input,
});
input=new Input(
{
hint: $hint,
input: $input,
},
www
);
menu=new MenuConstructor(
{
node: $menu,
datasets: datasets,
},
www
);
typeahead=new Typeahead(
{
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength,
},
www
);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
}},
isEnabled: function isEnabled(){
var enabled;
ttEach(this.first(), function (t){
enabled=t.isEnabled();
});
return enabled;
},
enable: function enable(){
ttEach(this, function (t){
t.enable();
});
return this;
},
disable: function disable(){
ttEach(this, function (t){
t.disable();
});
return this;
},
isActive: function isActive(){
var active;
ttEach(this.first(), function (t){
active=t.isActive();
});
return active;
},
activate: function activate(){
ttEach(this, function (t){
t.activate();
});
return this;
},
deactivate: function deactivate(){
ttEach(this, function (t){
t.deactivate();
});
return this;
},
isOpen: function isOpen(){
var open;
ttEach(this.first(), function (t){
open=t.isOpen();
});
return open;
},
open: function open(){
ttEach(this, function (t){
t.open();
});
return this;
},
close: function close(){
ttEach(this, function (t){
t.close();
});
return this;
},
select: function select(el){
var success=false,
$el=$(el);
ttEach(this.first(), function (t){
success=t.select($el);
});
return success;
},
autocomplete: function autocomplete(el){
var success=false,
$el=$(el);
ttEach(this.first(), function (t){
success=t.autocomplete($el);
});
return success;
},
moveCursor: function moveCursoe(delta){
var success=false;
ttEach(this.first(), function (t){
success=t.moveCursor(delta);
});
return success;
},
val: function val(newVal){
var query;
if(!arguments.length){
ttEach(this.first(), function (t){
query=t.getVal();
});
return query;
}else{
ttEach(this, function (t){
t.setVal(newVal);
});
return this;
}},
destroy: function destroy(){
ttEach(this, function (typeahead, $input){
revert($input);
typeahead.destroy();
});
return this;
},
};
$.fn.typeahead=function (method){
if(methods[method]){
return methods[method].apply(this, [].slice.call(arguments, 1));
}else{
return methods.initialize.apply(this, arguments);
}};
$.fn.typeahead.noConflict=function noConflict(){
$.fn.typeahead=old;
return this;
};
function ttEach($els, fn){
$els.each(function (){
var $input=$(this),
typeahead;
(typeahead=$input.data(keys.typeahead))&&fn(typeahead, $input);
});
}
function buildHintFromInput($input, www){
return $input
.clone()
.addClass(www.classes.hint)
.removeData()
.css(www.css.hint)
.css(getBackgroundStyles($input))
.prop("readonly", true)
.removeAttr("id name placeholder required")
.attr({
autocomplete: "off",
spellcheck: "false",
tabindex: -1,
});
}
function prepInput($input, www){
$input.data(keys.attrs, {
dir: $input.attr("dir"),
autocomplete: $input.attr("autocomplete"),
spellcheck: $input.attr("spellcheck"),
style: $input.attr("style"),
});
$input.addClass(www.classes.input).attr({
autocomplete: "off",
spellcheck: false,
});
try {
!$input.attr("dir")&&$input.attr("dir", "auto");
} catch (e){}
return $input;
}
function getBackgroundStyles($el){
return {
backgroundAttachment: $el.css("background-attachment"),
backgroundClip: $el.css("background-clip"),
backgroundColor: $el.css("background-color"),
backgroundImage: $el.css("background-image"),
backgroundOrigin: $el.css("background-origin"),
backgroundPosition: $el.css("background-position"),
backgroundRepeat: $el.css("background-repeat"),
backgroundSize: $el.css("background-size"),
};}
function revert($input){
var www, $wrapper;
www=$input.data(keys.www);
$wrapper=$input.parent().filter(www.selectors.wrapper);
_.each($input.data(keys.attrs), function (val, key){
_.isUndefined(val) ? $input.removeAttr(key):$input.attr(key, val);
});
$input
.removeData(keys.typeahead)
.removeData(keys.www)
.removeData(keys.attr)
.removeClass(www.classes.input);
if($wrapper.length){
$input.detach().insertAfter($wrapper);
$wrapper.remove();
}}
function $elOrNull(obj){
var isValid, $el;
isValid=_.isJQuery(obj)||_.isElement(obj);
$el=isValid ? $(obj).first():[];
return $el.length ? $el:null;
}})();
});
(function (root, factory){
if(typeof define==="function"&&define.amd){
define("bloodhound", ["jquery"], function (a0){
return (root["Bloodhound"]=factory(a0));
});
}else if(typeof exports==="object"){
module.exports=factory(require("jquery"));
}else{
root["Bloodhound"]=factory(jQuery);
}})(this, function ($){
var _=(function (){
"use strict";
return {
isMsie: function (){
return /(msie|trident)/i.test(navigator.userAgent)
? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]
: false;
},
isBlankString: function (str){
return !str||/^\s*$/.test(str);
},
escapeRegExChars: function (str){
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
isString: function (obj){
return typeof obj==="string";
},
isNumber: function (obj){
return typeof obj==="number";
},
isArray: $.isArray,
isFunction: $.isFunction,
isObject: $.isPlainObject,
isUndefined: function (obj){
return typeof obj==="undefined";
},
isElement: function (obj){
return !!(obj&&obj.nodeType===1);
},
isJQuery: function (obj){
return obj instanceof $;
},
toStr: function toStr(s){
return _.isUndefined(s)||s===null ? "":s + "";
},
bind: $.proxy,
each: function (collection, cb){
$.each(collection, reverseArgs);
function reverseArgs(index, value){
return cb(value, index);
}},
map: $.map,
filter: $.grep,
every: function (obj, test){
var result=true;
if(!obj){
return result;
}
$.each(obj, function (key, val){
if(!(result=test.call(null, val, key, obj))){
return false;
}});
return !!result;
},
some: function (obj, test){
var result=false;
if(!obj){
return result;
}
$.each(obj, function (key, val){
if((result=test.call(null, val, key, obj))){
return false;
}});
return !!result;
},
mixin: $.extend,
identity: function (x){
return x;
},
clone: function (obj){
return $.extend(true, {}, obj);
},
getIdGenerator: function (){
var counter=0;
return function (){
return counter++;
};},
templatify: function templatify(obj){
return $.isFunction(obj) ? obj:template;
function template(){
return String(obj);
}},
defer: function (fn){
setTimeout(fn, 0);
},
debounce: function (func, wait, immediate){
var timeout, result;
return function (){
var context=this,
args=arguments,
later,
callNow;
later=function (){
timeout=null;
if(!immediate){
result=func.apply(context, args);
}};
callNow=immediate&&!timeout;
clearTimeout(timeout);
timeout=setTimeout(later, wait);
if(callNow){
result=func.apply(context, args);
}
return result;
};},
throttle: function (func, wait){
var context, args, timeout, result, previous, later;
previous=0;
later=function (){
previous=new Date();
timeout=null;
result=func.apply(context, args);
};
return function (){
var now=new Date(),
remaining=wait - (now - previous);
context=this;
args=arguments;
if(remaining <=0){
clearTimeout(timeout);
timeout=null;
previous=now;
result=func.apply(context, args);
}else if(!timeout){
timeout=setTimeout(later, remaining);
}
return result;
};},
stringify: function (val){
return _.isString(val) ? val:JSON.stringify(val);
},
noop: function (){},
};})();
var VERSION="0.11.1";
var tokenizers=(function (){
"use strict";
return {
nonword: nonword,
whitespace: whitespace,
obj: {
nonword: getObjTokenizer(nonword),
whitespace: getObjTokenizer(whitespace),
},
};
function whitespace(str){
str=_.toStr(str);
return str ? str.split(/\s+/):[];
}
function nonword(str){
str=_.toStr(str);
return str ? str.split(/\W+/):[];
}
function getObjTokenizer(tokenizer){
return function setKey(keys){
keys=_.isArray(keys) ? keys:[].slice.call(arguments, 0);
return function tokenize(o){
var tokens=[];
_.each(keys, function (k){
tokens=tokens.concat(tokenizer(_.toStr(o[k])));
});
return tokens;
};};
}})();
var LruCache=(function (){
"use strict";
function LruCache(maxSize){
this.maxSize=_.isNumber(maxSize) ? maxSize:100;
this.reset();
if(this.maxSize <=0){
this.set=this.get=$.noop;
}}
_.mixin(LruCache.prototype, {
set: function set(key, val){
var tailItem=this.list.tail,
node;
if(this.size >=this.maxSize){
this.list.remove(tailItem);
delete this.hash[tailItem.key];
this.size--;
}
if((node=this.hash[key])){
node.val=val;
this.list.moveToFront(node);
}else{
node=new Node(key, val);
this.list.add(node);
this.hash[key]=node;
this.size++;
}},
get: function get(key){
var node=this.hash[key];
if(node){
this.list.moveToFront(node);
return node.val;
}},
reset: function reset(){
this.size=0;
this.hash={};
this.list=new List();
},
});
function List(){
this.head=this.tail=null;
}
_.mixin(List.prototype, {
add: function add(node){
if(this.head){
node.next=this.head;
this.head.prev=node;
}
this.head=node;
this.tail=this.tail||node;
},
remove: function remove(node){
node.prev ? (node.prev.next=node.next):(this.head=node.next);
node.next ? (node.next.prev=node.prev):(this.tail=node.prev);
},
moveToFront: function (node){
this.remove(node);
this.add(node);
},
});
function Node(key, val){
this.key=key;
this.val=val;
this.prev=this.next=null;
}
return LruCache;
})();
var PersistentStorage=(function (){
"use strict";
var LOCAL_STORAGE;
try {
LOCAL_STORAGE=window.localStorage;
LOCAL_STORAGE.setItem("~~~", "!");
LOCAL_STORAGE.removeItem("~~~");
} catch (err){
LOCAL_STORAGE=null;
}
function PersistentStorage(namespace, override){
this.prefix=["__", namespace, "__"].join("");
this.ttlKey="__ttl__";
this.keyMatcher=new RegExp("^" + _.escapeRegExChars(this.prefix));
this.ls=override||LOCAL_STORAGE;
!this.ls&&this._noop();
}
_.mixin(PersistentStorage.prototype, {
_prefix: function (key){
return this.prefix + key;
},
_ttlKey: function (key){
return this._prefix(key) + this.ttlKey;
},
_noop: function (){
this.get=this.set=this.remove=this.clear=this.isExpired=_.noop;
},
_safeSet: function (key, val){
try {
this.ls.setItem(key, val);
} catch (err){
if(err.name==="QuotaExceededError"){
this.clear();
this._noop();
}}
},
get: function (key){
if(this.isExpired(key)){
this.remove(key);
}
return decode(this.ls.getItem(this._prefix(key)));
},
set: function (key, val, ttl){
if(_.isNumber(ttl)){
this._safeSet(this._ttlKey(key), encode(now() + ttl));
}else{
this.ls.removeItem(this._ttlKey(key));
}
return this._safeSet(this._prefix(key), encode(val));
},
remove: function (key){
this.ls.removeItem(this._ttlKey(key));
this.ls.removeItem(this._prefix(key));
return this;
},
clear: function (){
var i,
keys=gatherMatchingKeys(this.keyMatcher);
for (i=keys.length; i--;){
this.remove(keys[i]);
}
return this;
},
isExpired: function (key){
var ttl=decode(this.ls.getItem(this._ttlKey(key)));
return _.isNumber(ttl)&&now() > ttl ? true:false;
},
});
return PersistentStorage;
function now(){
return new Date().getTime();
}
function encode(val){
return JSON.stringify(_.isUndefined(val) ? null:val);
}
function decode(val){
return $.parseJSON(val);
}
function gatherMatchingKeys(keyMatcher){
var i,
key,
keys=[],
len=LOCAL_STORAGE.length;
for (i=0; i < len; i++){
if((key=LOCAL_STORAGE.key(i)).match(keyMatcher)){
keys.push(key.replace(keyMatcher, ""));
}}
return keys;
}})();
var Transport=(function (){
"use strict";
var pendingRequestsCount=0,
pendingRequests={},
maxPendingRequests=6,
sharedCache=new LruCache(10);
function Transport(o){
o=o||{};
this.cancelled=false;
this.lastReq=null;
this._send=o.transport;
this._get=o.limiter ? o.limiter(this._get):this._get;
this._cache=o.cache===false ? new LruCache(0):sharedCache;
}
Transport.setMaxPendingRequests=function setMaxPendingRequests(num){
maxPendingRequests=num;
};
Transport.resetCache=function resetCache(){
sharedCache.reset();
};
_.mixin(Transport.prototype, {
_fingerprint: function fingerprint(o){
o=o||{};
return o.url + o.type + $.param(o.data||{});
},
_get: function (o, cb){
var that=this,
fingerprint,
jqXhr;
fingerprint=this._fingerprint(o);
if(this.cancelled||fingerprint!==this.lastReq){
return;
}
if((jqXhr=pendingRequests[fingerprint])){
jqXhr.done(done).fail(fail);
}else if(pendingRequestsCount < maxPendingRequests){
pendingRequestsCount++;
pendingRequests[fingerprint]=this._send(o)
.done(done)
.fail(fail)
.always(always);
}else{
this.onDeckRequestArgs=[].slice.call(arguments, 0);
}
function done(resp){
cb(null, resp);
that._cache.set(fingerprint, resp);
}
function fail(){
cb(true);
}
function always(){
pendingRequestsCount--;
delete pendingRequests[fingerprint];
if(that.onDeckRequestArgs){
that._get.apply(that, that.onDeckRequestArgs);
that.onDeckRequestArgs=null;
}}
},
get: function (o, cb){
var resp, fingerprint;
cb=cb||$.noop;
o=_.isString(o)
? {
url: o,
}
: o||{};
fingerprint=this._fingerprint(o);
this.cancelled=false;
this.lastReq=fingerprint;
if((resp=this._cache.get(fingerprint))){
cb(null, resp);
}else{
this._get(o, cb);
}},
cancel: function (){
this.cancelled=true;
},
});
return Transport;
})();
var SearchIndex=(window.SearchIndex=(function (){
"use strict";
var CHILDREN="c",
IDS="i";
function SearchIndex(o){
o=o||{};
if(!o.datumTokenizer||!o.queryTokenizer){
$.error("datumTokenizer and queryTokenizer are both required");
}
this.identify=o.identify||_.stringify;
this.datumTokenizer=o.datumTokenizer;
this.queryTokenizer=o.queryTokenizer;
this.reset();
}
_.mixin(SearchIndex.prototype, {
bootstrap: function bootstrap(o){
this.datums=o.datums;
this.trie=o.trie;
},
add: function (data){
var that=this;
data=_.isArray(data) ? data:[data];
_.each(data, function (datum){
var id, tokens;
that.datums[(id=that.identify(datum))]=datum;
tokens=normalizeTokens(that.datumTokenizer(datum));
_.each(tokens, function (token){
var node, chars, ch;
node=that.trie;
chars=token.split("");
while ((ch=chars.shift())){
node=node[CHILDREN][ch]||(node[CHILDREN][ch]=newNode());
node[IDS].push(id);
}});
});
},
get: function get(ids){
var that=this;
return _.map(ids, function (id){
return that.datums[id];
});
},
search: function search(query){
var that=this,
tokens,
matches;
tokens=normalizeTokens(this.queryTokenizer(query));
_.each(tokens, function (token){
var node, chars, ch, ids;
if(matches&&matches.length===0){
return false;
}
node=that.trie;
chars=token.split("");
while (node&&(ch=chars.shift())){
node=node[CHILDREN][ch];
}
if(node&&chars.length===0){
ids=node[IDS].slice(0);
matches=matches ? getIntersection(matches, ids):ids;
}else{
matches=[];
return false;
}});
return matches
? _.map(unique(matches), function (id){
return that.datums[id];
})
: [];
},
all: function all(){
var values=[];
for (var key in this.datums){
values.push(this.datums[key]);
}
return values;
},
reset: function reset(){
this.datums={};
this.trie=newNode();
},
serialize: function serialize(){
return {
datums: this.datums,
trie: this.trie,
};},
});
return SearchIndex;
function normalizeTokens(tokens){
tokens=_.filter(tokens, function (token){
return !!token;
});
tokens=_.map(tokens, function (token){
return token.toLowerCase();
});
return tokens;
}
function newNode(){
var node={};
node[IDS]=[];
node[CHILDREN]={};
return node;
}
function unique(array){
var seen={},
uniques=[];
for (var i=0, len=array.length; i < len; i++){
if(!seen[array[i]]){
seen[array[i]]=true;
uniques.push(array[i]);
}}
return uniques;
}
function getIntersection(arrayA, arrayB){
var ai=0,
bi=0,
intersection=[];
arrayA=arrayA.sort();
arrayB=arrayB.sort();
var lenArrayA=arrayA.length,
lenArrayB=arrayB.length;
while (ai < lenArrayA&&bi < lenArrayB){
if(arrayA[ai] < arrayB[bi]){
ai++;
}else if(arrayA[ai] > arrayB[bi]){
bi++;
}else{
intersection.push(arrayA[ai]);
ai++;
bi++;
}}
return intersection;
}})());
var Prefetch=(function (){
"use strict";
var keys;
keys={
data: "data",
protocol: "protocol",
thumbprint: "thumbprint",
};
function Prefetch(o){
this.url=o.url;
this.ttl=o.ttl;
this.cache=o.cache;
this.prepare=o.prepare;
this.transform=o.transform;
this.transport=o.transport;
this.thumbprint=o.thumbprint;
this.storage=new PersistentStorage(o.cacheKey);
}
_.mixin(Prefetch.prototype, {
_settings: function settings(){
return {
url: this.url,
type: "GET",
dataType: "json",
};},
store: function store(data){
if(!this.cache){
return;
}
this.storage.set(keys.data, data, this.ttl);
this.storage.set(keys.protocol, location.protocol, this.ttl);
this.storage.set(keys.thumbprint, this.thumbprint, this.ttl);
},
fromCache: function fromCache(){
var stored={},
isExpired;
if(!this.cache){
return null;
}
stored.data=this.storage.get(keys.data);
stored.protocol=this.storage.get(keys.protocol);
stored.thumbprint=this.storage.get(keys.thumbprint);
isExpired =
stored.thumbprint!==this.thumbprint||stored.protocol!==location.protocol;
return stored.data&&!isExpired ? stored.data:null;
},
fromNetwork: function (cb){
var that=this,
settings;
if(!cb){
return;
}
settings=this.prepare(this._settings());
this.transport(settings).fail(onError).done(onResponse);
function onError(){
cb(true);
}
function onResponse(resp){
cb(null, that.transform(resp));
}},
clear: function clear(){
this.storage.clear();
return this;
},
});
return Prefetch;
})();
var Remote=(function (){
"use strict";
function Remote(o){
this.url=o.url;
this.prepare=o.prepare;
this.transform=o.transform;
this.transport=new Transport({
cache: o.cache,
limiter: o.limiter,
transport: o.transport,
});
}
_.mixin(Remote.prototype, {
_settings: function settings(){
return {
url: this.url,
type: "GET",
dataType: "json",
};},
get: function get(query, cb){
var that=this,
settings;
if(!cb){
return;
}
query=query||"";
settings=this.prepare(query, this._settings());
return this.transport.get(settings, onResponse);
function onResponse(err, resp){
err ? cb([]):cb(that.transform(resp));
}},
cancelLastRequest: function cancelLastRequest(){
this.transport.cancel();
},
});
return Remote;
})();
var oParser=(function (){
"use strict";
return function parse(o){
var defaults, sorter;
defaults={
initialize: true,
identify: _.stringify,
datumTokenizer: null,
queryTokenizer: null,
sufficient: 5,
sorter: null,
local: [],
prefetch: null,
remote: null,
};
o=_.mixin(defaults, o||{});
!o.datumTokenizer&&$.error("datumTokenizer is required");
!o.queryTokenizer&&$.error("queryTokenizer is required");
sorter=o.sorter;
o.sorter=sorter
? function (x){
return x.sort(sorter);
}
: _.identity;
o.local=_.isFunction(o.local) ? o.local():o.local;
o.prefetch=parsePrefetch(o.prefetch);
o.remote=parseRemote(o.remote);
return o;
};
function parsePrefetch(o){
var defaults;
if(!o){
return null;
}
defaults={
url: null,
ttl: 24 * 60 * 60 * 1e3,
cache: true,
cacheKey: null,
thumbprint: "",
prepare: _.identity,
transform: _.identity,
transport: null,
};
o=_.isString(o)
? {
url: o,
}
: o;
o=_.mixin(defaults, o);
!o.url&&$.error("prefetch requires url to be set");
o.transform=o.filter||o.transform;
o.cacheKey=o.cacheKey||o.url;
o.thumbprint=VERSION + o.thumbprint;
o.transport=o.transport ? callbackToDeferred(o.transport):$.ajax;
return o;
}
function parseRemote(o){
var defaults;
if(!o){
return;
}
defaults={
url: null,
cache: true,
prepare: null,
replace: null,
wildcard: null,
limiter: null,
rateLimitBy: "debounce",
rateLimitWait: 300,
transform: _.identity,
transport: null,
};
o=_.isString(o)
? {
url: o,
}
: o;
o=_.mixin(defaults, o);
!o.url&&$.error("remote requires url to be set");
o.transform=o.filter||o.transform;
o.prepare=toRemotePrepare(o);
o.limiter=toLimiter(o);
o.transport=o.transport ? callbackToDeferred(o.transport):$.ajax;
delete o.replace;
delete o.wildcard;
delete o.rateLimitBy;
delete o.rateLimitWait;
return o;
}
function toRemotePrepare(o){
var prepare, replace, wildcard;
prepare=o.prepare;
replace=o.replace;
wildcard=o.wildcard;
if(prepare){
return prepare;
}
if(replace){
prepare=prepareByReplace;
}else if(o.wildcard){
prepare=prepareByWildcard;
}else{
prepare=idenityPrepare;
}
return prepare;
function prepareByReplace(query, settings){
settings.url=replace(settings.url, query);
return settings;
}
function prepareByWildcard(query, settings){
settings.url=settings.url.replace(wildcard, encodeURIComponent(query));
return settings;
}
function idenityPrepare(query, settings){
return settings;
}}
function toLimiter(o){
var limiter, method, wait;
limiter=o.limiter;
method=o.rateLimitBy;
wait=o.rateLimitWait;
if(!limiter){
limiter=/^throttle$/i.test(method) ? throttle(wait):debounce(wait);
}
return limiter;
function debounce(wait){
return function debounce(fn){
return _.debounce(fn, wait);
};}
function throttle(wait){
return function throttle(fn){
return _.throttle(fn, wait);
};}}
function callbackToDeferred(fn){
return function wrapper(o){
var deferred=$.Deferred();
fn(o, onSuccess, onError);
return deferred;
function onSuccess(resp){
_.defer(function (){
deferred.resolve(resp);
});
}
function onError(err){
_.defer(function (){
deferred.reject(err);
});
}};}})();
var Bloodhound=(function (){
"use strict";
var old;
old=window&&window.Bloodhound;
function Bloodhound(o){
o=oParser(o);
this.sorter=o.sorter;
this.identify=o.identify;
this.sufficient=o.sufficient;
this.local=o.local;
this.remote=o.remote ? new Remote(o.remote):null;
this.prefetch=o.prefetch ? new Prefetch(o.prefetch):null;
this.index=new SearchIndex({
identify: this.identify,
datumTokenizer: o.datumTokenizer,
queryTokenizer: o.queryTokenizer,
});
o.initialize!==false&&this.initialize();
}
Bloodhound.noConflict=function noConflict(){
window&&(window.Bloodhound=old);
return Bloodhound;
};
Bloodhound.tokenizers=tokenizers;
_.mixin(Bloodhound.prototype, {
__ttAdapter: function ttAdapter(){
var that=this;
return this.remote ? withAsync:withoutAsync;
function withAsync(query, sync, async){
return that.search(query, sync, async);
}
function withoutAsync(query, sync){
return that.search(query, sync);
}},
_loadPrefetch: function loadPrefetch(){
var that=this,
deferred,
serialized;
deferred=$.Deferred();
if(!this.prefetch){
deferred.resolve();
}else if((serialized=this.prefetch.fromCache())){
this.index.bootstrap(serialized);
deferred.resolve();
}else{
this.prefetch.fromNetwork(done);
}
return deferred.promise();
function done(err, data){
if(err){
return deferred.reject();
}
that.add(data);
that.prefetch.store(that.index.serialize());
deferred.resolve();
}},
_initialize: function initialize(){
var that=this,
deferred;
this.clear();
(this.initPromise=this._loadPrefetch()).done(addLocalToIndex);
return this.initPromise;
function addLocalToIndex(){
that.add(that.local);
}},
initialize: function initialize(force){
return !this.initPromise||force ? this._initialize():this.initPromise;
},
add: function add(data){
this.index.add(data);
return this;
},
get: function get(ids){
ids=_.isArray(ids) ? ids:[].slice.call(arguments);
return this.index.get(ids);
},
search: function search(query, sync, async){
var that=this,
local;
local=this.sorter(this.index.search(query));
sync(this.remote ? local.slice():local);
if(this.remote&&local.length < this.sufficient){
this.remote.get(query, processRemote);
}else if(this.remote){
this.remote.cancelLastRequest();
}
return this;
function processRemote(remote){
var nonDuplicates=[];
_.each(remote, function (r){
!_.some(local, function (l){
return that.identify(r)===that.identify(l);
})&&nonDuplicates.push(r);
});
async&&async(nonDuplicates);
}},
all: function all(){
return this.index.all();
},
clear: function clear(){
this.index.reset();
return this;
},
clearPrefetchCache: function clearPrefetchCache(){
this.prefetch&&this.prefetch.clear();
return this;
},
clearRemoteCache: function clearRemoteCache(){
Transport.resetCache();
return this;
},
ttAdapter: function ttAdapter(){
return this.__ttAdapter();
},
});
return Bloodhound;
})();
return Bloodhound;
});
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.Handlebars=b():a.Handlebars=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){"use strict";function d(){var a=r();return a.compile=function(b,c){return k.compile(b,c,a)},a.precompile=function(b,c){return k.precompile(b,c,a)},a.AST=i["default"],a.Compiler=k.Compiler,a.JavaScriptCompiler=m["default"],a.Parser=j.parser,a.parse=j.parse,a.parseWithoutProcessing=j.parseWithoutProcessing,a}var e=c(1)["default"];b.__esModule=!0;var f=c(2),g=e(f),h=c(45),i=e(h),j=c(46),k=c(51),l=c(52),m=e(l),n=c(49),o=e(n),p=c(44),q=e(p),r=g["default"].create,s=d();s.create=d,q["default"](s),s.Visitor=o["default"],s["default"]=s,b["default"]=s,a.exports=b["default"]},function(a,b){"use strict";b["default"]=function(a){return a&&a.__esModule?a:{"default":a}},b.__esModule=!0},function(a,b,c){"use strict";function d(){var a=new h.HandlebarsEnvironment;return n.extend(a,h),a.SafeString=j["default"],a.Exception=l["default"],a.Utils=n,a.escapeExpression=n.escapeExpression,a.VM=p,a.template=function(b){return p.template(b,a)},a}var e=c(3)["default"],f=c(1)["default"];b.__esModule=!0;var g=c(4),h=e(g),i=c(37),j=f(i),k=c(6),l=f(k),m=c(5),n=e(m),o=c(38),p=e(o),q=c(44),r=f(q),s=d();s.create=d,r["default"](s),s["default"]=s,b["default"]=s,a.exports=b["default"]},function(a,b){"use strict";b["default"]=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b},b.__esModule=!0},function(a,b,c){"use strict";function d(a,b,c){this.helpers=a||{},this.partials=b||{},this.decorators=c||{},i.registerDefaultHelpers(this),j.registerDefaultDecorators(this)}var e=c(1)["default"];b.__esModule=!0,b.HandlebarsEnvironment=d;var f=c(5),g=c(6),h=e(g),i=c(10),j=c(30),k=c(32),l=e(k),m=c(33),n="4.7.7";b.VERSION=n;var o=8;b.COMPILER_REVISION=o;var p=7;b.LAST_COMPATIBLE_COMPILER_REVISION=p;var q={1:"<=1.0.rc.2",2:"==1.0.0-rc.3",3:"==1.0.0-rc.4",4:"==1.x.x",5:"==2.0.0-alpha.x",6:">=2.0.0-beta.1",7:">=4.0.0 <4.3.0",8:">=4.3.0"};b.REVISION_CHANGES=q;var r="[object Object]";d.prototype={constructor:d,logger:l["default"],log:l["default"].log,registerHelper:function(a,b){if(f.toString.call(a)===r){if(b)throw new h["default"]("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(f.toString.call(a)===r)f.extend(this.partials,a);else{if("undefined"==typeof b)throw new h["default"]('Attempting to register a partial called "'+a+'" as undefined');this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]},registerDecorator:function(a,b){if(f.toString.call(a)===r){if(b)throw new h["default"]("Arg not supported with multiple decorators");f.extend(this.decorators,a)}else this.decorators[a]=b},unregisterDecorator:function(a){delete this.decorators[a]},resetLoggedPropertyAccesses:function(){m.resetLoggedProperties()}};var s=l["default"].log;b.log=s,b.createFrame=f.createFrame,b.logger=l["default"]},function(a,b){"use strict";function c(a){return k[a]}function d(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function e(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1}function f(a){if("string"!=typeof a){if(a&&a.toHTML)return a.toHTML();if(null==a)return"";if(!a)return a+"";a=""+a}return m.test(a)?a.replace(l,c):a}function g(a){return!a&&0!==a||!(!p(a)||0!==a.length)}function h(a){var b=d({},a);return b._parent=a,b}function i(a,b){return a.path=b,a}function j(a,b){return(a?a+".":"")+b}b.__esModule=!0,b.extend=d,b.indexOf=e,b.escapeExpression=f,b.isEmpty=g,b.createFrame=h,b.blockParams=i,b.appendContextPath=j;var k={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},l=/[&<>"'`=]/g,m=/[&<>"'`=]/,n=Object.prototype.toString;b.toString=n;var o=function(a){return"function"==typeof a};o(/x/)&&(b.isFunction=o=function(a){return"function"==typeof a&&"[object Function]"===n.call(a)}),b.isFunction=o;var p=Array.isArray||function(a){return!(!a||"object"!=typeof a)&&"[object Array]"===n.call(a)};b.isArray=p},function(a,b,c){"use strict";function d(a,b){var c=b&&b.loc,g=void 0,h=void 0,i=void 0,j=void 0;c&&(g=c.start.line,h=c.end.line,i=c.start.column,j=c.end.column,a+=" - "+g+":"+i);for(var k=Error.prototype.constructor.call(this,a),l=0;l<f.length;l++)this[f[l]]=k[f[l]];Error.captureStackTrace&&Error.captureStackTrace(this,d);try{c&&(this.lineNumber=g,this.endLineNumber=h,e?(Object.defineProperty(this,"column",{value:i,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:j,enumerable:!0})):(this.column=i,this.endColumn=j))}catch(m){}}var e=c(7)["default"];b.__esModule=!0;var f=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];d.prototype=new Error,b["default"]=d,a.exports=b["default"]},function(a,b,c){a.exports={"default":c(8),__esModule:!0}},function(a,b,c){var d=c(9);a.exports=function(a,b,c){return d.setDesc(a,b,c)}},function(a,b){var c=Object;a.exports={create:c.create,getProto:c.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:c.getOwnPropertyDescriptor,setDesc:c.defineProperty,setDescs:c.defineProperties,getKeys:c.keys,getNames:c.getOwnPropertyNames,getSymbols:c.getOwnPropertySymbols,each:[].forEach}},function(a,b,c){"use strict";function d(a){h["default"](a),j["default"](a),l["default"](a),n["default"](a),p["default"](a),r["default"](a),t["default"](a)}function e(a,b,c){a.helpers[b]&&(a.hooks[b]=a.helpers[b],c||delete a.helpers[b])}var f=c(1)["default"];b.__esModule=!0,b.registerDefaultHelpers=d,b.moveHelperToHooks=e;var g=c(11),h=f(g),i=c(12),j=f(i),k=c(25),l=f(k),m=c(26),n=f(m),o=c(27),p=f(o),q=c(28),r=f(q),s=c(29),t=f(s)},function(a,b,c){"use strict";b.__esModule=!0;var d=c(5);b["default"]=function(a){a.registerHelper("blockHelperMissing",function(b,c){var e=c.inverse,f=c.fn;if(b===!0)return f(this);if(b===!1||null==b)return e(this);if(d.isArray(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):e(this);if(c.data&&c.ids){var g=d.createFrame(c.data);g.contextPath=d.appendContextPath(c.data.contextPath,c.name),c={data:g}}return f(b,c)})},a.exports=b["default"]},function(a,b,c){(function(d){"use strict";var e=c(13)["default"],f=c(1)["default"];b.__esModule=!0;var g=c(5),h=c(6),i=f(h);b["default"]=function(a){a.registerHelper("each",function(a,b){function c(b,c,d){l&&(l.key=b,l.index=c,l.first=0===c,l.last=!!d,m&&(l.contextPath=m+b)),k+=f(a[b],{data:l,blockParams:g.blockParams([a[b],b],[m+b,null])})}if(!b)throw new i["default"]("Must pass iterator to #each");var f=b.fn,h=b.inverse,j=0,k="",l=void 0,m=void 0;if(b.data&&b.ids&&(m=g.appendContextPath(b.data.contextPath,b.ids[0])+"."),g.isFunction(a)&&(a=a.call(this)),b.data&&(l=g.createFrame(b.data)),a&&"object"==typeof a)if(g.isArray(a))for(var n=a.length;j<n;j++)j in a&&c(j,j,j===a.length-1);else if(d.Symbol&&a[d.Symbol.iterator]){for(var o=[],p=a[d.Symbol.iterator](),q=p.next();!q.done;q=p.next())o.push(q.value);a=o;for(var n=a.length;j<n;j++)c(j,j,j===a.length-1)}else!function(){var b=void 0;e(a).forEach(function(a){void 0!==b&&c(b,j-1),b=a,j++}),void 0!==b&&c(b,j-1,!0)}();return 0===j&&(k=h(this)),k})},a.exports=b["default"]}).call(b,function(){return this}())},function(a,b,c){a.exports={"default":c(14),__esModule:!0}},function(a,b,c){c(15),a.exports=c(21).Object.keys},function(a,b,c){var d=c(16);c(18)("keys",function(a){return function(b){return a(d(b))}})},function(a,b,c){var d=c(17);a.exports=function(a){return Object(d(a))}},function(a,b){a.exports=function(a){if(void 0==a)throw TypeError("Can't call method on  "+a);return a}},function(a,b,c){var d=c(19),e=c(21),f=c(24);a.exports=function(a,b){var c=(e.Object||{})[a]||Object[a],g={};g[a]=b(c),d(d.S+d.F*f(function(){c(1)}),"Object",g)}},function(a,b,c){var d=c(20),e=c(21),f=c(22),g="prototype",h=function(a,b,c){var i,j,k,l=a&h.F,m=a&h.G,n=a&h.S,o=a&h.P,p=a&h.B,q=a&h.W,r=m?e:e[b]||(e[b]={}),s=m?d:n?d[b]:(d[b]||{})[g];m&&(c=b);for(i in c)j=!l&&s&&i in s,j&&i in r||(k=j?s[i]:c[i],r[i]=m&&"function"!=typeof s[i]?c[i]:p&&j?f(k,d):q&&s[i]==k?function(a){var b=function(b){return this instanceof a?new a(b):a(b)};return b[g]=a[g],b}(k):o&&"function"==typeof k?f(Function.call,k):k,o&&((r[g]||(r[g]={}))[i]=k))};h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,a.exports=h},function(a,b){var c=a.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=c)},function(a,b){var c=a.exports={version:"1.2.6"};"number"==typeof __e&&(__e=c)},function(a,b,c){var d=c(23);a.exports=function(a,b,c){if(d(a),void 0===b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}}},function(a,b){a.exports=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function!");return a}},function(a,b){a.exports=function(a){try{return!!a()}catch(b){return!0}}},function(a,b,c){"use strict";var d=c(1)["default"];b.__esModule=!0;var e=c(6),f=d(e);b["default"]=function(a){a.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new f["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')})},a.exports=b["default"]},function(a,b,c){"use strict";var d=c(1)["default"];b.__esModule=!0;var e=c(5),f=c(6),g=d(f);b["default"]=function(a){a.registerHelper("if",function(a,b){if(2!=arguments.length)throw new g["default"]("#if requires exactly one argument");return e.isFunction(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||e.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){if(2!=arguments.length)throw new g["default"]("#unless requires exactly one argument");return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})})},a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0,b["default"]=function(a){a.registerHelper("log",function(){for(var b=[void 0],c=arguments[arguments.length-1],d=0;d<arguments.length-1;d++)b.push(arguments[d]);var e=1;null!=c.hash.level?e=c.hash.level:c.data&&null!=c.data.level&&(e=c.data.level),b[0]=e,a.log.apply(a,b)})},a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0,b["default"]=function(a){a.registerHelper("lookup",function(a,b,c){return a?c.lookupProperty(a,b):a})},a.exports=b["default"]},function(a,b,c){"use strict";var d=c(1)["default"];b.__esModule=!0;var e=c(5),f=c(6),g=d(f);b["default"]=function(a){a.registerHelper("with",function(a,b){if(2!=arguments.length)throw new g["default"]("#with requires exactly one argument");e.isFunction(a)&&(a=a.call(this));var c=b.fn;if(e.isEmpty(a))return b.inverse(this);var d=b.data;return b.data&&b.ids&&(d=e.createFrame(b.data),d.contextPath=e.appendContextPath(b.data.contextPath,b.ids[0])),c(a,{data:d,blockParams:e.blockParams([a],[d&&d.contextPath])})})},a.exports=b["default"]},function(a,b,c){"use strict";function d(a){g["default"](a)}var e=c(1)["default"];b.__esModule=!0,b.registerDefaultDecorators=d;var f=c(31),g=e(f)},function(a,b,c){"use strict";b.__esModule=!0;var d=c(5);b["default"]=function(a){a.registerDecorator("inline",function(a,b,c,e){var f=a;return b.partials||(b.partials={},f=function(e,f){var g=c.partials;c.partials=d.extend({},g,b.partials);var h=a(e,f);return c.partials=g,h}),b.partials[e.args[0]]=e.fn,f})},a.exports=b["default"]},function(a,b,c){"use strict";b.__esModule=!0;var d=c(5),e={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(a){if("string"==typeof a){var b=d.indexOf(e.methodMap,a.toLowerCase());a=b>=0?b:parseInt(a,10)}return a},log:function(a){if(a=e.lookupLevel(a),"undefined"!=typeof console&&e.lookupLevel(e.level)<=a){var b=e.methodMap[a];console[b]||(b="log");for(var c=arguments.length,d=Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];console[b].apply(console,d)}}};b["default"]=e,a.exports=b["default"]},function(a,b,c){"use strict";function d(a){var b=i(null);b.constructor=!1,b.__defineGetter__=!1,b.__defineSetter__=!1,b.__lookupGetter__=!1;var c=i(null);return c.__proto__=!1,{properties:{whitelist:l.createNewLookupObject(c,a.allowedProtoProperties),defaultValue:a.allowProtoPropertiesByDefault},methods:{whitelist:l.createNewLookupObject(b,a.allowedProtoMethods),defaultValue:a.allowProtoMethodsByDefault}}}function e(a,b,c){return"function"==typeof a?f(b.methods,c):f(b.properties,c)}function f(a,b){return void 0!==a.whitelist[b]?a.whitelist[b]===!0:void 0!==a.defaultValue?a.defaultValue:(g(b),!1)}function g(a){o[a]!==!0&&(o[a]=!0,n.log("error",'Handlebars: Access has been denied to resolve the property "'+a+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}function h(){j(o).forEach(function(a){delete o[a]})}var i=c(34)["default"],j=c(13)["default"],k=c(3)["default"];b.__esModule=!0,b.createProtoAccessControl=d,b.resultIsAllowed=e,b.resetLoggedProperties=h;var l=c(36),m=c(32),n=k(m),o=i(null)},function(a,b,c){a.exports={"default":c(35),__esModule:!0}},function(a,b,c){var d=c(9);a.exports=function(a,b){return d.create(a,b)}},function(a,b,c){"use strict";function d(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return f.extend.apply(void 0,[e(null)].concat(b))}var e=c(34)["default"];b.__esModule=!0,b.createNewLookupObject=d;var f=c(5)},function(a,b){"use strict";function c(a){this.string=a}b.__esModule=!0,c.prototype.toString=c.prototype.toHTML=function(){return""+this.string},b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=v.COMPILER_REVISION;if(!(b>=v.LAST_COMPATIBLE_COMPILER_REVISION&&b<=v.COMPILER_REVISION)){if(b<v.LAST_COMPATIBLE_COMPILER_REVISION){var d=v.REVISION_CHANGES[c],e=v.REVISION_CHANGES[b];throw new u["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new u["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){function c(c,d,e){e.hash&&(d=s.extend({},d,e.hash),e.ids&&(e.ids[0]=!0)),c=b.VM.resolvePartial.call(this,c,d,e);var f=s.extend({},e,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),g=b.VM.invokePartial.call(this,c,d,f);if(null==g&&b.compile&&(e.partials[e.name]=b.compile(c,a.compilerOptions,b),g=e.partials[e.name](d,f)),null!=g){if(e.indent){for(var h=g.split("\n"),i=0,j=h.length;i<j&&(h[i]||i+1!==j);i++)h[i]=e.indent+h[i];g=h.join("\n")}return g}throw new u["default"]("The partial "+e.name+" could not be compiled when running in runtime-only mode")}function d(b){function c(b){return""+a.main(g,b,g.helpers,g.partials,f,i,h)}var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],f=e.data;d._setup(e),!e.partial&&a.useData&&(f=j(b,f));var h=void 0,i=a.useBlockParams?[]:void 0;return a.useDepths&&(h=e.depths?b!=e.depths[0]?[b].concat(e.depths):e.depths:[b]),(c=k(a.main,c,g,e.depths||[],f,i))(b,e)}if(!b)throw new u["default"]("No environment passed to template");if(!a||!a.main)throw new u["default"]("Unknown template object: "+typeof a);a.main.decorator=a.main_d,b.VM.checkRevision(a.compiler);var e=a.compiler&&7===a.compiler[0],g={strict:function(a,b,c){if(!(a&&b in a))throw new u["default"]('"'+b+'" not defined in '+a,{loc:c});return g.lookupProperty(a,b)},lookupProperty:function(a,b){var c=a[b];return null==c?c:Object.prototype.hasOwnProperty.call(a,b)?c:y.resultIsAllowed(c,g.protoAccessControl,b)?c:void 0},lookup:function(a,b){for(var c=a.length,d=0;d<c;d++){var e=a[d]&&g.lookupProperty(a[d],b);if(null!=e)return a[d][b]}},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:s.escapeExpression,invokePartial:c,fn:function(b){var c=a[b];return c.decorator=a[b+"_d"],c},programs:[],program:function(a,b,c,d,e){var g=this.programs[a],h=this.fn(a);return b||e||d||c?g=f(this,a,h,b,c,d,e):g||(g=this.programs[a]=f(this,a,h)),g},data:function(a,b){for(;a&&b--;)a=a._parent;return a},mergeIfNeeded:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=s.extend({},b,a)),c},nullContext:n({}),noop:b.VM.noop,compilerInfo:a.compiler};return d.isTop=!0,d._setup=function(c){if(c.partial)g.protoAccessControl=c.protoAccessControl,g.helpers=c.helpers,g.partials=c.partials,g.decorators=c.decorators,g.hooks=c.hooks;else{var d=s.extend({},b.helpers,c.helpers);l(d,g),g.helpers=d,a.usePartial&&(g.partials=g.mergeIfNeeded(c.partials,b.partials)),(a.usePartial||a.useDecorators)&&(g.decorators=s.extend({},b.decorators,c.decorators)),g.hooks={},g.protoAccessControl=y.createProtoAccessControl(c);var f=c.allowCallsToHelperMissing||e;w.moveHelperToHooks(g,"helperMissing",f),w.moveHelperToHooks(g,"blockHelperMissing",f)}},d._child=function(b,c,d,e){if(a.useBlockParams&&!d)throw new u["default"]("must pass block params");if(a.useDepths&&!e)throw new u["default"]("must pass parent depths");return f(g,b,a[b],c,0,d,e)},d}function f(a,b,c,d,e,f,g){function h(b){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],h=g;return!g||b==g[0]||b===a.nullContext&&null===g[0]||(h=[b].concat(g)),c(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),h)}return h=k(c,h,a,g,d,f),h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function g(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a="@partial-block"===c.name?c.data["partial-block"]:c.partials[c.name],a}function h(a,b,c){var d=c.data&&c.data["partial-block"];c.partial=!0,c.ids&&(c.data.contextPath=c.ids[0]||c.data.contextPath);var e=void 0;if(c.fn&&c.fn!==i&&!function(){c.data=v.createFrame(c.data);var a=c.fn;e=c.data["partial-block"]=function(b){var c=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return c.data=v.createFrame(c.data),c.data["partial-block"]=d,a(b,c)},a.partials&&(c.partials=s.extend({},c.partials,a.partials))}(),void 0===a&&e&&(a=e),void 0===a)throw new u["default"]("The partial "+c.name+" could not be found");if(a instanceof Function)return a(b,c)}function i(){return""}function j(a,b){return b&&"root"in b||(b=b?v.createFrame(b):{},b.root=a),b}function k(a,b,c,d,e,f){if(a.decorator){var g={};b=a.decorator(b,g,c,d&&d[0],e,f,d),s.extend(b,g)}return b}function l(a,b){o(a).forEach(function(c){var d=a[c];a[c]=m(d,b)})}function m(a,b){var c=b.lookupProperty;return x.wrapHelper(a,function(a){return s.extend({lookupProperty:c},a)})}var n=c(39)["default"],o=c(13)["default"],p=c(3)["default"],q=c(1)["default"];b.__esModule=!0,b.checkRevision=d,b.template=e,b.wrapProgram=f,b.resolvePartial=g,b.invokePartial=h,b.noop=i;var r=c(5),s=p(r),t=c(6),u=q(t),v=c(4),w=c(10),x=c(43),y=c(33)},function(a,b,c){a.exports={"default":c(40),__esModule:!0}},function(a,b,c){c(41),a.exports=c(21).Object.seal},function(a,b,c){var d=c(42);c(18)("seal",function(a){return function(b){return a&&d(b)?a(b):b}})},function(a,b){a.exports=function(a){return"object"==typeof a?null!==a:"function"==typeof a}},function(a,b){"use strict";function c(a,b){if("function"!=typeof a)return a;var c=function(){var c=arguments[arguments.length-1];return arguments[arguments.length-1]=b(c),a.apply(this,arguments)};return c}b.__esModule=!0,b.wrapHelper=c},function(a,b){(function(c){"use strict";b.__esModule=!0,b["default"]=function(a){var b="undefined"!=typeof c?c:window,d=b.Handlebars;a.noConflict=function(){return b.Handlebars===a&&(b.Handlebars=d),a}},a.exports=b["default"]}).call(b,function(){return this}())},function(a,b){"use strict";b.__esModule=!0;var c={helpers:{helperExpression:function(a){return"SubExpression"===a.type||("MustacheStatement"===a.type||"BlockStatement"===a.type)&&!!(a.params&&a.params.length||a.hash)},scopedId:function(a){return/^\.|this\b/.test(a.original)},simpleId:function(a){return 1===a.parts.length&&!c.helpers.scopedId(a)&&!a.depth}}};b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(a,b){if("Program"===a.type)return a;i["default"].yy=o,o.locInfo=function(a){return new o.SourceLocation(b&&b.srcName,a)};var c=i["default"].parse(a);return c}function e(a,b){var c=d(a,b),e=new k["default"](b);return e.accept(c)}var f=c(1)["default"],g=c(3)["default"];b.__esModule=!0,b.parseWithoutProcessing=d,b.parse=e;var h=c(47),i=f(h),j=c(48),k=f(j),l=c(50),m=g(l),n=c(5);b.parser=i["default"];var o={};n.extend(o,m)},function(a,b){"use strict";b.__esModule=!0;var c=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},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},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"},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]],performAction:function(a,b,c,d,e,f,g){var h=f.length-1;switch(e){case 1:return f[h-1];case 2:this.$=d.prepareProgram(f[h]);break;case 3:this.$=f[h];break;case 4:this.$=f[h];break;case 5:this.$=f[h];break;case 6:this.$=f[h];break;case 7:this.$=f[h];break;case 8:this.$=f[h];break;case 9:this.$={type:"CommentStatement",value:d.stripComment(f[h]),strip:d.stripFlags(f[h],f[h]),loc:d.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:f[h],value:f[h],loc:d.locInfo(this._$)};break;case 11:this.$=d.prepareRawBlock(f[h-2],f[h-1],f[h],this._$);break;case 12:this.$={path:f[h-3],params:f[h-2],hash:f[h-1]};break;case 13:this.$=d.prepareBlock(f[h-3],f[h-2],f[h-1],f[h],!1,this._$);break;case 14:this.$=d.prepareBlock(f[h-3],f[h-2],f[h-1],f[h],!0,this._$);break;case 15:this.$={open:f[h-5],path:f[h-4],params:f[h-3],hash:f[h-2],blockParams:f[h-1],strip:d.stripFlags(f[h-5],f[h])};break;case 16:this.$={path:f[h-4],params:f[h-3],hash:f[h-2],blockParams:f[h-1],strip:d.stripFlags(f[h-5],f[h])};break;case 17:this.$={path:f[h-4],params:f[h-3],hash:f[h-2],blockParams:f[h-1],strip:d.stripFlags(f[h-5],f[h])};break;case 18:this.$={strip:d.stripFlags(f[h-1],f[h-1]),program:f[h]};break;case 19:var i=d.prepareBlock(f[h-2],f[h-1],f[h],f[h],!1,this._$),j=d.prepareProgram([i],f[h-1].loc);j.chained=!0,this.$={strip:f[h-2].strip,program:j,chain:!0};break;case 20:this.$=f[h];break;case 21:this.$={path:f[h-1],strip:d.stripFlags(f[h-2],f[h])};break;case 22:this.$=d.prepareMustache(f[h-3],f[h-2],f[h-1],f[h-4],d.stripFlags(f[h-4],f[h]),this._$);break;case 23:this.$=d.prepareMustache(f[h-3],f[h-2],f[h-1],f[h-4],d.stripFlags(f[h-4],f[h]),this._$);break;case 24:this.$={type:"PartialStatement",name:f[h-3],params:f[h-2],hash:f[h-1],indent:"",strip:d.stripFlags(f[h-4],f[h]),loc:d.locInfo(this._$)};break;case 25:this.$=d.preparePartialBlock(f[h-2],f[h-1],f[h],this._$);break;case 26:this.$={path:f[h-3],params:f[h-2],hash:f[h-1],strip:d.stripFlags(f[h-4],f[h])};break;case 27:this.$=f[h];break;case 28:this.$=f[h];break;case 29:this.$={type:"SubExpression",path:f[h-3],params:f[h-2],hash:f[h-1],loc:d.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:f[h],loc:d.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:d.id(f[h-2]),value:f[h],loc:d.locInfo(this._$)};break;case 32:this.$=d.id(f[h-1]);break;case 33:this.$=f[h];break;case 34:this.$=f[h];break;case 35:this.$={type:"StringLiteral",value:f[h],original:f[h],loc:d.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(f[h]),original:Number(f[h]),loc:d.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===f[h],original:"true"===f[h],loc:d.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:d.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:d.locInfo(this._$)};break;case 40:this.$=f[h];break;case 41:this.$=f[h];break;case 42:this.$=d.preparePath(!0,f[h],this._$);break;case 43:this.$=d.preparePath(!1,f[h],this._$);break;case 44:f[h-2].push({part:d.id(f[h]),original:f[h],separator:f[h-1]}),this.$=f[h-2];break;case 45:this.$=[{part:d.id(f[h]),original:f[h]}];break;case 46:this.$=[];break;case 47:f[h-1].push(f[h]);break;case 48:this.$=[];break;case 49:f[h-1].push(f[h]);break;case 50:this.$=[];break;case 51:f[h-1].push(f[h]);break;case 58:this.$=[];break;case 59:f[h-1].push(f[h]);break;case 64:this.$=[];break;case 65:f[h-1].push(f[h]);break;case 70:this.$=[];break;case 71:f[h-1].push(f[h]);break;case 78:this.$=[];break;case 79:f[h-1].push(f[h]);break;case 82:this.$=[];break;case 83:f[h-1].push(f[h]);break;case 86:this.$=[];break;case 87:f[h-1].push(f[h]);break;case 90:this.$=[];break;case 91:f[h-1].push(f[h]);break;case 94:this.$=[];break;case 95:f[h-1].push(f[h]);break;case 98:this.$=[f[h]];break;case 99:f[h-1].push(f[h]);break;case 100:this.$=[f[h]];break;case 101:f[h-1].push(f[h])}},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},{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]}],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]},parseError:function(a,b){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:(null!==n&&"undefined"!=typeof n||(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substring(a,b.yyleng-c+a)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(e(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(b.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return b.yytext=e(1,2).replace(/\\"/g,'"'),80;case 32:return b.yytext=e(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return b.yytext=b.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},a.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\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],a.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:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(){var a=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=a}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"ContentStatement"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"ContentStatement"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"ContentStatement"===d.type&&(c||!d.rightStripped)){var e=d.value;d.value=d.value.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.value!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"ContentStatement"===d.type&&(c||!d.leftStripped)){var e=d.value;return d.value=d.value.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.value!==e,d.leftStripped}}var i=c(1)["default"];b.__esModule=!0;var j=c(49),k=i(j);d.prototype=new k["default"],d.prototype.Program=function(a){var b=!this.options.ignoreStandalone,c=!this.isRootSeen;this.isRootSeen=!0;for(var d=a.body,i=0,j=d.length;i<j;i++){var k=d[i],l=this.accept(k);if(l){var m=e(d,i,c),n=f(d,i,c),o=l.openStandalone&&m,p=l.closeStandalone&&n,q=l.inlineStandalone&&m&&n;l.close&&g(d,i,!0),l.open&&h(d,i,!0),b&&q&&(g(d,i),h(d,i)&&"PartialStatement"===k.type&&(k.indent=/([ \t]+$)/.exec(d[i-1].original)[1])),b&&o&&(g((k.program||k.inverse).body),h(d,i)),b&&p&&(g(d,i),h((k.inverse||k.program).body))}}return a},d.prototype.BlockStatement=d.prototype.DecoratorBlock=d.prototype.PartialBlockStatement=function(a){this.accept(a.program),this.accept(a.inverse);var b=a.program||a.inverse,c=a.program&&a.inverse,d=c,i=c;if(c&&c.chained)for(d=c.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var j={open:a.openStrip.open,close:a.closeStrip.close,openStandalone:f(b.body),closeStandalone:e((d||b).body)};if(a.openStrip.close&&g(b.body,null,!0),c){var k=a.inverseStrip;k.open&&h(b.body,null,!0),k.close&&g(d.body,null,!0),a.closeStrip.open&&h(i.body,null,!0),!this.options.ignoreStandalone&&e(b.body)&&f(d.body)&&(h(b.body),g(d.body))}else a.closeStrip.open&&h(b.body,null,!0);return j},d.prototype.Decorator=d.prototype.MustacheStatement=function(a){return a.strip},d.prototype.PartialStatement=d.prototype.CommentStatement=function(a){var b=a.strip||{};return{inlineStandalone:!0,open:b.open,close:b.close}},b["default"]=d,a.exports=b["default"]},function(a,b,c){"use strict";function d(){this.parents=[]}function e(a){this.acceptRequired(a,"path"),this.acceptArray(a.params),this.acceptKey(a,"hash")}function f(a){e.call(this,a),this.acceptKey(a,"program"),this.acceptKey(a,"inverse")}function g(a){this.acceptRequired(a,"name"),this.acceptArray(a.params),this.acceptKey(a,"hash")}var h=c(1)["default"];b.__esModule=!0;var i=c(6),j=h(i);d.prototype={constructor:d,mutating:!1,acceptKey:function(a,b){var c=this.accept(a[b]);if(this.mutating){if(c&&!d.prototype[c.type])throw new j["default"]('Unexpected node type "'+c.type+'" found when accepting '+b+" on "+a.type);a[b]=c}},acceptRequired:function(a,b){if(this.acceptKey(a,b),!a[b])throw new j["default"](a.type+" requires "+b)},acceptArray:function(a){for(var b=0,c=a.length;b<c;b++)this.acceptKey(a,b),a[b]||(a.splice(b,1),b--,c--)},accept:function(a){if(a){if(!this[a.type])throw new j["default"]("Unknown type: "+a.type,a);this.current&&this.parents.unshift(this.current),this.current=a;var b=this[a.type](a);return this.current=this.parents.shift(),!this.mutating||b?b:b!==!1?a:void 0}},Program:function(a){this.acceptArray(a.body)},MustacheStatement:e,Decorator:e,BlockStatement:f,DecoratorBlock:f,PartialStatement:g,PartialBlockStatement:function(a){g.call(this,a),this.acceptKey(a,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:e,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(a){this.acceptArray(a.pairs)},HashPair:function(a){this.acceptRequired(a,"value")}},b["default"]=d,a.exports=b["default"]},function(a,b,c){"use strict";function d(a,b){if(b=b.path?b.path.original:b,a.path.original!==b){var c={loc:a.path.loc};throw new q["default"](a.path.original+" doesn't match "+b,c)}}function e(a,b){this.source=a,this.start={line:b.first_line,column:b.first_column},this.end={line:b.last_line,column:b.last_column}}function f(a){return/^\[.*\]$/.test(a)?a.substring(1,a.length-1):a}function g(a,b){return{open:"~"===a.charAt(2),close:"~"===b.charAt(b.length-3)}}function h(a){return a.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")}function i(a,b,c){c=this.locInfo(c);for(var d=a?"@":"",e=[],f=0,g=0,h=b.length;g<h;g++){var i=b[g].part,j=b[g].original!==i;if(d+=(b[g].separator||"")+i,j||".."!==i&&"."!==i&&"this"!==i)e.push(i);else{if(e.length>0)throw new q["default"]("Invalid path: "+d,{loc:c});".."===i&&f++}}return{type:"PathExpression",data:a,depth:f,parts:e,original:d,loc:c}}function j(a,b,c,d,e,f){var g=d.charAt(3)||d.charAt(2),h="{"!==g&&"&"!==g,i=/\*/.test(d);return{type:i?"Decorator":"MustacheStatement",path:a,params:b,hash:c,escaped:h,strip:e,loc:this.locInfo(f)}}function k(a,b,c,e){d(a,c),e=this.locInfo(e);var f={type:"Program",body:b,strip:{},loc:e};return{type:"BlockStatement",path:a.path,params:a.params,hash:a.hash,program:f,openStrip:{},inverseStrip:{},closeStrip:{},loc:e}}function l(a,b,c,e,f,g){e&&e.path&&d(a,e);var h=/\*/.test(a.open);b.blockParams=a.blockParams;var i=void 0,j=void 0;if(c){if(h)throw new q["default"]("Unexpected inverse block on decorator",c);c.chain&&(c.program.body[0].closeStrip=e.strip),j=c.strip,i=c.program}return f&&(f=i,i=b,b=f),{type:h?"DecoratorBlock":"BlockStatement",path:a.path,params:a.params,hash:a.hash,program:b,inverse:i,openStrip:a.strip,inverseStrip:j,closeStrip:e&&e.strip,loc:this.locInfo(g)}}function m(a,b){if(!b&&a.length){var c=a[0].loc,d=a[a.length-1].loc;c&&d&&(b={source:c.source,start:{line:c.start.line,column:c.start.column},end:{line:d.end.line,column:d.end.column}})}return{type:"Program",body:a,strip:{},loc:b}}function n(a,b,c,e){return d(a,c),{type:"PartialBlockStatement",name:a.path,params:a.params,hash:a.hash,program:b,openStrip:a.strip,closeStrip:c&&c.strip,loc:this.locInfo(e)}}var o=c(1)["default"];b.__esModule=!0,b.SourceLocation=e,b.id=f,b.stripFlags=g,b.stripComment=h,b.preparePath=i,b.prepareMustache=j,b.prepareRawBlock=k,b.prepareBlock=l,b.prepareProgram=m,b.preparePartialBlock=n;var p=c(6),q=o(p)},function(a,b,c){"use strict";function d(){}function e(a,b,c){if(null==a||"string"!=typeof a&&"Program"!==a.type)throw new l["default"]("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a,b),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function f(a,b,c){function d(){var d=c.parse(a,b),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}function e(a,b){return f||(f=d()),f.call(this,a,b)}if(void 0===b&&(b={}),null==a||"string"!=typeof a&&"Program"!==a.type)throw new l["default"]("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=m.extend({},b),"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var f=void 0;return e._setup=function(a){return f||(f=d()),f._setup(a)},e._child=function(a,b,c,e){return f||(f=d()),f._child(a,b,c,e)},e}function g(a,b){if(a===b)return!0;if(m.isArray(a)&&m.isArray(b)&&a.length===b.length){for(var c=0;c<a.length;c++)if(!g(a[c],b[c]))return!1;return!0}}function h(a){if(!a.path.parts){var b=a.path;a.path={type:"PathExpression",data:!1,depth:0,parts:[b.original+""],original:b.original+"",loc:b.loc}}}var i=c(34)["default"],j=c(1)["default"];b.__esModule=!0,b.Compiler=d,b.precompile=e,b.compile=f;var k=c(6),l=j(k),m=c(5),n=c(45),o=j(n),p=[].slice;d.prototype={compiler:d,equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;c<b;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||!g(d.args,e.args))return!1}b=this.children.length;for(var c=0;c<b;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds,b.blockParams=b.blockParams||[],b.knownHelpers=m.extend(i(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},b.knownHelpers),this.accept(a)},compileProgram:function(a){var b=new this.compiler,c=b.compile(a,this.options),d=this.guid++;return this.usePartial=this.usePartial||c.usePartial,this.children[d]=c,this.useDepths=this.useDepths||c.useDepths,d},accept:function(a){if(!this[a.type])throw new l["default"]("Unknown type: "+a.type,a);this.sourceNode.unshift(a);var b=this[a.type](a);return this.sourceNode.shift(),b},Program:function(a){this.options.blockParams.unshift(a.blockParams);for(var b=a.body,c=b.length,d=0;d<c;d++)this.accept(b[d]);return this.options.blockParams.shift(),this.isSimple=1===c,this.blockParams=a.blockParams?a.blockParams.length:0,this},BlockStatement:function(a){h(a);var b=a.program,c=a.inverse;b=b&&this.compileProgram(b),c=c&&this.compileProgram(c);var d=this.classifySexpr(a);"helper"===d?this.helperSexpr(a,b,c):"simple"===d?(this.simpleSexpr(a),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("emptyHash"),this.opcode("blockValue",a.path.original)):(this.ambiguousSexpr(a,b,c),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(a){var b=a.program&&this.compileProgram(a.program),c=this.setupFullMustacheParams(a,b,void 0),d=a.path;this.useDecorators=!0,this.opcode("registerDecorator",c.length,d.original)},PartialStatement:function(a){this.usePartial=!0;var b=a.program;b&&(b=this.compileProgram(a.program));var c=a.params;if(c.length>1)throw new l["default"]("Unsupported number of partial arguments: "+c.length,a);c.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):c.push({type:"PathExpression",parts:[],depth:0}));var d=a.name.original,e="SubExpression"===a.name.type;e&&this.accept(a.name),this.setupFullMustacheParams(a,b,void 0,!0);var f=a.indent||"";this.options.preventIndent&&f&&(this.opcode("appendContent",f),f=""),this.opcode("invokePartial",e,d,f),this.opcode("append")},PartialBlockStatement:function(a){this.PartialStatement(a)},MustacheStatement:function(a){this.SubExpression(a),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(a){this.DecoratorBlock(a)},ContentStatement:function(a){a.value&&this.opcode("appendContent",a.value)},CommentStatement:function(){},SubExpression:function(a){h(a);var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ambiguousSexpr:function(a,b,c){var d=a.path,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),d.strict=!0,this.accept(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.path;b.strict=!0,this.accept(b),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.path,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new l["default"]("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.strict=!0,e.falsy=!0,this.accept(e),this.opcode("invokeHelper",d.length,e.original,o["default"].helpers.simpleId(e))}},PathExpression:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0],c=o["default"].helpers.scopedId(a),d=!a.depth&&!c&&this.blockParamIndex(b);d?this.opcode("lookupBlockParam",d,a.parts):b?a.data?(this.options.data=!0,this.opcode("lookupData",a.depth,a.parts,a.strict)):this.opcode("lookupOnContext",a.parts,a.falsy,a.strict,c):this.opcode("pushContext")},StringLiteral:function(a){this.opcode("pushString",a.value)},NumberLiteral:function(a){this.opcode("pushLiteral",a.value)},BooleanLiteral:function(a){this.opcode("pushLiteral",a.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(a){var b=a.pairs,c=0,d=b.length;for(this.opcode("pushHash");c<d;c++)this.pushParam(b[c].value);for(;c--;)this.opcode("assignToHash",b[c].key);this.opcode("popHash")},opcode:function(a){this.opcodes.push({opcode:a,args:p.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(a){a&&(this.useDepths=!0)},classifySexpr:function(a){var b=o["default"].helpers.simpleId(a.path),c=b&&!!this.blockParamIndex(a.path.parts[0]),d=!c&&o["default"].helpers.helperExpression(a),e=!c&&(d||b);if(e&&!d){var f=a.path.parts[0],g=this.options;g.knownHelpers[f]?d=!0:g.knownHelpersOnly&&(e=!1)}return d?"helper":e?"ambiguous":"simple"},pushParams:function(a){for(var b=0,c=a.length;b<c;b++)this.pushParam(a[b])},pushParam:function(a){var b=null!=a.value?a.value:a.original||"";if(this.stringParams)b.replace&&(b=b.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",b,a.type),"SubExpression"===a.type&&this.accept(a);else{if(this.trackIds){var c=void 0;if(!a.parts||o["default"].helpers.scopedId(a)||a.depth||(c=this.blockParamIndex(a.parts[0])),c){var d=a.parts.slice(1).join(".");this.opcode("pushId","BlockParam",c,d)}else b=a.original||b,b.replace&&(b=b.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",a.type,b)}this.accept(a)}},setupFullMustacheParams:function(a,b,c,d){var e=a.params;return this.pushParams(e),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.accept(a.hash):this.opcode("emptyHash",d),e},blockParamIndex:function(a){for(var b=0,c=this.options.blockParams.length;b<c;b++){var d=this.options.blockParams[b],e=d&&m.indexOf(d,a);if(d&&e>=0)return[b,e]}}}},function(a,b,c){"use strict";function d(a){this.value=a}function e(){}function f(a,b,c,d){var e=b.popStack(),f=0,g=c.length;for(a&&g--;f<g;f++)e=b.nameLookup(e,c[f],d);return a?[b.aliasable("container.strict"),"(",e,", ",b.quotedString(c[f]),", ",JSON.stringify(b.source.currentLocation),")"]:e}var g=c(13)["default"],h=c(1)["default"];b.__esModule=!0;var i=c(4),j=c(6),k=h(j),l=c(5),m=c(53),n=h(m);e.prototype={nameLookup:function(a,b){return this.internalNameLookup(a,b)},depthedLookup:function(a){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(a),")"]},compilerInfo:function(){var a=i.COMPILER_REVISION,b=i.REVISION_CHANGES[a];return[a,b]},appendToBuffer:function(a,b,c){return l.isArray(a)||(a=[a]),a=this.source.wrap(a,b),this.environment.isSimple?["return ",a,";"]:c?["buffer +=",a,";"]:(a.appendToBuffer=!0,a)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(a,b){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",a,",",JSON.stringify(b),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(a,b,c,d){this.environment=a,this.options=b,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,this.name=this.environment.name,this.isChild=!!c,this.context=c||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(a,b),this.useDepths=this.useDepths||a.useDepths||a.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||a.useBlockParams;var e=a.opcodes,f=void 0,g=void 0,h=void 0,i=void 0;for(h=0,i=e.length;h<i;h++)f=e[h],this.source.currentLocation=f.loc,g=g||f.loc,this[f.opcode].apply(this,f.args);if(this.source.currentLocation=g,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new k["default"]("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators=container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),";\n"]),
this.decorators.push("return fn;"),d?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths){\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var j=this.createFunctionContext(d);if(this.isChild)return j;var l={compiler:this.compilerInfo(),main:j};this.decorators&&(l.main_d=this.decorators,l.useDecorators=!0);var m=this.context,n=m.programs,o=m.decorators;for(h=0,i=n.length;h<i;h++)n[h]&&(l[h]=n[h],o[h]&&(l[h+"_d"]=o[h],l.useDecorators=!0));return this.environment.usePartial&&(l.usePartial=!0),this.options.data&&(l.useData=!0),this.useDepths&&(l.useDepths=!0),this.useBlockParams&&(l.useBlockParams=!0),this.options.compat&&(l.compat=!0),d?l.compilerOptions=this.options:(l.compiler=JSON.stringify(l.compiler),this.source.currentLocation={start:{line:1,column:0}},l=this.objectLiteral(l),b.srcName?(l=l.toStringWithSourceMap({file:b.destName}),l.map=l.map&&l.map.toString()):l=l.toString()),l},preamble:function(){this.lastContext=0,this.source=new n["default"](this.options.srcName),this.decorators=new n["default"](this.options.srcName)},createFunctionContext:function(a){var b=this,c="",d=this.stackVars.concat(this.registers.list);d.length>0&&(c+=", "+d.join(", "));var e=0;g(this.aliases).forEach(function(a){var d=b.aliases[a];d.children&&d.referenceCount>1&&(c+=", alias"+ ++e+"="+a,d.children[0]="alias"+e)}),this.lookupPropertyFunctionIsUsed&&(c+=", "+this.lookupPropertyFunctionVarDeclaration());var f=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&f.push("blockParams"),this.useDepths&&f.push("depths");var h=this.mergeSource(c);return a?(f.push(h),Function.apply(this,f)):this.source.wrap(["function(",f.join(","),"){\n  ",h,"}"])},mergeSource:function(a){var b=this.environment.isSimple,c=!this.forceBuffer,d=void 0,e=void 0,f=void 0,g=void 0;return this.source.each(function(a){a.appendToBuffer?(f?a.prepend("  + "):f=a,g=a):(f&&(e?f.prepend("buffer +="):d=!0,g.add(";"),f=g=void 0),e=!0,b||(c=!1))}),c?f?(f.prepend("return "),g.add(";")):e||this.source.push('return "";'):(a+=", buffer="+(d?"":this.initializeBuffer()),f?(f.prepend("return buffer + "),g.add(";")):this.source.push("return buffer;")),a&&this.source.prepend("var "+a.substring(2)+(d?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){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()},blockValue:function(a){var b=this.aliasable("container.hooks.blockHelperMissing"),c=[this.contextName(0)];this.setupHelperArgs(a,0,c);var d=this.popStack();c.splice(1,0,d),this.push(this.source.functionCall(b,"call",c))},ambiguousBlockValue:function(){var a=this.aliasable("container.hooks.blockHelperMissing"),b=[this.contextName(0)];this.setupHelperArgs("",0,b,!0),this.flushInline();var c=this.topStack();b.splice(1,0,c),this.pushSource(["if(!",this.lastHelper,"){ ",c,"=",this.source.functionCall(a,"call",b),"}"])},appendContent:function(a){this.pendingContent?a=this.pendingContent+a:this.pendingLocation=this.source.currentLocation,this.pendingContent=a},append:function(){if(this.isInline())this.replaceStack(function(a){return["!=null ? ",a,':""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var a=this.popStack();this.pushSource(["if(",a,"!=null){ ",this.appendToBuffer(a,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c,d){var e=0;d||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[e++])),this.resolvePath("context",a,e,b,c)},lookupBlockParam:function(a,b){this.useBlockParams=!0,this.push(["blockParams[",a[0],"][",a[1],"]"]),this.resolvePath("context",b,1)},lookupData:function(a,b,c){a?this.pushStackLiteral("container.data(data, "+a+")"):this.pushStackLiteral("data"),this.resolvePath("data",b,0,!0,c)},resolvePath:function(a,b,c,d,e){var g=this;if(this.options.strict||this.options.assumeObjects)return void this.push(f(this.options.strict&&e,this,b,a));for(var h=b.length;c<h;c++)this.replaceStack(function(e){var f=g.nameLookup(e,b[c],a);return d?["&&",f]:["!=null ? ",f,":",e]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(a,b){this.pushContext(),this.pushString(b),"SubExpression"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(a){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(a?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(a.ids)),this.stringParams&&(this.push(this.objectLiteral(a.contexts)),this.push(this.objectLiteral(a.types))),this.push(this.objectLiteral(a.values))},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},registerDecorator:function(a,b){var c=this.nameLookup("decorators",b,"decorator"),d=this.setupHelperArgs(b,a);this.decorators.push(["fn=",this.decorators.functionCall(c,"",["fn","props","container",d]),"||fn;"])},invokeHelper:function(a,b,c){var d=this.popStack(),e=this.setupHelper(a,b),f=[];c&&f.push(e.name),f.push(d),this.options.strict||f.push(this.aliasable("container.hooks.helperMissing"));var g=["(",this.itemsSeparatedBy(f,"||"),")"],h=this.source.functionCall(g,"call",e.callParams);this.push(h)},itemsSeparatedBy:function(a,b){var c=[];c.push(a[0]);for(var d=1;d<a.length;d++)c.push(b,a[d]);return c},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(this.source.functionCall(c.name,"call",c.callParams))},invokeAmbiguous:function(a,b){this.useRegister("helper");var c=this.popStack();this.emptyHash();var d=this.setupHelper(0,a,b),e=this.lastHelper=this.nameLookup("helpers",a,"helper"),f=["(","(helper=",e,"||",c,")"];this.options.strict||(f[0]="(helper=",f.push("!=null ? helper:",this.aliasable("container.hooks.helperMissing"))),this.push(["(",f,d.paramsInit?["),(",d.paramsInit]:[],"),","(typeof helper===",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",d.callParams),":helper))"])},invokePartial:function(a,b,c){var d=[],e=this.setupParams(b,1,d);a&&(b=this.popStack(),delete e.name),c&&(e.indent=JSON.stringify(c)),e.helpers="helpers",e.partials="partials",e.decorators="container.decorators",a?d.unshift(b):d.unshift(this.nameLookup("partials",b,"partial")),this.options.compat&&(e.depths="depths"),e=this.objectLiteral(e),d.push(e),this.push(this.source.functionCall("container.invokePartial","",d))},assignToHash:function(a){var b=this.popStack(),c=void 0,d=void 0,e=void 0;this.trackIds&&(e=this.popStack()),this.stringParams&&(d=this.popStack(),c=this.popStack());var f=this.hash;c&&(f.contexts[a]=c),d&&(f.types[a]=d),e&&(f.ids[a]=e),f.values[a]=b},pushId:function(a,b,c){"BlockParam"===a?this.pushStackLiteral("blockParams["+b[0]+"].path["+b[1]+"]"+(c?" + "+JSON.stringify("."+c):"")):"PathExpression"===a?this.pushString(b):"SubExpression"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:e,compileChildren:function(a,b){for(var c=a.children,d=void 0,e=void 0,f=0,g=c.length;f<g;f++){d=c[f],e=new this.compiler;var h=this.matchExistingProgram(d);if(null==h){this.context.programs.push("");var i=this.context.programs.length;d.index=i,d.name="program"+i,this.context.programs[i]=e.compile(d,b,this.context,!this.precompile),this.context.decorators[i]=e.decorators,this.context.environments[i]=d,this.useDepths=this.useDepths||e.useDepths,this.useBlockParams=this.useBlockParams||e.useBlockParams,d.useDepths=this.useDepths,d.useBlockParams=this.useBlockParams}else d.index=h.index,d.name="program"+h.index,this.useDepths=this.useDepths||h.useDepths,this.useBlockParams=this.useBlockParams||h.useBlockParams}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;b<c;b++){var d=this.context.environments[b];if(d&&d.equals(a))return d}},programExpression:function(a){var b=this.environment.children[a],c=[b.index,"data",b.blockParams];return(this.useBlockParams||this.useDepths)&&c.push("blockParams"),this.useDepths&&c.push("depths"),"container.program("+c.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},push:function(a){return a instanceof d||(a=this.source.wrap(a)),this.inlineStack.push(a),a},pushStackLiteral:function(a){this.push(new d(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),a&&this.source.push(a)},replaceStack:function(a){var b=["("],c=void 0,e=void 0,f=void 0;if(!this.isInline())throw new k["default"]("replaceStack on non-inline");var g=this.popStack(!0);if(g instanceof d)c=[g.value],b=["(",c],f=!0;else{e=!0;var h=this.incrStack();b=["((",this.push(h),"=",g,")"],c=this.topStack()}var i=a.call(this,c);f||this.popStack(),e&&this.stackSlot--,this.push(b.concat(i,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;this.inlineStack=[];for(var b=0,c=a.length;b<c;b++){var e=a[b];if(e instanceof d)this.compileStack.push(e);else{var f=this.incrStack();this.pushSource([f,"=",e,";"]),this.compileStack.push(f)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),c=(b?this.inlineStack:this.compileStack).pop();if(!a&&c instanceof d)return c.value;if(!b){if(!this.stackSlot)throw new k["default"]("Invalid stack pop");this.stackSlot--}return c},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,b=a[a.length-1];return b instanceof d?b.value:b},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return this.source.quotedString(a)},objectLiteral:function(a){return this.source.objectLiteral(a)},aliasable:function(a){var b=this.aliases[a];return b?(b.referenceCount++,b):(b=this.aliases[a]=this.source.wrap(a),b.aliasable=!0,b.referenceCount=1,b)},setupHelper:function(a,b,c){var d=[],e=this.setupHelperArgs(b,a,d,c),f=this.nameLookup("helpers",b,"helper"),g=this.aliasable(this.contextName(0)+"!=null ? "+this.contextName(0)+":(container.nullContext||{})");return{params:d,paramsInit:e,name:f,callParams:[g].concat(d)}},setupParams:function(a,b,c){var d={},e=[],f=[],g=[],h=!c,i=void 0;h&&(c=[]),d.name=this.quotedString(a),d.hash=this.popStack(),this.trackIds&&(d.hashIds=this.popStack()),this.stringParams&&(d.hashTypes=this.popStack(),d.hashContexts=this.popStack());var j=this.popStack(),k=this.popStack();(k||j)&&(d.fn=k||"container.noop",d.inverse=j||"container.noop");for(var l=b;l--;)i=this.popStack(),c[l]=i,this.trackIds&&(g[l]=this.popStack()),this.stringParams&&(f[l]=this.popStack(),e[l]=this.popStack());return h&&(d.args=this.source.generateArray(c)),this.trackIds&&(d.ids=this.source.generateArray(g)),this.stringParams&&(d.types=this.source.generateArray(f),d.contexts=this.source.generateArray(e)),this.options.data&&(d.data="data"),this.useBlockParams&&(d.blockParams="blockParams"),d},setupHelperArgs:function(a,b,c,d){var e=this.setupParams(a,b,c);return e.loc=JSON.stringify(this.source.currentLocation),e=this.objectLiteral(e),d?(this.useRegister("options"),c.push("options"),["options=",e]):c?(c.push(e),""):e}},function(){for(var a="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(" "),b=e.RESERVED_WORDS={},c=0,d=a.length;c<d;c++)b[a[c]]=!0}(),e.isValidJavaScriptVariableName=function(a){return!e.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},b["default"]=e,a.exports=b["default"]},function(a,b,c){"use strict";function d(a,b,c){if(g.isArray(a)){for(var d=[],e=0,f=a.length;e<f;e++)d.push(b.wrap(a[e],c));return d}return"boolean"==typeof a||"number"==typeof a?a+"":a}function e(a){this.srcFile=a,this.source=[]}var f=c(13)["default"];b.__esModule=!0;var g=c(5),h=void 0;try{}catch(i){}h||(h=function(a,b,c,d){this.src="",d&&this.add(d)},h.prototype={add:function(a){g.isArray(a)&&(a=a.join("")),this.src+=a},prepend:function(a){g.isArray(a)&&(a=a.join("")),this.src=a+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),e.prototype={isEmpty:function(){return!this.source.length},prepend:function(a,b){this.source.unshift(this.wrap(a,b))},push:function(a,b){this.source.push(this.wrap(a,b))},merge:function(){var a=this.empty();return this.each(function(b){a.add(["  ",b,"\n"])}),a},each:function(a){for(var b=0,c=this.source.length;b<c;b++)a(this.source[b])},empty:function(){var a=this.currentLocation||{start:{}};return new h(a.start.line,a.start.column,this.srcFile)},wrap:function(a){var b=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return a instanceof h?a:(a=d(a,this,b),new h(b.start.line,b.start.column,this.srcFile,a))},functionCall:function(a,b,c){return c=this.generateList(c),this.wrap([a,b?"."+b+"(":"(",c,")"])},quotedString:function(a){return'"'+(a+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=this,c=[];f(a).forEach(function(e){var f=d(a[e],b);"undefined"!==f&&c.push([b.quotedString(e),":",f])});var e=this.generateList(c);return e.prepend("{"),e.add("}"),e},generateList:function(a){for(var b=this.empty(),c=0,e=a.length;c<e;c++)c&&b.add(","),b.add(d(a[c],this));return b},generateArray:function(a){var b=this.generateList(a);return b.prepend("["),b.add("]"),b}},b["default"]=e,a.exports=b["default"]}])});
Handlebars.registerHelper("ifeq", function (v1, v2, options){
if(v1==v2){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("getLabel", function (options, fields, fieldName, _options){
return fields[fieldName + "_text"];
});
Handlebars.registerHelper("getPostTitle", function (fields, fieldName, _options){
return typeof fields[fieldName]==="object"&&fields[fieldName].post_title
? fields[fieldName].post_title
: "";
});
Handlebars.registerHelper("getStatusText", function (options, region, status, _options){
return typeof options!=="undefined" &&
typeof region[status]!=="undefined" &&
typeof options.findById(region[status])!=="undefined"
? options.findById(region[status]).label
: "...";
});
Handlebars.registerHelper("round", function (x, options){
return Math.round(x);
});
Handlebars.registerHelper("ifinr", function (v1, v2, options){
for (var i in v2){
if(v2[i].id==v1) return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("ifselected", function (v1, v2, options){
for (var i in v2){
if(v2[i].value==v1) return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("ifin", function (v1, v2, options){
if(v2.indexOf(v1)!=-1){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("ifnoteq", function (v1, v2, options){
if(v1!=v2){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("ifjson", function (v1, v2, options){
if(typeof v1[v2]=="object"){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("ifnotjson", function (v1, v2, options){
if(typeof v1[v2]!="object"){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("getRegions", function (v1, v2, options){
var regions=v1[v2];
var str="";
if(regions&&regions.length){
str +=
'<label class="badge bg-secondary">' +
(regions[0].title ? regions[0].title:regions[0].id) +
"</label> ";
if(regions.length > 1)
str +='<span class="mapsvg-data-image-counter">+' + (regions.length - 1) + "</span>";
return new Handlebars.SafeString(str);
}});
Handlebars.registerHelper("getSelectedOptions", function (v1, v2, options){
var regions=v1[v2];
var str="";
if(regions&&regions.length){
var label=regions[0].label===undefined ? regions[0].value:regions[0].label;
str +='<label class="badge bg-secondary">' + label + "</label> ";
if(regions.length > 1)
str +='<span class="mapsvg-data-image-counter">+' + (regions.length - 1) + "</span>";
return new Handlebars.SafeString(str);
}});
Handlebars.registerHelper("getRegionIDs", function (v1, v2, options){
var regions=v1[v2];
var str="";
if(regions&&regions.length){
str +=
'<label class="badge bg-secondary">' +
(region.title ? region.title:region.id) +
"</label> ";
if(regions.length > 1)
str +='<span class="mapsvg-data-image-counter">+' + (regions.length - 1) + "</span>";
return new Handlebars.SafeString(str);
}});
Handlebars.registerHelper("getThumbs", function (v1, v2, options){
var images=v1[v2];
var str="";
if(images&&images.length){
str +='<img src="' + images[0].thumbnail + '" class="mapsvg-data-thumbnail"/>';
if(images.length > 1)
str +='<span class="mapsvg-data-image-counter">+' + (images.length - 1) + "</span>";
return new Handlebars.SafeString(str);
}});
Handlebars.registerHelper("getMarkerImage", function (v1, v2, options){
var location=v1[v2];
if(!location||!location.markerImagePath){
return "";
}
return new Handlebars.SafeString('<img src="' +
location.markerImagePath +
'" class="mapsvg-marker-image"/> ' +
(location.address&&location.address.formatted ? location.address.formatted:"")
);
});
Handlebars.registerHelper("not", function (v1, v2, options){
if(v1!=v2){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("if_starts", function (v1, v2, options){
if(v1&&v1.indexOf(v2)==0){
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper("if_function", function (v1, options){
return typeof v1=="function" ? options.fn(this):options.inverse(this);
});
Handlebars.registerHelper("if_number", function (v1, options){
return jQuery.isNumeric(v1) ? options.fn(this):options.inverse(this);
});
Handlebars.registerHelper("if_string", function (v1, options){
return typeof v1=="string"&&!jQuery.isNumeric(v1)
? options.fn(this)
: options.inverse(this);
});
Handlebars.registerHelper("toString", function (object){
return object!=undefined ? MapSVG.convertToText(object):"";
});
Handlebars.registerHelper("jsonToString", function (object){
return object!=undefined ? JSON.stringify(object):"";
});
Handlebars.registerHelper("log", function (object){
console.log(object);
});
function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2){
var R=6371;
var dLat=deg2rad(lat2 - lat1);
var dLon=deg2rad(lon2 - lon1);
var a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
var c=2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d=R * c;
return d;
}
function deg2rad(deg){
return deg * (Math.PI / 180);
}
Handlebars.registerHelper("distanceFrom", function (location){
if(MapSVG.distanceSearch){
var distance=getDistanceFromLatLonInKm(
location.geoPoint.lat,
location.geoPoint.lng,
MapSVG.distanceSearch.geoPoint.lat,
MapSVG.distanceSearch.geoPoint.lng
);
if(MapSVG.distanceSearch.units==="mi"){
distance=distance * 0.62137;
}
return distance.toFixed(2) + " " + MapSVG.distanceSearch.units;
}else{
return "";
}});
Handlebars.registerHelper("distanceTo", function (location){
if(MapSVG.distanceSearch){
var distance=getDistanceFromLatLonInKm(
location.geoPoint.lat,
location.geoPoint.lng,
MapSVG.distanceSearch.geoPoint.lat,
MapSVG.distanceSearch.geoPoint.lng
);
if(MapSVG.distanceSearch.units==="mi"){
distance=distance * 0.62137;
}
return distance.toFixed(2) + " " + MapSVG.distanceSearch.units;
}else{
return "";
}});
Handlebars.registerHelper("stripUnderscores", function (object){
return object!=undefined ? object.replace(/_/g, " "):"";
});
Handlebars.registerHelper("spacesToUnderscores", function (object){
return object!=undefined ? object.replace(/ /g, "_"):"";
});
Handlebars.registerHelper("switch", function (value, options){
this._switch_value_=value;
this._switch_break_=false;
var html=options.fn(this);
delete this._switch_break_;
delete this._switch_value_;
return html;
});
Handlebars.registerHelper("case", function (value, options){
var args=Array.prototype.slice.call(arguments);
var options=args.pop();
var caseValues=args;
if(this._switch_break_ ||
(!this._open_break_&&caseValues.indexOf(this._switch_value_)===-1)
){
return "";
}else{
if(options.hash.break==="true"||options.hash.break===true){
this._switch_break_=true;
}else{
this._open_break_=true;
}
return options.fn(this);
}});
Handlebars.registerHelper("default", function (options){
if(!this._switch_break_){
return options.fn(this);
}});
Handlebars.registerHelper("numberFormat", function (value, options){
var dl=options.hash["decimalLength"]||2;
var ts=options.hash["thousandsSep"]||" ";
var ds=options.hash["decimalSep"]||".";
var value=parseFloat(value);
var re="\\d(?=(\\d{3})+" + (dl > 0 ? "\\D":"$") + ")";
var num=value.toFixed(Math.max(0, ~~dl));
return (ds ? num.replace(".", ds):num).replace(new RegExp(re, "g"), "$&" + ts);
});
Handlebars.registerHelper("shortcode", function (shortcode){
for (item in this){
shortcode=shortcode.replace(new RegExp("{{" + item + "}}", "g"), this[item]);
}
if(typeof window.MapSVG.resizeIframe==="undefined"){
window.MapSVG.resizeIframe=function (el){
var iframe=jQuery(el).contents();
function mReceiveMessage(event){
var frames=document.getElementsByTagName("iframe");
for (var i=0; i < frames.length; i++){
if(frames[i].contentWindow===event.source){
jQuery(frames[i]).css({ height: event.data.height });
break;
}}
}
window.addEventListener("message", mReceiveMessage, false);
};
window.MapSVG.resizeIframe();
}
var url=mapsvg_paths.home + "/mapsvg_sc?mapsvg_shortcode=" + encodeURI(shortcode);
return new Handlebars.SafeString('<iframe width="100%" class="mapsvg-iframe-shortcode"  src="' + url + '"></iframe>'
);
});
Handlebars.registerHelper("shortcode_inline", function (shortcode){
for (item in this){
shortcode=shortcode.replace(new RegExp("{{" + item + "}}", "g"), this[item]);
}
if(typeof window.MapSVG.shortcodeCounter=="undefined"){
window.MapSVG.shortcodeCounter=0;
}
var id="mapsvg-inline-shortcode-" + ++window.MapSVG.shortcodeCounter;
var shortcodeBlock='<span class="mapsvg-inline-shortcode" id="' + id + '"></span>';
var url=mapsvg_paths.home + "/mapsvg_sc";
jQuery
.get(mapsvg_paths.api + "shortcodes/" + shortcode, function (data){
jQuery("#" + id).replaceWith(data);
})
.done(()=> {
console.log("done");
})
.fail(()=> {
console.log("fail");
})
.always(()=> {
console.log("always");
});
return new Handlebars.SafeString(shortcodeBlock);
});
Handlebars.registerHelper("post", function (value){
if(this.post){
if(typeof window.MapSVG.resizeIframe==="undefined"){
window.MapSVG.resizeIframe=function (el){
var iframe=jQuery(el).contents();
function mReceiveMessage(event){
var frames=document.getElementsByTagName("iframe");
for (var i=0; i < frames.length; i++){
if(frames[i].contentWindow===event.source){
jQuery(frames[i]).css({ height: event.data.height });
break;
}}
}
window.addEventListener("message", mReceiveMessage, false);
};
window.MapSVG.resizeIframe();
}
return new Handlebars.SafeString('<iframe width="100%" class="mapsvg-iframe-post"  src="/mapsvg_sc?mapsvg_embed_post=' +
encodeURI(this.post.id) +
'"></iframe>'
);
}else{
return "";
}});
Handlebars.registerHelper("math", function (lvalue, operator, rvalue){
lvalue=parseFloat(lvalue);
rvalue=parseFloat(rvalue);
return {
"+": lvalue + rvalue,
"-": lvalue - rvalue,
"*": lvalue * rvalue,
"/": lvalue / rvalue,
"%": lvalue % rvalue,
}[operator];
});
Handlebars.registerHelper("for", function (from, to, incr, block){
var accum="";
for (var i=from; i < to; i +=incr) accum +=block.fn(i);
return accum;
});
(function (global, factory){
typeof exports==='object'&&typeof module!=='undefined' ? factory(exports, require('Handlebars'), require('Bloodhound'), require('CodeMirror')) :
typeof define==='function'&&define.amd ? define(['exports', 'Handlebars', 'Bloodhound', 'CodeMirror'], factory) :
(global=global||self, factory(global.mapsvg={}, global.Handlebars, global.Bloodhound, global.CodeMirror));
}(this, (function (exports, Handlebars, Bloodhound, CodeMirror){ 'use strict';
Handlebars=Handlebars&&Handlebars.hasOwnProperty('default') ? Handlebars['default']:Handlebars;
Bloodhound=Bloodhound&&Bloodhound.hasOwnProperty('default') ? Bloodhound['default']:Bloodhound;
var MapSVG=function (){};
const $=jQuery;
MapSVG.formBuilder={};
MapSVG.mediaUploader={};
if(typeof wp!=="undefined"&&typeof wp.media!=="undefined"){
MapSVG.mediaUploader=wp.media({
title: "Choose images",
button: {
text: "Choose images",
},
multiple: true,
});
}
MapSVG.templatesLoaded={};
if(typeof mapsvg_paths!=="undefined"){
MapSVG.urls=mapsvg_paths;
}else{
MapSVG.urls={};}
if(typeof ajaxurl!=="undefined"){
MapSVG.urls.ajaxurl=ajaxurl;
}
MapSVG.instances=[];
MapSVG.userAgent=navigator.userAgent.toLowerCase();
MapSVG.touchDevice =
"ontouchstart" in window||navigator.MaxTouchPoints > 0||navigator.msMaxTouchPoints > 0;
MapSVG.ios =
MapSVG.userAgent.indexOf("ipad") > -1 ||
MapSVG.userAgent.indexOf("iphone") > -1 ||
MapSVG.userAgent.indexOf("ipod") > -1;
MapSVG.android=MapSVG.userAgent.indexOf("android");
MapSVG.isPhone=window.matchMedia("only screen and (max-width: 812px)").matches;
MapSVG.browser={};
MapSVG.browser.ie =
MapSVG.userAgent.indexOf("msie") > -1 ||
MapSVG.userAgent.indexOf("trident") > -1 ||
MapSVG.userAgent.indexOf("edge") > -1
? {}
: false;
MapSVG.browser.firefox=MapSVG.userAgent.indexOf("firefox") > -1;
MapSVG.browser.safari =
MapSVG.userAgent.indexOf("safari") > -1&&MapSVG.userAgent.indexOf("chrome")===-1;
var ua=window.navigator.userAgent;
MapSVG.device={};
MapSVG.device.ios = !!ua.match(/iPad/i)||!!ua.match(/iPhone/i);
MapSVG.device.android = !!ua.match(/Android/i);
if(!String.prototype.trim){
String.prototype.trim=function (){
return this.replace(/^\s+|\s+$/g, "");
};}
MapSVG.mouseCoords=function (e){
if(e.clientX){
return { x: e.clientX + $(document).scrollLeft(), y: e.clientY + $(document).scrollTop() };}
if(e.pageX){
return { x: e.pageX, y: e.pageY };}else if(MapSVG.touchDevice){
e=e.originalEvent||e;
return e.touches&&e.touches[0]
? { x: e.touches[0].pageX, y: e.touches[0].pageY }
: { x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY };}};
MapSVG.addInstance=function (mapsvg){
MapSVG.instances.push(mapsvg);
};
MapSVG.get=function (index){
return MapSVG.instances[index];
};
MapSVG.getById=function (id){
var instance=MapSVG.instances.filter(function (i){
return i.id==id;
});
if(instance.length > 0){
return instance[0];
}};
MapSVG.getByContainerId=function (id){
var instance=MapSVG.instances.filter(function (i){
return i.$map.attr("id")==id;
});
if(instance.length > 0){
return instance[0];
}};
MapSVG.extend=function (sub, base){
sub.prototype=Object.create(base.prototype);
sub.prototype.constructor=sub;
};
MapSVG.ucfirst=function (string){
return string.charAt(0).toUpperCase() + string.slice(1);
};
MapSVG.parseBoolean=function (string){
switch (String(string).toLowerCase()){
case "on":
case "true":
case "1":
case "yes":
case "y":
return true;
case "off":
case "false":
case "0":
case "no":
case "n":
return false;
default:
return undefined;
}};
MapSVG.isNumber=function (n){
return !isNaN(parseFloat(n))&&isFinite(n);
};
MapSVG.safeURL=function (url){
if(url.indexOf("http://")==0||url.indexOf("https://")==0)
url="//" + url.split("://").pop();
return url.replace(/^.*\/\/[^\/]+/, "");
};
MapSVG.convertToText=function (obj){
var string=[];
if(obj===null){
return null;
}
if(obj===undefined){
return '""';
}else if(typeof obj=="object"&&obj.join==undefined){
var prop;
for (prop in obj){
if(obj.hasOwnProperty(prop)){
var key='"' + prop.replace(/\"/g, '\\"') + '"'; //prop.search(/[^a-zA-Z]+/)===-1 ?  prop : ...
string.push(key + ": " + MapSVG.convertToText(obj[prop]));
}}
return "{" + string.join(",") + "}";
}else if(typeof obj=="object"&&!(obj.join==undefined)){
var prop;
for (prop in obj){
string.push(MapSVG.convertToText(obj[prop]));
}
return "[" + string.join(",") + "]";
}else if(typeof obj=="function"){
return obj.toString().replace("function anonymous", "function");
}else{
return JSON.stringify(obj);
}};
if(!("remove" in Element.prototype)){
Element.prototype.remove=function (){
if(this.parentNode){
this.parentNode.removeChild(this);
}};}
Math.hypot =
Math.hypot ||
function (){
var y=0;
var length=arguments.length;
for (var i=0; i < length; i++){
if(arguments[i]===Infinity||arguments[i]===-Infinity){
return Infinity;
}
y +=arguments[i] * arguments[i];
}
return Math.sqrt(y);
};
SVGElement.prototype.getTransformToElement =
SVGElement.prototype.getTransformToElement ||
function (toElement){
let value;
try {
value=toElement.getScreenCTM().inverse().multiply(this.getScreenCTM());
} catch (e){
return;
}
return value;
};
Map.prototype.toArray=function (){
return Array.from(this, ([name, value])=> value);
};
MapSVG.ResizeSensor=class ResizeSensor {
constructor(element, callback){
var _this=this;
_this.element=element;
_this.callback=callback;
var style=getComputedStyle(element);
var zIndex=parseInt(style.zIndex);
if(isNaN(zIndex)){
zIndex=0;
}
zIndex--;
_this.expand=document.createElement("div");
_this.expand.style.position="absolute";
_this.expand.style.left="0px";
_this.expand.style.top="0px";
_this.expand.style.right="0px";
_this.expand.style.bottom="0px";
_this.expand.style.overflow="hidden";
_this.expand.style.zIndex=zIndex.toString();
_this.expand.style.visibility="hidden";
var expandChild=document.createElement("div");
expandChild.style.position="absolute";
expandChild.style.left="0px";
expandChild.style.top="0px";
expandChild.style.width="10000000px";
expandChild.style.height="10000000px";
_this.expand.appendChild(expandChild);
_this.shrink=document.createElement("div");
_this.shrink.style.position="absolute";
_this.shrink.style.left="0px";
_this.shrink.style.top="0px";
_this.shrink.style.right="0px";
_this.shrink.style.bottom="0px";
_this.shrink.style.overflow="hidden";
_this.shrink.style.zIndex=zIndex.toString();
_this.shrink.style.visibility="hidden";
var shrinkChild=document.createElement("div");
shrinkChild.style.position="absolute";
shrinkChild.style.left="0px";
shrinkChild.style.top="0px";
shrinkChild.style.width="200%";
shrinkChild.style.height="200%";
_this.shrink.appendChild(shrinkChild);
_this.element.appendChild(_this.expand);
_this.element.appendChild(_this.shrink);
var size=element.getBoundingClientRect();
_this.currentWidth=size.width;
_this.currentHeight=size.height;
_this.setScroll();
_this.expand.addEventListener("scroll", function (){
_this.onScroll();
});
_this.shrink.addEventListener("scroll", function (){
_this.onScroll();
});
}
onScroll(){
var _this=this;
var size=_this.element.getBoundingClientRect();
var newWidth=size.width;
var newHeight=size.height;
if(newWidth!=_this.currentWidth||newHeight!=_this.currentHeight){
_this.currentWidth=newWidth;
_this.currentHeight=newHeight;
_this.callback();
}
this.setScroll();
}
setScroll(){
this.expand.scrollLeft=10000000;
this.expand.scrollTop=10000000;
this.shrink.scrollLeft=10000000;
this.shrink.scrollTop=10000000;
}
destroy(){
this.expand.remove();
this.shrink.remove();
}};
MapSVG.nonce=function (){
return mapsvg_runtime_vars.nonce;
};
MapSVG.fixColorHash=(color)=> {
const hexColorNoHash=new RegExp(/^([0-9a-f]{3}|[0-9a-f]{6})$/i);
if(color&&color.match(hexColorNoHash)!==null){
color="#" + color;
}
return color;
};
MapSVG.throttle=(method, delay, scope, params)=> {
clearTimeout(method._tId);
method._tId=setTimeout(function (){
method.apply(scope, params);
}, delay);
};
MapSVG.geocode=(query, callback)=> {
if(!window.google){
console.error("MapSVG: can't do Geocoding - Google Maps API is not loaded.");
jQuery.growl.error({
title: "Error",
message: "Google Maps API files are not loaded",
});
return false;
}
if(!MapSVG.geocoder){
MapSVG.geocoder=new google.maps.Geocoder();
}
MapSVG.throttle(MapSVG.geocoder.geocode, 500, MapSVG.geocoder, [
query,
function (results, status){
if(status==="OK"){
callback(results);
}else{
jQuery.growl.error({
title: "Error: " + status,
message:
"There is some problem with Google API keys. See browser's console for more details",
});
}},
]);
};
MapSVG.handleFailedRequest=(response)=> {
var message="";
if(response.status===403){
if(response.responseText.indexOf("Wordfence")!==-1){
message +=
"The request has been blocked by Wordfence. " +
'Switch Wordfence to "Learning mode", and save the map settings again. ' +
"If the settings are saved successfully, you can switch Wordfence back to normal mode.";
}else{
message +=
"The request has been blocked by your server. " +
"Do you have mod_sec Apache's module enabled? If that's the case you need to change its settings.";
}}else{
if(response&&response.responseText){
try {
var _response=JSON.parse(response.responseText);
if(_response&&_response.data&&_response.data.error){
message=_response.data.error;
}} catch (e){
}}
}
$.growl.error({
title: "Error: " + response.status + " " + response.statusText,
message: message,
duration: 30000,
});
};
if(!Object.values){
Object.values=function (object){
return Object.keys(object).map(function (k){
return object[k];
});
};}
window.MapSVG=MapSVG;
const defRegionTemplate="<div>\n" +
"  <p>This is the demo content of the <strong>Region %templateType%</strong>.</p>\n" +
'  <p>How to edit it: if you are in mapsvg control panel now, click on the following link to open the template editor for this view: <a href="#" class="mapsvg-template-link" data-template="%templateTypeSnake%Region">Menu > Templates > Region %templateType%</a>.</p>\n' +
'  <p>More information about templates: <a href="https://mapsvg.com/docs/map-editor/templates" target="_blank">mapsvg.com/docs/map-editor/templates</a></p>\n' +
"</div>\n" +
"<hr />\n\n" +
"<!-- Region fields are available in this template -->\n" +
"<h5>{{#if title}} {{title}} {{else}} {{id}} {{/if}}</h5>\n" +
"<p>Status: {{status_text}}</p>\n\n" +
"<!-- Show all linked Database Objects: -->\n" +
"{{#each objects}}\n\n" +
"  <!-- DB Object are available inside of this block -->\n\n" +
"  <h5>{{title}}</h5>\n" +
"  <!-- When you need to render a field as HTML, use 3 curly braces instead of 2:-->\n" +
"  <p>{{{description}}}</p>\n" +
"  <p><em>{{location.address.formatted}}</em></p>\n\n" +
"  <!-- Show all images: -->\n" +
"  {{#each images}}\n" +
'    <!-- Image fields "thumbnail", "medium", "full" -->\n' +
"    <!-- are available in this block                -->\n" +
'    <img src="{{thumbnail}}" />\n' +
"  {{/each}}\n\n" +
"{{/each}}";
const defDBTemplate="<div>\n" +
"  <p>This is the demo content of the <strong>DB Object %templateType%</strong>.</p>\n" +
'  <p>How to edit it: if you are in mapsvg control panel now, click on the following link to open the template editor for this view: <a href="#" class="mapsvg-template-link" data-template="%templateTypeSnake%">Menu > Templates > DB Object %templateType%</a>.</p>\n' +
'  <p>More information about templates: <a href="https://mapsvg.com/docs/map-editor/templates" target="_blank">mapsvg.com/docs/map-editor/templates</a></p>\n' +
"</div>\n" +
"<hr />\n\n" +
"<!-- DB Object fields are available in this template. -->\n" +
"<h5>{{title}}</h5>\n" +
"<!-- When you need to render a fields as HTML, use 3 curly braces instead of 2:-->\n" +
"<p>{{{description}}}</p>\n" +
"<p><em>{{location.address.formatted}}</em></p>\n\n" +
"<!-- Show all images: -->\n" +
"{{#each images}}\n" +
'  <!-- Image fields "thumbnail", "medium", "full" -->\n' +
"  <!-- are available in this block                -->\n" +
'  <img src="{{thumbnail}}" />\n' +
"{{/each}}\n\n" +
"<!-- Show all linked Regions, comma-separated: -->\n" +
"<p> Regions: \n" +
"  {{#each regions}}\n" +
"    <!-- Region fields are available in this block -->\n" +
"    {{#if title}}\n" +
"      {{title}}\n" +
"    {{else}}\n" +
"      {{id}}\n" +
"    {{/if}}{{#unless @last}}, {{/unless}}\n" +
"  {{/each}}\n" +
"</p>";
const dirItemItemTemplate="<!-- If Directory Source=Database: DB Object fields are available in this template -->\n" +
"<!-- If Directory Source=Regions: Region fields are available in this template -->\n" +
"{{title}}";
const DefaultOptions={
source: "",
markerLastID: 0,
regionLastID: 0,
dataLastID: 1,
disableAll: false,
width: null,
height: null,
lockAspectRatio: false,
padding: { top: 0, left: 0, right: 0, bottom: 0 },
maxWidth: null,
maxHeight: null,
minWidth: null,
minHeight: null,
loadingText: "Loading map...",
colorsIgnore: false,
colors: {
baseDefault: "#000000",
background: "#eeeeee",
selected: 40,
hover: 20,
directory: "#fafafa",
detailsView: "",
status: {},
clusters: "",
clustersBorders: "",
clustersText: "",
clustersHover: "",
clustersHoverBorders: "",
clustersHoverText: "",
markers: {
base: { opacity: 100, saturation: 100 },
hovered: { opacity: 100, saturation: 100 },
unhovered: { opacity: 40, saturation: 100 },
active: { opacity: 100, saturation: 100 },
inactive: { opacity: 40, saturation: 100 },
},
},
regions: {},
clustering: { on: false },
viewBox: [],
cursor: "default",
manualRegions: false,
onClick: null,
mouseOver: null,
mouseOut: null,
menuOnClick: null,
beforeLoad: null,
afterLoad: null,
zoom: {
on: true,
limit: [0, 22],
delta: 2,
buttons: { on: true, location: "right" },
mousewheel: true,
fingers: true,
hideSvg: false,
hideSvgZoomLevel: 7,
},
scroll: { on: true, limit: false, background: false, spacebar: false },
responsive: true,
tooltips: { on: false, position: "bottom-right", template: "", maxWidth: "", minWidth: 100 },
popovers: {
on: false,
position: "top",
template: "",
centerOn: true,
width: 300,
maxWidth: 50,
maxHeight: 50,
},
multiSelect: false,
regionStatuses: {
"1": { label: "Enabled", value: "1", color: "", disabled: false },
"0": { label: "Disabled", value: "0", color: "", disabled: true },
},
events: {
afterLoad: "function(){\n" +
"
"
"
"}",
beforeLoad: "function(){\n" +
"
"
"
"}",
databaseLoaded: "function (){\n" +
"
"
"}",
"click.region": "function (e, mapsvg){\n" +
"
"
"}",
"mouseover.region": "function (e, mapsvg){\n" +
"
"
"}",
"mouseout.region": "function (e, mapsvg){\n" +
"
"
"}",
"click.marker": "function (e, mapsvg){\n" +
"
"
"}",
"mouseover.marker": "function (e, mapsvg){\n" +
"
"
"}",
"mouseout.marker": "function (e, mapsvg){\n" +
"
"
"}",
"click.directoryItem": "function (e, regionOrObject, mapsvg){\n" + "
"mouseover.directoryItem": "function (e, regionOrObject, mapsvg){\n" + "
"mouseout.directoryItem": "function (e, regionOrObject, mapsvg){\n" + "
"shown.popover": "function (mapsvg){\n" + "
"closed.popover": "function (mapsvg){\n" + "
"closed.detailsView": "function (mapsvg){\n" + "
"shown.detailsView": "function (mapsvg){\n" + "
},
css: "#mapsvg-map-%id% .mapsvg-tooltip {\n\n}\n" +
"#mapsvg-map-%id% .mapsvg-popover {\n\n}\n" +
"#mapsvg-map-%id% .mapsvg-details-container {\n\n}\n" +
"#mapsvg-map-%id% .mapsvg-directory-item {\n\n}\n" +
"#mapsvg-map-%id% .mapsvg-region-label {\n" +
"  \n" +
"  font-size: 11px;\n" +
"  padding: 3px 5px;\n" +
"  border-radius: 4px;\n" +
"}\n" +
"#mapsvg-map-%id% .mapsvg-marker-label {\n" +
"  padding: 3px 5px;\n" +
"  \n}\n" +
"#mapsvg-map-%id% .mapsvg-filters-wrap {\n\n}\n" +
"\n\n\n\n\n\n",
templates: {
popoverRegion: defRegionTemplate
.replace(/%templateType%/g, "Popover")
.replace(/%templateTypeSnake%/g, "popover"),
popoverMarker: defDBTemplate
.replace(/%templateType%/g, "Popover")
.replace(/%templateTypeSnake%/g, "popover"),
tooltipRegion: "<!-- Region fields are available in this template -->\n{{id}} - {{title}}",
tooltipMarker: "<!-- DB Object fields are available in this template -->\n{{title}}",
directoryItem: dirItemItemTemplate,
directoryCategoryItem: '<!-- Available fields: "label", "value", "counter" -->\n<span class="mapsvg-category-label">{{label}}</span>\n<span class="mapsvg-category-counter">{{counter}}</span>\n<span class="mapsvg-chevron"></span>',
detailsView: defDBTemplate
.replace(/%templateType%/g, "Details View")
.replace(/%templateTypeSnake%/g, "detailsView"),
detailsViewRegion: defRegionTemplate
.replace(/%templateType%/g, "Details View")
.replace(/%templateTypeSnake%/g, "detailsView"),
labelMarker: "<!-- DB Object fields are available in this template -->\n{{title}}",
labelRegion: "<!-- Region fields are available in this template -->\n{{title}}",
labelLocation: "You are here!",
},
choropleth: {
on: false,
source: "regions",
sourceFieldSelect: {
on: false,
variants: [],
},
bubbleMode: false,
bubbleSize: {
min: 20,
max: 40,
},
labels: { low: "low", high: "high" },
colors: { lowRGB: null, highRGB: null, low: "#550000", high: "#ee0000", noData: "#333333" },
min: 0,
max: 0,
coloring: {
mode: "gradient",
noData: {
color: "#999999",
description: "No data",
},
gradient: {
colors: {
lowRGB: null,
highRGB: null,
diffRGB: null,
low: "#550000",
high: "#ee0000",
},
labels: {
low: "low",
high: "high",
},
values: {
min: null,
max: null,
maxAdjusted: null,
},
},
palette: {
outOfRange: {
color: "#ececec",
description: "Out of range",
},
colors: [
{
color: "#550000",
valueFrom: 0,
valueTo: 50,
description: "",
},
],
},
legend: {
on: true,
layout: "vertical",
container: "bottom-left",
title: "Choropleth map",
text: "",
description: "",
width: "20%",
height: "20%",
},
},
},
filters: {
on: true,
source: "database",
location: "header",
modalLocation: "map",
width: "100%",
hide: false,
showButtonText: "Filters",
clearButtonText: "Clear all",
clearButton: false,
searchButton: false,
searchButtonText: "Search",
padding: "",
},
menu: {
on: false,
hideOnMobile: true,
location: "leftSidebar",
locationMobile: "leftSidebar",
search: false,
containerId: "",
searchPlaceholder: "Search...",
searchFallback: false,
source: "database",
showFirst: "map",
showMapOnClick: true,
minHeight: "400",
sortBy: "id",
sortDirection: "desc",
categories: {
on: false,
groupBy: "",
hideEmpty: true,
collapse: true,
collapseOther: true,
},
clickActions: {
region: "default",
marker: "default",
directoryItem: {
triggerClick: true,
showPopover: false,
showDetails: true,
},
},
detailsViewLocation: "overDirectory",
noResultsText: "No results found",
filterout: { field: "", cond: "=", val: "" },
},
database: {
pagination: {
on: true,
perpage: 30,
next: "Next",
prev: "Prev.",
showIn: "both",
},
loadOnStart: true,
table: "",
},
actions: {
map: {
afterLoad: {
selectRegion: false,
},
},
region: {
mouseover: {
showTooltip: false,
},
click: {
addIdToUrl: false,
showDetails: true,
showDetailsFor: "region",
filterDirectory: false,
loadObjects: false,
showPopover: false,
showPopoverFor: "region",
goToLink: false,
linkField: "Region.link",
},
touch: {
showPopover: false,
},
},
marker: {
mouseover: {
showTooltip: false,
},
click: {
showDetails: true,
showPopover: false,
goToLink: false,
linkField: "Object.link",
},
touch: {
showPopover: false,
},
},
directoryItem: {
click: {
showDetails: true,
showPopover: false,
goToLink: false,
selectRegion: true,
fireRegionOnClick: true,
linkField: "Object.link",
},
hover: {
centerOnMarker: false,
},
},
},
detailsView: {
location: "map",
containerId: "",
width: "100%",
mobileFullscreen: true,
},
mobileView: {
labelMap: "Map",
labelList: "List",
labelClose: "Close",
},
googleMaps: {
on: false,
apiKey: "",
loaded: false,
center: "auto",
type: "roadmap",
minZoom: 1,
style: "default",
styleJSON: [],
language: "en",
},
groups: [],
floors: [],
layersControl: {
on: false,
position: "top-left",
label: "Show on map",
expanded: true,
maxHeight: "100%",
},
floorsControl: {
on: false,
position: "top-left",
label: "Floors",
expanded: false,
maxHeight: "100%",
},
containers: {
leftSidebar: { on: false, width: "250px" },
rightSidebar: { on: false, width: "250px" },
header: { on: true, height: "auto" },
footer: { on: false, height: "auto" },
},
labelsMarkers: { on: false },
labelsRegions: { on: false },
svgFileVersion: 1,
fitMarkers: false,
fitMarkersOnStart: false,
fitSingleMarkerZoom: 20,
controls: {
location: "right",
zoom: true,
zoomReset: false,
userLocation: false,
previousMap: false,
},
previousMapsIds: [],
};
var trimLeft=/^\s+/,
trimRight=/\s+$/,
tinyCounter=0,
mathRound=Math.round,
mathMin=Math.min,
mathMax=Math.max,
mathRandom=Math.random;
function tinycolor(color, opts){
color=color ? color:"";
opts=opts||{};
if(color instanceof tinycolor){
return color;
}
if(!(this instanceof tinycolor)){
return new tinycolor(color, opts);
}
var rgb=inputToRGB(color);
(this._originalInput=color),
(this._r=rgb.r),
(this._g=rgb.g),
(this._b=rgb.b),
(this._a=rgb.a),
(this._roundA=mathRound(100 * this._a) / 100),
(this._format=opts.format||rgb.format);
this._gradientType=opts.gradientType;
if(this._r < 1){
this._r=mathRound(this._r);
}
if(this._g < 1){
this._g=mathRound(this._g);
}
if(this._b < 1){
this._b=mathRound(this._b);
}
this._ok=rgb.ok;
this._tc_id=tinyCounter++;
}
tinycolor.prototype={
isDark: function (){
return this.getBrightness() < 128;
},
isLight: function (){
return !this.isDark();
},
isValid: function (){
return this._ok;
},
getOriginalInput: function (){
return this._originalInput;
},
getFormat: function (){
return this._format;
},
getAlpha: function (){
return this._a;
},
getBrightness: function (){
var rgb=this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
},
getLuminance: function (){
var rgb=this.toRgb();
var RsRGB, GsRGB, BsRGB, R, G, B;
RsRGB=rgb.r / 255;
GsRGB=rgb.g / 255;
BsRGB=rgb.b / 255;
if(RsRGB <=0.03928){
R=RsRGB / 12.92;
}else{
R=Math.pow((RsRGB + 0.055) / 1.055, 2.4);
}
if(GsRGB <=0.03928){
G=GsRGB / 12.92;
}else{
G=Math.pow((GsRGB + 0.055) / 1.055, 2.4);
}
if(BsRGB <=0.03928){
B=BsRGB / 12.92;
}else{
B=Math.pow((BsRGB + 0.055) / 1.055, 2.4);
}
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
},
setAlpha: function (value){
this._a=boundAlpha(value);
this._roundA=mathRound(100 * this._a) / 100;
return this;
},
toHsv: function (){
var hsv=rgbToHsv(this._r, this._g, this._b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };},
toHsvString: function (){
var hsv=rgbToHsv(this._r, this._g, this._b);
var h=mathRound(hsv.h * 360),
s=mathRound(hsv.s * 100),
v=mathRound(hsv.v * 100);
return this._a==1
? "hsv(" + h + ", " + s + "%, " + v + "%)"
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
},
toHsl: function (){
var hsl=rgbToHsl(this._r, this._g, this._b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };},
toHslString: function (){
var hsl=rgbToHsl(this._r, this._g, this._b);
var h=mathRound(hsl.h * 360),
s=mathRound(hsl.s * 100),
l=mathRound(hsl.l * 100);
return this._a==1
? "hsl(" + h + ", " + s + "%, " + l + "%)"
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
},
toHex: function (allow3Char){
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function (allow3Char){
return "#" + this.toHex(allow3Char);
},
toHex8: function (allow4Char){
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function (allow4Char){
return "#" + this.toHex8(allow4Char);
},
toRgb: function (){
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };},
toRgbString: function (){
return this._a==1
? "rgb(" +
mathRound(this._r) +
", " +
mathRound(this._g) +
", " +
mathRound(this._b) +
")"
: "rgba(" +
mathRound(this._r) +
", " +
mathRound(this._g) +
", " +
mathRound(this._b) +
", " +
this._roundA +
")";
},
toPercentageRgb: function (){
return {
r: mathRound(bound01(this._r, 255) * 100) + "%",
g: mathRound(bound01(this._g, 255) * 100) + "%",
b: mathRound(bound01(this._b, 255) * 100) + "%",
a: this._a,
};},
toPercentageRgbString: function (){
return this._a==1
? "rgb(" +
mathRound(bound01(this._r, 255) * 100) +
"%, " +
mathRound(bound01(this._g, 255) * 100) +
"%, " +
mathRound(bound01(this._b, 255) * 100) +
"%)"
: "rgba(" +
mathRound(bound01(this._r, 255) * 100) +
"%, " +
mathRound(bound01(this._g, 255) * 100) +
"%, " +
mathRound(bound01(this._b, 255) * 100) +
"%, " +
this._roundA +
")";
},
toName: function (){
if(this._a===0){
return "transparent";
}
if(this._a < 1){
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)]||false;
},
toFilter: function (secondColor){
var hex8String="#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String=hex8String;
var gradientType=this._gradientType ? "GradientType=1, ":"";
if(secondColor){
var s=tinycolor(secondColor);
secondHex8String="#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
}
return (
"progid:DXImageTransform.Microsoft.gradient(" +
gradientType +
"startColorstr=" +
hex8String +
",endColorstr=" +
secondHex8String +
")"
);
},
toString: function (format){
var formatSet = !!format;
format=format||this._format;
var formattedString=false;
var hasAlpha=this._a < 1&&this._a >=0;
var needsAlphaFormat =
!formatSet &&
hasAlpha &&
(format==="hex" ||
format==="hex6" ||
format==="hex3" ||
format==="hex4" ||
format==="hex8" ||
format==="name");
if(needsAlphaFormat){
if(format==="name"&&this._a===0){
return this.toName();
}
return this.toRgbString();
}
if(format==="rgb"){
formattedString=this.toRgbString();
}
if(format==="prgb"){
formattedString=this.toPercentageRgbString();
}
if(format==="hex"||format==="hex6"){
formattedString=this.toHexString();
}
if(format==="hex3"){
formattedString=this.toHexString(true);
}
if(format==="hex4"){
formattedString=this.toHex8String(true);
}
if(format==="hex8"){
formattedString=this.toHex8String();
}
if(format==="name"){
formattedString=this.toName();
}
if(format==="hsl"){
formattedString=this.toHslString();
}
if(format==="hsv"){
formattedString=this.toHsvString();
}
return formattedString||this.toHexString();
},
clone: function (){
return tinycolor(this.toString());
},
_applyModification: function (fn, args){
var color=fn.apply(null, [this].concat([].slice.call(args)));
this._r=color._r;
this._g=color._g;
this._b=color._b;
this.setAlpha(color._a);
return this;
},
lighten: function (){
return this._applyModification(lighten, arguments);
},
brighten: function (){
return this._applyModification(brighten, arguments);
},
darken: function (){
return this._applyModification(darken, arguments);
},
desaturate: function (){
return this._applyModification(desaturate, arguments);
},
saturate: function (){
return this._applyModification(saturate, arguments);
},
greyscale: function (){
return this._applyModification(greyscale, arguments);
},
spin: function (){
return this._applyModification(spin, arguments);
},
_applyCombination: function (fn, args){
return fn.apply(null, [this].concat([].slice.call(args)));
},
analogous: function (){
return this._applyCombination(analogous, arguments);
},
complement: function (){
return this._applyCombination(complement, arguments);
},
monochromatic: function (){
return this._applyCombination(monochromatic, arguments);
},
splitcomplement: function (){
return this._applyCombination(splitcomplement, arguments);
},
triad: function (){
return this._applyCombination(triad, arguments);
},
tetrad: function (){
return this._applyCombination(tetrad, arguments);
},
};
tinycolor.fromRatio=function (color, opts){
if(typeof color=="object"){
var newColor={};
for (var i in color){
if(color.hasOwnProperty(i)){
if(i==="a"){
newColor[i]=color[i];
}else{
newColor[i]=convertToPercentage(color[i]);
}}
}
color=newColor;
}
return tinycolor(color, opts);
};
function inputToRGB(color){
var rgb={ r: 0, g: 0, b: 0 };
var a=1;
var s=null;
var v=null;
var l=null;
var ok=false;
var format=false;
if(typeof color=="string"){
color=stringInputToObject(color);
}
if(typeof color=="object"){
if(isValidCSSUnit(color.r)&&isValidCSSUnit(color.g)&&isValidCSSUnit(color.b)){
rgb=rgbToRgb(color.r, color.g, color.b);
ok=true;
format=String(color.r).substr(-1)==="%" ? "prgb":"rgb";
}else if(isValidCSSUnit(color.h)&&isValidCSSUnit(color.s)&&isValidCSSUnit(color.v)){
s=convertToPercentage(color.s);
v=convertToPercentage(color.v);
rgb=hsvToRgb(color.h, s, v);
ok=true;
format="hsv";
}else if(isValidCSSUnit(color.h)&&isValidCSSUnit(color.s)&&isValidCSSUnit(color.l)){
s=convertToPercentage(color.s);
l=convertToPercentage(color.l);
rgb=hslToRgb(color.h, s, l);
ok=true;
format="hsl";
}
if(color.hasOwnProperty("a")){
a=color.a;
}}
a=boundAlpha(a);
return {
ok: ok,
format: color.format||format,
r: mathMin(255, mathMax(rgb.r, 0)),
g: mathMin(255, mathMax(rgb.g, 0)),
b: mathMin(255, mathMax(rgb.b, 0)),
a: a,
};}
function rgbToRgb(r, g, b){
return {
r: bound01(r, 255) * 255,
g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255,
};}
function rgbToHsl(r, g, b){
r=bound01(r, 255);
g=bound01(g, 255);
b=bound01(b, 255);
var max=mathMax(r, g, b),
min=mathMin(r, g, b);
var h,
s,
l=(max + min) / 2;
if(max==min){
h=s = 0;
}else{
var d=max - min;
s=l > 0.5 ? d / (2 - max - min):d / (max + min);
switch (max){
case r:
h=(g - b) / d + (g < b ? 6:0);
break;
case g:
h=(b - r) / d + 2;
break;
case b:
h=(r - g) / d + 4;
break;
}
h /=6;
}
return { h: h, s: s, l: l };}
function hslToRgb(h, s, l){
var r, g, b;
h=bound01(h, 360);
s=bound01(s, 100);
l=bound01(l, 100);
function hue2rgb(p, q, t){
if(t < 0) t +=1;
if(t > 1) t -=1;
if(t < 1 / 6) return p + (q - p) * 6 * t;
if(t < 1 / 2) return q;
if(t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
}
if(s===0){
r=g = b=l;
}else{
var q=l < 0.5 ? l * (1 + s):l + s - l * s;
var p=2 * l - q;
r=hue2rgb(p, q, h + 1 / 3);
g=hue2rgb(p, q, h);
b=hue2rgb(p, q, h - 1 / 3);
}
return { r: r * 255, g: g * 255, b: b * 255 };}
function rgbToHsv(r, g, b){
r=bound01(r, 255);
g=bound01(g, 255);
b=bound01(b, 255);
var max=mathMax(r, g, b),
min=mathMin(r, g, b);
var h,
s,
v=max;
var d=max - min;
s=max===0 ? 0:d / max;
if(max==min){
h=0;
}else{
switch (max){
case r:
h=(g - b) / d + (g < b ? 6:0);
break;
case g:
h=(b - r) / d + 2;
break;
case b:
h=(r - g) / d + 4;
break;
}
h /=6;
}
return { h: h, s: s, v: v };}
function hsvToRgb(h, s, v){
h=bound01(h, 360) * 6;
s=bound01(s, 100);
v=bound01(v, 100);
var i=Math.floor(h),
f=h - i,
p=v * (1 - s),
q=v * (1 - f * s),
t=v * (1 - (1 - f) * s),
mod=i % 6,
r=[v, q, p, p, t, v][mod],
g=[t, v, v, q, p, p][mod],
b=[p, p, t, v, v, q][mod];
return { r: r * 255, g: g * 255, b: b * 255 };}
function rgbToHex(r, g, b, allow3Char){
var hex=[
pad2(mathRound(r).toString(16)),
pad2(mathRound(g).toString(16)),
pad2(mathRound(b).toString(16)),
];
if(allow3Char &&
hex[0].charAt(0)==hex[0].charAt(1) &&
hex[1].charAt(0)==hex[1].charAt(1) &&
hex[2].charAt(0)==hex[2].charAt(1)
){
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");
}
function rgbaToHex(r, g, b, a, allow4Char){
var hex=[
pad2(mathRound(r).toString(16)),
pad2(mathRound(g).toString(16)),
pad2(mathRound(b).toString(16)),
pad2(convertDecimalToHex(a)),
];
if(allow4Char &&
hex[0].charAt(0)==hex[0].charAt(1) &&
hex[1].charAt(0)==hex[1].charAt(1) &&
hex[2].charAt(0)==hex[2].charAt(1) &&
hex[3].charAt(0)==hex[3].charAt(1)
){
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");
}
function rgbaToArgbHex(r, g, b, a){
var hex=[
pad2(convertDecimalToHex(a)),
pad2(mathRound(r).toString(16)),
pad2(mathRound(g).toString(16)),
pad2(mathRound(b).toString(16)),
];
return hex.join("");
}
tinycolor.equals=function (color1, color2){
if(!color1||!color2){
return false;
}
return tinycolor(color1).toRgbString()==tinycolor(color2).toRgbString();
};
tinycolor.random=function (){
return tinycolor.fromRatio({
r: mathRandom(),
g: mathRandom(),
b: mathRandom(),
});
};
function desaturate(color, amount){
amount=amount===0 ? 0:amount||10;
var hsl=tinycolor(color).toHsl();
hsl.s -=amount / 100;
hsl.s=clamp01(hsl.s);
return tinycolor(hsl);
}
function saturate(color, amount){
amount=amount===0 ? 0:amount||10;
var hsl=tinycolor(color).toHsl();
hsl.s +=amount / 100;
hsl.s=clamp01(hsl.s);
return tinycolor(hsl);
}
function greyscale(color){
return tinycolor(color).desaturate(100);
}
function lighten(color, amount){
amount=amount===0 ? 0:amount||10;
var hsl=tinycolor(color).toHsl();
hsl.l +=amount / 100;
hsl.l=clamp01(hsl.l);
return tinycolor(hsl);
}
function brighten(color, amount){
amount=amount===0 ? 0:amount||10;
var rgb=tinycolor(color).toRgb();
rgb.r=mathMax(0, mathMin(255, rgb.r - mathRound(255 * -(amount / 100))));
rgb.g=mathMax(0, mathMin(255, rgb.g - mathRound(255 * -(amount / 100))));
rgb.b=mathMax(0, mathMin(255, rgb.b - mathRound(255 * -(amount / 100))));
return tinycolor(rgb);
}
function darken(color, amount){
amount=amount===0 ? 0:amount||10;
var hsl=tinycolor(color).toHsl();
hsl.l -=amount / 100;
hsl.l=clamp01(hsl.l);
return tinycolor(hsl);
}
function spin(color, amount){
var hsl=tinycolor(color).toHsl();
var hue=(hsl.h + amount) % 360;
hsl.h=hue < 0 ? 360 + hue:hue;
return tinycolor(hsl);
}
function complement(color){
var hsl=tinycolor(color).toHsl();
hsl.h=(hsl.h + 180) % 360;
return tinycolor(hsl);
}
function triad(color){
var hsl=tinycolor(color).toHsl();
var h=hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }),
];
}
function tetrad(color){
var hsl=tinycolor(color).toHsl();
var h=hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }),
];
}
function splitcomplement(color){
var hsl=tinycolor(color).toHsl();
var h=hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
];
}
function analogous(color, results, slices){
results=results||6;
slices=slices||30;
var hsl=tinycolor(color).toHsl();
var part=360 / slices;
var ret=[tinycolor(color)];
for (hsl.h=(hsl.h - ((part * results) >> 1) + 720) % 360; --results;){
hsl.h=(hsl.h + part) % 360;
ret.push(tinycolor(hsl));
}
return ret;
}
function monochromatic(color, results){
results=results||6;
var hsv=tinycolor(color).toHsv();
var h=hsv.h,
s=hsv.s,
v=hsv.v;
var ret=[];
var modification=1 / results;
while (results--){
ret.push(tinycolor({ h: h, s: s, v: v }));
v=(v + modification) % 1;
}
return ret;
}
tinycolor.mix=function (color1, color2, amount){
amount=amount===0 ? 0:amount||50;
var rgb1=tinycolor(color1).toRgb();
var rgb2=tinycolor(color2).toRgb();
var p=amount / 100;
var rgba={
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a,
};
return tinycolor(rgba);
};
tinycolor.readability=function (color1, color2){
var c1=tinycolor(color1);
var c2=tinycolor(color2);
return (
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
);
};
tinycolor.isReadable=function (color1, color2, wcag2){
var readability=tinycolor.readability(color1, color2);
var wcag2Parms, out;
out=false;
wcag2Parms=validateWCAG2Parms(wcag2);
switch (wcag2Parms.level + wcag2Parms.size){
case "AAsmall":
case "AAAlarge":
out=readability >=4.5;
break;
case "AAlarge":
out=readability >=3;
break;
case "AAAsmall":
out=readability >=7;
break;
}
return out;
};
tinycolor.mostReadable=function (baseColor, colorList, args){
var bestColor=null;
var bestScore=0;
var readability;
var includeFallbackColors, level, size;
args=args||{};
includeFallbackColors=args.includeFallbackColors;
level=args.level;
size=args.size;
for (var i=0; i < colorList.length; i++){
readability=tinycolor.readability(baseColor, colorList[i]);
if(readability > bestScore){
bestScore=readability;
bestColor=tinycolor(colorList[i]);
}}
if(tinycolor.isReadable(baseColor, bestColor, { level: level, size: size }) ||
!includeFallbackColors
){
return bestColor;
}else{
args.includeFallbackColors=false;
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
}};
var names=(tinycolor.names={
aliceblue: "f0f8ff",
antiquewhite: "faebd7",
aqua: "0ff",
aquamarine: "7fffd4",
azure: "f0ffff",
beige: "f5f5dc",
bisque: "ffe4c4",
black: "000",
blanchedalmond: "ffebcd",
blue: "00f",
blueviolet: "8a2be2",
brown: "a52a2a",
burlywood: "deb887",
burntsienna: "ea7e5d",
cadetblue: "5f9ea0",
chartreuse: "7fff00",
chocolate: "d2691e",
coral: "ff7f50",
cornflowerblue: "6495ed",
cornsilk: "fff8dc",
crimson: "dc143c",
cyan: "0ff",
darkblue: "00008b",
darkcyan: "008b8b",
darkgoldenrod: "b8860b",
darkgray: "a9a9a9",
darkgreen: "006400",
darkgrey: "a9a9a9",
darkkhaki: "bdb76b",
darkmagenta: "8b008b",
darkolivegreen: "556b2f",
darkorange: "ff8c00",
darkorchid: "9932cc",
darkred: "8b0000",
darksalmon: "e9967a",
darkseagreen: "8fbc8f",
darkslateblue: "483d8b",
darkslategray: "2f4f4f",
darkslategrey: "2f4f4f",
darkturquoise: "00ced1",
darkviolet: "9400d3",
deeppink: "ff1493",
deepskyblue: "00bfff",
dimgray: "696969",
dimgrey: "696969",
dodgerblue: "1e90ff",
firebrick: "b22222",
floralwhite: "fffaf0",
forestgreen: "228b22",
fuchsia: "f0f",
gainsboro: "dcdcdc",
ghostwhite: "f8f8ff",
gold: "ffd700",
goldenrod: "daa520",
gray: "808080",
green: "008000",
greenyellow: "adff2f",
grey: "808080",
honeydew: "f0fff0",
hotpink: "ff69b4",
indianred: "cd5c5c",
indigo: "4b0082",
ivory: "fffff0",
khaki: "f0e68c",
lavender: "e6e6fa",
lavenderblush: "fff0f5",
lawngreen: "7cfc00",
lemonchiffon: "fffacd",
lightblue: "add8e6",
lightcoral: "f08080",
lightcyan: "e0ffff",
lightgoldenrodyellow: "fafad2",
lightgray: "d3d3d3",
lightgreen: "90ee90",
lightgrey: "d3d3d3",
lightpink: "ffb6c1",
lightsalmon: "ffa07a",
lightseagreen: "20b2aa",
lightskyblue: "87cefa",
lightslategray: "789",
lightslategrey: "789",
lightsteelblue: "b0c4de",
lightyellow: "ffffe0",
lime: "0f0",
limegreen: "32cd32",
linen: "faf0e6",
magenta: "f0f",
maroon: "800000",
mediumaquamarine: "66cdaa",
mediumblue: "0000cd",
mediumorchid: "ba55d3",
mediumpurple: "9370db",
mediumseagreen: "3cb371",
mediumslateblue: "7b68ee",
mediumspringgreen: "00fa9a",
mediumturquoise: "48d1cc",
mediumvioletred: "c71585",
midnightblue: "191970",
mintcream: "f5fffa",
mistyrose: "ffe4e1",
moccasin: "ffe4b5",
navajowhite: "ffdead",
navy: "000080",
oldlace: "fdf5e6",
olive: "808000",
olivedrab: "6b8e23",
orange: "ffa500",
orangered: "ff4500",
orchid: "da70d6",
palegoldenrod: "eee8aa",
palegreen: "98fb98",
paleturquoise: "afeeee",
palevioletred: "db7093",
papayawhip: "ffefd5",
peachpuff: "ffdab9",
peru: "cd853f",
pink: "ffc0cb",
plum: "dda0dd",
powderblue: "b0e0e6",
purple: "800080",
rebeccapurple: "663399",
red: "f00",
rosybrown: "bc8f8f",
royalblue: "4169e1",
saddlebrown: "8b4513",
salmon: "fa8072",
sandybrown: "f4a460",
seagreen: "2e8b57",
seashell: "fff5ee",
sienna: "a0522d",
silver: "c0c0c0",
skyblue: "87ceeb",
slateblue: "6a5acd",
slategray: "708090",
slategrey: "708090",
snow: "fffafa",
springgreen: "00ff7f",
steelblue: "4682b4",
tan: "d2b48c",
teal: "008080",
thistle: "d8bfd8",
tomato: "ff6347",
turquoise: "40e0d0",
violet: "ee82ee",
wheat: "f5deb3",
white: "fff",
whitesmoke: "f5f5f5",
yellow: "ff0",
yellowgreen: "9acd32",
});
var hexNames=(tinycolor.hexNames=flip(names));
function flip(o){
var flipped={};
for (var i in o){
if(o.hasOwnProperty(i)){
flipped[o[i]]=i;
}}
return flipped;
}
function boundAlpha(a){
a=parseFloat(a);
if(isNaN(a)||a < 0||a > 1){
a=1;
}
return a;
}
function bound01(n, max){
if(isOnePointZero(n)){
n="100%";
}
var processPercent=isPercentage(n);
n=mathMin(max, mathMax(0, parseFloat(n)));
if(processPercent){
n=parseInt(n * max, 10) / 100;
}
if(Math.abs(n - max) < 0.000001){
return 1;
}
return (n % max) / parseFloat(max);
}
function clamp01(val){
return mathMin(1, mathMax(0, val));
}
function parseIntFromHex(val){
return parseInt(val, 16);
}
function isOnePointZero(n){
return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1;
}
function isPercentage(n){
return typeof n==="string"&&n.indexOf("%")!=-1;
}
function pad2(c){
return c.length==1 ? "0" + c:"" + c;
}
function convertToPercentage(n){
if(n <=1){
n=n * 100 + "%";
}
return n;
}
function convertDecimalToHex(d){
return Math.round(parseFloat(d) * 255).toString(16);
}
function convertHexToDecimal(h){
return parseIntFromHex(h) / 255;
}
var matchers=(function (){
var CSS_INTEGER="[-\\+]?\\d+%?";
var CSS_NUMBER="[-\\+]?\\d*\\.\\d+%?";
var CSS_UNIT="(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
var PERMISSIVE_MATCH3 =
"[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 =
"[\\s|\\(]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")[,|\\s]+(" +
CSS_UNIT +
")\\s*\\)?";
return {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
};})();
function isValidCSSUnit(color){
return !!matchers.CSS_UNIT.exec(color);
}
function stringInputToObject(color){
color=color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
var named=false;
if(names[color]){
color=names[color];
named=true;
}else if(color=="transparent"){
return { r: 0, g: 0, b: 0, a: 0, format: "name" };}
var match;
if((match=matchers.rgb.exec(color))){
return { r: match[1], g: match[2], b: match[3] };}
if((match=matchers.rgba.exec(color))){
return { r: match[1], g: match[2], b: match[3], a: match[4] };}
if((match=matchers.hsl.exec(color))){
return { h: match[1], s: match[2], l: match[3] };}
if((match=matchers.hsla.exec(color))){
return { h: match[1], s: match[2], l: match[3], a: match[4] };}
if((match=matchers.hsv.exec(color))){
return { h: match[1], s: match[2], v: match[3] };}
if((match=matchers.hsva.exec(color))){
return { h: match[1], s: match[2], v: match[3], a: match[4] };}
if((match=matchers.hex8.exec(color))){
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
a: convertHexToDecimal(match[4]),
format: named ? "name":"hex8",
};}
if((match=matchers.hex6.exec(color))){
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
format: named ? "name":"hex",
};}
if((match=matchers.hex4.exec(color))){
return {
r: parseIntFromHex(match[1] + "" + match[1]),
g: parseIntFromHex(match[2] + "" + match[2]),
b: parseIntFromHex(match[3] + "" + match[3]),
a: convertHexToDecimal(match[4] + "" + match[4]),
format: named ? "name":"hex8",
};}
if((match=matchers.hex3.exec(color))){
return {
r: parseIntFromHex(match[1] + "" + match[1]),
g: parseIntFromHex(match[2] + "" + match[2]),
b: parseIntFromHex(match[3] + "" + match[3]),
format: named ? "name":"hex",
};}
return false;
}
function validateWCAG2Parms(parms){
var level, size;
parms=parms||{ level: "AA", size: "small" };
level=(parms.level||"AA").toUpperCase();
size=(parms.size||"small").toLowerCase();
if(level!=="AA"&&level!=="AAA"){
level="AA";
}
if(size!=="small"&&size!=="large"){
size="small";
}
return { level: level, size: size };}
const $$1=jQuery;
class Server {
constructor(){
this.apiUrl=MapSVG.urls.api;
}
getUrl(path){
return this.apiUrl + path;
}
get(path, data){
return $$1.ajax({
url: this.apiUrl + path,
type: "GET",
data: data,
beforeSend: function (xhr){
if(MapSVG.nonce()){
xhr.setRequestHeader("X-WP-Nonce", MapSVG.nonce());
}},
});
}
post(path, data){
const ajaxParams={
url: this.apiUrl + path,
type: "POST",
data: data,
beforeSend: function (xhr){
if(MapSVG.nonce()){
xhr.setRequestHeader("X-WP-Nonce", MapSVG.nonce());
}},
};
if(data instanceof FormData){
ajaxParams["processData"]=false;
ajaxParams["contentType"]=false;
}
return $$1.ajax(ajaxParams);
}
put(path, data){
const ajaxParams={
url: this.apiUrl + path,
type: "POST",
data: data,
beforeSend: function (xhr){
if(MapSVG.nonce()){
xhr.setRequestHeader("X-WP-Nonce", MapSVG.nonce());
}
xhr.setRequestHeader("X-HTTP-Method-Override", "PUT");
},
};
if(data instanceof FormData){
ajaxParams["processData"]=false;
ajaxParams["contentType"]=false;
}
return $$1.ajax(ajaxParams);
}
delete(path, data){
return $$1.ajax({
url: this.apiUrl + path,
type: "POST",
data: data,
beforeSend: function (xhr){
if(MapSVG.nonce()){
xhr.setRequestHeader("X-WP-Nonce", MapSVG.nonce());
}
xhr.setRequestHeader("X-HTTP-Method-Override", "DELETE");
},
});
}
ajax(path, data){
data.url=this.getUrl(path);
data.beforeSend=function (xhr){
if(MapSVG.nonce()){
xhr.setRequestHeader("X-WP-Nonce", MapSVG.nonce());
}};
return $$1.ajax(data);
}}
class Events {
constructor(context){
this.events={};
this.context=context;
}
on(event, callbackOrObjectType, callback){
if(!this.events[event])
this.events[event]=[];
let callbackFunction;
if(typeof callbackOrObjectType==="string"){
callbackFunction=callback;
}else{
callbackFunction=callbackOrObjectType;
}
this.events[event].push(callbackFunction);
return this;
}
off(event, callback){
const _this=this;
if(this.events[event]&&this.events[event].length){
this.events[event].forEach(function (_callback, index){
if(typeof callback==="undefined"){
_this.events[event].splice(index, 1);
}
else if(_callback===callback){
_this.events[event].splice(index, 1);
}});
}
return this;
}
trigger(event, thisArg, args){
if(this.events[event]&&this.events[event].length)
this.events[event].forEach((callback)=> {
try {
callback&&callback.apply(thisArg||this.context, args||[this.context]);
}
catch (err){
console.error(err);
}});
return this;
}}
class ArrayIndexed extends Array {
constructor(indexKey, items, options){
if(items){
super(...items);
}else{
super();
}
this.key=indexKey;
this.dict={};
this.nextId=1;
if(options){
this.options=options;
}else{
this.options={ autoId: false, unique: false };}
if(this.length > 0){
let i=0;
const _this=this;
if(this.options.autoId){
let maxId=0;
let missingIds=false;
this.forEach(function (item){
if(item[_this.key]!=null){
if(item[_this.key] > maxId){
maxId=item[_this.key];
}}else{
missingIds=true;
}});
this.nextId=++maxId;
if(missingIds){
this.forEach(function (item){
if(item[_this.key]==null){
item[_this.key]=_this.nextId;
_this.nextId++;
}});
}}
this.forEach(function (item){
_this.dict[item[_this.key]]=i;
i++;
});
}}
push(item){
const length=super.push(item);
if(this.options.autoId===true){
item[this.key]=this.nextId;
this.nextId++;
}
this.dict[item[this.key]]=length - 1;
return length;
}
pop(){
const item=this[this.length - 1];
const id=item[this.key];
const length=super.pop();
delete this.dict[id];
this.reindex();
return super.pop();
}
update(data){
if(data[this.key]!=null){
const obj=this.get(data[this.key]);
for (const i in data){
obj[i]=data[i];
}
return obj;
}
return false;
}
get(id){
return this.findById(id);
}
findById(id){
return this[this.dict[id]];
}
deleteById(id){
const index=this.dict[id];
if(typeof index!=="undefined"){
delete this.dict[id];
this.splice(index, 1);
}}
delete(id){
this.deleteById(id);
}
clear(){
this.length=0;
this.reindex();
}
reindex(){
const _this=this;
this.dict={};
this.forEach(function (item, index){
_this.dict[item[_this.key]]=index;
});
}
sort(compareFn){
super.sort(compareFn);
this.reindex();
return this;
}
splice(start, deleteCount){
const res=super.splice(start, deleteCount);
this.reindex();
return res;
}}
class SchemaField {
constructor(field){
const booleans=["visible", "searchable", "readonly", "protected"];
for (const key in field){
this[key]=field[key];
}
booleans.forEach((paramName)=> {
if(typeof this[paramName]!=="undefined"){
this[paramName]=MapSVG.parseBoolean(this[paramName]);
}else{
this[paramName]=false;
}});
if(typeof this.options!=="undefined"){
if(!(this.options instanceof ArrayIndexed)){
this.options=new ArrayIndexed("value", this.options);
}}
}}
class Schema {
constructor(options){
this.fields=new ArrayIndexed("name");
this.build(options);
this.lastChangeTime=Date.now();
this.events=new Events(this);
}
build(options){
const allowedParams=["id", "title", "type", "name", "fields"];
allowedParams.forEach((paramName)=> {
const setter="set" + MapSVG.ucfirst(paramName);
if(typeof options[paramName]!=="undefined"&&typeof this[setter]=="function"){
this[setter](options[paramName]);
}});
}
update(options){
this.build(options);
}
setId(id){
this.id=id;
}
setTitle(title){
this.title=title;
}
setName(name){
this.name=name;
}
loaded(){
return this.fields.length!==0;
}
setFields(fields){
if(fields){
this.fields.clear();
fields.forEach((fieldParams)=> {
this.fields.push(new SchemaField(fieldParams));
});
}}
getFields(){
return this.fields;
}
getFieldsAsArray(){
return this.fields;
}
getFieldNames(){
return this.fields.map((f)=> f.name);
}
getField(field){
return this.fields.findById(field);
}
getFieldByType(type){
let f=null;
this.fields.forEach(function (field){
if(field.type===type)
f=field;
});
return f;
}
getColumns(filters){
filters=filters||{};
const columns=this.fields;
const needfilters=Object.keys(filters).length!==0;
let results=[];
if(needfilters){
let filterpass;
columns.forEach(function (obj){
filterpass=true;
for (const param in filters){
filterpass=obj[param]==filters[param];
}
filterpass&&results.push(obj);
});
}else{
results=columns;
}
return results;
}
getData(){
const data={
id: this.id,
title: this.title,
name: this.name,
fields: this.fields,
type: this.type,
};
return data;
}}
class Query {
constructor(options){
this.filters={};
this.filterout={};
this.page=1;
if(options){
for (const i in options){
if(typeof options[i]!=="undefined"){
this[i]=options[i];
}}
}}
setFields(fields){
const _this=this;
for (const key in fields){
if(key=="filters"){
_this.setFilters(fields[key]);
}else{
_this[key]=fields[key];
}}
}
update(query){
for (const i in query){
if(typeof query[i]!=="undefined"){
if(i==="filters"){
this.setFilters(query[i]);
}else{
this[i]=query[i];
}}
}}
get(){
return {
search: this.search,
searchField: this.searchField,
searchFallback: this.searchFallback,
filters: this.filters,
filterout: this.filterout,
page: this.page,
sort: this.sort,
perpage: this.perpage,
lastpage: this.lastpage,
};}
clearFilters(){
this.resetFilters();
}
setFilters(fields){
const _this=this;
for (const key in fields){
if(fields[key]===null||fields[key]===""||fields[key]===undefined){
if(_this.filters[key]){
delete _this.filters[key];
}}else{
_this.filters[key]=fields[key];
}}
}
setSearch(search){
this.search=search;
}
setFilterOut(fields){
if(fields===null){
delete this.filterout;
}else{
this.filterout=fields;
}}
resetFilters(fields){
this.filters={};
this.setSearch("");
}
setFilterField(field, value){
this.filters[field]=value;
}
hasFilters(){
return Object.keys(this.filters).length > 0||this.search.length > 0;
}
removeFilter(fieldName){
this.filters[fieldName]=null;
delete this.filters[fieldName];
}
requestSchema(requestSchema){
this.withSchema=requestSchema ? requestSchema:true;
}}
class LocationAddress {
constructor(fields){
for (const i in fields){
this[i]=fields[i];
}}
getData(){
const copy={};
[
"route",
"address_formatted",
"administrative_area_level_1",
"administrative_area_level_1_short",
"administrative_area_level_2",
"administrative_area_level_2_short",
"country",
"country_short",
"postal_code",
].forEach((field)=> {
if(this[field]){
copy[field]=this[field];
}});
return copy;
}
get state(){
return this.country_short==="US" ? this.administrative_area_level_1:null;
}
get state_short(){
return this.country_short==="US" ? this.administrative_area_level_1_short:null;
}
get county(){
return this.country_short==="US" ? this.administrative_area_level_2:null;
}
get zip(){
return this.postal_code;
}}
class ScreenPoint {
constructor(x, y){
this.x=x;
this.y=y;
}}
class SVGPoint {
constructor(x, y){
let _x, _y;
if(typeof x==="object"){
if(x.x&&x.y){
_x=parseFloat(x.x + "");
_y=parseFloat(x.y + "");
}else{
console.error("MapSVG: incorrect format of {x, y} object for SVGPoint.");
_x=0;
_y=0;
}}else{
_x=parseFloat(x + "");
_y=parseFloat(y + "");
}
this.x=_x;
this.y=_y;
}
toString(){
return this.x + "," + this.y;
}}
class GeoPoint {
constructor(lat, lng){
let _lat, _lng;
if(typeof lat==="object"){
if(lat.lat&&lat.lng){
_lat=parseFloat(lat.lat + "");
_lng=parseFloat(lat.lng + "");
}else{
console.error("MapSVG: incorrect format of {lat, lng} object for GeoPoint.");
_lat=0;
_lng=0;
}}else{
_lat=parseFloat(lat + "");
_lng=parseFloat(lng + "");
}
this.lat=_lat;
this.lng=_lng;
}
toString(){
return this.lat + "," + this.lng;
}}
class Location {
constructor(options){
this.update(options);
}
update(options){
if(options.object){
this.setObject(options.object);
}
if(options.img){
this.setImage(options.img);
}
if(options.address){
this.setAddress(options.address);
}
if(options.svgPoint){
this.setSvgPoint(options.svgPoint);
}
if(options.geoPoint){
this.setGeoPoint(options.geoPoint);
}}
setObject(object){
this.object=object;
}
setImage(imgUrl){
if(typeof imgUrl!=="string"){
return;
}
let src=imgUrl.split("/").pop();
if(imgUrl.indexOf("uploads")!==-1){
src="uploads/" + src;
}
this.img=src;
this.imagePath=this.getImageUrl();
this.marker&&this.marker&&this.marker.setImage(this.imagePath);
}
getImageUrl(){
if(this.img&&this.img.indexOf("uploads/")===0){
return MapSVG.urls.uploads + "markers/" + this.img.replace("uploads/", "");
}else{
return MapSVG.urls.root + "markers/" + (this.img||"_pin_default.png");
}}
setAddress(address){
this.address=new LocationAddress(address);
}
setSvgPoint(svgPoint){
this.svgPoint=svgPoint instanceof SVGPoint ? svgPoint:new SVGPoint(svgPoint);
if(this.marker){
this.marker.setSvgPointFromLocation();
}}
setGeoPoint(geoPoint){
this.geoPoint=geoPoint instanceof GeoPoint ? geoPoint:new GeoPoint(geoPoint);
if(this.marker){
this.marker.setSvgPointFromLocation();
}}
getMarkerImage(){
if(this.img&&this.img.indexOf("uploads/")===0){
return MapSVG.urls.uploads + "markers/" + this.img.replace("uploads/", "");
}else{
return MapSVG.urls.root + "markers/" + (this.img||"_pin_default.png");
}}
getData(){
const data={
img: this.img,
imagePath: this.imagePath,
markerImagePath: this.marker&&this.marker.object
? this.marker.object.getMarkerImage()
: this.imagePath,
address: this.address,
};
if(this.geoPoint){
data.geoPoint={ lat: this.geoPoint.lat, lng: this.geoPoint.lng };}
if(this.svgPoint){
data.svgPoint={ x: this.svgPoint.x, y: this.svgPoint.y };}
return data;
}}
class CustomObject {
constructor(params, schema){
this.initialLoad=true;
this.setSchema(schema);
this.dirtyFields=[];
this.regions=[];
this._regions={};
if(params.id!==undefined){
this.id=params.id;
}
this.initialLoad=true;
this.build(params);
this.initialLoad=false;
if(this.id){
this.clearDirtyFields();
}}
setSchema(schema){
this.schema=schema;
this.schema.events.on("changed", ()=> this.setLocationField());
this.fields=schema.getFieldNames();
this.setLocationField();
}
build(params){
for (const fieldName in params){
const field=this.schema.getField(fieldName);
if(field){
if(!this.initialLoad){
this.dirtyFields.push(fieldName);
}
switch (field.type){
case "region":
this.regions=params[fieldName];
break;
case "location":
if(params[fieldName]!=null &&
params[fieldName]!="" &&
Object.keys(params[fieldName]).length!==0){
const data={
img: this.isMarkersByFieldEnabled()
? this.getMarkerImage()
: params[fieldName].img,
address: new LocationAddress(params[fieldName].address),
};
if(params[fieldName].geoPoint &&
params[fieldName].geoPoint.lat &&
params[fieldName].geoPoint.lng){
data.geoPoint=new GeoPoint(params[fieldName].geoPoint);
}
else if(params[fieldName].svgPoint &&
params[fieldName].svgPoint.x &&
params[fieldName].svgPoint.y){
data.svgPoint=new SVGPoint(params[fieldName].svgPoint);
}
if(this.location!=null){
this.location.update(data);
}else{
this.location=new Location(data);
}}else{
this.location=null;
}
break;
case "post":
if(params.post){
this.post=params.post;
}
break;
case "select":
this[fieldName]=params[fieldName];
if(!field.multiselect){
this[fieldName + "_text"]=this.getEnumLabel(field, params, fieldName);
}
break;
case "radio":
this[fieldName]=params[fieldName];
this[fieldName + "_text"]=this.getEnumLabel(field, params, fieldName);
break;
default:
this[fieldName]=params[fieldName];
break;
}}
}
const locationField=this.getLocationField();
if(locationField&&this.isMarkersByFieldEnabled()&&this.isMarkerFieldChanged(params)){
this.reloadMarkerImage();
}}
isMarkerFieldChanged(params){
return Object.keys(params).indexOf(this.getLocationField().markerField)!==-1;
}
setLocationField(){
}
getLocationField(){
return this.schema.getFieldByType("location");
}
reloadMarkerImage(){
this.location&&this.location.setImage(this.getMarkerImage());
}
getMarkerImage(){
let fieldValue;
if(this.isMarkersByFieldEnabled()){
const locationField=this.getLocationField();
fieldValue=this[locationField.markerField];
if(!fieldValue){
return locationField.defaultMarkerPath||MapSVG.defaultMarkerImage;
}else{
if(locationField.markerField==="regions"){
fieldValue=fieldValue[0]&&fieldValue[0].id;
}
else if(typeof fieldValue==="object"&&fieldValue.length){
fieldValue=fieldValue[0].value;
}
return (locationField.markersByField[fieldValue] ||
locationField.defaultMarkerPath ||
MapSVG.defaultMarkerImage);
}}else{
return this.location.imagePath;
}}
isMarkersByFieldEnabled(){
const locationField=this.getLocationField();
if(!locationField){
return false;
}
if(locationField.markersByFieldEnabled &&
locationField.markerField &&
Object.values(locationField.markersByField).length > 0){
return true;
}else{
return false;
}}
clone(){
const data=this.getData();
return new CustomObject(data, this.schema);
}
getEnumLabel(field, params, fieldName){
const value=field.options.get(params[fieldName]);
if(typeof value!=="undefined"){
return value.label;
}else{
return "";
}}
update(params){
this.build(params);
}
getDirtyFields(){
const data={};
this.dirtyFields.forEach((field)=> {
data[field]=this[field];
});
data.id=this.id;
if(data.location!=null&&data.location instanceof Location){
data.location=data.location.getData();
}
if(this.schema.getFieldByType("region")){
data.regions=this.regions;
}
return data;
}
clearDirtyFields(){
this.dirtyFields=[];
}
getData(){
const data={};
const fields=this.schema.getFields();
fields.forEach((field)=> {
switch (field.type){
case "region":
data[field.name]=this[field.name];
break;
case "select":
data[field.name]=this[field.name];
if(!field.multiselect){
data[field.name + "_text"]=this[field.name + "_text"];
}
break;
case "post":
data[field.name]=this[field.name];
data["post"]=this.post;
break;
case "status":
case "radio":
data[field.name]=this[field.name];
data[field.name + "_text"]=this[field.name + "_text"];
break;
case "location":
data[field.name]=this[field.name] ? this[field.name].getData():null;
break;
default:
data[field.name]=this[field.name];
break;
}});
return data;
}
getRegions(regionsTableName){
return this.regions;
}
getRegionsForTable(regionsTableName){
return this.regions
? this.regions.filter((region)=> !region.tableName||region.tableName===regionsTableName)
: [];
}}
const $$2=jQuery;
class Repository {
constructor(objectName, path){
this.server=new Server();
this.query=new Query();
this.events=new Events(this);
this.className="";
this.objectNameSingle=objectName;
this.objectNameMany=objectName + "s";
this.setPath(path);
this.objects=new ArrayIndexed("id");
this.completeChunks=0;
}
setNoFiltersNoLoad(value){
this.noFiltersNoLoad=value;
}
setDataSource(path){
this.setPath(path);
this.query=new Query({ withSchema: true });
return this.find().done(()=> {
this.query.update({ withSchema: false });
});
}
setPath(path){
this.path=path.replace(/\/+$/, "") + "/";
}
setSchema(schema){
this.schema=schema;
}
getSchema(){
return this.schema;
}
loadDataFromResponse(response){
let data;
data=this.decodeData(response);
this.objects.clear();
if(data[this.objectNameMany]&&data[this.objectNameMany].length){
this.hasMoreRecords =
this.query.perpage&&data[this.objectNameMany].length > this.query.perpage;
if(this.hasMoreRecords){
data[this.objectNameMany].pop();
}
data[this.objectNameMany].forEach((obj)=> {
this.objects.push(obj);
});
}else{
this.hasMoreRecords=false;
}
this.loaded=true;
this.events.trigger("loaded");
}
reload(){
return this.find();
}
create(object){
const defer=jQuery.Deferred();
defer.promise();
const data={};
data[this.objectNameSingle]=this.encodeData(object);
this.server
.post(this.path, data)
.done((response)=> {
const data=this.decodeData(response);
const object=data[this.objectNameSingle];
this.objects.push(object);
defer.resolve(object);
this.events.trigger("created", this, [object]);
})
.fail((response)=> {
defer.reject(response);
});
return defer;
}
findById(id, nocache=false){
const defer=jQuery.Deferred();
defer.promise();
let object;
if(!nocache){
object=this.objects.findById(id.toString());
}
if(!nocache&&object){
defer.resolve(object);
}else{
this.server
.get(this.path + id)
.done((response)=> {
const data=this.decodeData(response);
defer.resolve(data[this.objectNameSingle]);
})
.fail((response)=> {
defer.reject(response);
});
}
return defer;
}
find(query){
this.events.trigger("load");
const defer=jQuery.Deferred();
defer.promise();
if(typeof query!=="undefined"){
this.query.update(query);
}
if(this.noFiltersNoLoad&&!this.query.hasFilters()){
this.objects.clear();
this.events.trigger("loaded");
defer.resolve(this.getLoaded());
return defer;
}
if(!this.schema){
this.query.update({ withSchema: true });
}
this.server
.get(this.path, this.query)
.done((response)=> {
if(!this.schema){
this.query.update({ withSchema: false });
}
this.loadDataFromResponse(response);
defer.resolve(this.getLoaded());
})
.fail((response)=> {
defer.reject(response);
});
return defer;
}
getLoaded(){
return this.objects;
}
getLoadedObject(id){
return this.objects.findById(id.toString());
}
getLoadedAsArray(){
return this.objects;
}
update(object){
const defer=jQuery.Deferred();
defer.promise();
const data={};
const objectUpdatedFields="getDirtyFields" in object ? object.getDirtyFields():object;
data[this.objectNameSingle]=this.encodeData(objectUpdatedFields);
this.server
.put(this.path + objectUpdatedFields.id, data)
.done((response)=> {
if("clearDirtyFields" in object){
object.clearDirtyFields();
}
defer.resolve(object);
this.events.trigger("updated", this, object);
})
.fail((response, stat)=> {
defer.reject(response, stat);
});
return defer;
}
delete(id){
const defer=jQuery.Deferred();
defer.promise();
this.server
.delete(this.path + id)
.done((response)=> {
this.objects.delete(id.toString());
this.events.trigger("deleted");
defer.resolve();
})
.fail((response)=> {
defer.reject(response);
});
return defer;
}
clear(){
const defer=jQuery.Deferred();
defer.promise();
this.server
.delete(this.path)
.done((response)=> {
this.objects.clear();
this.events.trigger("loaded");
this.events.trigger("cleared");
defer.resolve();
})
.fail((response)=> {
defer.reject(response);
});
return defer;
}
onFirstPage(){
return this.query.page===1;
}
onLastPage(){
return this.hasMoreRecords===false;
}
encodeData(params){
return params;
}
decodeData(dataJSON){
let data;
if(typeof dataJSON==="string"){
data=JSON.parse(dataJSON);
}else{
data=dataJSON;
}
if((data.object||data.region||data.regions||data.objects)&&data.schema){
this.setSchema(new Schema(data.schema));
}
const dataFormatted={};
for (const key in data){
if(data[key]){
switch (key){
case "object":
case "region":
dataFormatted[key]=new CustomObject(data[key], this.schema);
break;
case "objects":
case "regions":
dataFormatted[key]=data[key].map((obj)=> new CustomObject(obj, this.schema));
break;
case "schema":
dataFormatted[key]=this.schema||new Schema(data[key]);
break;
case "schemas":
dataFormatted[key]=data[key].map((obj)=> new Schema(obj));
break;
}}
}
return dataFormatted;
}
import(data, convertLatlngToAddress, mapsvg){
const _this=this;
const locationField=_this.schema.getFieldByType("location");
let language="en";
if(locationField&&locationField.language){
language=locationField.language;
}
data=this.formatCSV(data, mapsvg);
return this.importByChunks(data, language, convertLatlngToAddress).done(function (){
_this.find();
});
}
importByChunks(data, language, convertLatlngToAddress){
const _this=this;
let i, j, temparray, chunk=50;
const chunks=[];
for (i=0, j=data.length; i < j; i +=chunk){
temparray=data.slice(i, i + chunk);
chunks.push(temparray);
}
if(chunks.length > 0){
let delay=0;
const delayPlus=chunks[0][0]&&chunks[0][0].location ? 1000:0;
var defer=$$2.Deferred();
defer.promise();
_this.completeChunks=0;
chunks.forEach(function (chunk){
delay +=delayPlus;
setTimeout(function (){
const data={
language: language,
convertLatlngToAddress: convertLatlngToAddress,
};
data[_this.objectNameMany]=JSON.stringify(chunk);
_this.server
.post(_this.path + "import", data)
.done(function (_data){
_this.completeChunk(chunks, defer);
})
.fail((response)=> {
console.error(response);
});
}, delay);
});
}
return defer;
}
completeChunk(chunks, defer){
const _this=this;
_this.completeChunks++;
if(_this.completeChunks===chunks.length){
defer.resolve();
}}
formatCSV(data, mapsvg){
const _this=this;
const latLngRegex=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/g;
const regionsTable=mapsvg.regionsRepository.getSchema().name;
data.forEach(function (object, index){
const newObject={};
for (const key in object){
let field=_this.schema.getField(key);
if(key==="post"){
field={ type: "post" };}
if(field!==undefined){
switch (field.type){
case "region":
newObject[key]={};
newObject[key]=object[key]
.split(",")
.map(function (regionId){
return regionId.trim();
})
.filter(function (rId){
return (mapsvg.getRegion(rId)!==undefined ||
mapsvg.regions.find(function (item){
return item.title===rId;
})!==undefined);
})
.map(function (rId){
let r=mapsvg.getRegion(rId);
if(typeof r==="undefined"){
r=mapsvg.regions.find(function (item){
return item.title===rId;
});
}
return { id: r.id, title: r.title, tableName: regionsTable };});
break;
case "location":
if(object[key].match(latLngRegex)){
const coords=object[key].split(",").map(function (n){
return parseFloat(n);
});
if(coords.length==2 &&
coords[0] > -90 &&
coords[0] < 90 &&
coords[1] > -180 &&
coords[1] < 180){
newObject[key]={
geoPoint: { lat: coords[0], lng: coords[1] },
};}else{
newObject[key]="";
}}
else if(object[key]){
newObject[key]={ address: object[key] };}
if(typeof newObject[key]=="object"){
newObject[key].img=mapsvg.options.defaultMarkerImage;
}
break;
case "select":
const field=_this.schema.getField(key);
if(field.multiselect){
const labels=_this.schema.getField(key).options.map(function (f){
return f.label;
});
newObject[key]=object[key]
.split(",")
.map(function (label){
return label.trim();
})
.filter(function (label){
return labels.indexOf(label)!==-1;
})
.map(function (label){
return _this.schema
.getField(key)
.options.filter(function (option){
return option.label==label;
})[0];
});
if(newObject[key].length===0){
const values=_this.schema
.getField(key)
.options.map(function (f){
return f.value + "";
});
newObject[key]=object[key]
.split(",")
.map(function (value){
return value.trim();
})
.filter(function (value){
return values.indexOf(value)!==-1;
})
.map(function (value){
return _this.schema
.getField(key)
.options.filter(function (option){
return option.value==value;
})[0];
});
}}else{
newObject[key]=object[key];
}
break;
case "radio":
case "text":
case "textarea":
case "status":
default:
newObject[key]=object[key];
break;
}}
}
data[index]=newObject;
});
return data;
}}
class MapsRepository extends Repository {
constructor(){
super("map", "maps");
this.path="maps/";
}
encodeData(params){
const data={};
if(typeof params.options!=="undefined"){
data.options=JSON.stringify(params.options);
data.options=data.options.replace(/select/g, "!mapsvg-encoded-slct");
data.options=data.options.replace(/table/g, "!mapsvg-encoded-tbl");
data.options=data.options.replace(/database/g, "!mapsvg-encoded-db");
data.options=data.options.replace(/varchar/g, "!mapsvg-encoded-vc");
data.options=data.options.replace(/int\(11\)/g, "!mapsvg-encoded-int");
}
if(typeof params.title!=="undefined"){
data.title=params.title;
}
if(typeof params.id!=="undefined"){
data.id=params.id;
}
if(typeof params.status!=="undefined"){
data.status=params.status;
}
return data;
}
decodeData(dataJSON){
let data;
if(typeof dataJSON==="string"){
data=JSON.parse(dataJSON);
}else{
data=dataJSON;
}
return data;
}
copy(id, title){
const defer=jQuery.Deferred();
defer.promise();
const data={ options: { title: title }};
this.server
.post(this.path + id + "/copy", this.encodeData(data))
.done((response)=> {
const data=this.decodeData(response);
this.objects.clear();
this.events.trigger("loaded");
this.events.trigger("cleared");
defer.resolve(data.map);
})
.fail(()=> {
defer.reject();
});
return defer;
}
createFromV2(object){
const defer=jQuery.Deferred();
defer.promise();
const data={};
data[this.objectNameSingle]=this.encodeData(object);
this.server
.post(this.path + "/createFromV2", data)
.done((response)=> {
const data=this.decodeData(response);
const object=data[this.objectNameSingle];
this.objects.push(object);
defer.resolve(object);
this.events.trigger("created", this, [object]);
})
.fail(()=> {
defer.reject();
});
return defer;
}
delete(id){
const defer=jQuery.Deferred();
defer.promise();
this.server
.delete(this.path + id)
.done((response)=> {
this.objects.delete(id.toString());
this.events.trigger("deleted");
defer.resolve();
})
.fail(()=> {
defer.reject();
});
return defer;
}}
class MapsV2Repository extends Repository {
constructor(){
super("map", "maps");
this.path="maps-v2/";
}
encodeData(params){
const data={};
data.options=JSON.stringify(params.options);
data.options=data.options.replace(/select/g, "!mapsvg-encoded-slct");
data.options=data.options.replace(/table/g, "!mapsvg-encoded-tbl");
data.options=data.options.replace(/database/g, "!mapsvg-encoded-db");
data.options=data.options.replace(/varchar/g, "!mapsvg-encoded-vc");
data.id=params.id;
data.title=params.title;
return data;
}
decodeData(dataJSON){
let data;
if(typeof dataJSON==="string"){
data=JSON.parse(dataJSON);
}else{
data=dataJSON;
}
return data;
}}
class Converter {
constructor(mapElement, defViewBox, viewBox, geoViewBox){
this.mapElement=mapElement;
this.defViewBox=defViewBox;
this.viewBox=viewBox;
this.yShift=0;
if(geoViewBox){
this.setGeoViewBox(geoViewBox);
}}
setYShift(){
if(this.defViewBox.width===20426){
this.yShift=0;
return;
}
if(this.geoViewBox){
const topLeftPoint=this.convertGeoToSVG(this.geoViewBox.ne);
this.yShift=topLeftPoint.y - this.defViewBox.y;
}}
setGeoViewBox(geoViewBox){
this.geoViewBox=geoViewBox;
this.mapLonDelta=this.geoViewBox.ne.lng - this.geoViewBox.sw.lng;
this.mapLatBottomDegree=(this.geoViewBox.sw.lat * Math.PI) / 180;
this.worldMapWidth=(this.defViewBox.width / this.mapLonDelta) * 360;
this.worldMapRadius=((this.defViewBox.width / this.mapLonDelta) * 360) / (2 * Math.PI);
this.setYShift();
}
setWorldShift(on){
this.worldShift=on;
}
getScale(){
return this.mapElement.clientWidth / this.viewBox.width;
}
convertSVGToPixel(svgPoint){
const scale=this.getScale();
let shiftXByGM=0;
const shiftYByGM=0;
if(this.worldShift){
if(this.viewBox.x - this.defViewBox.x > this.defViewBox.width){
shiftXByGM =
this.worldMapWidth *
Math.floor((this.viewBox.x - this.defViewBox.x) / this.defViewBox.width);
}}
return new ScreenPoint((svgPoint.x - this.viewBox.x + shiftXByGM) * scale, (svgPoint.y - this.viewBox.y + shiftYByGM) * scale);
}
convertPixelToSVG(screenPoint){
const scale=this.getScale();
return new SVGPoint(screenPoint.x / scale + this.viewBox.x, screenPoint.y / scale + this.viewBox.y);
}
convertGeoToSVG(geoPoint){
if(!this.geoViewBox){
throw new Error("Can't do convertGeoToSVG() - geoViewBox is not provided.");
}
let x=(geoPoint.lng - this.geoViewBox.sw.lng) * (this.defViewBox.width / this.mapLonDelta);
const lat=(geoPoint.lat * Math.PI) / 180;
const mapOffsetY=(this.worldMapRadius / 2) *
Math.log((1 + Math.sin(this.mapLatBottomDegree)) / (1 - Math.sin(this.mapLatBottomDegree)));
let y=this.defViewBox.height -
((this.worldMapRadius / 2) * Math.log((1 + Math.sin(lat)) / (1 - Math.sin(lat))) -
mapOffsetY);
x +=this.defViewBox.x;
y +=this.defViewBox.y;
y -=this.yShift;
return new SVGPoint(x, y);
}
convertSVGToGeo(svgPoint){
if(!this.geoViewBox){
throw new Error("Can't do convertSVGToGeo() - geoViewBox is not provided.");
}
const tx=svgPoint.x - this.defViewBox.x;
const ty=svgPoint.y - this.defViewBox.y;
const mapOffsetY=(this.worldMapRadius / 2) *
Math.log((1 + Math.sin(this.mapLatBottomDegree)) / (1 - Math.sin(this.mapLatBottomDegree)));
const equatorY=this.defViewBox.height + mapOffsetY;
const a=(equatorY - ty) / this.worldMapRadius;
let lat=(180 / Math.PI) * (2 * Math.atan(Math.exp(a)) - Math.PI / 2);
let lng=this.geoViewBox.sw.lng + (tx / this.defViewBox.width) * this.mapLonDelta;
lat=parseFloat(lat.toFixed(6));
lng=parseFloat(lng.toFixed(6));
return new GeoPoint(lat, lng);
}}
const $$3=jQuery;
class ResizeSensor {
constructor(element, callback){
const _this=this;
_this.element=element;
_this.callback=callback;
const style=getComputedStyle(element);
let zIndex=parseInt(style.zIndex);
if(isNaN(zIndex)){
zIndex=0;
}
zIndex--;
_this.expand=document.createElement("div");
_this.expand.style.position="absolute";
_this.expand.style.left="0px";
_this.expand.style.top="0px";
_this.expand.style.right="0px";
_this.expand.style.bottom="0px";
_this.expand.style.overflow="hidden";
_this.expand.style.zIndex=zIndex.toString();
_this.expand.style.visibility="hidden";
const expandChild=document.createElement("div");
expandChild.style.position="absolute";
expandChild.style.left="0px";
expandChild.style.top="0px";
expandChild.style.width="10000000px";
expandChild.style.height="10000000px";
_this.expand.appendChild(expandChild);
_this.shrink=document.createElement("div");
_this.shrink.style.position="absolute";
_this.shrink.style.left="0px";
_this.shrink.style.top="0px";
_this.shrink.style.right="0px";
_this.shrink.style.bottom="0px";
_this.shrink.style.overflow="hidden";
_this.shrink.style.zIndex=zIndex.toString();
_this.shrink.style.visibility="hidden";
const shrinkChild=document.createElement("div");
shrinkChild.style.position="absolute";
shrinkChild.style.left="0px";
shrinkChild.style.top="0px";
shrinkChild.style.width="200%";
shrinkChild.style.height="200%";
_this.shrink.appendChild(shrinkChild);
_this.element.appendChild(_this.expand);
_this.element.appendChild(_this.shrink);
const size=element.getBoundingClientRect();
_this.currentWidth=size.width;
_this.currentHeight=size.height;
_this.setScroll();
_this.expand.addEventListener("scroll", function (){
_this.onScroll();
});
_this.shrink.addEventListener("scroll", function (){
_this.onScroll();
});
}
onScroll(){
const _this=this;
const size=_this.element.getBoundingClientRect();
const newWidth=size.width;
const newHeight=size.height;
if(newWidth!=_this.currentWidth||newHeight!=_this.currentHeight){
_this.currentWidth=newWidth;
_this.currentHeight=newHeight;
_this.callback();
}
this.setScroll();
}
setScroll(){
this.expand.scrollLeft=10000000;
this.expand.scrollTop=10000000;
this.shrink.scrollLeft=10000000;
this.shrink.scrollTop=10000000;
}
destroy(){
this.expand.remove();
this.shrink.remove();
}}
class ViewBox {
constructor(x, y, width, height){
if(typeof x==="object"){
if(x.hasOwnProperty("x") &&
x.hasOwnProperty("y") &&
x.hasOwnProperty("width") &&
x.hasOwnProperty("height")){
this.x=typeof x.x==="string" ? parseFloat(x.x):x.x;
this.y=typeof x.y==="string" ? parseFloat(x.y):x.y;
this.width=typeof x.width==="string" ? parseFloat(x.width):x.width;
this.height=typeof x.height==="string" ? parseFloat(x.height):x.height;
}
else if(typeof x==="object"&&x.length&&x.length===4){
this.x=typeof x[0]==="string" ? parseFloat(x[0]):x[0];
this.y=typeof x[1]==="string" ? parseFloat(x[1]):x[1];
this.width=typeof x[2]==="string" ? parseFloat(x[2]):x[2];
this.height=typeof x[3]==="string" ? parseFloat(x[3]):x[3];
}}else{
this.x=typeof x==="string" ? parseFloat(x):x;
this.y=typeof y==="string" ? parseFloat(y):y;
this.width=typeof width==="string" ? parseFloat(width):width;
this.height=typeof height==="string" ? parseFloat(height):height;
}}
update(newViewBox){
this.x=newViewBox.x;
this.y=newViewBox.y;
this.width=newViewBox.width;
this.height=newViewBox.height;
}
toString(){
return this.x + " " + this.y + " " + this.width + " " + this.height;
}
toArray(){
return [this.x, this.y, this.width, this.height];
}
clone(){
return new ViewBox({ x: this.x, y: this.y, width: this.width, height: this.height });
}
fitsInViewBox(viewBox, atLeastByOneDimension){
if(atLeastByOneDimension===true){
return viewBox.width > this.width||viewBox.height > this.height;
}else{
return viewBox.width > this.width&&viewBox.height > this.height;
}}
addPadding(padding){
if(padding.top){
this.y -=padding.top;
this.height +=padding.top;
}
if(padding.right){
this.width +=padding.right;
}
if(padding.bottom){
this.height +=padding.bottom;
}
if(padding.left){
this.x -=padding.left;
this.width +=padding.left;
}}
}
class GeoViewBox {
constructor(sw, ne){
this.sw=sw;
this.ne=ne;
}}
const $$4=jQuery;
class MapObject {
constructor(element, mapsvg){
this.id="";
this.objects=[];
this.events=new Events(this);
this.element=element;
this.mapsvg=mapsvg;
}
getBBox(){
return new ViewBox(1, 2, 3, 4);
}
getGeoBounds(){
const bbox=this.getBBox();
const pointSW=new SVGPoint(bbox.x, bbox.y + bbox.height);
const pointNE=new SVGPoint(bbox.x + bbox.width, bbox.y);
const sw=this.mapsvg.converter.convertSVGToGeo(pointSW);
const ne=this.mapsvg.converter.convertSVGToGeo(pointNE);
return { sw: sw, ne: ne };}
getComputedStyle(prop, elem){
elem=elem||this.element;
return MapObject.getComputedStyle(prop, elem);
}
static getComputedStyle(prop, elem){
const _p1=elem.getAttribute(prop);
if(_p1){
return _p1;
}
const _p2=elem.getAttribute("style");
if(_p2){
const s=_p2.split(";");
const z=s.filter(function (e){
e=e.trim();
const attr=e.split(":");
if(attr[0]==prop)
return true;
});
if(z.length){
return z[0].split(":").pop().trim();
}}
const parent=elem.parentElement;
const elemType=parent ? parent.tagName:null;
if(elemType&&elemType!="svg")
return MapObject.getComputedStyle(prop, parent);
else
return undefined;
}
getStyle(prop){
const _p1=this.attr(prop);
if(_p1){
return _p1;
}
const _p2=this.attr("style");
if(_p2){
const s=_p2.split(";");
const z=s.filter(function (e){
var e=e.trim();
if(e.indexOf(prop)===0)
return e;
});
return z.length ? z[0].split(":").pop().trim():undefined;
}
return "";
}
getCenter(){
const x=this.element.getBoundingClientRect().left;
const y=this.element.getBoundingClientRect().top;
const w=this.element.getBoundingClientRect().width;
const h=this.element.getBoundingClientRect().height;
const point=new ScreenPoint(x + w / 2, y + h / 2);
return point;
}
getCenterSVG(){
const bbox=this.getBBox();
const point=new SVGPoint(bbox.x + bbox.width / 2, bbox.y + bbox.height / 2);
return point;
}
getCenterLatLng(yShift){
yShift=yShift ? yShift:0;
const bbox=this.getBBox();
const x=bbox.x + bbox.width / 2;
const y=bbox.y + bbox.height / 2 - yShift;
const point=new SVGPoint(x, y);
return this.mapsvg.converter.convertSVGToGeo(point);
}
attr(v1, v2=null){
const svgDom=this.element;
if(typeof v1=="object"){
for (const key in v1){
const item=v1[key];
if(typeof item==="string"||typeof item==="number"){
svgDom.setAttribute(key, "" + item);
}}
}
else if(typeof v1=="string"&&(typeof v2=="string"||typeof v2=="number")){
svgDom.setAttribute(v1, "" + v2);
}
else if(v2==undefined){
return svgDom.getAttribute(v1);
}}
setId(id){
if(id!==undefined){
this.id=id;
this.element.setAttribute("id", id);
}}
}
const $$5=jQuery;
class Marker extends MapObject {
constructor(params){
super(null, params.mapsvg);
this.element=$$5("<div />").addClass("mapsvg-marker")[0];
this.image=$$5('<img src="" />').addClass("mapsvg-marker-image")[0];
if(params.object){
this.setObject(params.object);
}
if(!(params.location instanceof Location)){
throw new Error("MapSVG.Marker: no Location provided for Marker initializaton");
}else{
this.location=params.location;
this.location.marker=this;
}
this.setImage(this.location.imagePath);
$$5(this.element).append(this.image);
if(params.width&&params.height){
this.setSize(params.width, params.height);
}else{
this.setSize(15, 24);
}
this.setId(this.mapsvg.markerId());
this.setSvgPointFromLocation();
this.setAltAttr();
}
reload(){
this.setImage();
this.setSvgPointFromLocation();
}
getImagePath(){
return (this.object&&this.object.getMarkerImage())||this.location.getMarkerImage();
}
setSize(width, height){
this.width=width;
this.height=height;
this.setCentered(this.width===this.height);
}
setSvgPointFromLocation(){
const svgPoint=this.location.geoPoint &&
this.location.geoPoint.lat!==0 &&
this.location.geoPoint.lng!==0
? this.mapsvg.converter.convertGeoToSVG(this.location.geoPoint)
: this.location.svgPoint;
if(svgPoint){
this.setSvgPoint(svgPoint);
}}
setId(id){
MapObject.prototype.setId.call(this, id);
this.mapsvg.markers.reindex();
}
getBBox(){
if(this.centered){
return new ViewBox(this.svgPoint.x - this.width / 2 / this.mapsvg.scale, this.svgPoint.y - this.height / 2 / this.mapsvg.scale, this.width / this.mapsvg.scale, this.height / this.mapsvg.scale);
}else{
return new ViewBox(this.svgPoint.x - this.width / 2 / this.mapsvg.scale, this.svgPoint.y - this.height / this.mapsvg.scale, this.width / this.mapsvg.scale, this.height / this.mapsvg.scale);
}}
getOptions(){
const o={
id: this.id,
src: this.src,
svgPoint: this.svgPoint,
geoPoint: this.geoPoint,
};
$$5.each(o, function (key, val){
if(val==undefined){
delete o[key];
}});
return o;
}
update(data){
for (const key in data){
const setter="set" + MapSVG.ucfirst(key);
if(setter in this)
this[setter](data[key]);
}}
setImage(src, skipChangingLocationImage=false){
if(!src){
src=this.getImagePath();
}
this.src=MapSVG.safeURL(src);
const img=new Image();
const marker=this;
img.onload=function (){
if(marker.image.getAttribute("src")!=="src"){
marker.image.setAttribute("src", marker.src);
}
marker.setSize(this.width, this.height);
marker.adjustScreenPosition();
};
img.src=this.src;
this.events.trigger("change");
}
setAltAttr(){
const marker=this;
marker.altAttr =
typeof marker.object!="undefined" &&
typeof marker.object.title!="undefined" &&
marker.object.title!==""
? marker.object.title
: marker.id;
marker.image.setAttribute("alt", marker.altAttr);
}
setSvgPoint(svgPoint){
this.svgPoint=svgPoint;
this.adjustScreenPosition();
this.events.trigger("change");
}
adjustScreenPosition(){
const pos=this.mapsvg.converter.convertSVGToPixel(this.svgPoint);
pos.x -=this.width / 2;
pos.y -= !this.centered ? this.height:this.height / 2;
this.setScreenPosition(pos.x, pos.y);
}
moveSrceenPositionBy(deltaX, deltaY){
const oldPos=this.screenPoint, x=oldPos.x - deltaX, y=oldPos.y - deltaY;
this.setScreenPosition(x, y);
}
setScreenPosition(x, y){
if(this.screenPoint instanceof ScreenPoint){
this.screenPoint.x=x;
this.screenPoint.y=y;
}else{
this.screenPoint=new ScreenPoint(x, y);
}
this.updateVisibility();
if(this.visible===true){
this.element.style.transform="translate(" + x + "px," + y + "px)";
this.adjustLabelScreenPosition();
}}
adjustLabelScreenPosition(){
if(this.label){
const markerPos=this.screenPoint, x=Math.round(markerPos.x + this.width / 2 - $$5(this.label).outerWidth() / 2), y=Math.round(markerPos.y - $$5(this.label).outerHeight());
}}
inViewBox(){
const x=this.screenPoint.x, y=this.screenPoint.y, mapFullWidth=this.mapsvg.containers.map.offsetWidth, mapFullHeight=this.mapsvg.containers.map.offsetHeight;
return (x - this.width / 2 < 2 * mapFullWidth &&
x + this.width / 2 > -mapFullWidth &&
y - this.height / 2 < 2 * mapFullHeight &&
y + this.height / 2 > -mapFullHeight);
}
updateVisibility(){
if(this.inViewBox()===true){
this.visible=true;
this.element.classList.remove("mapsvg-out-of-sight");
if(this.label){
this.label.classList.remove("mapsvg-out-of-sight");
}}else{
this.visible=false;
this.element.classList.add("mapsvg-out-of-sight");
if(this.label){
this.label.classList.add("mapsvg-out-of-sight");
}}
return this.visible;
}
isMoving(){
return this.moving;
}
setMoving(value){
this.moving=value;
}
drag(startCoords, scale, endCallback, clickCallback){
const _this=this;
this.svgPointBeforeDrag=new SVGPoint(this.svgPoint.x, this.svgPoint.y);
this.setMoving(true);
$$5("body").on("mousemove.drag.mapsvg", function (e){
e.preventDefault();
$$5(_this.mapsvg.containers.map).addClass("no-transitions");
const mouseNew=MapSVG.mouseCoords(e);
const dx=mouseNew.x - startCoords.x;
const dy=mouseNew.y - startCoords.y;
const newSvgPoint=new SVGPoint(_this.svgPointBeforeDrag.x + dx / scale, _this.svgPointBeforeDrag.y + dy / scale);
_this.setSvgPoint(newSvgPoint);
});
$$5("body").on("mouseup.drag.mapsvg", function (e){
e.preventDefault();
_this.undrag();
const mouseNew=MapSVG.mouseCoords(e);
const dx=mouseNew.x - startCoords.x;
const dy=mouseNew.y - startCoords.y;
const newSvgPoint=new SVGPoint(_this.svgPointBeforeDrag.x + dx / scale, _this.svgPointBeforeDrag.y + dy / scale);
_this.setSvgPoint(newSvgPoint);
if(_this.mapsvg.isGeo()){
_this.geoPoint=_this.mapsvg.converter.convertSVGToGeo(newSvgPoint);
}
endCallback&&endCallback.call(_this);
if(_this.svgPointBeforeDrag.x==_this.svgPoint.x &&
_this.svgPointBeforeDrag.y==_this.svgPoint.y)
clickCallback&&clickCallback.call(_this);
});
}
undrag(){
this.setMoving(false);
$$5("body").off(".drag.mapsvg");
$$5(this.mapsvg.containers.map).removeClass("no-transitions");
}
delete(){
if(this.label){
this.label.remove();
this.label=null;
}
$$5(this.element).empty().remove();
}
setObject(obj){
this.object=obj;
$$5(this.element).attr("data-object-id", this.object.id);
}
hide(){
$$5(this.element).addClass("mapsvg-marker-hidden");
if(this.label){
$$5(this.label).hide();
}}
show(){
$$5(this.element).removeClass("mapsvg-marker-hidden");
if(this.label){
$$5(this.label).show();
}}
highlight(){
$$5(this.element).addClass("mapsvg-marker-hover");
}
unhighlight(){
$$5(this.element).removeClass("mapsvg-marker-hover");
}
select(){
this.selected=true;
$$5(this.element).addClass("mapsvg-marker-active");
}
deselect(){
this.selected=false;
$$5(this.element).removeClass("mapsvg-marker-active");
}
getData(){
return this.object;
}
getChoroplethColor(){
const markerValue=parseFloat(this.object[this.mapsvg.options.choropleth.sourceField]);
let color;
if(!markerValue){
color=this.mapsvg.options.choropleth.coloring.noData.color;
}
else if(this.mapsvg.options.choropleth.coloring.mode==="gradient"){
const gradient=this.mapsvg.options.choropleth.coloring.gradient, w=gradient.values.maxAdjusted===0
? 0
: (markerValue - gradient.values.min) / gradient.values.maxAdjusted, r=Math.round(gradient.colors.diffRGB.r * w + gradient.colors.lowRGB.r), g=Math.round(gradient.colors.diffRGB.g * w + gradient.colors.lowRGB.g), b=Math.round(gradient.colors.diffRGB.b * w + gradient.colors.lowRGB.b), a=(gradient.colors.diffRGB.a * w + gradient.colors.lowRGB.a).toFixed(2);
color="rgba(" + r + "," + g + "," + b + "," + a + ")";
}else{
const paletteColors=this.mapsvg.options.choropleth.coloring.palette.colors;
if(!paletteColors[0].valueFrom&&markerValue < paletteColors[0].valueTo){
color=paletteColors[0].color;
}
else if(!paletteColors[paletteColors.length - 1].valueTo &&
markerValue > paletteColors[paletteColors.length - 1].valueFrom){
color=paletteColors[paletteColors.length - 1].color;
}else{
paletteColors.forEach(function (paletteColor){
if(markerValue >=paletteColor.valueFrom &&
markerValue < paletteColor.valueTo){
color=paletteColor.color;
}});
color=color
? color
: this.mapsvg.options.choropleth.coloring.palette.outOfRange.color;
}}
return color;
}
getBubbleSize(){
let bubbleSize;
if(this.object[this.mapsvg.options.choropleth.sourceField]){
const maxBubbleSize=Number(this.mapsvg.options.choropleth.bubbleSize.max), minBubbleSize=Number(this.mapsvg.options.choropleth.bubbleSize.min), maxSourceFieldvalue=this.mapsvg.options.choropleth.coloring.gradient.values.max, minSourceFieldvalue=this.mapsvg.options.choropleth.coloring.gradient.values.min, sourceFieldvalue=parseFloat(this.object[this.mapsvg.options.choropleth.sourceField]);
bubbleSize =
((sourceFieldvalue - minSourceFieldvalue) /
(maxSourceFieldvalue - minSourceFieldvalue)) *
(maxBubbleSize - minBubbleSize) +
Number(minBubbleSize);
}else{
bubbleSize=false;
}
return bubbleSize;
}
getBubbleScreenPosition(){
const bubbleSize=Number(this.getBubbleSize());
return {
x: this.width / 2 - bubbleSize / 2,
y: this.height - bubbleSize / 2,
};}
drawBubble(){
const bubbleId="mapsvg-bubble-" + this.object.id;
const bubbleValue=parseFloat(this.object[this.mapsvg.options.choropleth.sourceField]);
if(bubbleValue){
if(!this.bubble){
this.bubble=$$5('<div id="' +
bubbleId +
'" data-marker-id="' +
this.element.id +
'" class="mapsvg-bubble mapsvg-marker-bubble"></div>')[0];
$$5(this.element).append(this.bubble);
}
const color=this.getChoroplethColor(), bubbleSize=Number(this.getBubbleSize());
$$5(this.bubble)
.css("background-color", color)
.css("width", bubbleSize + "px")
.css("height", bubbleSize + "px")
.css("lineHeight", bubbleSize - 2 + "px");
}else{
$$5("#" + bubbleId).remove();
delete this.bubble;
}}
setBubbleMode(bubbleMode){
this.bubbleMode=bubbleMode;
if(bubbleMode){
this.setCentered(true);
this.drawBubble();
if(this.bubble){
this.width=this.bubble.offsetWidth;
this.height=this.bubble.offsetHeight;
this.adjustScreenPosition();
}}else{
this.setImage(this.src);
}}
setLabel(html){
if(html){
if(!this.label){
this.label=$$5("<div />").addClass("mapsvg-marker-label")[0];
$$5(this.element).append(this.label);
}
$$5(this.label).html(html);
}else{
if(this.label){
$$5(this.label).remove();
delete this.label;
}}
}
setCentered(on){
this.centered=on;
}}
const $$6=jQuery;
class MarkerCluster extends MapObject {
constructor(options, mapsvg){
super(null, mapsvg);
this.svgPoint=options.svgPoint;
this.cellX=options.cellX;
this.cellY=options.cellY;
this.markers=options.markers||[];
this.cellSize=50;
this.width=30;
this.elem=$$6('<div class="mapsvg-marker-cluster">' + this.markers.length + "</div>")[0];
$$6(this.elem).data("cluster", this);
if(this.markers.length < 2){
$$6(this.elem).hide();
}
this.adjustScreenPosition();
}
addMarker(marker){
this.markers.push(marker);
if(this.markers.length > 1){
if(this.markers.length===2){
$$6(this.elem).show();
}
if(this.markers.length===2){
const x=this.markers.map(function (m){
return m.svgPoint.x;
});
this.min_x=Math.min.apply(null, x);
this.max_x=Math.max.apply(null, x);
const y=this.markers.map(function (m){
return m.svgPoint.y;
});
this.min_y=Math.min.apply(null, y);
this.max_y=Math.max.apply(null, y);
this.svgPoint.x=this.min_x + (this.max_x - this.min_x) / 2;
this.svgPoint.y=this.min_y + (this.max_y - this.min_y) / 2;
}
if(this.markers.length > 2){
if(marker.svgPoint.x < this.min_x){
this.min_x=marker.svgPoint.x;
}
else if(marker.svgPoint.x > this.max_x){
this.max_x=marker.svgPoint.x;
}
if(marker.svgPoint.y < this.min_y){
this.min_y=marker.svgPoint.y;
}
else if(marker.svgPoint.x > this.max_x){
this.max_y=marker.svgPoint.y;
}
this.svgPoint.x=this.min_x + (this.max_x - this.min_x) / 2;
this.svgPoint.y=this.min_y + (this.max_y - this.min_y) / 2;
}}else{
this.svgPoint.x=marker.svgPoint.x;
this.svgPoint.y=marker.svgPoint.y;
}
$$6(this.elem).text(this.markers.length);
this.adjustScreenPosition();
}
canTakeMarker(marker){
const _this=this;
const screenPoint=_this.mapsvg.converter.convertSVGToPixel(marker.svgPoint);
return (this.cellX===Math.ceil(screenPoint.x / this.cellSize) &&
this.cellY===Math.ceil(screenPoint.y / this.cellSize));
}
destroy(){
this.markers=null;
$$6(this.elem).remove();
}
adjustScreenPosition(){
const pos=this.mapsvg.converter.convertSVGToPixel(this.svgPoint);
pos.x -=this.width / 2;
pos.y -=this.width / 2;
this.setScreenPosition(pos.x, pos.y);
}
moveSrceenPositionBy(deltaX, deltaY){
const oldPos=this.screenPoint, x=oldPos.x - deltaX, y=oldPos.y - deltaY;
this.setScreenPosition(x, y);
}
setScreenPosition(x, y){
if(this.screenPoint instanceof ScreenPoint){
this.screenPoint.x=x;
this.screenPoint.y=y;
}else{
this.screenPoint=new ScreenPoint(x, y);
}
this.updateVisibility();
if(this.visible===true){
this.elem.style.transform="translate(" + x + "px," + y + "px)";
}}
inViewBox(){
const x=this.screenPoint.x, y=this.screenPoint.y, mapFullWidth=this.mapsvg.containers.map.offsetWidth, mapFullHeight=this.mapsvg.containers.map.offsetHeight;
return (x - this.width / 2 < mapFullWidth &&
x + this.width / 2 > 0 &&
y - this.width / 2 < mapFullHeight &&
y + this.width / 2 > 0);
}
updateVisibility(){
if(this.inViewBox()===true){
this.visible=true;
this.elem.classList.remove("mapsvg-out-of-sight");
}else{
this.visible=false;
this.elem.classList.add("mapsvg-out-of-sight");
}
return this.visible;
}
getBBox(){
let bbox={
x: this.svgPoint.x,
y: this.svgPoint.y,
width: this.cellSize / this.mapsvg.getScale(),
height: this.cellSize / this.mapsvg.getScale(),
};
bbox=$$6.extend(true, {}, bbox);
return new ViewBox(bbox.x, bbox.y, bbox.width, bbox.height);
}
getData(){
return this.markers.map((m)=> m.object);
}}
const $$7=jQuery;
class Region extends MapObject {
constructor(element, mapsvg){
super(element, mapsvg);
this.id=this.element.getAttribute("id");
if(this.id&&this.mapsvg.options.regionPrefix){
this.setId(this.id.replace(this.mapsvg.options.regionPrefix, ""));
}
this.id_no_spaces=this.id.replace(/\s/g, "_");
this.element.setAttribute("class", (this.element.className||"") + " mapsvg-region");
this.setStyleInitial();
const regionOptions=this.mapsvg.options.regions&&this.mapsvg.options.regions[this.id]
? this.mapsvg.options.regions[this.id]
: null;
this.disabled=this.getDisabledState();
this.disabled&&this.attr("class", this.attr("class") + " mapsvg-disabled");
this.default_attr={};
this.selected_attr={};
this.hover_attr={};
let selected=false;
if(regionOptions&&regionOptions.selected){
selected=true;
delete regionOptions.selected;
}
regionOptions&&this.update(regionOptions);
this.setFill();
if(selected){
this.setSelected();
}
this.saveState();
}
adjustStroke(scale){
$$7(this.element).css({ "stroke-width": this.style["stroke-width"] / scale });
}
setStyleInitial(){
this.style={ fill: this.getComputedStyle("fill") };
this.style.stroke=this.getComputedStyle("stroke")||"";
let w;
w=this.getComputedStyle("stroke-width");
w=w ? w.replace("px", ""):"1";
w=parseFloat(w);
this.style["stroke-width"]=w;
$$7(this.element).attr("data-stroke-width", w);
}
saveState(){
this.initialState=JSON.stringify(this.getOptions());
}
getBBox(){
const _bbox=this.element.getBBox();
const bbox=new ViewBox(_bbox.x, _bbox.y, _bbox.width, _bbox.height);
const matrix=this.element.getTransformToElement(this.mapsvg.containers.svg);
if(!matrix){
return _bbox;
}
const x2=bbox.x + bbox.width;
const y2=bbox.y + bbox.height;
let position=this.mapsvg.containers.svg.createSVGPoint();
position.x=bbox.x;
position.y=bbox.y;
position=position.matrixTransform(matrix);
bbox.x=position.x;
bbox.y=position.y;
position.x=x2;
position.y=y2;
position=position.matrixTransform(matrix);
bbox.width=position.x - bbox.x;
bbox.height=position.y - bbox.y;
return bbox;
}
changed(){
return JSON.stringify(this.getOptions())!=this.initialState;
}
edit(){
this.elemOriginal=$$7(this.element).clone()[0];
}
editCommit(){
this.elemOriginal=null;
}
editCancel(){
this.mapsvg.containers.svg.appendChild(this.elemOriginal);
this.element=this.elemOriginal;
this.elemOriginal=null;
}
getOptions(forTemplate){
let o;
o={
id: this.id,
id_no_spaces: this.id_no_spaces,
title: this.title,
fill: this.mapsvg.options.regions[this.id]&&this.mapsvg.options.regions[this.id].fill,
data: this.data,
choroplethValue: this.choroplethValue,
};
if(forTemplate){
o.disabled=this.disabled;
}
for (const key in o){
if(typeof o[key]==="undefined"){
delete o[key];
}}
if(this.customAttrs){
const that=this;
this.customAttrs.forEach(function (attr){
o[attr]=that[attr];
});
}
return o;
}
forTemplate(){
const data={
id: this.id,
title: this.title,
objects: this.objects,
data: this.data,
};
if(this.data){
for (const key in this.data){
if(key!="title"&&key!="id")
data[key]=this.data[key];
}}
return data;
}
getData(){
return this.forTemplate();
}
update(options){
for (const key in options){
const setter="set" + MapSVG.ucfirst(key);
if(setter in this)
this[setter](options[key]);
else {
this[key]=options[key];
this.customAttrs=this.customAttrs||[];
this.customAttrs.push(key);
}}
}
setTitle(title){
if(title){
this.title=title;
}
this.element.setAttribute("title", this.title);
}
setStyle(style){
$$7.extend(true, this.style, style);
this.setFill();
}
getChoroplethColor(){
const o=this.mapsvg.options.choropleth;
let color="";
if(this.data &&
(this.data[this.mapsvg.options.regionChoroplethField] ||
this.data[this.mapsvg.options.regionChoroplethField]===0)){
const w=o.maxAdjusted===0
? 0
: (parseFloat(this.data[this.mapsvg.options.regionChoroplethField]) - o.min) /
o.maxAdjusted;
const c={
r: Math.round(o.colors.diffRGB.r * w + o.colors.lowRGB.r),
g: Math.round(o.colors.diffRGB.g * w + o.colors.lowRGB.g),
b: Math.round(o.colors.diffRGB.b * w + o.colors.lowRGB.b),
a: (o.colors.diffRGB.a * w + o.colors.lowRGB.a).toFixed(2),
};
color="rgba(" + c.r + "," + c.g + "," + c.b + "," + c.a + ")";
}else{
color=o.colors.noData;
}
return color;
}
_new_getChoroplethColor(){
let regionValue=parseFloat(this.data[this.mapsvg.options.choropleth.sourceField]), color;
if(!regionValue){
color=this.mapsvg.options.choropleth.coloring.noData.color;
}
else if(this.mapsvg.options.choropleth.coloring.mode==="gradient"){
const gradient=this.mapsvg.options.choropleth.coloring.gradient, w=gradient.values.maxAdjusted===0
? 0
: (regionValue - gradient.values.min) / gradient.values.maxAdjusted, r=Math.round(gradient.colors.diffRGB.r * w + gradient.colors.lowRGB.r), g=Math.round(gradient.colors.diffRGB.g * w + gradient.colors.lowRGB.g), b=Math.round(gradient.colors.diffRGB.b * w + gradient.colors.lowRGB.b), a=(gradient.colors.diffRGB.a * w + gradient.colors.lowRGB.a).toFixed(2);
color="rgba(" + r + "," + g + "," + b + "," + a + ")";
}else{
const paletteColors=this.mapsvg.options.choropleth.coloring.palette.colors;
if(!paletteColors[0].valueFrom&&regionValue < paletteColors[0].valueTo){
color=paletteColors[0].color;
}
else if(!paletteColors[paletteColors.length - 1].valueTo &&
regionValue > paletteColors[paletteColors.length - 1].valueFrom){
color=paletteColors[paletteColors.length - 1].color;
}else{
paletteColors.forEach(function (paletteColor){
if(regionValue >=paletteColor.valueFrom &&
regionValue < paletteColor.valueTo){
color=paletteColor.color;
}});
color=color
? color
: this.mapsvg.options.choropleth.coloring.palette.outOfRange.color;
}}
return color;
}
getBubbleSize(){
let bubbleSize;
if(this.data[this.mapsvg.options.choropleth.sourceField]){
const maxBubbleSize=Number(this.mapsvg.options.choropleth.bubbleSize.max), minBubbleSize=Number(this.mapsvg.options.choropleth.bubbleSize.min), maxSourceFieldvalue=this.mapsvg.options.choropleth.coloring.gradient.values.max, minSourceFieldvalue=this.mapsvg.options.choropleth.coloring.gradient.values.min, sourceFieldvalue=parseFloat(this.data[this.mapsvg.options.choropleth.sourceField]);
bubbleSize =
((sourceFieldvalue - minSourceFieldvalue) /
(maxSourceFieldvalue - minSourceFieldvalue)) *
(maxBubbleSize - minBubbleSize) +
minBubbleSize;
}else{
bubbleSize=false;
}
return bubbleSize;
}
setFill(fill){
if(this.mapsvg.options.colorsIgnore){
$$7(this.element).css(this.style);
return;
}
if(fill){
const regions={};
regions[this.id]={ fill: fill };
$$7.extend(true, this.mapsvg.options, { regions: regions });
}
else if(!fill &&
fill!==undefined &&
this.mapsvg.options.regions &&
this.mapsvg.options.regions[this.id] &&
this.mapsvg.options.regions[this.id].fill){
delete this.mapsvg.options.regions[this.id].fill;
}
if(this.mapsvg.options.choropleth.on){
this.default_attr["fill"]=this.getChoroplethColor();
}
else if(this.status!==undefined &&
this.mapsvg.regions &&
this.mapsvg.regionsRepository.getSchema().getFieldByType("status") &&
this.mapsvg.regionsRepository.getSchema().getFieldByType("status").optionsDict &&
this.mapsvg.regionsRepository.getSchema().getFieldByType("status").optionsDict[this.status] &&
this.mapsvg.regionsRepository.getSchema().getFieldByType("status").optionsDict[this.status].color){
this.default_attr["fill"]=this.mapsvg.regionsRepository
.getSchema()
.getFieldByType("status").optionsDict[this.status].color;
}
else if(this.mapsvg.options.regions[this.id] &&
this.mapsvg.options.regions[this.id].fill){
this.default_attr["fill"]=this.mapsvg.options.regions[this.id].fill;
}
else if(this.mapsvg.options.colors.base){
this.default_attr["fill"]=this.mapsvg.options.colors.base;
}
else if(this.style.fill!="none"){
this.default_attr["fill"]=this.style.fill
? this.style.fill
: this.mapsvg.options.colors.baseDefault;
}else{
this.default_attr["fill"]="none";
}
if(MapSVG.isNumber(this.mapsvg.options.colors.selected))
this.selected_attr["fill"]=tinycolor(this.default_attr.fill)
.lighten(parseFloat("" + this.mapsvg.options.colors.selected))
.toRgbString();
else
this.selected_attr["fill"]=this.mapsvg.options.colors.selected;
if(MapSVG.isNumber(this.mapsvg.options.colors.hover))
this.hover_attr["fill"]=tinycolor(this.default_attr.fill)
.lighten(parseFloat("" + this.mapsvg.options.colors.hover))
.toRgbString();
else
this.hover_attr["fill"]=this.mapsvg.options.colors.hover;
$$7(this.element).css("fill", this.default_attr["fill"]);
this.fill=this.default_attr["fill"];
if(this.style.stroke!="none"&&this.mapsvg.options.colors.stroke!=undefined){
$$7(this.element).css("stroke", this.mapsvg.options.colors.stroke);
}else{
const s=this.style.stroke==undefined ? "":this.style.stroke;
$$7(this.element).css("stroke", s);
}
if(this.selected)
this.setSelected();
}
setDisabled(on, skipSetFill){
on=on!==undefined ? MapSVG.parseBoolean(on):this.getDisabledState();
const prevDisabled=this.disabled;
this.disabled=on;
this.attr("class", this.attr("class").replace("mapsvg-disabled", ""));
if(on){
this.attr("class", this.attr("class") + " mapsvg-disabled");
}
if(this.disabled!=prevDisabled)
this.mapsvg.deselectRegion(this);
!skipSetFill&&this.setFill();
}
setStatus(status){
const statusOptions=this.mapsvg.options.regionStatuses&&this.mapsvg.options.regionStatuses[status];
if(statusOptions){
this.status=status;
if(this.data){
this.data.status=status;
this.data.status_text=statusOptions.label;
}
this.setDisabled(statusOptions.disabled, true);
}else{
this.status=undefined;
if(this.data){
this.data.status=undefined;
this.data.status_text=undefined;
}
this.setDisabled(false, true);
}
this.setFill();
}
setSelected(){
this.mapsvg.selectRegion(this);
}
setchoroplethValue(val){
if($$7.isNumeric(val)){
if(typeof val==="string"){
val=parseFloat(val);
}
this.choroplethValue=val;
}else{
this.choroplethValue=undefined;
}}
getDisabledState(asDefault){
const opts=this.mapsvg.options.regions[this.id];
if(!asDefault&&opts&&opts.disabled!==undefined){
return opts.disabled;
}else{
return (this.mapsvg.options.disableAll ||
this.style.fill==="none" ||
this.id=="labels" ||
this.id=="Labels");
}}
highlight(){
$$7(this.element).css({ fill: this.hover_attr.fill });
$$7(this.element).addClass("mapsvg-region-hover");
}
unhighlight(){
$$7(this.element).css({ fill: this.default_attr.fill });
$$7(this.element).removeClass("mapsvg-region-hover");
}
select(){
$$7(this.element).css({ fill: this.selected_attr.fill });
this.selected=true;
$$7(this.element).addClass("mapsvg-region-active");
}
deselect(){
$$7(this.element).css({ fill: this.default_attr.fill });
this.selected=false;
$$7(this.element).removeClass("mapsvg-region-active");
}
setData(data){
this.data=data;
if(typeof data.title!=="undefined"){
this.setTitle(data.title);
}}
drawBubble(){
if(this.data){
const bubbleId="mapsvg-bubble-" + this.id;
const bubbleValue=parseFloat(this.data[this.mapsvg.options.choropleth.sourceField]);
if(bubbleValue){
if(!this.center){
this.center=this.getCenterSVG();
}
const pos=this.mapsvg.converter.convertSVGToPixel(this.center);
if(!this.bubble){
this.bubble=$$7('<div id="' +
bubbleId +
'" class="mapsvg-bubble mapsvg-region-bubble"></div>')[0];
$$7(this.mapsvg.layers.bubbles).append(this.bubble);
}
const color=this.getChoroplethColor();
const bubbleSize=Number(this.getBubbleSize());
$$7(this.bubble)
.css("transform", "translate(-50%,-50%) translate(" + pos.x + "px," + pos.y + "px)")
.css("background-color", color)
.css("width", bubbleSize + "px")
.css("height", bubbleSize + "px")
.css("lineHeight", bubbleSize - 2 + "px");
}else{
delete this.bubble;
}}
}
adjustLabelScreenPosition(){
if(this.label){
if(!this.center){
this.center=this.getCenterSVG();
}
const pos=this.mapsvg.converter.convertSVGToPixel(this.center), x=pos.x - this.label.offsetWidth / 2, y=pos.y - this.label.offsetHeight / 2;
this.setLabelScreenPosition(x, y);
}}
adjustBubbleScreenPosition(){
if(this.bubble){
if(!this.center){
this.center=this.getCenterSVG();
}
const pos=this.mapsvg.converter.convertSVGToPixel(this.center), x=pos.x - this.bubble.offsetWidth / 2, y=pos.y - this.bubble.offsetHeight / 2;
this.setBubbleScreenPosition(x, y);
}}
moveLabelScreenPositionBy(deltaX, deltaY){
if(this.label){
const labelStyle=window.getComputedStyle(this.label), matrix=labelStyle.transform||labelStyle.webkitTransform, matrixValues=matrix.match(/matrix.*\((.+)\)/)[1].split(", "), x=parseFloat(matrixValues[4]) - deltaX, y=parseFloat(matrixValues[5]) - deltaY;
this.setLabelScreenPosition(x, y);
}}
moveBubbleScreenPositionBy(deltaX, deltaY){
if(this.bubble){
const labelStyle=window.getComputedStyle(this.bubble), matrix=labelStyle.transform||labelStyle.webkitTransform, matrixValues=matrix.match(/matrix.*\((.+)\)/)[1].split(", "), x=parseFloat(matrixValues[4]) - deltaX, y=parseFloat(matrixValues[5]) - deltaY;
this.setBubbleScreenPosition(x, y);
}}
setLabelScreenPosition(x, y){
if(this.label){
this.label.style.transform="translate(" + x + "px," + y + "px)";
}}
setBubbleScreenPosition(x, y){
if(this.bubble){
this.bubble.style.transform="translate(" + x + "px," + y + "px)";
}}
}
class SchemaRepository extends Repository {
constructor(){
const objectName="schema";
super(objectName, +objectName + "s");
this.className="Schema";
this.objectNameSingle=objectName;
this.objectNameMany=objectName + "s";
this.path=objectName + "s/";
this.events=new Events(this);
}
create(schema){
const defer=jQuery.Deferred();
defer.promise();
const data={};
data[this.objectNameSingle]=this.encodeData(schema);
this.server
.post(this.path, data)
.done((response)=> {
const data=this.decodeData(response);
schema.id=data[this.objectNameSingle].id;
this.objects.push(schema);
this.events.trigger("created");
schema.events.trigger("created");
defer.resolve(schema);
})
.fail(()=> {
defer.reject();
});
return defer;
}
update(schema){
const defer=jQuery.Deferred();
defer.promise();
const data={};
data[this.objectNameSingle]=this.encodeData(schema);
this.server
.put(this.path + schema.id, data)
.done((response)=> {
const data=this.decodeData(response);
this.objects.push(schema);
defer.resolve(schema);
this.events.trigger("changed");
schema.events.trigger("changed");
})
.fail(()=> {
defer.reject();
});
return defer;
}
encodeData(schema){
const _schema=schema.getData();
let fieldsJsonString=JSON.stringify(_schema);
fieldsJsonString=fieldsJsonString.replace(/select/g, "!mapsvg-encoded-slct");
fieldsJsonString=fieldsJsonString.replace(/table/g, "!mapsvg-encoded-tbl");
fieldsJsonString=fieldsJsonString.replace(/database/g, "!mapsvg-encoded-db");
fieldsJsonString=fieldsJsonString.replace(/varchar/g, "!mapsvg-encoded-vc");
fieldsJsonString=fieldsJsonString.replace(/int\(11\)/g, "!mapsvg-encoded-int");
const back=JSON.parse(fieldsJsonString);
back.fields=JSON.stringify(_schema.fields);
return back;
}}
const $$8=jQuery;
class Controller {
constructor(options){
this.containers={
main: options.container,
};
this.mapsvg=options.mapsvg;
this.template=options.template||"";
this.scrollable=options.scrollable===undefined ? true:options.scrollable;
this.withToolbar=options.withToolbar===undefined ? true:options.withToolbar;
this.autoresize=MapSVG.parseBoolean(options.autoresize);
this.templates={
toolbar: Handlebars.compile(this.getToolbarTemplate()),
main: Handlebars.compile(this.getMainTemplate()),
};
this.data=options.data;
this.width=options.width;
this.color=options.color;
this.events=new Events(this);
if(options.events){
for (const eventName in options.events){
if(typeof options.events[eventName]==="function"){
this.events.on(eventName, options.events[eventName]);
}}
}}
viewDidLoad(){
const _this=this;
_this.updateScroll();
if(this.autoresize){
_this.adjustHeight();
this.resizeSensor.setScroll();
}}
_viewDidLoad(){
this.updateScroll();
}
viewDidAppear(){ }
viewDidDisappear(){ }
updateScroll(){
if(!this.scrollable)
return;
const _this=this;
$$8(this.containers.contentWrap).nanoScroller({
preventPageScrolling: true,
});
setTimeout(function (){
$$8(_this.containers.contentWrap).nanoScroller({
preventPageScrolling: true,
});
}, 300);
}
adjustHeight(){
const _this=this;
$$8(_this.containers.main).height($$8(_this.containers.main).find(".mapsvg-auto-height").outerHeight() +
(_this.containers.toolbar ? $$8(_this.containers.toolbar).outerHeight():0));
}
_init(){
const _this=this;
_this.render();
_this.init();
}
init(){ }
getToolbarTemplate(){
return "";
}
setMainTemplate(template){
return (this.templates.main=Handlebars.compile(template));
}
getMainTemplate(){
return this.template;
}
render(){
const _this=this;
this.containers.view=$$8("<div />")
.attr("id", "mapsvg-controller-" + this.name)
.addClass("mapsvg-controller-view")[0];
this.containers.contentWrap=$$8("<div />").addClass("mapsvg-controller-view-wrap")[0];
this.containers.contentWrap2=$$8("<div />")[0];
this.containers.sizer=$$8("<div />").addClass("mapsvg-auto-height")[0];
this.containers.contentView=$$8("<div />").addClass("mapsvg-controller-view-content")[0];
this.containers.sizer.appendChild(this.containers.contentView);
if(this.scrollable){
$$8(this.containers.contentWrap).addClass("nano");
$$8(this.containers.contentWrap2).addClass("nano-content");
}
this.containers.contentWrap.appendChild(this.containers.contentWrap2);
this.containers.contentWrap2.appendChild(this.containers.sizer);
if(this.withToolbar&&this.templates.toolbar){
this.containers.toolbar=$$8("<div />").addClass("mapsvg-controller-view-toolbar")[0];
this.containers.view.appendChild(this.containers.toolbar);
}
this.containers.view.append(this.containers.contentWrap);
this.containers.main.appendChild(this.containers.view);
$$8(this.containers.main).data("controller", this);
if(this.width)
this.containers.view.style.width=this.width;
if(this.color)
this.containers.view.style["background-color"]=this.color;
_this.viewReadyToFill();
this.redraw();
setTimeout(function (){
_this._viewDidLoad();
_this.viewDidLoad();
_this.setEventHandlersCommon();
_this.setEventHandlers();
}, 1);
}
viewReadyToFill(){
const _this=this;
if(_this.autoresize){
_this.resizeSensor=new ResizeSensor(this.containers.sizer, ()=> {
_this.adjustHeight();
_this.updateScroll();
_this.events.trigger("resize", this, [this]);
});
}}
redraw(data){
if(data!==undefined){
this.data=data;
}
try {
$$8(this.containers.contentView).html(this.templates.main(this.data));
}
catch (err){
console.error(err);
$$8(this.containers.contentView).html("");
}
if(this.withToolbar&&this.templates.toolbar)
$$8(this.containers.toolbar).html(this.templates.toolbar(this.data));
this.updateTopShift();
if(this.noPadding)
this.containers.contentView.style.padding="0";
this.updateScroll();
}
updateTopShift(){
const _this=this;
if(!this.withToolbar)
return;
$$8(_this.containers.contentWrap).css({
top: $$8(_this.containers.toolbar).outerHeight(true) + "px",
});
setTimeout(function (){
$$8(_this.containers.contentWrap).css({
top: $$8(_this.containers.toolbar).outerHeight(true) + "px",
});
}, 100);
setTimeout(function (){
$$8(_this.containers.contentWrap).css({
top: $$8(_this.containers.toolbar).outerHeight(true) + "px",
});
}, 200);
setTimeout(function (){
$$8(_this.containers.contentWrap).css({
top: $$8(_this.containers.toolbar).outerHeight(true) + "px",
});
_this.updateScroll();
}, 500);
}
setEventHandlersCommon(){ }
setEventHandlers(){ }
destroy(){
delete this.resizeSensor;
$$8(this.containers.view).empty().remove();
}}
const $$9=jQuery;
class DirectoryController extends Controller {
constructor(options){
super(options);
this.repository=options.repository;
this.noPadding=true;
this.position=options.position;
this.search=options.search;
}
getToolbarTemplate(){
let t='<div class="mapsvg-directory-search-wrap">';
t +='<div class="mapsvg-directory-filter-wrap filter-wrap"></div>';
t +="</div>";
t +="</div>";
return t;
}
viewDidLoad(){
const _this=this;
this.menuBtn=$$9('<div class="mapsvg-button-menu"><i class="mapsvg-icon-menu"></i> ' +
this.mapsvg.options.mobileView.labelList +
"</div>")[0];
this.mapBtn=$$9('<div class="mapsvg-button-map"><i class="mapsvg-icon-map"></i> ' +
this.mapsvg.options.mobileView.labelMap +
"</div>")[0];
if(MapSVG.isPhone&&_this.mapsvg.options.menu.hideOnMobile){
if(this.mapsvg.options.menu.showFirst=="map"){
this.toggle(false);
}else{
this.toggle(true);
}}
this.mobileButtons=$$9('<div class="mapsvg-mobile-buttons"></div>')[0];
this.mobileButtons.append(this.menuBtn, this.mapBtn);
if(this.mapsvg.options.menu.on!==false){
this.mapsvg.containers.wrapAll.appendChild(this.mobileButtons);
}
this.events.trigger("shown", this.containers.view);
}
setEventHandlers(){
const _this=this;
$$9(window).on("resize", function (){
_this.updateTopShift();
});
$$9(this.menuBtn).on("click", function (){
_this.toggle(true);
});
$$9(this.mapBtn).on("click", function (){
_this.toggle(false);
_this.mapsvg.redraw();
});
$$9(this.containers.view)
.on("click.menu.mapsvg", ".mapsvg-directory-item", function (e){
if(e.target.nodeName=="A"){
return;
}
const objID=$$9(this).data("object-id");
let regions;
let marker;
let detailsViewObject;
let eventObject;
_this.deselectItems();
_this.selectItems(objID, false);
if(MapSVG.isPhone&&_this.mapsvg.options.menu.showMapOnClick){
_this.toggle(false);
}
if(_this.mapsvg.options.menu.source=="regions"){
regions=[_this.mapsvg.getRegion(objID)];
eventObject=regions[0];
detailsViewObject=regions[0];
}else{
detailsViewObject=_this.repository.getLoadedObject(objID);
eventObject=detailsViewObject;
const _regions=detailsViewObject.getRegions(_this.mapsvg.regionsRepository.schema.name);
if(_regions){
regions=_regions
.map(function (region){
return _this.mapsvg.getRegion(region.id);
})
.filter(function (r){
return r!==undefined;
});
}}
if(detailsViewObject.location&&detailsViewObject.location.marker)
marker=detailsViewObject.location.marker;
if(_this.mapsvg.options.actions.directoryItem.click.showDetails){
_this.mapsvg.loadDetailsView(detailsViewObject);
}
if(regions&&regions.length > 0){
if(_this.mapsvg.options.actions.directoryItem.click.zoom){
_this.mapsvg.zoomTo(regions, _this.mapsvg.options.actions.directoryItem.click.zoomToLevel);
}
if(regions.length > 1){
_this.mapsvg.setMultiSelect(true);
}
regions.forEach(function (region){
const center=region.getCenter();
e.clientX=center[0];
e.clientY=center[1];
if(_this.mapsvg.options.actions.directoryItem.click.selectRegion){
_this.mapsvg.selectRegion(region, true);
}
if(_this.mapsvg.options.actions.directoryItem.click.showRegionPopover){
if(_this.mapsvg.options.actions.directoryItem.click.zoom){
setTimeout(function (){
_this.mapsvg.showPopover(region);
}, 500);
}else{
_this.mapsvg.showPopover(region);
}}
if(_this.mapsvg.options.actions.directoryItem.click.fireRegionOnClick){
_this.mapsvg.events.trigger("click.region", region, [region]);
}});
if(regions.length > 1){
_this.mapsvg.setMultiSelect(false, false);
}}
if(marker){
if(_this.mapsvg.options.actions.directoryItem.click.zoomToMarker){
_this.mapsvg.zoomTo(marker, _this.mapsvg.options.actions.directoryItem.click.zoomToMarkerLevel);
}
if(_this.mapsvg.options.actions.directoryItem.click.showMarkerPopover){
if(_this.mapsvg.options.actions.directoryItem.click.zoomToMarker){
setTimeout(function (){
_this.mapsvg.showPopover(detailsViewObject);
}, 500);
}else{
_this.mapsvg.showPopover(detailsViewObject);
}}
if(_this.mapsvg.options.actions.directoryItem.click.fireMarkerOnClick){
_this.mapsvg.events.trigger("click.marker", marker, [e, _this.mapsvg]);
}
_this.mapsvg.selectMarker(marker);
}
_this.events.trigger("click", this, [e, eventObject, _this.mapsvg]);
const actions=_this.mapsvg.options.actions;
if(actions.directoryItem.click.goToLink){
const linkParts=actions.directoryItem.click.linkField.split(".");
let url;
if(linkParts.length > 1){
const obj=linkParts.shift();
const attr="." + linkParts.join(".");
if(obj=="Region"){
if(regions[0]&&regions[0].data)
url=eval("regions[0].data" + attr);
}else{
if(detailsViewObject)
url=eval("detailsViewObject" + attr);
}
if(url){
if(actions.directoryItem.click.newTab){
const win=window.open(url, "_blank");
win.focus();
}else{
window.location.href=url;
}}
}}
if(actions.directoryItem.click.showAnotherMap){
if(_this.mapsvg.editMode){
alert('"Show another map" action is disabled in the preview');
return true;
}
const linkParts2=actions.directoryItem.click.showAnotherMapField.split(".");
if(linkParts2.length > 1){
const obj2=linkParts2.shift();
const attr2="." + linkParts2.join(".");
let map_id;
if(obj2=="Region"){
if(regions[0]&&regions[0].data)
map_id=eval("regions[0].data" + attr2);
}else{
if(detailsViewObject)
map_id=eval("detailsViewObject" + attr2);
}
if(map_id){
const container=actions.directoryItem.click.showAnotherMapContainerId
? $$9("#" + actions.directoryItem.click.showAnotherMapContainerId)[0]
: $$9(_this.mapsvg.containers.map)[0];
_this.mapsvg.loadMap(map_id, container);
}}
}})
.on("mouseover.menu.mapsvg", ".mapsvg-directory-item", function (e){
const objID=$$9(this).data("object-id");
let regions;
let detailsViewObject;
let eventObject;
let marker;
if(_this.mapsvg.options.menu.source=="regions"){
regions=[_this.mapsvg.getRegion(objID)];
eventObject=regions[0];
detailsViewObject=regions[0];
}else{
detailsViewObject=_this.repository.getLoadedObject(objID);
eventObject=detailsViewObject;
const _regions=detailsViewObject.getRegions(_this.mapsvg.regionsRepository.schema.name);
if(_regions){
regions=_regions.map(function (region){
return _this.mapsvg.getRegion(region.id);
});
}
if(detailsViewObject.location){
marker=detailsViewObject.location.marker;
}}
if(regions&&regions.length){
_this.mapsvg.highlightRegions(regions);
}
if(marker){
_this.mapsvg.highlightMarker(marker);
if(_this.mapsvg.options.actions.directoryItem.hover.centerOnMarker){
_this.mapsvg.centerOn(marker);
}}
_this.events.trigger("mouseover", $$9(this), [e, eventObject, _this.mapsvg]);
})
.on("mouseout.menu.mapsvg", ".mapsvg-directory-item", function (e){
const objID=$$9(this).data("object-id");
let regions;
let detailsViewObject;
let eventObject;
let marker;
if(_this.mapsvg.options.menu.source=="regions"){
regions=[_this.mapsvg.getRegion(objID)];
eventObject=regions[0];
detailsViewObject=regions[0];
}else{
detailsViewObject=_this.repository.getLoadedObject(objID);
eventObject=detailsViewObject;
const _regions=detailsViewObject.getRegions(_this.mapsvg.regionsRepository.schema.name);
if(_regions){
regions=_regions.map(function (region){
return _this.mapsvg.getRegion(region.id);
});
}
if(detailsViewObject.location){
marker=detailsViewObject.location.marker;
}}
if(regions&&regions.length){
_this.mapsvg.unhighlightRegions();
}
if(marker){
_this.mapsvg.unhighlightMarker();
}
_this.events.trigger("mouseout", $$9(this), [e, eventObject, _this.mapsvg]);
});
$$9(this.containers.contentView).on("click", ".mapsvg-category-item", function (){
const panel=$$9(this).next(".mapsvg-category-block");
if(panel[0].style.maxHeight||panel.hasClass("active")){
panel[0].style.maxHeight=null;
}else{
panel[0].style.maxHeight=panel[0].scrollHeight + "px";
}
if($$9(this).hasClass("active")){
$$9(this).toggleClass("active", false);
$$9(this).next(".mapsvg-category-block").addClass("collapsed").removeClass("active");
}else{
if(_this.mapsvg.options.menu.categories.collapseOther){
$$9(this).parent().find(".mapsvg-category-item.active").removeClass("active");
$$9(this)
.parent()
.find(".mapsvg-category-block.active")
.removeClass("active")
.addClass("collapsed");
}
$$9(this).toggleClass("active", true);
$$9(this).next(".mapsvg-category-block").removeClass("collapsed").addClass("active");
}
const panels=$$9(".mapsvg-category-block.collapsed");
panels.each(function (i, panel){
panel.style.maxHeight=null;
});
});
}
highlightItems(ids){
const _this=this;
if(typeof ids!="object")
ids=[ids];
ids.forEach(function (id){
$$9(_this.containers.view)
.find("#mapsvg-directory-item-" + _this.convertId(id))
.addClass("hover");
});
}
unhighlightItems(){
$$9(this.containers.view).find(".mapsvg-directory-item").removeClass("hover");
}
selectItems(ids, scrollTo=true){
if(typeof ids!="object")
ids=[ids];
ids.forEach((id)=> {
$$9(this.containers.view)
.find("#mapsvg-directory-item-" + this.convertId(id))
.addClass("selected");
});
if(scrollTo&&$$9("#mapsvg-directory-item-" + ids[0]).length > 0){
this.scrollable &&
$$9(this.containers.contentWrap).nanoScroller({
scrollTo: $$9(this.containers.view).find("#mapsvg-directory-item-" + this.convertId(ids[0])),
});
}}
deselectItems(){
$$9(this.containers.view).find(".mapsvg-directory-item").removeClass("selected");
}
removeItems(ids){
$$9(this.containers.view)
.find("#mapsvg-directory-item-" + this.convertId(ids))
.remove();
}
filterOut(items){
const _this=this;
if(this.repository.path.indexOf("regions")!==-1){
let f;
f={
field: "",
val: "",
};
if(_this.mapsvg.options.menu.filterout.field){
f.field=_this.mapsvg.options.menu.filterout.field;
f.val=_this.mapsvg.options.menu.filterout.val;
}
items=items.filter(function (item){
let ok=true;
const status=_this.mapsvg.options.regionStatuses;
if(status[item.status]){
ok = !status[item.status].disabled;
}
if(ok&&f.field){
ok=item[f.field]!=f.val;
}
return ok;
});
}
return items;
}
loadItemsToDirectory(){
let items=[];
const _this=this;
if(!_this.repository.loaded)
return false;
if(_this.mapsvg.options.menu.categories &&
_this.mapsvg.options.menu.categories.on &&
_this.mapsvg.options.menu.categories.groupBy){
const categoryField=_this.mapsvg.options.menu.categories.groupBy;
if(_this.repository.getSchema().getField(categoryField)===undefined ||
_this.repository.getSchema().getField(categoryField).options===undefined){
return false;
}
const categories=_this.repository.getSchema().getField(categoryField).options;
categories.forEach(function (category){
let dbItems=_this.repository.getLoaded();
dbItems=_this.filterOut(dbItems);
const itemArr=[];
dbItems.forEach((item)=> {
itemArr.push(item);
});
const catItems=itemArr.filter(function (object){
if(categoryField==="regions"){
const objectRegions=typeof object[categoryField]!=="undefined" &&
object[categoryField].length
? object[categoryField]
: [];
const objectRegionIDs=objectRegions.map(function (region){
return region.id;
});
return objectRegionIDs.indexOf(category.id)!==-1;
}else{
return object[categoryField]==category.value;
}});
category.counter=catItems.length;
if(categoryField==="regions"){
category.label=category.title;
category.value=category.id;
}
catItems.sort(function (a, b){
const field=_this.mapsvg.options.menu.sortBy;
return a[field]==b[field]
? 0
: (_this.mapsvg.options.menu.sortDirection==="asc"
? +(a[field] > [field])
: +(a[field] < [field]))||-1;
});
items.push({ category: category, items: catItems });
});
if(_this.mapsvg.options.menu.categories.hideEmpty){
items=items.filter(function (item){
return item.category.counter > 0;
});
}}else{
if(_this.mapsvg.options.menu.source==="regions"){
items=_this.repository.getLoaded().map((r)=> {
const data=r.getData();
data.objects=_this.mapsvg.getRegion(data.id).objects;
data.id_no_spaces=data.id.split(" ").join("_");
return data;
});
items=_this.filterOut(items);
}else{
items=_this.repository
.getLoaded()
.map((r)=> r.getData(_this.mapsvg.regionsRepository.schema.name));
}}
try {
$$9(this.containers.contentView).html(this.templates.main({ items: items }));
}
catch (err){
console.error('MapSVG: Error in the "Directory item" template');
console.error(err);
}
if(items.length===0){
$$9(this.containers.contentView).html('<div class="mapsvg-no-results">' +
this.mapsvg.options.menu.noResultsText +
"</div>");
}
if(_this.mapsvg.options.menu.categories.on){
if(_this.mapsvg.options.menu.categories.collapse&&items.length > 1){
$$9(this.containers.contentView).find(".mapsvg-category-block").addClass("collapsed");
}
else if(_this.mapsvg.options.menu.categories.collapse&&items.length===1){
$$9(this.containers.contentView).find(".mapsvg-category-item").addClass("active");
$$9(this.containers.contentView).find(".mapsvg-category-block").addClass("active");
const panel=$$9(this.containers.contentView).find(".mapsvg-category-block")[0];
if(panel)
panel.style.maxHeight=panel.scrollHeight + "px";
}
else if(!_this.mapsvg.options.menu.categories.collapse){
$$9(this.containers.contentView).find(".mapsvg-category-item").addClass("active");
$$9(this.containers.contentView).find(".mapsvg-category-block").addClass("active");
const panels=$$9(this.containers.contentView).find(".mapsvg-category-block");
if(panels.length)
panels.each(function (i, panel){
panel.style.maxHeight=panel.scrollHeight + "px";
});
}}
this.updateTopShift();
this.updateScroll();
}
toggle(on){
const _this=this;
if(on){
$$9(this.containers.main).parent().show();
$$9(_this.mapsvg.containers.mapContainer).hide();
$$9(this.menuBtn).addClass("active");
$$9(this.mapBtn).removeClass("active");
}else{
$$9(this.containers.main).parent().hide();
$$9(_this.mapsvg.containers.mapContainer).show();
$$9(this.menuBtn).removeClass("active");
$$9(this.mapBtn).addClass("active");
}
if(!$$9(this.containers.main).parent().is(":visible")){
if(MapSVG.isPhone){
$$9(_this.mapsvg.containers.wrap).css("height", "auto");
_this.updateScroll();
}}else{
if(MapSVG.isPhone &&
$$9(this.containers.main).height() < parseInt(this.mapsvg.options.menu.minHeight)){
$$9(_this.mapsvg.containers.wrap).css("height", parseInt(this.mapsvg.options.menu.minHeight) + "px");
_this.updateScroll();
}}
this.updateTopShift();
}
addPagination(pager){
$$9(this.containers.contentView).append('<div class="mapsvg-pagination-container"></div>');
$$9(this.containers.contentView).find(".mapsvg-pagination-container").html(pager);
}
convertId(id){
return (id + "")
.split(" ")
.join("_")
.replace(/(:|\(|\)|\.|\[|\]|,|=|@)/g, "\\$1");
}}
const $$a=jQuery;
class DetailsController extends Controller {
constructor(options){
super(options);
this.modal=options.modal;
}
getToolbarTemplate(){
if(this.withToolbar)
return '<div class="mapsvg-popover-close mapsvg-details-close"></div>';
else
return "";
}
viewDidLoad(){
const _this=this;
this.events.trigger("shown", _this, [_this]);
if(this.modal &&
MapSVG.isPhone &&
this.mapsvg.options.detailsView.mobileFullscreen &&
!this.mobileCloseBtn){
this.mobileCloseBtn=$$a('<button class="mapsvg-mobile-modal-close">' +
_this.mapsvg.options.mobileView.labelClose +
"</button>")[0];
this.containers.view.appendChild(this.mobileCloseBtn);
}}
setEventHandlers(){
const _this=this;
$$a(this.containers.toolbar).on("click touchend", ".mapsvg-popover-close", function (e){
e.stopPropagation();
_this.destroy();
_this.events.trigger("closed", _this, [_this]);
});
$$a(this.containers.view).on("click touchend", ".mapsvg-mobile-modal-close", function (e){
e.stopPropagation();
_this.destroy();
_this.events.trigger("closed", _this, [_this]);
});
}}
const $$b=jQuery;
class FormElement {
constructor(options, formBuilder, external){
this.readonly=typeof options.readonly!=="undefined" ? options.readonly:false;
this.protected=typeof options.protected!=="undefined" ? options.protected:false;
this.auto_increment =
typeof options.auto_increment!=="undefined" ? options.auto_increment:false;
this.not_null=typeof options.not_null!=="undefined" ? options.not_null:false;
this.searchable=typeof options.searchable!=="undefined" ? options.searchable:false;
this.visible=typeof options.visible!=="undefined" ? options.visible:true;
this.formBuilder=formBuilder;
this.events=new Events(this);
this.type=options.type;
this.value=options.value;
this.db_type=options.db_type||"varchar(255)";
this.label=this.label||(options.label===undefined ? "Label":options.label);
this.name=this.name||options.name||"label";
this.help=options.help||"";
this.placeholder=options.placeholder;
this.setExternal(external);
let t=this.type;
if(t==="marker"&&this.mapIsGeo){
t="marker-geo";
}
if(t==="location"&&this.mapIsGeo){
t="location-geo";
}
if(this.filtersMode){
this.parameterName=options.parameterName||"";
this.parameterNameShort=this.parameterName.split(".")[1];
this.name=this.parameterNameShort;
this.placeholder=options.placeholder||"";
this.templates={
main: Handlebars.compile($$b("#mapsvg-filters-tmpl-" + t + "-view").html()),
};}else{
this.templates={
main: Handlebars.compile($$b("#mapsvg-data-tmpl-" + t + "-view").html()),
};}
this.inputs={};}
init(){
this.setDomElements();
this.setEventHandlers();
}
setDomElements(){
this.domElements={
main: $$b(this.templates.main(this.getDataForTemplate()))[0],
};
$$b(this.domElements.main).data("formElement", this);
this.addSelect2();
}
setEventHandlers(){
const _this=this;
if(this.formBuilder.editMode){
$$b(this.domElements.main).on("click", function (){
_this.events.trigger("click", _this, [_this]);
});
}}
addSelect2(){
if($$b().mselect2){
$$b(this.domElements.main)
.find("select")
.css({ width: "100%", display: "block" })
.mselect2()
.on("select2:focus", function (){
$$b(this).mselect2("open");
});
$$b(this.domElements.main)
.find(".select2-selection--multiple .select2-search__field")
.css("width", "100%");
}}
setEditorEventHandlers(){
const _this=this;
$$b(this.domElements.edit).on("click", "button.mapsvg-remove", function (){
$$b(_this.domElements.main).empty().remove();
$$b(_this.domElements.edit).empty().remove();
_this.events.trigger("delete", _this, [_this]);
});
$$b(this.domElements.edit).on("click", ".mapsvg-filter-insert-options", function (){
const objType=_this.parameterName.split(".")[0];
const fieldName=_this.parameterName.split(".")[1];
let field;
if(objType=="Object"){
field=_this.formBuilder.mapsvg.objectsRepository.getSchema().getField(fieldName);
}else{
if(fieldName=="id"){
const options=[];
_this.formBuilder.mapsvg.regions.forEach(function (r){
options.push({ label: r.id, value: r.id });
});
field={
options: options,
};}
else if(fieldName==="title"){
const options=[];
_this.formBuilder.mapsvg.regions.forEach(function (r){
options.push({ label: r.title, value: r.title });
});
field={ options: options };}else{
field=_this.formBuilder.mapsvg.regionsRepository
.getSchema()
.getField(fieldName);
}}
if((field&&field.options)||fieldName==="regions"){
let options;
if(fieldName=="regions"){
const _options=_this.formBuilder.mapsvg.regions.map((r)=> {
return { id: r.id, title: r.title };});
_options.sort(function (a, b){
if(a.title < b.title)
return -1;
if(a.title > b.title)
return 1;
return 0;
});
options=_options.map(function (o){
return (o.title||o.id) + ":" + o.id;
});
}else{
options=field.options.map(function (o){
return o.label + ":" + o.value;
});
}
$$b(this)
.closest(".form-group")
.find("textarea")
.val(options.join("\n"))
.trigger("change");
}});
$$b(this.domElements.edit).on("keyup change paste", "input, textarea, select", function (){
const prop=$$b(this).attr("name");
const array=$$b(this).data("array");
if(_this.type==="status"&&array){
const param=$$b(this).data("param");
const index=$$b(this).closest("tr").index();
_this.options[index]=_this.options[index]||{
label: "",
value: "",
color: "",
disabled: false,
};
_this.options[index][param]=$$b(this).is(":checkbox")
? $$b(this).prop("checked")
: $$b(this).val();
_this.redraw();
}
else if(_this.type==="distance"&&array){
const param=$$b(this).data("param");
const index=$$b(this).closest("tr").index();
if(!_this.options[index]){
_this.options[index]={ value: "", default: false };}
if(param==="default"){
_this.options.forEach(function (option){
option.default=false;
});
_this.options[index].default=$$b(this).prop("checked");
}else{
_this.options[index].value=$$b(this).val();
}
_this.redraw();
}
else if(prop=="label"||prop=="name"){
return false;
}else{
let value;
value =
$$b(this).attr("type")=="checkbox" ? $$b(this).prop("checked"):$$b(this).val();
if($$b(this).attr("type")=="radio"){
const name=$$b(this).attr("name");
value=$$b('input[name="' + name + '"]:checked').val();
}
_this.update(prop, value);
}});
$$b(this.domElements.edit).on("keyup change paste", 'input[name="label"]', function (){
if(!_this.nameChanged){
_this.label=$$b(this).val() + "";
if(_this.type!="region"&&_this.type!="location"&&_this.type!="title"){
let str=$$b(this).val() + "";
str=str.toLowerCase().replace(/ /g, "_").replace(/\W/g, "");
if(str.length < 64){
$$b(_this.domElements.edit).find('input[name="name"]').val(str);
}
_this.name=str + "";
}
$$b(_this.domElements.main).find("label").first().html(_this.label);
if(!_this.filtersMode){
$$b(_this.domElements.main)
.find("label")
.first()
.append('<div class="field-name">' + _this.name + "</div>");
}}
});
$$b(this.domElements.edit).on("keyup change paste", 'input[name="name"]', function (e){
if(e.target.value){
if(e.target.value.match(/[^a-zA-Z0-9_]/g)){
e.target.value=e.target.value.replace(/[^a-zA-Z0-9_]/g, "");
$$b(e.target).trigger("change");
}
if(e.target.value[0].match(/[^a-zA-Z_]/g)){
e.target.value =
e.target.value[0].replace(/[^a-zA-Z_]/g, "") + e.target.value.slice(1);
$$b(e.target).trigger("change");
}}
if(_this.type!="region")
_this.name=e.target.value;
$$b(_this.domElements.main)
.find("label")
.html(_this.label + '<div class="field-name">' + _this.name + "</div>");
_this.nameChanged=true;
});
$$b(this.domElements.edit).on("keyup change paste", 'textarea[name="help"]', function (e){
$$b(_this.domElements.main).find(".form-text").text(e.target.value);
});
}
getEditor(){
if(!this.filtersMode){
this.templates.edit =
this.templates.edit ||
Handlebars.compile($$b("#mapsvg-data-tmpl-" + this.type + "-control").html());
}else{
this.templates.edit =
this.templates.edit ||
Handlebars.compile($$b("#mapsvg-filters-tmpl-" + this.type + "-control").html());
}
this.domElements.edit=$$b("<div>" + this.templates.edit(this.getDataForTemplate()) + "</div>")[0];
return this.domElements.edit;
}
destroyEditor(){
$$b(this.domElements.edit).empty().remove();
}
initEditor(){
$$b(this.domElements.edit).find("input").first().select();
if($$b().colorpicker){
$$b(this.domElements.edit)
.find(".cpicker")
.colorpicker()
.on("changeColor.colorpicker", function (event){
const input=$$b(this).find("input");
if(input.val()=="")
$$b(this).find("i").css({ "background-color": "" });
});
}
if($$b().mselect2){
if(this.type!=="distance"){
$$b(this.domElements.edit)
.find("select")
.css({ width: "100%", display: "block" })
.mselect2();
}}
this.setEditorEventHandlers();
}
getSchema(){
let data;
data={
type: this.type,
db_type: this.db_type,
label: this.label,
name: this.name,
value: this.value,
searchable: this.searchable,
help: this.help,
visible: this.visible===undefined ? true:this.visible,
readonly: this.readonly,
placeholder: this.placeholder,
protected: this.protected,
auto_increment: this.auto_increment,
not_null: this.not_null,
};
if(this.options){
data.options=this.getSchemaFieldOptionsList();
}
if(this.filtersMode){
data.parameterName=this.parameterName;
data.parameterNameShort=this.parameterName.split(".")[1];
}
return data;
}
getSchemaFieldOptionsList(){
const options=[];
this.options.forEach((option, index)=> {
if(this.options[index].value!==""){
options.push(this.options[index]);
}});
return options;
}
getDataForTemplate(){
const data=this.getSchema();
data._name=data.name;
if(this.namespace){
data.name=this.name.split("[")[0];
let suffix=this.name.split("[")[1]||"";
if(suffix)
suffix="[" + suffix;
data.name=this.namespace + "[" + data.name + "]" + suffix;
}
data.external=this.external;
return data;
}
update(prop, value){
const _this=this;
if(prop=="options"){
const options=[];
value=value.split("\n").forEach(function (row){
row=row.trim().split(":");
if(_this.type=="checkbox"&&row.length==3){
options.push({
label: row[0],
name: row[1],
value: row[2],
});
}
else if((_this.type=="radio" ||
_this.type=="select" ||
_this.type=="checkboxes") &&
row.length==2){
options.push({
label: row[0],
value: row[1],
});
}});
this.options=options;
}else{
this[prop]=value;
}
if(prop=="parameterName"){
$$b(this.domElements.edit).find(".mapsvg-filter-param-name").text(value);
}}
redraw(){
const newView=$$b(this.templates.main(this.getDataForTemplate()));
$$b(this.domElements.main).html(newView.html());
if($$b().mselect2){
if(this.type!=="distance"){
$$b(this.domElements.main)
.find("select")
.css({ width: "100%", display: "block" })
.mselect2()
.on("select2:focus", function (){
$$b(this).mselect2("open");
});
}else{
$$b(this.domElements.main)
.find("select")
.mselect2()
.on("select2:focus", function (){
$$b(this).mselect2("open");
});
}}
}
redrawEditor(){
if(this.domElements.edit){
$$b(this.domElements.edit).empty();
$$b(this.domElements.edit).html("<div>" + this.templates.edit(this.getDataForTemplate()) + "</div>");
this.initEditor();
}}
setOptions(options){
if(options){
this.options=[];
this.optionsDict={};
options.forEach((value, key)=> {
this.options.push(value);
this.optionsDict[key]=value;
});
return this.options;
}else{
return this.setOptions([
{ label: "Option one", name: "option_one", value: 1 },
{ label: "Option two", name: "option_two", value: 2 },
]);
}}
getData(){
return { name: this.name, value: this.getValue() };}
destroy(){
if($$b().mselect2){
const sel=$$b(this.domElements.main).find(".mapsvg-select2");
if(sel.length){
sel.mselect2("destroy");
}}
}
show(){
$$b(this.domElements.main).show();
}
hide(){
$$b(this.domElements.main).hide();
}
setExternal(params){
this.external=params;
if(typeof this.external.mapIsGeo!=="undefined"){
this.mapIsGeo=this.external.mapIsGeo;
}
if(typeof this.external.editMode!=="undefined"){
this.editMode=this.external.editMode;
}
if(typeof this.external.filtersMode!=="undefined"){
this.filtersMode=this.external.filtersMode;
}
if(typeof this.external.namespace!=="undefined"){
this.namespace=this.external.namespace;
}}
getValue(){
return this.value;
}
setValue(value, updateInput=true){
this.value=value;
if(updateInput){
this.setInputValue(value);
}}
setInputValue(value){
return;
}
triggerChanged(){
this.events.trigger("changed", this, [this]);
}}
const $$c=jQuery;
class CheckboxFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
if(typeof options.showAsSwitch==="undefined"){
this.showAsSwitch=true;
}else{
this.showAsSwitch=options.showAsSwitch;
}
this.db_type="tinyint(1)";
this.checkboxLabel=options.checkboxLabel;
this.checkboxValue=options.checkboxValue;
}
setDomElements(){
super.setDomElements();
this.inputs.checkbox=$$c(this.domElements.main).find("input")[0];
this.inputs.switch=$$c(this.domElements.main).find("input")[0];
}
setEventHandlers(){
super.setEventHandlers();
$$c(this.inputs.checkbox).on("change", (e)=> {
this.setValue(e.target.checked, false);
this.triggerChanged();
});
}
setEditorEventHandlers(){
super.setEditorEventHandlers();
$$c(this.domElements.edit).on("change", "[name='showAsSwitch']", (e)=> {
if(this.showAsSwitch){
$$c(this.domElements.main)
.find("[name='checkboxToSwitch']")
.addClass("form-switch form-switch-md");
}
if(!this.showAsSwitch){
$$c(this.domElements.main)
.find("[name='checkboxToSwitch']")
.removeClass("form-switch form-switch-md");
}});
$$c(this.domElements.edit).on("keyup change paste", '[name="checkboxLabel"]', (e)=> {
$$c(this.domElements.main).find(".form-check-label").text(e.target.value);
});
}
getSchema(){
const schema=super.getSchema();
if(this.checkboxLabel){
schema.checkboxLabel=this.checkboxLabel;
}
if(this.checkboxValue){
schema.checkboxValue=this.checkboxValue;
}
schema.showAsSwitch=this.showAsSwitch;
return schema;
}
setInputValue(value){
this.inputs.checkbox.checked=value===true;
}}
const $$d=jQuery;
class CheckboxesFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.db_type="text";
this.checkboxLabel=options.checkboxLabel;
this.setOptions(options.options);
}
setDomElements(){
super.setDomElements();
this.$checkboxes=$$d(this.domElements.main).find('input[type="checkbox"]');
this.setInputValue(this.value||[]);
}
setEventHandlers(){
super.setEventHandlers();
this.$checkboxes.on("change", (e)=> {
const values=[];
$$d(this.domElements.main)
.find("input:checked")
.each((i, el)=> {
values.push(jQuery(el).attr("value"));
});
this.setValue(values, false);
this.triggerChanged();
});
}
setInputValue(values){
if(values===null){
$$d(this.domElements.main).find(`input`).prop("checked", false);
}else{
values.forEach((value)=> {
$$d(this.domElements.main).find(`input[value="${value}"]`).prop("checked", true);
});
}}
}
const $$e=jQuery;
class DateFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
if(this.formBuilder.admin){
this.languages=[
"en-GB",
"ar",
"az",
"bg",
"bs",
"ca",
"cs",
"cy",
"da",
"de",
"el",
"es",
"et",
"eu",
"fa",
"fi",
"fo",
"fr",
"gl",
"he",
"hr",
"hu",
"hy",
"id",
"is",
"it",
"ja",
"ka",
"kh",
"kk",
"kr",
"lt",
"lv",
"mk",
"ms",
"nb",
"nl",
"nl-BE",
"no",
"pl",
"pt-BR",
"pt",
"ro",
"rs",
"rs-latin",
"ru",
"sk",
"sl",
"sq",
"sr",
"sr-latin",
"sv",
"sw",
"th",
"tr",
"uk",
"vi",
"zh-CN",
"zh-TW",
];
}
this.db_type="varchar(50)";
this.language=options.language;
}
setDomElements(){
super.setDomElements();
this.inputs.date=$$e(this.domElements.main).find("input")[0];
}
setEventHandlers(){
super.setEventHandlers();
$$e(this.inputs.date).on("change", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
getSchema(){
const schema=super.getSchema();
schema.language=this.language;
return schema;
}
getDataForTemplate(){
const data=super.getDataForTemplate();
if(this.formBuilder.admin)
data.languages=this.languages;
data.language=this.language;
return data;
}}
const $$f=jQuery;
class DistanceFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.name="distance";
this.label=this.label||(options.label===undefined ? "Search radius":options.label);
this.distanceControl=options.distanceControl||"select";
this.distanceUnits=options.distanceUnits||"km";
this.distanceUnitsLabel=options.distanceUnitsLabel||"km";
this.fromLabel=options.fromLabel||"from";
this.placeholder=options.placeholder;
this.userLocationButton=options.userLocationButton||false;
this.type=options.type;
this.addressField=options.addressField||true;
this.addressFieldPlaceholder=options.addressFieldPlaceholder||"Address";
this.languages=[
{ value: "sq", label: "Albanian" },
{ value: "ar", label: "Arabic" },
{
value: "eu",
label: "Basque",
},
{ value: "be", label: "Belarusian" },
{ value: "bg", label: "Bulgarian" },
{
value: "my",
label: "Burmese",
},
{ value: "bn", label: "Bengali" },
{ value: "ca", label: "Catalan" },
{
value: "zh-cn",
label: "Chinese (simplified)",
},
{ value: "zh-tw", label: "Chinese (traditional)" },
{
value: "hr",
label: "Croatian",
},
{ value: "cs", label: "Czech" },
{ value: "da", label: "Danish" },
{
value: "nl",
label: "Dutch",
},
{ value: "en", label: "English" },
{
value: "en-au",
label: "English (australian)",
},
{ value: "en-gb", label: "English (great Britain)" },
{
value: "fa",
label: "Farsi",
},
{ value: "fi", label: "Finnish" },
{ value: "fil", label: "Filipino" },
{
value: "fr",
label: "French",
},
{ value: "gl", label: "Galician" },
{ value: "de", label: "German" },
{
value: "el",
label: "Greek",
},
{ value: "gu", label: "Gujarati" },
{ value: "iw", label: "Hebrew" },
{
value: "hi",
label: "Hindi",
},
{ value: "hu", label: "Hungarian" },
{ value: "id", label: "Indonesian" },
{
value: "it",
label: "Italian",
},
{ value: "ja", label: "Japanese" },
{ value: "kn", label: "Kannada" },
{
value: "kk",
label: "Kazakh",
},
{ value: "ko", label: "Korean" },
{ value: "ky", label: "Kyrgyz" },
{
value: "lt",
label: "Lithuanian",
},
{ value: "lv", label: "Latvian" },
{ value: "mk", label: "Macedonian" },
{
value: "ml",
label: "Malayalam",
},
{ value: "mr", label: "Marathi" },
{ value: "no", label: "Norwegian" },
{
value: "pl",
label: "Polish",
},
{ value: "pt", label: "Portuguese" },
{
value: "pt-br",
label: "Portuguese (brazil)",
},
{ value: "pt-pt", label: "Portuguese (portugal)" },
{
value: "pa",
label: "Punjabi",
},
{ value: "ro", label: "Romanian" },
{ value: "ru", label: "Russian" },
{
value: "sr",
label: "Serbian",
},
{ value: "sk", label: "Slovak" },
{ value: "sl", label: "Slovenian" },
{
value: "es",
label: "Spanish",
},
{ value: "sv", label: "Swedish" },
{ value: "tl", label: "Tagalog" },
{
value: "ta",
label: "Tamil",
},
{ value: "te", label: "Telugu" },
{ value: "th", label: "Thai" },
{
value: "tr",
label: "Turkish",
},
{ value: "uk", label: "Ukrainian" },
{ value: "uz", label: "Uzbek" },
{
value: "vi",
label: "Vietnamese",
},
];
this.countries=MapSVG.countries;
this.country=options.country;
this.language=options.language;
this.searchByZip=options.searchByZip;
this.zipLength=parseInt(options.zipLength)||5;
this.userLocationButton=MapSVG.parseBoolean(options.userLocationButton);
this.options=options.options||[
{ value: "10", default: true },
{ value: "30", default: false },
{ value: "50", default: false },
{ value: "100", default: false },
];
let defOption;
if(this.value){
this.options.forEach((option)=> {
if(option.value===this.value.length){
defOption=option;
}});
}
if(!defOption){
defOption=this.options.find(function (option){
return option.default===true;
});
}
if(!defOption){
defOption=this.options[0];
}
const defLengthOption=this.options.find((opt)=> opt.selected===true);
this.defaultLength=defOption.value;
this.setDefaultValue();
}
setDefaultValue(){
this.value={
units: this.distanceUnits,
geoPoint: { lat: null, lng: null },
length: this.defaultLength,
address: "",
country: this.country,
};}
setDomElements(){
super.setDomElements();
this.inputs.units=($$f(this.domElements.main).find('[name="distanceUnits"]')[0]);
this.inputs.geoPoint=($$f(this.domElements.main).find('[name="distanceGeoPoint"]')[0]);
this.inputs.length=($$f(this.domElements.main).find('[name="distanceLength"]')[0]);
this.inputs.address=($$f(this.domElements.main).find('[name="distance"]')[0]);
}
getSchema(){
const schema=super.getSchema();
schema.distanceControl=this.distanceControl;
schema.distanceUnits=this.distanceUnits;
schema.distanceUnitsLabel=this.distanceUnitsLabel;
schema.fromLabel=this.fromLabel;
schema.addressField=this.addressField;
schema.addressFieldPlaceholder=this.addressFieldPlaceholder;
schema.userLocationButton=this.userLocationButton;
schema.placeholder=this.placeholder;
schema.language=this.language;
schema.country=this.country;
schema.searchByZip=this.searchByZip;
schema.zipLength=parseInt(this.zipLength + "");
schema.userLocationButton=MapSVG.parseBoolean(this.userLocationButton);
if(schema.distanceControl==="none"){
schema.distanceDefault=schema.options.filter(function (o){
return o.default;
})[0].value;
}
schema.options.forEach(function (option, index){
if(schema.options[index].value===""){
schema.options.splice(index, 1);
}else{
schema.options[index].default=MapSVG.parseBoolean(schema.options[index].default);
}});
return schema;
}
getDataForTemplate(){
const data=super.getDataForTemplate();
if(this.formBuilder.admin){
data.languages=this.languages;
data.countries=this.countries;
}
data.language=this.language;
data.country=this.country;
data.searchByZip=this.searchByZip;
data.zipLength=this.zipLength;
data.userLocationButton=MapSVG.parseBoolean(this.userLocationButton);
return data;
}
destroy(){
if($$f().mselect2){
const sel=$$f(this.domElements.main).find(".mapsvg-select2");
if(sel.length){
sel.mselect2("destroy");
}}
}
initEditor(){
super.initEditor();
this.mayBeAddDistanceRow();
if($$f().mselect2){
$$f(this.domElements.edit).find("select").mselect2();
}}
setEventHandlers(){
super.setEventHandlers();
const _this=this;
$$f(this.domElements.edit).on("keyup change paste", ".mapsvg-edit-distance-row input", function (){
_this.mayBeAddDistanceRow();
});
const server=new Server();
const locations=new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace("formatted_address"),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: server.getUrl("geocoding") +
"?address=" +
(this.searchByZip===true ? "zip%20":"") +
"%QUERY%&language=" +
this.language +
(this.country ? "&country=" + this.country:""),
wildcard: "%QUERY%",
transform: function (response){
if(response.error_message){
alert(response.error_message);
}
return response.results;
},
rateLimitWait: 600,
},
});
const thContainer=$$f(this.domElements.main).find(".typeahead");
this.spinner=$$f("<span class='spinner-border spinner-border-sm'></span>")[0];
if(this.searchByZip){
$$f(this.domElements.main).find(".mapsvg-distance-fields").addClass("search-by-zip");
thContainer.on("change keyup", (e)=> {
const zip=$$f(e.target).val().toString();
if(zip.length===_this.zipLength){
$$f(this.spinner).appendTo($$f(e.target).closest(".distance-search-wrap"));
this.formBuilder.setIsLoading(true);
locations.search($$f(e.target).val(), (data)=> this.handleAddressFieldChange(zip, data), (data)=> this.handleAddressFieldChange(zip, data, true));
}});
}else{
const tH=thContainer
.typeahead({ minLength: 3 }, {
name: "mapsvg-addresses",
display: "formatted_address",
limit: 5,
async: true,
source: (query, sync, async)=> {
const request={ address: query };
if(this.country){
request.componentRestrictions={ country: this.country };}
MapSVG.geocode(request, async);
},
})
.on("typeahead:asyncrequest", (e)=> {
$$f(this.spinner).appendTo($$f(e.target).closest(".twitter-typeahead"));
this.formBuilder.setIsLoading(true);
})
.on("typeahead:asynccancel typeahead:asyncreceive", (e)=> {
$$f(this.spinner).remove();
this.formBuilder.setIsLoading(false);
});
$$f(this.domElements.main).find(".mapsvg-distance-fields").removeClass("search-by-zip");
}
if(_this.userLocationButton){
const userLocationButton=$$f(this.domElements.main).find(".user-location-button");
userLocationButton.on("click", ()=> {
_this.formBuilder.mapsvg.showUserLocation((location)=> {
locations.search(location.geoPoint.lat + "," + location.geoPoint.lng, (data)=> this.setAddressByUserLocation(data, location), (data)=> this.setAddressByUserLocation(data, location));
this.setValue({ geoPoint: location.geoPoint });
this.triggerChanged();
});
});
}
thContainer.on("change keyup", (e)=> {
const input=e.target;
if(input.value===""&&this.getValue()!==null){
this.setValue(null);
this.triggerChanged();
}});
thContainer.on("typeahead:select", (ev, item)=> {
this.setValue({
address: item.formatted_address,
geoPoint: item.geometry.location.toJSON(),
});
this.triggerChanged();
thContainer.blur();
});
$$f(this.inputs.geoPoint).on("change", (e)=> {
const geoPoint=e.target.value.split(",").map((value)=> parseFloat(value));
this.setValue({ geoPoint: { lat: geoPoint[0], lng: geoPoint[1] }}, false);
this.triggerChanged();
});
$$f(this.inputs.length).on("change", (e)=> {
this.setLength(parseInt(e.target.value), false);
this.triggerChanged();
});
}
setAddressByUserLocation(data, location){
if(data&&data[0]){
this.setAddress(data[0].formatted_address);
}else{
this.setAddress(location.geoPoint.lat + "," + location.geoPoint.lng);
}}
handleAddressFieldChange(zip, data, removeSpinner=false){
if(removeSpinner){
$$f(this.spinner).remove();
this.formBuilder.setIsLoading(false);
}
if(data&&data[0]){
this.setValue({ address: zip, geoPoint: data[0].geometry.location }, false);
this.triggerChanged();
}}
addSelect2(){
if($$f().mselect2){
$$f(this.domElements.main)
.find("select")
.mselect2()
.on("select2:focus", function (){
$$f(this).mselect2("open");
});
}}
mayBeAddDistanceRow(){
const _this=this;
const editDistanceRow=$$f($$f("#mapsvg-edit-distance-row").html());
const z=$$f(_this.domElements.edit).find(".mapsvg-edit-distance-row:last-child input");
if(z&&z.last()&&z.last().val()&&z.last().val().toString().trim().length){
const newRow=editDistanceRow.clone();
newRow.insertAfter($$f(_this.domElements.edit).find(".mapsvg-edit-distance-row:last-child"));
}
const rows=$$f(_this.domElements.edit).find(".mapsvg-edit-distance-row");
const row1=rows.eq(rows.length - 2);
const row2=rows.eq(rows.length - 1);
if(row1.length &&
row2.length &&
!row1.find("input:eq(0)").val().toString().trim() &&
!row2.find("input:eq(0)").val().toString().trim()){
row2.remove();
}}
setValue(value, updateInput=true){
if(value===null){
this.setGeoPoint(null);
this.setAddress("");
}else{
for (const key in value){
if(typeof this.value[key]!==undefined){
const method="set" + MapSVG.ucfirst(key);
if(typeof this[method]==="function"){
this[method](value[key], updateInput);
}}
}}
}
setGeoPoint(geoPoint, updateInput=true){
this.value.geoPoint=geoPoint===null ? { lat: null, lng: null }:geoPoint;
if(updateInput){
this.setInputGeoPointValue(geoPoint);
}}
setInputGeoPointValue(geoPoint){
this.inputs.geoPoint.value=geoPoint ? geoPoint.lat + "," + geoPoint.lng:"";
}
setLength(length, updateInput=true){
this.value.length=parseInt(length.toString());
this.defaultLength=this.value.length;
if(updateInput){
this.setInputLengthValue(this.value.length);
}}
setInputLengthValue(length){
this.inputs.length.value=length.toString();
}
setAddress(address, updateInput=true){
this.value.address=address!==null ? address:"";
if(updateInput){
this.setInputAddressValue(this.value.address);
}}
setInputAddressValue(address){
this.inputs.address.value=address;
}
getValue(){
return this.value.geoPoint.lat===null ? null:this.value;
}}
const $$g=jQuery;
class EmptyFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.readonly=true;
}}
class IdFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
}
getData(){
return { name: "id", value: this.value };}}
function createCommonjsModule(fn, module){
return module={ exports: {}}, fn(module, module.exports), module.exports;
}
var sortable_min=createCommonjsModule(function (module){
(function sortableModule(factory){
{
module.exports=factory();
}})(function sortableFactory(){
if(typeof window=="undefined"||!window.document){
return function sortableError(){
throw new Error("Sortable.js requires a window with a document");
};}
var dragEl,
parentEl,
ghostEl,
cloneEl,
rootEl,
nextEl,
scrollEl,
scrollParentEl,
scrollCustomFn,
lastEl,
lastCSS,
lastParentCSS,
oldIndex,
newIndex,
activeGroup,
putSortable,
autoScroll={},
tapEvt,
touchEvt,
moved,
RSPACE=/\s+/g,
expando="Sortable" + new Date().getTime(),
win=window,
document=win.document,
parseInt=win.parseInt,
$=win.jQuery||win.Zepto,
Polymer=win.Polymer,
supportDraggable = !!("draggable" in document.createElement("div")),
supportCssPointerEvents=(function (el){
if(navigator.userAgent.match(/Trident.*rv[ :]?11\./)){
return false;
}
el=document.createElement("x");
el.style.cssText="pointer-events:auto";
return el.style.pointerEvents==="auto";
})(),
_silent=false,
abs=Math.abs,
min=Math.min,
touchDragOverListeners=[],
_autoScroll=_throttle(function (
evt,
options,
rootEl
){
if(rootEl&&options.scroll){
var el,
rect,
sens=options.scrollSensitivity,
speed=options.scrollSpeed,
x=evt.clientX,
y=evt.clientY,
winWidth=window.innerWidth,
winHeight=window.innerHeight,
vx,
vy,
scrollOffsetX,
scrollOffsetY;
if(scrollParentEl!==rootEl){
scrollEl=options.scroll;
scrollParentEl=rootEl;
scrollCustomFn=options.scrollFn;
if(scrollEl===true){
scrollEl=rootEl;
do {
if(scrollEl.offsetWidth < scrollEl.scrollWidth ||
scrollEl.offsetHeight < scrollEl.scrollHeight
){
break;
}
} while ((scrollEl=scrollEl.parentNode));
}}
if(scrollEl){
el=scrollEl;
rect=scrollEl.getBoundingClientRect();
vx=(abs(rect.right - x) <=sens) - (abs(rect.left - x) <=sens);
vy=(abs(rect.bottom - y) <=sens) - (abs(rect.top - y) <=sens);
}
if(!(vx||vy)){
vx=(winWidth - x <=sens) - (x <=sens);
vy=(winHeight - y <=sens) - (y <=sens);
(vx||vy)&&(el=win);
}
if(autoScroll.vx!==vx||autoScroll.vy!==vy||autoScroll.el!==el){
autoScroll.el=el;
autoScroll.vx=vx;
autoScroll.vy=vy;
clearInterval(autoScroll.pid);
if(el){
autoScroll.pid=setInterval(function (){
scrollOffsetY=vy ? vy * speed:0;
scrollOffsetX=vx ? vx * speed:0;
if("function"===typeof scrollCustomFn){
return scrollCustomFn.call(_this,
scrollOffsetX,
scrollOffsetY,
evt
);
}
if(el===win){
win.scrollTo(win.pageXOffset + scrollOffsetX,
win.pageYOffset + scrollOffsetY
);
}else{
el.scrollTop +=scrollOffsetY;
el.scrollLeft +=scrollOffsetX;
}}, 24);
}}
}},
30),
_prepareGroup=function (options){
function toFn(value, pull){
if(value===void 0||value===true){
value=group.name;
}
if(typeof value==="function"){
return value;
}else{
return function (to, from){
var fromGroup=from.options.group.name;
return pull
? value
: value &&
(value.join ? value.indexOf(fromGroup) > -1:fromGroup==value);
};}}
var group={};
var originalGroup=options.group;
if(!originalGroup||typeof originalGroup!="object"){
originalGroup={ name: originalGroup };}
group.name=originalGroup.name;
group.checkPull=toFn(originalGroup.pull, true);
group.checkPut=toFn(originalGroup.put);
options.group=group;
};
function Sortable(el, options){
if(!(el&&el.nodeType&&el.nodeType===1)){
throw "Sortable: `el` must be HTMLElement, and not " + {}.toString.call(el);
}
this.el=el;
this.options=options=_extend({}, options);
el[expando]=this;
var defaults={
group: Math.random(),
sort: true,
disabled: false,
store: null,
handle: null,
scroll: true,
scrollSensitivity: 30,
scrollSpeed: 10,
draggable: /[uo]l/i.test(el.nodeName) ? "li":">*",
ghostClass: "sortable-ghost",
chosenClass: "sortable-chosen",
dragClass: "sortable-drag",
ignore: "a, img",
filter: null,
animation: 0,
setData: function (dataTransfer, dragEl){
dataTransfer.setData("Text", dragEl.textContent);
},
dropBubble: false,
dragoverBubble: false,
dataIdAttr: "data-id",
delay: 0,
forceFallback: false,
fallbackClass: "sortable-fallback",
fallbackOnBody: false,
fallbackTolerance: 0,
fallbackOffset: { x: 0, y: 0 },
};
for (var name in defaults){
!(name in options)&&(options[name]=defaults[name]);
}
_prepareGroup(options);
for (var fn in this){
if(fn.charAt(0)==="_"&&typeof this[fn]==="function"){
this[fn]=this[fn].bind(this);
}}
this.nativeDraggable=options.forceFallback ? false:supportDraggable;
_on(el, "mousedown", this._onTapStart);
_on(el, "touchstart", this._onTapStart);
if(this.nativeDraggable){
_on(el, "dragover", this);
_on(el, "dragenter", this);
}
touchDragOverListeners.push(this._onDragOver);
options.store&&this.sort(options.store.get(this));
}
Sortable.prototype= {
constructor: Sortable,
_onTapStart: function ( evt){
if(evt.target.tagName=="i"||evt.target.tagName=="I"){
evt.target.click();
return;
}
var _this=this,
el=this.el,
options=this.options,
type=evt.type,
touch=evt.touches&&evt.touches[0],
target=(touch||evt).target,
originalTarget=(evt.target.shadowRoot&&evt.path[0])||target,
filter=options.filter,
startIndex;
if(dragEl){
return;
}
if((type==="mousedown"&&evt.button!==0)||options.disabled){
return;
}
if(options.handle&&!_closest(originalTarget, options.handle, el)){
return;
}
target=_closest(target, options.draggable, el);
if(!target){
return;
}
startIndex=_index(target, options.draggable);
if(typeof filter==="function"){
if(filter.call(this, evt, target, this)){
_dispatchEvent(_this, originalTarget, "filter", target, el, startIndex);
evt.preventDefault();
return;
}}else if(filter){
filter=filter.split(",").some(function (criteria){
criteria=_closest(originalTarget, criteria.trim(), el);
if(criteria){
_dispatchEvent(_this, criteria, "filter", target, el, startIndex);
return true;
}});
if(filter){
evt.preventDefault();
return;
}}
this._prepareDragStart(evt, touch, target, startIndex);
},
_prepareDragStart: function (
evt,
touch,
target,
startIndex
){
var _this=this,
el=_this.el,
options=_this.options,
ownerDocument=el.ownerDocument,
dragStartFn;
if(target&&!dragEl&&target.parentNode===el){
tapEvt=evt;
rootEl=el;
dragEl=target;
parentEl=dragEl.parentNode;
nextEl=dragEl.nextSibling;
activeGroup=options.group;
oldIndex=startIndex;
this._lastX=(touch||evt).clientX;
this._lastY=(touch||evt).clientY;
dragEl.style["will-change"]="transform";
dragStartFn=function (){
_this._disableDelayedDrag();
dragEl.draggable=_this.nativeDraggable;
_toggleClass(dragEl, options.chosenClass, true);
_this._triggerDragStart(touch);
_dispatchEvent(_this, rootEl, "choose", dragEl, rootEl, oldIndex);
};
options.ignore.split(",").forEach(function (criteria){
_find(dragEl, criteria.trim(), _disableDraggable);
});
_on(ownerDocument, "mouseup", _this._onDrop);
_on(ownerDocument, "touchend", _this._onDrop);
_on(ownerDocument, "touchcancel", _this._onDrop);
if(options.delay){
_on(ownerDocument, "mouseup", _this._disableDelayedDrag);
_on(ownerDocument, "touchend", _this._disableDelayedDrag);
_on(ownerDocument, "touchcancel", _this._disableDelayedDrag);
_on(ownerDocument, "mousemove", _this._disableDelayedDrag);
_on(ownerDocument, "touchmove", _this._disableDelayedDrag);
_this._dragStartTimer=setTimeout(dragStartFn, options.delay);
}else{
dragStartFn();
}}
},
_disableDelayedDrag: function (){
var ownerDocument=this.el.ownerDocument;
clearTimeout(this._dragStartTimer);
_off(ownerDocument, "mouseup", this._disableDelayedDrag);
_off(ownerDocument, "touchend", this._disableDelayedDrag);
_off(ownerDocument, "touchcancel", this._disableDelayedDrag);
_off(ownerDocument, "mousemove", this._disableDelayedDrag);
_off(ownerDocument, "touchmove", this._disableDelayedDrag);
},
_triggerDragStart: function ( touch){
if(touch){
tapEvt={
target: dragEl,
clientX: touch.clientX,
clientY: touch.clientY,
};
this._onDragStart(tapEvt, "touch");
}else if(!this.nativeDraggable){
this._onDragStart(tapEvt, true);
}else{
_on(dragEl, "dragend", this);
_on(rootEl, "dragstart", this._onDragStart);
}
try {
if(document.selection){
setTimeout(function (){
document.selection.empty();
});
}else{
window.getSelection().removeAllRanges();
}} catch (err){}},
_dragStarted: function (){
if(rootEl&&dragEl){
var options=this.options;
_toggleClass(dragEl, options.ghostClass, true);
_toggleClass(dragEl, options.dragClass, false);
Sortable.active=this;
_dispatchEvent(this, rootEl, "start", dragEl, rootEl, oldIndex);
}},
_emulateDragOver: function (){
if(touchEvt){
if(this._lastX===touchEvt.clientX&&this._lastY===touchEvt.clientY){
return;
}
this._lastX=touchEvt.clientX;
this._lastY=touchEvt.clientY;
if(!supportCssPointerEvents){
_css(ghostEl, "display", "none");
}
var target=document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
parent=target,
i=touchDragOverListeners.length;
if(parent){
do {
if(parent[expando]){
while (i--){
touchDragOverListeners[i]({
clientX: touchEvt.clientX,
clientY: touchEvt.clientY,
target: target,
rootEl: parent,
});
}
break;
}
target=parent;
} while (
(parent=parent.parentNode)
);
}
if(!supportCssPointerEvents){
_css(ghostEl, "display", "");
}}
},
_onTouchMove: function ( evt){
if(tapEvt){
var options=this.options,
fallbackTolerance=options.fallbackTolerance,
fallbackOffset=options.fallbackOffset,
touch=evt.touches ? evt.touches[0]:evt,
dx=touch.clientX - tapEvt.clientX + fallbackOffset.x,
dy=touch.clientY - tapEvt.clientY + fallbackOffset.y,
translate3d=evt.touches
? "translate3d(" + dx + "px," + dy + "px,0)"
: "translate(" + dx + "px," + dy + "px)";
if(!Sortable.active){
if(fallbackTolerance &&
min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) <
fallbackTolerance
){
return;
}
this._dragStarted();
}
this._appendGhost();
moved=true;
touchEvt=touch;
_css(ghostEl, "webkitTransform", translate3d);
_css(ghostEl, "mozTransform", translate3d);
_css(ghostEl, "msTransform", translate3d);
_css(ghostEl, "transform", translate3d);
evt.preventDefault();
}},
_appendGhost: function (){
if(!ghostEl){
var rect=dragEl.getBoundingClientRect(),
css=_css(dragEl),
options=this.options,
ghostRect;
ghostEl=dragEl.cloneNode(true);
_toggleClass(ghostEl, options.ghostClass, false);
_toggleClass(ghostEl, options.fallbackClass, true);
_toggleClass(ghostEl, options.dragClass, true);
_css(ghostEl, "top", rect.top - parseInt(css.marginTop, 10));
_css(ghostEl, "left", rect.left - parseInt(css.marginLeft, 10));
_css(ghostEl, "width", rect.width);
_css(ghostEl, "height", rect.height);
_css(ghostEl, "opacity", "0.8");
_css(ghostEl, "position", "fixed");
_css(ghostEl, "zIndex", "100000");
_css(ghostEl, "pointerEvents", "none");
(options.fallbackOnBody&&document.body.appendChild(ghostEl)) ||
rootEl.appendChild(ghostEl);
ghostRect=ghostEl.getBoundingClientRect();
_css(ghostEl, "width", rect.width * 2 - ghostRect.width);
_css(ghostEl, "height", rect.height * 2 - ghostRect.height);
}},
_onDragStart: function ( evt,  useFallback){
var dataTransfer=evt.dataTransfer,
options=this.options;
this._offUpEvents();
if(activeGroup.checkPull(this, this, dragEl, evt)=="clone"){
cloneEl=_clone(dragEl);
_css(cloneEl, "display", "none");
rootEl.insertBefore(cloneEl, dragEl);
_dispatchEvent(this, rootEl, "clone", dragEl);
}
_toggleClass(dragEl, options.dragClass, true);
if(useFallback){
if(useFallback==="touch"){
_on(document, "touchmove", this._onTouchMove);
_on(document, "touchend", this._onDrop);
_on(document, "touchcancel", this._onDrop);
}else{
_on(document, "mousemove", this._onTouchMove);
_on(document, "mouseup", this._onDrop);
}
this._loopId=setInterval(this._emulateDragOver, 50);
}else{
if(dataTransfer){
dataTransfer.effectAllowed="move";
options.setData&&options.setData.call(this, dataTransfer, dragEl);
}
_on(document, "drop", this);
setTimeout(this._dragStarted, 0);
}},
_onDragOver: function ( evt){
var el=this.el,
target,
dragRect,
targetRect,
revert,
options=this.options,
group=options.group,
activeSortable=Sortable.active,
isOwner=activeGroup===group,
canSort=options.sort;
if(evt.preventDefault!==void 0){
evt.preventDefault();
!options.dragoverBubble&&evt.stopPropagation();
}
moved=true;
if(activeGroup &&
!options.disabled &&
(isOwner
? canSort||(revert = !rootEl.contains(dragEl))
: putSortable===this ||
(activeGroup.checkPull(this, activeSortable, dragEl, evt) &&
group.checkPut(this, activeSortable, dragEl, evt))) &&
(evt.rootEl===void 0||evt.rootEl===this.el)
){
_autoScroll(evt, options, this.el);
if(_silent){
return;
}
target=_closest(evt.target, options.draggable, el);
dragRect=dragEl.getBoundingClientRect();
putSortable=this;
if(revert){
_cloneHide(true);
parentEl=rootEl;
if(cloneEl||nextEl){
rootEl.insertBefore(dragEl, cloneEl||nextEl);
}else if(!canSort){
rootEl.appendChild(dragEl);
}
return;
}
if(el.children.length===0 ||
el.children[0]===ghostEl ||
(el===evt.target&&(target=_ghostIsLast(el, evt)))
){
if(target){
if(target.animated){
return;
}
targetRect=target.getBoundingClientRect();
}
_cloneHide(isOwner);
if(_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt)!==false){
if(!dragEl.contains(el)){
el.appendChild(dragEl);
parentEl=el;
}
this._animate(dragRect, dragEl);
target&&this._animate(targetRect, target);
}}else if(target &&
!target.animated &&
target!==dragEl &&
target.parentNode[expando]!==void 0
){
if(lastEl!==target){
lastEl=target;
lastCSS=_css(target);
lastParentCSS=_css(target.parentNode);
}
targetRect=target.getBoundingClientRect();
var width=targetRect.right - targetRect.left,
height=targetRect.bottom - targetRect.top,
floating =
/left|right|inline/.test(lastCSS.cssFloat + lastCSS.display) ||
(lastParentCSS.display=="flex" &&
lastParentCSS["flex-direction"].indexOf("row")===0),
isWide=target.offsetWidth > dragEl.offsetWidth,
isLong=target.offsetHeight > dragEl.offsetHeight,
halfway =
(floating
? (evt.clientX - targetRect.left) / width
: (evt.clientY - targetRect.top) / height) > 0.5,
nextSibling=target.nextElementSibling,
moveVector=_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
after;
if(moveVector!==false){
_silent=true;
setTimeout(_unsilent, 30);
_cloneHide(isOwner);
if(moveVector===1||moveVector===-1){
after=moveVector===1;
}else if(floating){
var elTop=dragEl.offsetTop,
tgTop=target.offsetTop;
if(elTop===tgTop){
after =
(target.previousElementSibling===dragEl&&!isWide) ||
(halfway&&isWide);
}else if(target.previousElementSibling===dragEl ||
dragEl.previousElementSibling===target
){
after=(evt.clientY - targetRect.top) / height > 0.5;
}else{
after=tgTop > elTop;
}}else{
after=(nextSibling!==dragEl&&!isLong)||(halfway&&isLong);
}
if(!dragEl.contains(el)){
if(after&&!nextSibling){
el.appendChild(dragEl);
}else{
target.parentNode.insertBefore(dragEl,
after ? nextSibling:target
);
}}
parentEl=dragEl.parentNode;
this._animate(dragRect, dragEl);
this._animate(targetRect, target);
}}
}},
_animate: function (prevRect, target){
var ms=this.options.animation;
if(ms){
var currentRect=target.getBoundingClientRect();
_css(target, "transition", "none");
_css(
target,
"transform",
"translate3d(" +
(prevRect.left - currentRect.left) +
"px," +
(prevRect.top - currentRect.top) +
"px,0)"
);
target.offsetWidth;
_css(target, "transition", "all " + ms + "ms");
_css(target, "transform", "translate3d(0,0,0)");
clearTimeout(target.animated);
target.animated=setTimeout(function (){
_css(target, "transition", "");
_css(target, "transform", "");
target.animated=false;
}, ms);
}},
_offUpEvents: function (){
var ownerDocument=this.el.ownerDocument;
_off(document, "touchmove", this._onTouchMove);
_off(ownerDocument, "mouseup", this._onDrop);
_off(ownerDocument, "touchend", this._onDrop);
_off(ownerDocument, "touchcancel", this._onDrop);
},
_onDrop: function ( evt){
var el=this.el,
options=this.options;
clearInterval(this._loopId);
clearInterval(autoScroll.pid);
clearTimeout(this._dragStartTimer);
_off(document, "mousemove", this._onTouchMove);
if(this.nativeDraggable){
_off(document, "drop", this);
_off(el, "dragstart", this._onDragStart);
}
this._offUpEvents();
if(evt){
if(moved){
evt.preventDefault();
!options.dropBubble&&evt.stopPropagation();
}
ghostEl&&ghostEl.parentNode.removeChild(ghostEl);
if(dragEl){
if(this.nativeDraggable){
_off(dragEl, "dragend", this);
}
_disableDraggable(dragEl);
dragEl.style["will-change"]="";
_toggleClass(dragEl, this.options.ghostClass, false);
_toggleClass(dragEl, this.options.chosenClass, false);
if(rootEl!==parentEl){
newIndex=_index(dragEl, options.draggable);
if(newIndex >=0){
_dispatchEvent(
null,
parentEl,
"add",
dragEl,
rootEl,
oldIndex,
newIndex
);
_dispatchEvent(
this,
rootEl,
"remove",
dragEl,
rootEl,
oldIndex,
newIndex
);
_dispatchEvent(
null,
parentEl,
"sort",
dragEl,
rootEl,
oldIndex,
newIndex
);
_dispatchEvent(
this,
rootEl,
"sort",
dragEl,
rootEl,
oldIndex,
newIndex
);
}}else{
cloneEl&&cloneEl.parentNode.removeChild(cloneEl);
if(dragEl.nextSibling!==nextEl){
newIndex=_index(dragEl, options.draggable);
if(newIndex >=0){
_dispatchEvent(
this,
rootEl,
"update",
dragEl,
rootEl,
oldIndex,
newIndex
);
_dispatchEvent(
this,
rootEl,
"sort",
dragEl,
rootEl,
oldIndex,
newIndex
);
}}
}
if(Sortable.active){
if(newIndex==null||newIndex===-1){
newIndex=oldIndex;
}
_dispatchEvent(this, rootEl, "end", dragEl, rootEl, oldIndex, newIndex);
this.save();
}}
}
this._nulling();
},
_nulling: function (){
rootEl=dragEl=parentEl=ghostEl=nextEl=cloneEl=scrollEl=scrollParentEl=tapEvt=touchEvt=moved=newIndex=lastEl=lastCSS=putSortable=activeGroup=Sortable.active=null;
},
handleEvent: function ( evt){
var type=evt.type;
if(type==="dragover"||type==="dragenter"){
if(dragEl){
this._onDragOver(evt);
_globalDragOver(evt);
}}else if(type==="drop"||type==="dragend"){
this._onDrop(evt);
}},
toArray: function (){
var order=[],
el,
children=this.el.children,
i=0,
n=children.length,
options=this.options;
for (; i < n; i++){
el=children[i];
if(_closest(el, options.draggable, this.el)){
order.push(el.getAttribute(options.dataIdAttr)||_generateId(el));
}}
return order;
},
sort: function (order){
var items={},
rootEl=this.el;
this.toArray().forEach(function (id, i){
var el=rootEl.children[i];
if(_closest(el, this.options.draggable, rootEl)){
items[id]=el;
}}, this);
order.forEach(function (id){
if(items[id]){
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}});
},
save: function (){
var store=this.options.store;
store&&store.set(this);
},
closest: function (el, selector){
return _closest(el, selector||this.options.draggable, this.el);
},
option: function (name, value){
var options=this.options;
if(value===void 0){
return options[name];
}else{
options[name]=value;
if(name==="group"){
_prepareGroup(options);
}}
},
destroy: function (){
var el=this.el;
el[expando]=null;
_off(el, "mousedown", this._onTapStart);
_off(el, "touchstart", this._onTapStart);
if(this.nativeDraggable){
_off(el, "dragover", this);
_off(el, "dragenter", this);
}
Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function (el){
el.removeAttribute("draggable");
});
touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
this._onDrop();
this.el=el=null;
},
};
function _cloneHide(state){
if(cloneEl&&cloneEl.state!==state){
_css(cloneEl, "display", state ? "none":"");
!state&&cloneEl.state&&rootEl.insertBefore(cloneEl, dragEl);
cloneEl.state=state;
}}
function _closest( el,  selector,  ctx){
if(el){
ctx=ctx||document;
do {
if((selector===">*"&&el.parentNode===ctx)||_matches(el, selector)){
return el;
}
} while ((el=_getParentOrHost(el)));
}
return null;
}
function _getParentOrHost(el){
var parent=el.host;
return parent&&parent.nodeType ? parent:el.parentNode;
}
function _globalDragOver( evt){
if(evt.dataTransfer){
evt.dataTransfer.dropEffect="move";
}
evt.preventDefault();
}
function _on(el, event, fn){
el.addEventListener(event, fn, false);
}
function _off(el, event, fn){
el.removeEventListener(event, fn, false);
}
function _toggleClass(el, name, state){
if(el){
if(el.classList){
el.classList[state ? "add":"remove"](name);
}else{
var className=(" " + el.className + " ")
.replace(RSPACE, " ")
.replace(" " + name + " ", " ");
el.className=(className + (state ? " " + name:"")).replace(RSPACE, " ");
}}
}
function _css(el, prop, val){
var style=el&&el.style;
if(style){
if(val===void 0){
if(document.defaultView&&document.defaultView.getComputedStyle){
val=document.defaultView.getComputedStyle(el, "");
}else if(el.currentStyle){
val=el.currentStyle;
}
return prop===void 0 ? val:val[prop];
}else{
if(!(prop in style)){
prop="-webkit-" + prop;
}
style[prop]=val + (typeof val==="string" ? "":"px");
}}
}
function _find(ctx, tagName, iterator){
if(ctx){
var list=ctx.getElementsByTagName(tagName),
i=0,
n=list.length;
if(iterator){
for (; i < n; i++){
iterator(list[i], i);
}}
return list;
}
return [];
}
function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex){
sortable=sortable||rootEl[expando];
var evt=document.createEvent("Event"),
options=sortable.options,
onName="on" + name.charAt(0).toUpperCase() + name.substr(1);
evt.initEvent(name, true, true);
evt.to=rootEl;
evt.from=fromEl||rootEl;
evt.item=targetEl||rootEl;
evt.clone=cloneEl;
evt.oldIndex=startIndex;
evt.newIndex=newIndex;
rootEl.dispatchEvent(evt);
if(options[onName]){
options[onName].call(sortable, evt);
}}
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt){
var evt,
sortable=fromEl[expando],
onMoveFn=sortable.options.onMove,
retVal;
evt=document.createEvent("Event");
evt.initEvent("move", true, true);
evt.to=toEl;
evt.from=fromEl;
evt.dragged=dragEl;
evt.draggedRect=dragRect;
evt.related=targetEl||toEl;
evt.relatedRect=targetRect||toEl.getBoundingClientRect();
fromEl.dispatchEvent(evt);
if(onMoveFn){
retVal=onMoveFn.call(sortable, evt, originalEvt);
}
return retVal;
}
function _disableDraggable(el){
el.draggable=false;
}
function _unsilent(){
_silent=false;
}
function _ghostIsLast(el, evt){
var lastEl=el.lastElementChild,
rect=lastEl.getBoundingClientRect();
return (
(evt.clientY - (rect.top + rect.height) > 5 ||
evt.clientX - (rect.right + rect.width) > 5) &&
lastEl
);
}
function _generateId(el){
var str=el.tagName + el.className + el.src + el.href + el.textContent,
i=str.length,
sum=0;
while (i--){
sum +=str.charCodeAt(i);
}
return sum.toString(36);
}
function _index(el, selector){
var index=0;
if(!el||!el.parentNode){
return -1;
}
while (el&&(el=el.previousElementSibling)){
if(el.nodeName.toUpperCase()!=="TEMPLATE" &&
(selector===">*"||_matches(el, selector))
){
index++;
}}
return index;
}
function _matches( el,  selector){
if(el){
selector=selector.split(".");
var tag=selector.shift().toUpperCase(),
re=new RegExp("\\s(" + selector.join("|") + ")(?=\\s)", "g");
return (
(tag===""||el.nodeName.toUpperCase()==tag) &&
(!selector.length ||
((" " + el.className + " ").match(re)||[]).length==selector.length)
);
}
return false;
}
function _throttle(callback, ms){
var args, _this;
return function (){
if(args===void 0){
args=arguments;
_this=this;
setTimeout(function (){
if(args.length===1){
callback.call(_this, args[0]);
}else{
callback.apply(_this, args);
}
args=void 0;
}, ms);
}};}
function _extend(dst, src){
if(dst&&src){
for (var key in src){
if(src.hasOwnProperty(key)){
dst[key]=src[key];
}}
}
return dst;
}
function _clone(el){
return $
? $(el).clone(true)[0]
: Polymer&&Polymer.dom
? Polymer.dom(el).cloneNode(true)
: el.cloneNode(true);
}
Sortable.utils={
on: _on,
off: _off,
css: _css,
find: _find,
is: function (el, selector){
return !!_closest(el, selector, el);
},
extend: _extend,
throttle: _throttle,
closest: _closest,
toggleClass: _toggleClass,
clone: _clone,
index: _index,
};
Sortable.create=function (el, options){
return new Sortable(el, options);
};
Sortable.version="1.4.2";
return Sortable;
});
});
const $$h=jQuery;
class ImagesFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchType=options.searchType||"fulltext";
this.mediaUploader=external.mediaUploader;
this.button_text=options.button_text||"Browse...";
this.db_type="text";
this.label=options.label||"Images";
this.name=options.name||"images";
this.images=this.value||[];
this.value=JSON.stringify(this.value);
}
init(){
super.init();
this.redrawImages();
}
setDomElements(){
super.setDomElements();
}
getData(){
this.updateData();
return { name: this.name, value: this.images };}
getSchema(){
const schema=super.getSchema();
schema.button_text=this.button_text;
return schema;
}
updateData(){
const newListOfImages=[];
$$h(this.domElements.main)
.find(".mapsvg-thumbnail-wrap")
.each(function (index, el){
const imageData=$$h(el).data("image");
newListOfImages.push(imageData);
});
this.images=newListOfImages;
this.value=JSON.stringify(this.images);
$$h(this.domElements.main).find("input").val(this.value);
}
setEventHandlers(){
super.setEventHandlers();
if(this.formBuilder.editMode){
return;
}
const _this=this;
const imageDOM=$$h(this.domElements.main).find(".mapsvg-data-images");
this.external.mediaUploader.on("select", ()=> {
if(_this.formBuilder.mediaUploaderisOpenedFor!==_this)
return false;
const attachments=_this.external.mediaUploader.state().get("selection").toJSON();
attachments.forEach(function (img){
const image={ sizes: {}};
for (const type in img.sizes){
image[type]=img.sizes[type].url
.replace("http://", "//")
.replace("https://", "//");
image.sizes[type]={
width: img.sizes[type].width,
height: img.sizes[type].height,
};}
if(!image.thumbnail){
image.thumbnail=image.full;
image.sizes.thumbnail={
width: img.sizes.full.width,
height: img.sizes.full.height,
};}
if(!image.medium){
image.medium=image.full;
image.sizes.medium={
width: img.sizes.full.width,
height: img.sizes.full.height,
};}
image.caption=img.caption;
image.description=img.description;
_this.images.push(image);
});
this.setValue(this.images);
_this.redrawImages();
});
$$h(_this.domElements.main).on("click", ".mapsvg-upload-image", function (e){
e.preventDefault();
_this.formBuilder.mediaUploaderisOpenedFor=_this;
_this.external.mediaUploader.open();
});
$$h(_this.domElements.main).on("click", ".mapsvg-image-delete", function (e){
e.preventDefault();
$$h(this).closest(".mapsvg-thumbnail-wrap").remove();
_this.updateData();
});
_this.sortable=new sortable_min(imageDOM[0], {
animation: 150,
onStart: function (){
$$h(_this.domElements.main).addClass("sorting");
},
onEnd: function (evt){
_this.images=[];
$$h(_this.domElements.main)
.find("img")
.each(function (i, image){
_this.images.push($$h(image).data("image"));
});
this.value=JSON.stringify(_this.images);
$$h(_this.domElements.main).find("input").val(this.value);
$$h(_this.domElements.main).removeClass("sorting");
},
});
}
redrawImages(){
const imageDOM=$$h(this.domElements.main).find(".mapsvg-data-images");
imageDOM.empty();
this.images &&
this.images.forEach(function (image){
const img=$$h('<img class="mapsvg-data-thumbnail" />')
.attr("src", image.thumbnail)
.data("image", image);
const imgContainer=$$h('<div class="mapsvg-thumbnail-wrap"></div>').data("image", image);
imgContainer.append(img);
imgContainer.append('<i class="mfa mfa-times  mapsvg-image-delete"></i>');
imageDOM.append(imgContainer);
});
$$h(this.domElements.main).find("input").val(this.value);
}
destroy(){
super.destroy();
this.external.mediaUploader.off("select");
}}
const $$i=jQuery;
class LocationFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.label=this.label||(options.label===undefined ? "Location":options.label);
this.name="location";
this.db_type="text";
this.languages=[
{ value: "sq", label: "Albanian" },
{ value: "ar", label: "Arabic" },
{
value: "eu",
label: "Basque",
},
{ value: "be", label: "Belarusian" },
{ value: "bg", label: "Bulgarian" },
{
value: "my",
label: "Burmese",
},
{ value: "bn", label: "Bengali" },
{ value: "ca", label: "Catalan" },
{
value: "zh-cn",
label: "Chinese (simplified)",
},
{ value: "zh-tw", label: "Chinese (traditional)" },
{
value: "hr",
label: "Croatian",
},
{ value: "cs", label: "Czech" },
{ value: "da", label: "Danish" },
{
value: "nl",
label: "Dutch",
},
{ value: "en", label: "English" },
{
value: "en-au",
label: "English (australian)",
},
{ value: "en-gb", label: "English (great Britain)" },
{
value: "fa",
label: "Farsi",
},
{ value: "fi", label: "Finnish" },
{ value: "fil", label: "Filipino" },
{
value: "fr",
label: "French",
},
{ value: "gl", label: "Galician" },
{ value: "de", label: "German" },
{
value: "el",
label: "Greek",
},
{ value: "gu", label: "Gujarati" },
{ value: "iw", label: "Hebrew" },
{
value: "hi",
label: "Hindi",
},
{ value: "hu", label: "Hungarian" },
{ value: "id", label: "Indonesian" },
{
value: "it",
label: "Italian",
},
{ value: "ja", label: "Japanese" },
{ value: "kn", label: "Kannada" },
{
value: "kk",
label: "Kazakh",
},
{ value: "ko", label: "Korean" },
{ value: "ky", label: "Kyrgyz" },
{
value: "lt",
label: "Lithuanian",
},
{ value: "lv", label: "Latvian" },
{ value: "mk", label: "Macedonian" },
{
value: "ml",
label: "Malayalam",
},
{ value: "mr", label: "Marathi" },
{ value: "no", label: "Norwegian" },
{
value: "pl",
label: "Polish",
},
{ value: "pt", label: "Portuguese" },
{
value: "pt-br",
label: "Portuguese (brazil)",
},
{ value: "pt-pt", label: "Portuguese (portugal)" },
{
value: "pa",
label: "Punjabi",
},
{ value: "ro", label: "Romanian" },
{ value: "ru", label: "Russian" },
{
value: "sr",
label: "Serbian",
},
{ value: "sk", label: "Slovak" },
{ value: "sl", label: "Slovenian" },
{
value: "es",
label: "Spanish",
},
{ value: "sv", label: "Swedish" },
{ value: "tl", label: "Tagalog" },
{
value: "ta",
label: "Tamil",
},
{ value: "te", label: "Telugu" },
{ value: "th", label: "Thai" },
{
value: "tr",
label: "Turkish",
},
{ value: "uk", label: "Ukrainian" },
{ value: "uz", label: "Uzbek" },
{
value: "vi",
label: "Vietnamese",
},
];
this.language=options.language;
this.markerImages=MapSVG.markerImages;
this.markersByField=options.markersByField;
this.markerField=options.markerField;
this.markersByFieldEnabled=MapSVG.parseBoolean(options.markersByFieldEnabled);
this.defaultMarkerPath =
options.defaultMarkerPath ||
this.formBuilder.mapsvg.getData().options.defaultMarkerImage;
this.templates.marker=Handlebars.compile($$i("#mapsvg-data-tmpl-marker").html());
}
init(){
super.init();
if(this.value){
this.renderMarker();
}
this.renderMarkerSelector();
}
getSchema(){
const schema=super.getSchema();
schema.language=this.language;
schema.defaultMarkerPath=this.defaultMarkerPath;
schema.markersByField=this.markersByField;
schema.markerField=this.markerField;
schema.markersByFieldEnabled=MapSVG.parseBoolean(this.markersByFieldEnabled);
return schema;
}
getData(){
return { name: this.name, value: this.value };}
getDataForTemplate(){
const data=super.getDataForTemplate();
if(this.formBuilder.admin){
data.languages=this.languages;
data.markerImages=MapSVG.markerImages;
data.markersByField=this.markersByField;
data.markerField=this.markerField;
data.markersByFieldEnabled=MapSVG.parseBoolean(this.markersByFieldEnabled);
const _this=this;
data.markerImages.forEach(function (m){
if(m.relativeUrl===_this.defaultMarkerPath){
m.default=true;
}else{
m.default=false;
}});
}
data.language=this.language;
if(this.value){
data.location=this.value;
if(data.location.marker){
data.location.img =
(this.value.marker.src.indexOf(MapSVG.urls.uploads)===0 ? "uploads/":"") +
this.value.marker.src.split("/").pop();
}}
data.showUploadBtn=data.external.filtersMode;
return data;
}
initEditor(){
super.initEditor();
this.renderMarkerSelector();
this.fillMarkersByFieldOptions(this.markerField);
}
setDomElements(){
super.setDomElements();
this.domElements.markerImageButton=$$i(this.domElements.main).find("img")[0];
}
setEventHandlers(){
super.setEventHandlers();
const _this=this;
const server=new Server();
if(_this.formBuilder.mapsvg.isGeo()){
const locations=new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace("formatted_address"),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: server.getUrl("geocoding") + "?address=%QUERY%&language=" + this.language,
wildcard: "%QUERY%",
transform: function (response){
if(response.error_message){
alert(response.error_message);
}
return response.results;
},
rateLimitWait: 600,
},
});
const thContainer=$$i(this.domElements.main).find(".typeahead");
const tH=thContainer
.typeahead({ minLength: 3 }, {
name: "mapsvg-addresses",
display: "formatted_address",
async: true,
source: (query, sync, async)=> {
const preg=new RegExp(/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/);
if(preg.test(query)){
const latlng=query.split(",").map((item)=> item.trim());
const item={
formatted_address: latlng.join(","),
address_components: [],
geometry: {
location: {
lat: ()=> latlng[0],
lng: ()=> latlng[1],
},
},
};
sync([item]);
return;
}
MapSVG.geocode({ address: query }, async);
},
})
.on("typeahead:asyncrequest", function (e){
$$i(e.target).addClass("tt-loading");
})
.on("typeahead:asynccancel typeahead:asyncreceive", function (e){
$$i(e.target).removeClass("tt-loading");
});
thContainer.on("typeahead:select", (ev, item)=> {
this.setValue(null, false);
const address={};
address.formatted=item.formatted_address;
item.address_components.forEach((addr_item)=> {
const type=addr_item.types[0];
address[type]=addr_item.long_name;
if(addr_item.short_name!=addr_item.long_name){
address[type + "_short"]=addr_item.short_name;
}});
const locationData={
address: address,
geoPoint: new GeoPoint(item.geometry.location.lat(), item.geometry.location.lng()),
img: this.getMarkerImage(this.formBuilder.getData()),
imagePath: this.getMarkerImage(this.formBuilder.getData()),
};
this.setValue(locationData, false);
thContainer.typeahead("val", "");
this.triggerChanged();
});
}
$$i(this.domElements.main).on("change", ".marker-file-uploader", function (){
_this.markerIconUpload(this);
});
$$i(this.domElements.main).on("click", ".mapsvg-marker-image-btn-trigger", function (e){
e.preventDefault();
$$i(this).toggleClass("active");
_this.toggleMarkerSelector();
});
$$i(this.domElements.main).on("click", ".mapsvg-marker-delete", function (e){
e.preventDefault();
_this.setValue(null);
_this.triggerChanged();
});
}
setEditorEventHandlers(){
super.setEditorEventHandlers();
const _this=this;
$$i(this.domElements.edit).on("change", ".marker-file-uploader", function (){
_this.markerIconUpload(this);
});
$$i(this.domElements.edit).on("change", 'select[name="markerField"]', function (){
const fieldName=$$i(this).val();
_this.resetMarkersByField();
const newOptions=_this.fillMarkersByFieldOptions(fieldName);
_this.setMarkersByField(newOptions);
});
$$i(this.domElements.edit).on("click", ".mapsvg-marker-image-selector button", function (e){
e.preventDefault();
const src=$$i(this).find("img").attr("src");
$$i(this).parent().find("button").removeClass("active");
$$i(this).addClass("active");
_this.setDefaultMarkerPath(src);
});
$$i(this.domElements.edit).on("click", ".mapsvg-marker-image-btn-trigger", function (e){
$$i(this).toggleClass("active");
_this.toggleMarkerSelectorInLocationEditor.call(_this, $$i(this), e);
});
}
markerIconUpload(input){
const uploadBtn=$$i(input).closest(".btn-file").buttonLoading(true);
for (let i=0; i < input.files.length; i++){
const data=new FormData();
data.append("file", input.files[0]);
const server=new Server();
server
.ajax("markers", {
type: "POST",
data: data,
processData: false,
contentType: false,
})
.done((resp)=> {
if(resp.error){
alert(resp.error);
}else{
const marker=resp.marker;
const newMarker=`
<button class="btn btn-outline-secondary mapsvg-marker-image-btn mapsvg-marker-image-btn-choose active">
<img src="${marker.relativeUrl}" />
</button>
</button>
`;
$$i(this.domElements.markerSelector)
.find(".mapsvg-marker-image-btn.active")
.removeClass("active");
$$i(newMarker).appendTo(this.domElements.markerSelector);
this.setMarkerImage(marker.relativeUrl);
MapSVG.markerImages.push(marker);
}})
.always(function (){
uploadBtn.buttonLoading(false);
});
}}
mayBeAddDistanceRow(){
const _this=this;
if(!this.domElements.editDistanceRow){
this.domElements.editDistanceRow=$$i($$i("#mapsvg-edit-distance-row").html())[0];
}
const z=$$i(this.domElements.edit).find(".mapsvg-edit-distance-row:last-child input");
if(z&&z.last()&&z.last().val()&&(z.last().val() + "").trim().length){
const newRow=$$i(this.templates.editDistanceRow).clone();
newRow.insertAfter($$i(_this.domElements.edit).find(".mapsvg-edit-distance-row:last-child"));
}
const rows=$$i(_this.domElements.edit).find(".mapsvg-edit-distance-row");
const row1=rows.eq(rows.length - 2);
const row2=rows.eq(rows.length - 1);
if(row1.length &&
row2.length &&
!row1.find("input:eq(0)").val().toString().trim() &&
!row2.find("input:eq(0)").val().toString().trim()){
row2.remove();
}}
fillMarkersByFieldOptions(fieldName){
const _this=this;
const field=_this.formBuilder.mapsvg.objectsRepository.getSchema().getField(fieldName);
const options={};
if(field){
const markerImg=_this.formBuilder.mapsvg.options.defaultMarkerImage;
const rows=[];
field.options.forEach(function (option){
const value=field.type==="region" ? option.id:option.value;
const label=field.type==="region" ? option.title||option.id:option.label;
const img=_this.markersByField&&_this.markersByField[value]
? _this.markersByField[value]
: markerImg;
rows.push('<tr data-option-id="' +
value +
'"><td>' +
label +
'</td><td><button class="btn dropdown-toggle btn-outline-secondary mapsvg-marker-image-btn-trigger mapsvg-marker-image-btn"><img src="' +
img +
'" class="new-marker-img" /><span class="caret"></span></button></td></tr>');
options[value]=img;
});
$$i("#markers-by-field").empty().append(rows);
}
return options;
}
renderMarker(marker){
if(marker&&marker.location){
this.value=marker.location.getData();
}
this.renderMarkerHtml();
}
renderMarkerHtml(){
if(!this.value){
$$i(this.domElements.main).find(".mapsvg-new-marker").hide();
}else{
$$i(this.domElements.main)
.find(".mapsvg-new-marker")
.show()
.html(this.templates.marker(this.value));
}}
toggleMarkerSelector(){
if(this.domElements.markerSelectorWrap &&
$$i(this.domElements.markerSelectorWrap).is(":visible")){
$$i(this.domElements.markerSelectorWrap).hide();
return;
}
if(this.domElements.markerSelectorWrap &&
$$i(this.domElements.markerSelectorWrap).not(":visible")){
$$i(this.domElements.markerSelector).find(".active").removeClass("active");
if(this.value&&this.value.markerImagePath){
$$i(this.domElements.markerSelector)
.find('[src="' + this.value.markerImagePath + '"]')
.parent()
.addClass("active");
}
$$i(this.domElements.markerSelectorWrap).show();
return;
}}
renderMarkerSelector(){
const _this=this;
const view=this.formBuilder.editMode ? this.domElements.edit:this.domElements.main;
if(!view)
return;
const currentImage=this.value ? this.value.markerImagePath:null;
const images=MapSVG.markerImages.map(function (image){
return ('<button class="btn btn-outline-secondary mapsvg-marker-image-btn mapsvg-marker-image-btn-choose ' +
(currentImage==image.relativeUrl ? "active":"") +
'"><img src="' +
image.relativeUrl +
'" /></button>');
});
this.domElements.markerSelectorWrap=$$i(view).find(".mapsvg-marker-image-selector")[0];
this.domElements.markerSelector=$$i(this.domElements.markerSelectorWrap).find(".mapsvg-marker-images")[0];
if(this.domElements.markerSelector){
$$i(this.domElements.markerSelector).empty();
}
if(!this.formBuilder.editMode){
this.domElements.markerSelectorWrap.style.display="none";
$$i(this.domElements.markerSelector).on("click", ".mapsvg-marker-image-btn-choose", function (e){
e.preventDefault();
const src=$$i(this).find("img").attr("src");
$$i(_this.domElements.markerSelectorWrap).hide();
$$i(_this.domElements.markerSelector).find(".active").removeClass("active");
$$i(this).addClass("active");
$$i(_this.domElements.main)
.find(".mapsvg-marker-image-btn-trigger")
.toggleClass("active", false);
$$i(_this.domElements.markerImageButton).attr("src", src);
_this.setMarkerImage(src);
});
}
$$i(this.domElements.markerSelector).html(images.join(""));
}
setMarkerImage(src){
this.setDefaultMarkerPath(src);
const value=this.value;
if(value){
value.img=src;
value.imagePath=src;
this.setValue(value);
this.triggerChanged();
this.renderMarker();
}}
toggleMarkerSelectorInLocationEditor(jQueryObj, e){
e.preventDefault();
const _this=this;
if(jQueryObj.data("markerSelector")&&jQueryObj.data("markerSelector").is(":visible")){
jQueryObj.data("markerSelector").hide();
return;
}
if(jQueryObj.data("markerSelector")&&jQueryObj.data("markerSelector").not(":visible")){
jQueryObj.data("markerSelector").show();
return;
}
const markerBtn=$$i(this).closest("td").find(".mapsvg-marker-image-btn-trigger");
const currentImage=markerBtn.attr("src");
const images=MapSVG.markerImages.map(function (image){
return ('<button class="btn btn-outline-secondary mapsvg-marker-image-btn mapsvg-marker-image-btn-choose ' +
(currentImage==image.relativeUrl ? "active":"") +
'"><img src="' +
image.relativeUrl +
'" /></button>');
});
if(!jQueryObj.data("markerSelector")){
const ms=$$i('<div class="mapsvg-marker-image-selector"></div>');
jQueryObj.closest("td").append(ms);
jQueryObj.data("markerSelector", ms);
}else{
jQueryObj.data("markerSelector").empty();
}
jQueryObj.data("markerSelector").html(images.join(""));
jQueryObj
.data("markerSelector")
.on("click", ".mapsvg-marker-image-btn-choose", function (e){
e.preventDefault();
const src=$$i(this).find("img").attr("src");
jQueryObj.data("markerSelector").hide();
const td=$$i(this).closest("td");
const fieldId=$$i(this).closest("tr").data("option-id");
const btn=td.find(".mapsvg-marker-image-btn-trigger");
btn.toggleClass("active", false);
btn.find("img").attr("src", src);
_this.setMarkerByField(fieldId, src);
});
}
setMarkersByField(options){
this.markersByField=options;
}
resetMarkersByField(){
this.markersByField={};}
setMarkerByField(fieldId, markerImg){
this.markersByField=this.markersByField||{};
this.markersByField[fieldId]=markerImg;
}
deleteMarker(){
$$i(this.domElements.main).find(".mapsvg-new-marker").hide();
$$i(this.domElements.main).find(".mapsvg-marker-id").attr("disabled", "disabled");
}
destroy(){
if($$i().mselect2){
const sel=$$i(this.domElements.main).find(".mapsvg-select2");
if(sel.length){
sel.mselect2("destroy");
}}
this.domElements.markerSelector&&$$i(this.domElements.markerSelector).popover("dispose");
}
setDefaultMarkerPath(path){
this.defaultMarkerPath=path;
this.formBuilder.mapsvg.setDefaultMarkerImage(path);
}
getMarkerImage(data){
let fieldValue;
if(this.markersByFieldEnabled){
fieldValue=data[this.markerField];
if(!fieldValue){
return this.defaultMarkerPath||MapSVG.defaultMarkerImage;
}else{
if(this.markerField==="regions"){
fieldValue=fieldValue[0]&&fieldValue[0].id;
}
else if(typeof fieldValue==="object"&&fieldValue.length){
fieldValue=fieldValue[0].value;
}
if(this.markersByField[fieldValue]){
return (this.markersByField[fieldValue] ||
this.defaultMarkerPath ||
MapSVG.defaultMarkerImage);
}}
}else{
return this.defaultMarkerPath||MapSVG.defaultMarkerImage;
}}
setValue(value, updateInput=true){
this.value=value;
if(this.value){
if(!this.value.address){
this.value.address={};}
if(Object.keys(this.value.address).length < 2&&this.value.geoPoint){
this.value.address.formatted =
this.value.geoPoint.lat + "," + this.value.geoPoint.lng;
}}
this.renderMarker();
}}
const $$j=jQuery;
class ModalFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.showButtonText=options.showButtonText;
}
getSchema(){
const schema=super.getSchema();
schema.showButtonText=this.showButtonText;
return schema;
}}
const $$k=jQuery;
class PostFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
if(this.formBuilder.admin)
this.post_types=this.formBuilder.admin.getPostTypes();
this.post_type=options.post_type||this.post_types[0];
this.add_fields=MapSVG.parseBoolean(options.add_fields);
this.db_type="int(11)";
this.name="post";
this.post=options.post;
}
setDomElements(){
super.setDomElements();
this.inputs.postSelect=($$k(this.domElements.main).find(".mapsvg-find-post")[0]);
}
getSchema(){
const schema=super.getSchema();
schema.post_type=this.post_type;
schema.add_fields=this.add_fields;
return schema;
}
destroy(){
if($$k().mselect2){
const sel=$$k(this.domElements.main).find(".mapsvg-select2");
if(sel.length){
sel.mselect2("destroy");
}}
}
getDataForTemplate(){
const data=super.getDataForTemplate();
if(this.formBuilder.admin)
data.post_types=this.formBuilder.admin.getPostTypes();
data.post_type=this.post_type;
data.post=this.post;
data.add_fields=this.add_fields||0;
return data;
}
setEventHandlers(){
super.setEventHandlers();
const server=new Server();
$$k(this.inputs.postSelect)
.mselect2({
placeholder: "Search post by title",
allowClear: true,
disabled: this.readonly,
ajax: {
url: server.getUrl("posts"),
dataType: "json",
delay: 250,
data: (params)=> {
return {
filters: { post_type: this.post_type },
search: params.term,
page: params.page,
};},
processResults: (data, params)=> {
params.page=params.page||1;
return {
results: data.posts ? data.posts:[],
pagination: {
more: false,
},
};},
cache: true,
},
escapeMarkup: (markup)=> {
return markup;
},
minimumInputLength: 1,
templateResult: this.formatRepo,
templateSelection: this.formatRepoSelection,
})
.on("select2:select", (e)=> {
const post=e.params.data;
this.setValue(post);
this.setInputValue(post);
this.triggerChanged();
})
.on("change", (e)=> {
if(e.target.value===""){
$$k(this.domElements.main).find(".mapsvg-post-id").text("");
$$k(this.domElements.main).find(".mapsvg-post-url").text("");
this.setValue(null, false);
this.triggerChanged();
}});
}
formatRepo(repo){
if(repo.loading){
return repo.text;
}else{
return "<div class='select2-result-repository clearfix'>" + repo.post_title + "</div>";
}}
formatRepoSelection(repo){
return repo.post_title||repo.text;
}
setValue(post, updateInput=true){
this.value=post;
if(updateInput){
this.setInputValue(post);
}}
setInputValue(post){
$$k(this.domElements.main).find(".mapsvg-post-id").text(post.id);
$$k(this.domElements.main).find(".mapsvg-post-url").text(post.url).attr("href", post.url);
}}
const $$l=jQuery;
class RadioFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.setOptions(options.options);
}
setDomElements(){
super.setDomElements();
this.inputs.radios=this.formBuilder.getForm().elements[this.name];
this.$radios=$$l(this.domElements.main).find('input[type="radio"]');
}
setEventHandlers(){
super.setEventHandlers();
this.$radios.on("change", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
setInputValue(value){
if(value===null){
this.$radios.prop("checked", false);
}else{
this.inputs.radios.value=value;
}}
}
const $$m=jQuery;
class RegionsFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchable=MapSVG.parseBoolean(options.searchable);
this.options=this.formBuilder.getRegionsList();
this.label=options.label===undefined ? "Regions":options.label;
this.name="regions";
this.db_type="text";
if(typeof this.value==="undefined"){
this.value=[];
}
this.regionsTableName=this.formBuilder.mapsvg.regionsRepository.getSchema().name;
}
setDomElements(){
super.setDomElements();
this.inputs.select=$$m(this.domElements.main).find("select")[0];
}
getData(){
return { name: "regions", value: this.value };}
getSchema(){
const schema=super.getSchema();
if(schema.multiselect)
schema.db_type="text";
const opts=$$m.extend(true, {}, { options: this.options });
schema.options=opts.options;
schema.optionsDict={};
schema.options.forEach(function (option){
schema.optionsDict[option.id]=option.title||option.id;
});
return schema;
}
getDataForTemplate(){
const data=super.getDataForTemplate();
data.regionsTableName=this.regionsTableName;
data.regionsFromCurrentTable=this.getRegionsForCurrentTable();
return data;
}
getRegionsForCurrentTable(){
return this.value
? this.value.filter((region)=> region.tableName===this.regionsTableName)
: [];
}
setEventHandlers(){
super.setEventHandlers();
$$m(this.inputs.select).on("change", (e)=> {
const selectedOptions=Array.from(this.inputs.select.selectedOptions);
const selectedValues=selectedOptions.map((option)=> option.value);
this.setValue(selectedValues, false);
this.triggerChanged();
});
}
destroy(){
if($$m().mselect2){
const sel=$$m(this.domElements.main).find(".mapsvg-select2");
if(sel.length){
sel.mselect2("destroy");
}}
}
setValue(regionIds, updateInput=true){
const regionsFromOtherTables=this.value.filter((region)=> region.tableName!==this.regionsTableName);
const regions=[];
regionIds.forEach((regionId)=> {
const region=this.formBuilder.mapsvg.getRegion(regionId);
regions.push({ id: region.id, title: region.title, tableName: this.regionsTableName });
});
this.value=regions.concat(regionsFromOtherTables);
if(updateInput){
this.setInputValue(regionIds);
}}
}
const $$n=jQuery;
class SaveFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.readonly=true;
}
setDomElements(){
super.setDomElements();
this.inputs.btnSave=$$n(this.domElements.main).find(".btn-save")[0];
this.inputs.btnClose=$$n(this.domElements.main).find(".mapsvg-close")[0];
}
setEventHandlers(){
super.setEventHandlers();
$$n(this.inputs.btnSave).on("click", (e)=> {
e.preventDefault();
this.events.trigger("click.btn.save");
});
$$n(this.inputs.btnClose).on("click", (e)=> {
e.preventDefault();
this.events.trigger("click.btn.close");
});
}}
const $$o=jQuery;
class SearchFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchFallback=MapSVG.parseBoolean(options.searchFallback)||false;
this.width=options.width||"100%";
this.name="search";
}
setDomElements(){
super.setDomElements();
this.inputs.text=$$o(this.domElements.main).find("input")[0];
}
setEventHandlers(){
super.setEventHandlers();
$$o(this.inputs.text).on("change keyup paste", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
setInputValue(value){
this.inputs.text.value=value;
}
getSchema(){
const schema=super.getSchema();
schema.searchFallback=MapSVG.parseBoolean(this.searchFallback);
schema.placeholder=this.placeholder;
schema.width=this.width;
return schema;
}}
const $$p=jQuery;
class SelectFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchable=MapSVG.parseBoolean(options.searchable);
this.multiselect=MapSVG.parseBoolean(options.multiselect);
this.optionsGrouped=options.optionsGrouped;
this.db_type=this.multiselect ? "text":"varchar(255)";
this.setOptions(options.options);
}
setDomElements(){
super.setDomElements();
this.inputs.select=$$p(this.domElements.main).find("select")[0];
}
getSchema(){
const schema=super.getSchema();
schema.multiselect=MapSVG.parseBoolean(this.multiselect);
if(schema.multiselect)
schema.db_type="text";
schema.optionsGrouped=this.optionsGrouped;
const opts=$$p.extend(true, {}, { options: this.options });
schema.options=opts.options||[];
schema.optionsDict={};
schema.options.forEach(function (option){
schema.optionsDict[option.value]=option.label;
});
return schema;
}
setEventHandlers(){
super.setEventHandlers();
$$p(this.inputs.select).on("change", (e)=> {
if(this.multiselect){
const selectedOptions=Array.from(this.inputs.select.selectedOptions);
const selectedValues=selectedOptions.map((option)=> {
return { label: option.label, value: option.value };});
this.setValue(selectedValues, false);
this.triggerChanged();
}else{
this.setValue(this.inputs.select.value, false);
this.triggerChanged();
}});
}
addSelect2(){
if($$p().mselect2){
const select2Options={};
if(this.formBuilder.filtersMode&&this.type=="select"){
select2Options.placeholder=this.placeholder;
if(!this.multiselect){
select2Options.allowClear=true;
}}
$$p(this.domElements.main)
.find("select")
.css({ width: "100%", display: "block" })
.mselect2(select2Options)
.on("select2:focus", function (){
$$p(this).mselect2("open");
});
$$p(this.domElements.main)
.find(".select2-selection--multiple .select2-search__field")
.css("width", "100%");
}}
setOptions(options){
if(options){
this.options=[];
this.optionsDict={};
options.forEach((value, key)=> {
this.options.push(value);
if(this.optionsGrouped){
value.options.forEach((value2, key2)=> {
this.optionsDict[value2.value]=value2;
});
}else{
this.optionsDict[key]=value;
}});
return this.options;
}else{
return this.setOptions([
{ label: "Option one", name: "option_one", value: 1 },
{ label: "Option two", name: "option_two", value: 2 },
]);
}}
setInputValue(value){
if(this.multiselect){
if(this.value){
$$p(this.inputs.select).val(this.value.map((el)=> el.value));
}else{
$$p(this.inputs.select).val([]);
}}else{
this.inputs.select.value=this.value;
}
$$p(this.inputs.select).trigger("change.select2");
}}
const $$q=jQuery;
class StatusFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.label=options.label||"Status";
this.name="status";
this.setOptions(options.options);
}
setDomElements(){
super.setDomElements();
this.inputs.select=$$q(this.domElements.main).find("select")[0];
if($$q().colorpicker){
$$q(this.domElements.main)
.find(".cpicker")
.colorpicker()
.on("changeColor.colorpicker", function (event){
const input=$$q(this).find("input");
if(input.val()=="")
$$q(this).find("i").css({ "background-color": "" });
});
this.domElements.edit &&
$$q(this.domElements.edit)
.find(".cpicker")
.colorpicker()
.on("changeColor.colorpicker", function (event){
const input=$$q(this).find("input");
if(input.val()=="")
$$q(this).find("i").css({ "background-color": "" });
});
}}
destroy(){
if($$q().mselect2){
const sel=$$q(this.domElements.main).find(".mapsvg-select2");
if(sel.length){
sel.mselect2("destroy");
}}
}
setEditorEventHandlers(){
super.setEditorEventHandlers();
const _this=this;
$$q(this.domElements.edit).on("keyup change paste", ".mapsvg-edit-status-row input", function (){
_this.mayBeAddStatusRow();
});
}
initEditor(){
super.initEditor();
const _this=this;
$$q(_this.domElements.edit)
.find(".cpicker")
.colorpicker()
.on("changeColor.colorpicker", function (event){
const input=$$q(this).find("input");
const index=$$q(this).closest("tr").index();
if(input.val()=="")
$$q(this).find("i").css({ "background-color": "" });
_this.options[index]=_this.options[index]||{
label: "",
value: "",
color: "",
disabled: false,
};
_this.options[index]["color"]=input.val();
});
_this.mayBeAddStatusRow();
}
mayBeAddStatusRow(){
const _this=this;
const editStatusRow=$$q($$q("#mapsvg-edit-status-row").html());
const z=$$q(_this.domElements.edit).find(".mapsvg-edit-status-label:last-child");
if(z&&z.last()&&z.last().val()&&(z.last().val() + "").trim().length){
const newRow=editStatusRow.clone();
newRow.insertAfter($$q(_this.domElements.edit).find(".mapsvg-edit-status-row:last-child"));
newRow
.find(".cpicker")
.colorpicker()
.on("changeColor.colorpicker", function (event){
const input=$$q(this).find("input");
const index=$$q(this).closest("tr").index();
if(input.val()=="")
$$q(this).find("i").css({ "background-color": "" });
_this.options[index]=_this.options[index]||{
label: "",
value: "",
color: "",
disabled: false,
};
_this.options[index]["color"]=input.val();
});
}
const rows=$$q(_this.domElements.edit).find(".mapsvg-edit-status-row");
const row1=rows.eq(rows.length - 2);
const row2=rows.eq(rows.length - 1);
if(row1.length &&
row2.length &&
!(row1.find("input:eq(0)").val().toString().trim() ||
row1.find("input:eq(1)").val().toString().trim() ||
row1.find("input:eq(2)").val().toString().trim()) &&
!(row2.find("input:eq(0)").val().toString().trim() ||
row2.find("input:eq(1)").val().toString().trim() ||
row2.find("input:eq(2)").val().toString().trim())){
row2.remove();
}}
setEventHandlers(){
super.setEventHandlers();
$$q(this.inputs.select).on("change keyup paste", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
getSchema(){
const schema=super.getSchema();
const opts=$$q.extend(true, {}, { options: this.options });
schema.options=opts.options;
schema.optionsDict={};
schema.options.forEach(function (option, index){
if(schema.options[index].value===""){
schema.options.splice(index, 1);
}else{
schema.options[index].disabled=MapSVG.parseBoolean(schema.options[index].disabled);
schema.optionsDict[option.value]=option;
}});
return schema;
}
setInputValue(value){
this.inputs.select.value=value;
}}
const $$r=jQuery;
class TextareaFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchType=options.searchType||"fulltext";
this.searchable=MapSVG.parseBoolean(options.searchable);
this.autobr=options.autobr;
this.html=options.html;
this.db_type="text";
}
setDomElements(){
super.setDomElements();
this.inputs.textarea=$$r(this.domElements.main).find("textarea")[0];
if(this.html){
this.editor=CodeMirror.fromTextArea(this.inputs.textarea, {
mode: { name: "handlebars", base: "text/html" },
matchBrackets: true,
lineNumbers: true,
});
if(this.formBuilder.admin){
this.editor.on("change", this.setTextareaValue);
}}
}
setEventHandlers(){
super.setEventHandlers();
$$r(this.inputs.textarea).on("change keyup paste", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
getSchema(){
const schema=super.getSchema();
schema.autobr=this.autobr;
schema.html=this.html;
return schema;
}
getDataForTemplate(){
const data=super.getDataForTemplate();
data.html=this.html;
return data;
}
setTextareaValue(codemirror, changeobj){
const handler=codemirror.getValue();
const textarea=$$r(codemirror.getTextArea());
textarea.val(handler).trigger("change");
}
destroy(){
const cm=$$r(this.domElements.main).find(".CodeMirror");
if(cm.length){
cm.empty().remove();
}}
}
const $$s=jQuery;
class TextFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchFallback=MapSVG.parseBoolean(options.searchFallback);
this.searchType=options.searchType;
this.width =
this.formBuilder.filtersHide&&!this.formBuilder.modal
? null
: options.width||"100%";
this.db_type="varchar(255)";
}
setDomElements(){
super.setDomElements();
this.inputs.text=$$s(this.domElements.main).find('input[type="text"]')[0];
}
getSchema(){
const schema=super.getSchema();
schema.searchType=this.searchType;
return schema;
}
setEventHandlers(){
super.setEventHandlers();
$$s(this.inputs.text).on("change keyup paste", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
setInputValue(value){
this.inputs.text.value=value;
}}
const $$t=jQuery;
class TitleFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchFallback=MapSVG.parseBoolean(options.searchFallback);
this.width =
this.formBuilder.filtersHide&&!this.formBuilder.modal
? null
: options.width||"100%";
this.db_type="varchar(255)";
}
setDomElements(){
super.setDomElements();
this.inputs.text=$$t(this.domElements.main).find('input[type="text"]')[0];
}
getSchema(){
const schema=super.getSchema();
schema.searchType=this.searchType;
return schema;
}
setEventHandlers(){
super.setEventHandlers();
$$t(this.inputs.text).on("change keyup paste", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
}
setInputValue(value){
this.inputs.text.value=value;
}}
const $$u=jQuery;
class ColorPickerFormElement extends FormElement {
constructor(options, formBuilder, external){
super(options, formBuilder, external);
this.searchFallback=MapSVG.parseBoolean(options.searchFallback);
this.width =
this.formBuilder.filtersHide&&!this.formBuilder.modal
? null
: options.width||"100%";
this.db_type="varchar(255)";
}
setDomElements(){
super.setDomElements();
this.inputs.text=$$u(this.domElements.main).find("input.cpicker")[0];
$$u(this.domElements.main).find(".colorpicker-element").colorpicker();
}
getSchema(){
const schema=super.getSchema();
schema.searchType=this.searchType;
return schema;
}
setEventHandlers(){
super.setEventHandlers();
$$u(this.inputs.text).on("change keyup paste", (e)=> {
this.setValue(e.target.value, false);
this.triggerChanged();
});
$$u(this.domElements.main).find(".colorpicker-element").colorpicker().on("changeColor.colorpicker", (e)=> {
this.setValue(this.inputs.text.value, false);
this.triggerChanged();
});
}
setInputValue(value){
this.inputs.text.value=value;
}}
const $$v=jQuery;
class FormElementFactory {
constructor(options){
this.mapsvg=options.mapsvg;
this.editMode=options.editMode;
this.filtersMode=options.filtersMode;
this.namespace=options.namespace;
this.mediaUploader=options.mediaUploader;
this.formBuilder=options.formBuilder;
this.showNames=options.showNames!==false;
}
create(options){
const types={
checkbox: CheckboxFormElement,
checkboxes: CheckboxesFormElement,
date: DateFormElement,
distance: DistanceFormElement,
empty: EmptyFormElement,
id: IdFormElement,
image: ImagesFormElement,
location: LocationFormElement,
modal: ModalFormElement,
post: PostFormElement,
radio: RadioFormElement,
region: RegionsFormElement,
save: SaveFormElement,
search: SearchFormElement,
select: SelectFormElement,
status: StatusFormElement,
text: TextFormElement,
textarea: TextareaFormElement,
title: TitleFormElement,
colorpicker: ColorPickerFormElement,
};
const formElement=new types[options.type](options, this.formBuilder, this.getExtraParams());
formElement.init();
return formElement;
}
getExtraParams(){
const databaseFields=[];
const databaseFieldsFilterable=[];
const databaseFieldsFilterableShort=[];
const regionFields=[];
const regionFieldsFilterable=[];
const regions=new ArrayIndexed("id");
let mapIsGeo=false;
if(this.mapsvg){
mapIsGeo=this.mapsvg.isGeo();
const schemaObjects=this.mapsvg.objectsRepository.getSchema();
if(schemaObjects){
schemaObjects.getFields().forEach(function (obj){
if(obj.type=="text" ||
obj.type=="region" ||
obj.type=="textarea" ||
obj.type=="post" ||
obj.type=="select" ||
obj.type=="radio" ||
obj.type=="checkbox"){
if(obj.type=="post"){
databaseFields.push("Object.post.post_title");
}else{
databaseFields.push("Object." + obj.name);
}}
if(obj.type=="region"||obj.type=="select"||obj.type=="radio"){
databaseFieldsFilterable.push("Object." + obj.name);
databaseFieldsFilterableShort.push(obj.name);
}});
}
const schemaRegions=this.mapsvg.regionsRepository.getSchema();
if(schemaRegions){
schemaRegions.getFieldsAsArray().forEach(function (obj){
if(obj.type=="status" ||
obj.type=="text" ||
obj.type=="textarea" ||
obj.type=="post" ||
obj.type=="select" ||
obj.type=="radio" ||
obj.type=="checkbox"){
if(obj.type=="post"){
regionFields.push("Region.post.post_title");
}else{
regionFields.push("Region." + obj.name);
}}
if(obj.type=="status"||obj.type=="select"||obj.type=="radio"){
regionFieldsFilterable.push("Region." + obj.name);
}});
}
this.mapsvg.regions.forEach((region)=> {
regions.push({ id: region.id, title: region.title });
});
}
return {
databaseFields: databaseFields,
databaseFieldsFilterable: databaseFieldsFilterable,
databaseFieldsFilterableShort: databaseFieldsFilterableShort,
regionFields: regionFields,
regionFieldsFilterable: regionFieldsFilterable,
regions: regions,
mapIsGeo: mapIsGeo,
mediaUploader: this.mediaUploader,
filtersMode: this.filtersMode,
showNames: this.showNames,
};}}
const $$w=jQuery;
class FormBuilder {
constructor(options){
const _this=this;
this.events=new Events();
this.container=options.container;
this.namespace=options.namespace;
this.mediaUploader=options.mediaUploader;
this.schema=options.schema||[];
this.editMode=options.editMode==undefined ? false:options.editMode;
this.filtersMode=options.filtersMode==undefined ? false:options.filtersMode;
this.filtersHide=options.filtersHide==undefined ? false:options.filtersHide;
this.modal=options.modal==undefined ? false:options.modal;
this.admin=options.admin;
this.mapsvg=options.mapsvg;
this.data=options.data||{};
this.clearButton=options.clearButton||false;
this.clearButtonText=options.clearButtonText||"";
this.searchButton=options.searchButton||false;
this.searchButtonText=options.searchButtonText||"";
this.showButtonText=options.showButtonText||"";
this.scrollable =
typeof options.scrollable!=="undefined"
? options.scrollable
: !_this.editMode&&!_this.filtersMode;
this.showNames=typeof options.showNames!=="undefined" ? options.showNames:true;
this.formElementFactory=new FormElementFactory({
mapsvg: this.mapsvg,
formBuilder: this,
mediaUploader: this.mediaUploader,
editMode: this.editMode,
filtersMode: this.filtersMode,
namespace: this.namespace,
showNames: this.showNames,
});
this.events=new Events(this);
if(options.events&&Object.keys(options.events).length > 0){
for (const eventName in options.events){
this.events.on(eventName, options.events[eventName]);
}}
this.template="form-builder";
this.closeOnSave=options.closeOnSave===true;
this.newRecord=options.newRecord===true;
this.types=options.types||[
"text",
"textarea",
"checkbox",
"radio",
"select",
"image",
"region",
"location",
"post",
"date",
];
this.templates={};
this.elements={};
this.view=$$w("<div />").addClass("mapsvg-form-builder")[0];
if(this.editMode)
$$w(this.view).addClass("full-flex");
if(!this.showNames){
$$w(this.view).addClass("hide-names");
}
this.formElements=new ArrayIndexed("name");
if(!MapSVG.templatesLoaded[this.template]){
this.loadTemplates(()=> this.init());
}else{
this.init();
}}
loadTemplates(callback){
$$w.get(MapSVG.urls.root + "dist/" + this.template + ".html?v=" + MapSVG.version, (data)=> {
$$w(data).appendTo("body");
MapSVG.templatesLoaded[this.template]=true;
Handlebars.registerPartial("dataMarkerPartial", $$w("#mapsvg-data-tmpl-marker").html());
if(this.editMode){
Handlebars.registerPartial("markerByFieldPartial", $$w("#mapsvg-markers-by-field-tmpl-partial").html());
}
callback();
});
}
init(){
const _this=this;
MapSVG.formBuilder=this;
this.form=document.createElement("form");
this.form.className="mapsvg-data-form-view";
if(!this.filtersMode){
this.form.classList.add("form-horizontal");
}
if(this.editMode){
const template=document.getElementById("mapsvg-form-editor-tmpl-ui").innerHTML;
const templateCompiled=Handlebars.compile(template);
this.view.innerHTML=templateCompiled({ types: this.types });
this.view.classList.add("edit");
this.form.classList.add("mapsvg-data-flex-full");
this.form.classList.add("mapsvg-data-container");
$$w(this.view).find(".mapsvg-data-preview").prepend(this.form);
this.formEditor=$$w(this.view).find("#mapsvg-data-form-edit")[0];
}else{
this.view.appendChild(this.form);
}
_this.elements={
buttons: {
text: $$w(_this.view).find("#mapsvg-data-btn-text")[0],
textarea: $$w(_this.view).find("#mapsvg-data-btn-textarea")[0],
checkbox: $$w(_this.view).find("#mapsvg-data-btn-checkbox")[0],
radio: $$w(_this.view).find("#mapsvg-data-btn-radio")[0],
select: $$w(_this.view).find("#mapsvg-data-btn-select")[0],
image: $$w(_this.view).find("#mapsvg-data-btn-image")[0],
region: $$w(_this.view).find("#mapsvg-data-btn-region")[0],
marker: $$w(_this.view).find("#mapsvg-data-btn-marker")[0],
saveSchema: $$w(_this.view).find("#mapsvg-data-btn-save-schema")[0],
},
containers: {
buttons_add: $$w(_this.view).find("#mapsvg-data-buttons-add")[0],
},
};
_this.redraw();
}
getForm(){
return this.form;
}
getFormEditor(){
return this.formEditor;
}
viewDidLoad(){ }
setEventHandlers(){
const _this=this;
$$w(this.getForm()).on("submit", (e)=> {
e.preventDefault();
});
if(this.filtersMode&&this.clearButton){
$$w(this.elements.buttons.clearButton).on("click", (e)=> {
e.preventDefault();
this.clearAllFields();
});
}
$$w(window)
.off("keydown.form.mapsvg")
.on("keydown.form.mapsvg", function (e){
if(MapSVG.formBuilder){
if((e.metaKey||e.ctrlKey)&&e.keyCode==13)
MapSVG.formBuilder.save();
else if(e.keyCode==27)
MapSVG.formBuilder.close();
}});
if(this.editMode){
$$w(this.view).on("click", "#mapsvg-data-buttons-add button", function (e){
e.preventDefault();
const type=$$w(this).data("create");
const formElement=_this.formElementFactory.create({ type: type });
_this.addField(formElement);
});
$$w(this.view).on("click", "#mapsvg-data-btn-save-schema", function (e){
e.preventDefault();
const fields=_this.getSchema();
const counts={};
_this.formElements.forEach(function (elem){
counts[elem.name]=(counts[elem.name]||0) + 1;
});
$$w(_this.getForm()).find(".form-group").removeClass("has-error");
const errors=[];
const reservedFields=[
"lat",
"lon",
"lng",
"location",
"location_lat",
"location_lon",
"location_lng",
"location_address",
"location_img",
"marker",
"marker_id",
"regions",
"region_id",
"post",
"post_title",
"post_url",
"keywords",
"status",
];
const reservedFieldsToTypes={
regions: "region",
status: "status",
post: "post",
marker: "marker",
location: "location",
};
let errUnique, errEmpty;
_this.formElements.forEach(function (formElement, index){
let err=false;
if(!_this.filtersMode){
if(counts[formElement.name] > 1){
if(!errUnique){
errUnique="Field names should be unique";
errors.push(errUnique);
err=true;
}}
else if(formElement.name.length===0){
if(!errEmpty){
errEmpty="Field name can't be empty";
errors.push(errEmpty);
err=true;
}}
else if(reservedFields.indexOf(formElement.name)!=-1){
if(!reservedFieldsToTypes[formElement.name] ||
(reservedFieldsToTypes[formElement.name] &&
reservedFieldsToTypes[formElement.name]!=formElement.type)){
const msg='Field name "' +
formElement.name +
'" is reserved, please set another name';
errors.push(msg);
err=true;
}}
}
if(formElement.options &&
formElement.type!="region" &&
formElement.type!="marker"){
const vals=formElement.options.map(function (obj){
return obj.value;
});
const uniq=[...Array.from(new Set(vals).values())];
if(vals.length!=uniq.length){
errors.push('Check "Options" list - values should not repeat');
err=true;
}}
err&&$$w(formElement.domElements.main).addClass("has-error");
});
if(errors.length===0){
_this.events.trigger("saveSchema", _this, [_this, fields]);
}else{
jQuery.growl.error({ title: "Errors", message: errors.join("<br />") });
}});
setTimeout(function (){
const el=_this.getForm();
_this.sortable=new Sortable(el, {
animation: 150,
onStart: function (){
$$w(_this.getForm()).addClass("sorting");
},
onEnd: function (){
setTimeout(function (){
$$w(_this.getForm()).removeClass("sorting");
_this.formElements.clear();
$$w(el)
.find(".form-group")
.each(function (index, elem){
_this.formElements.push($$w(elem).data("formElement"));
});
}, 500);
},
});
}, 1000);
}
new ResizeSensor(this.view, function (){
_this.scrollApi&&_this.scrollApi.reinitialise();
});
}
clearAllFields(){
this.formElements.forEach((f)=> f.setValue(null));
this.events.trigger("cleared");
}
setFormElementEventHandlers(formElement){
if(this.editMode){
formElement.events.on("click", (elem)=> {
this.edit(elem);
});
formElement.events.on("delete", (elem)=> {
this.deleteField(elem);
});
}else{
formElement.events.on("changed", (_formElement)=> {
const name=_formElement.name;
const value=_formElement.getValue();
if(_formElement.type!=="search"){
this.events.trigger("changed.field", _formElement, [_formElement, name, value]);
}else{
this.events.trigger("changed.search", _formElement, [_formElement, value]);
}});
}}
save(){
const _this=this;
if(_this.markerBackup){
const marker=_this.mapsvg.getEditingMarker();
marker.events.off("change");
_this.markerBackup=marker.getOptions();
_this.mapsvg.unsetEditingMarker();
}
const data=_this.getData();
_this.saved=true;
this.events.trigger("save", _this, [_this, data]);
}
getFormElementByType(type){
return this.formElements.find((el)=> el.type===type);
}
getData(){
const data={};
this.formElements.forEach((formElement)=> {
if(formElement.readonly===false||formElement.type==="id"){
const _formElementData=formElement.getData();
data[_formElementData.name]=_formElementData.value;
}});
return data;
}
reset(){
this.formElements.forEach((formElement)=> {
formElement.setValue(null);
});
}
update(data){
this.schema.getFields().forEach((field)=> {
const formElement=this.formElements.get(field.name);
if(formElement){
if(typeof data[field.name]!=="undefined"){
if(formElement.getValue()!==data[field.name]){
formElement.setValue(data[field.name]);
}}else{
formElement.setValue(null);
}}
});
}
redraw(){
const _this=this;
delete _this.markerBackup;
$$w(this.container).empty();
$$w(this.getForm()).empty();
this.formElements.clear();
this.schema &&
this.schema.fields.length > 0 &&
this.schema.fields.forEach((fieldSettings)=> {
if(this.filtersMode){
if(fieldSettings.type=="distance"){
fieldSettings.value=this.data.distance
? this.data.distance
: fieldSettings.value!==undefined
? fieldSettings.value
: null;
}else{
fieldSettings.value=this.data[fieldSettings.parameterNameShort];
}}else{
fieldSettings.value=this.data
? this.data[fieldSettings.name]
: fieldSettings.value!==undefined
? fieldSettings.value
: null;
}
if(fieldSettings.type=="location"&&!this.editMode){
if(fieldSettings.value &&
fieldSettings.value.marker &&
fieldSettings.value.marker.id) ;
this.admin&&this.admin.setMode&&this.admin.setMode("editMarkers");
this.admin&&this.admin.enableMarkersMode(true);
}
else if(fieldSettings.type=="post"){
fieldSettings.post=this.data["post"];
}
else if(fieldSettings.type==="region"){
fieldSettings.options=new ArrayIndexed("id", this.getRegionsList());
}
const formElement=this.formElementFactory.create(fieldSettings);
if(this.filtersMode){
if(!this.filtersHide ||
(this.filtersHide&&this.modal&&fieldSettings.type!=="search") ||
(!this.modal&&fieldSettings.type==="search")){
this.addField(formElement);
}}else{
this.addField(formElement);
}});
if(!_this.editMode){
if(this.schema.fields.length===0&&!this.filtersMode){
const formElement=this.formElementFactory.create({ type: "empty" });
_this.addField(formElement);
}else{
if(_this.admin&&!_this.admin.isMetabox){
const formElement=this.formElementFactory.create({ type: "save" });
formElement.events.on("click.btn.save", ()=> {
this.save();
});
formElement.events.on("click.btn.close", ()=> {
this.close();
});
_this.addField(formElement);
}}
}
if(_this.filtersMode&&_this.filtersHide&&!_this.modal){
const formElement=this.formElementFactory.create({
type: "modal",
showButtonText: _this.showButtonText,
});
this.showFiltersButton=_this.addField(formElement);
}
if(this.scrollable){
const nano=$$w('<div class="nano"></div>');
const nanoContent=$$w('<div class="nano-content"></div>');
nano.append(nanoContent);
nanoContent.append(this.view);
$$w(_this.container).append(nano);
nano.jScrollPane({ contentWidth: "0px", mouseWheelSpeed: 30 });
_this.scrollApi=nano.data("jsp");
}else{
$$w(_this.container).append(this.view);
}
if(_this.filtersMode&&_this.clearButton){
_this.elements.buttons.clearButton=$$w('<div class="form-group mapsvg-filters-reset-container">' +
'<button type="button" class="btn btn-outline-secondary mapsvg-filters-reset">' +
_this.clearButtonText +
"</button></div>")[0];
$$w(this.getForm()).append(_this.elements.buttons.clearButton);
}
if(_this.filtersMode&&_this.searchButton){
_this.elements.buttons.searchButton=$$w('<div class="form-group mapsvg-filters-reset-container" id="mapsvg-search-container"><button class="btn btn-outline-secondary mapsvg-filters-reset">' +
_this.searchButtonText +
"</button></div>")[0];
$$w(this.getForm()).append(_this.elements.buttons.searchButton);
}
if(!this.editMode&&!_this.filtersMode)
$$w(this.view).find("input:visible,textarea:visible").not(".tt-hint").first().focus();
const cm=$$w(this.container).find(".CodeMirror");
cm.each(function (index, el){
el&&el.CodeMirror.refresh();
});
_this.setEventHandlers();
this.events.trigger("init", this, [this, this.getData()]);
this.events.trigger("loaded", this, [this]);
}
updateExtraParamsInFormElements(){
this.formElements.forEach((formElement)=> {
formElement.setExternal(this.formElementFactory.getExtraParams());
if(formElement.type==="location"){
formElement.redraw();
}});
}
deleteField(formElement){
const _this=this;
_this.formElements.delete(formElement.name);
}
getExtraParams(){
const databaseFields=[];
this.mapsvg.objectsRepository
.getSchema()
.getFields()
.forEach(function (obj){
if(obj.type=="text" ||
obj.type=="region" ||
obj.type=="textarea" ||
obj.type=="post" ||
obj.type=="select" ||
obj.type=="radio" ||
obj.type=="checkbox"){
if(obj.type=="post"){
databaseFields.push("Object.post.post_title");
}else{
databaseFields.push("Object." + obj.name);
}}
});
let databaseFieldsFilterableShort=[];
databaseFieldsFilterableShort=this.mapsvg.objectsRepository
.getSchema()
.getFieldsAsArray()
.filter(function (obj){
return obj.type=="select"||obj.type=="radio"||obj.type=="region";
})
.map(function (obj){
return obj.name;
});
let markerFieldsShort=[];
markerFieldsShort=databaseFieldsFilterableShort.filter((o)=> o.type==="select"||o.type==="radio");
const regionFields=this.mapsvg.regionsRepository
.getSchema()
.getFieldsAsArray()
.map(function (obj){
if(obj.type=="status" ||
obj.type=="text" ||
obj.type=="textarea" ||
obj.type=="post" ||
obj.type=="select" ||
obj.type=="radio" ||
obj.type=="checkbox"){
if(obj.type=="post"){
return "Region.post.post_title";
}else{
return "Region." + obj.name;
}}
});
return {
databaseFields: databaseFields,
databaseFieldsFilterableShort: databaseFieldsFilterableShort,
regionFields: regionFields,
markerFieldsShort: markerFieldsShort,
};}
addField(formElement){
const _this=this;
if(["region", "marker", "post", "status", "distance", "location", "search"].indexOf(formElement.type)!=-1){
let repeat=false;
_this.formElements.forEach(function (control){
if(control.type==formElement.type)
repeat=true;
});
if(repeat){
jQuery.growl.error({
title: "Error",
message: 'You can add only 1 "' + MapSVG.ucfirst(formElement.type) + '" field',
});
return;
}}
_this.formElements.push(formElement);
_this.getForm().append(formElement.domElements.main);
this.setFormElementEventHandlers(formElement);
if(this.editMode){
if(formElement.protected){
formElement.hide();
}else{
this.edit(formElement);
}}
return formElement;
}
edit(formElement){
const _this=this;
_this.currentlyEditing&&_this.currentlyEditing.destroyEditor();
this.getFormEditor().appendChild(formElement.getEditor());
formElement.initEditor();
_this.currentlyEditing=formElement;
$$w(_this.getForm()).find(".form-group.active").removeClass("active");
$$w(formElement.domElements.main).addClass("active");
}
get(){
}
getSchema(){
return this.formElements.map(function (formElement){
return formElement.getSchema();
});
}
close(){
this.formElements.forEach((formElement)=> formElement.destroy());
this.mediaUploader&&this.mediaUploader.off("select");
MapSVG.formBuilder=null;
this.events.trigger("close", this, [this]);
}
destroy(){
$$w(this.view).empty().remove();
this.sortable=null;
}
toJSON(addEmpty){
const obj={};
function add(obj, name, value){
if(!addEmpty&&!value)
return false;
if(name.length==1){
obj[name[0]]=value;
}else{
if(obj[name[0]]==null){
if(name[1]===""){
obj[name[0]]=[];
}else{
obj[name[0]]={};}}
if(obj[name[0]].length!==undefined){
obj[name[0]].push(value);
}else{
add(obj[name[0]], name.slice(1), value);
}}
}
$$w(this.elements.containers.formView)
.find("input, textarea, select")
.each(function (){
if(!$$w(this).data("skip") &&
!$$w(this).prop("disabled") &&
$$w(this).attr("name") &&
!(!addEmpty &&
$$w(this).attr("type")=="checkbox" &&
$$w(this).attr("checked")==undefined) &&
!($$w(this).attr("type")=="radio"&&$$w(this).attr("checked")==undefined)){
let value;
if($$w(this).attr("type")=="checkbox"){
value=$$w(this).prop("checked");
}else{
value=$$w(this).val();
}
add(obj, $$w(this).attr("name").replace(/]/g, "").split("["), value);
}});
return obj;
}
getRegionsList(){
return this.mapsvg.regions.map(function (r){
return { id: r.id, title: r.title };});
}
getRegionsAsArray(){
return this.mapsvg.regions;
}
setRegions(location){
const regionsFormElement=this.formElements.get("regions");
if(this.mapsvg.options.source.indexOf("/geo-calibrated/usa.svg")!==-1){
regionsFormElement.setValue(["US-" + location.address.state_short]);
}
else if(this.mapsvg.options.source.indexOf("/geo-calibrated/world.svg")!==-1){
if(location.address.country_short){
regionsFormElement.setValue([location.address.country_short]);
}}else{
if(location.address.administrative_area_level_1){
this.mapsvg.regions.forEach((_region)=> {
if(_region.title===location.address.administrative_area_level_1 ||
_region.title===location.address.administrative_area_level_2 ||
_region.id===location.address.country_short +
"-" +
location.address.administrative_area_level_1_short){
regionsFormElement.setValue([_region.id]);
}});
}}
}
setIsLoading(value){
this.isLoading=value;
if(this.searchButton){
if(this.isLoading){
$$w(this.elements.buttons.searchButton).find("button").attr("disabled", "disabled");
}else{
$$w(this.elements.buttons.searchButton).find("button").removeAttr("disabled");
}}
}}
const $$x=jQuery;
class FiltersController extends DetailsController {
constructor(options){
super(options);
this.showButtonText=options.showButtonText;
this.clearButton=options.clearButton;
this.clearButtonText=options.clearButtonText;
this.searchButton=options.searchButton;
this.searchButtonText=options.searchButtonText;
this.padding=options.padding;
this.schema=options.schema;
this.hideFilters=options.hide;
this.query=options.query;
}
viewDidLoad(){
super.viewDidLoad();
const _this=this;
this.formBuilder=new FormBuilder({
container: this.containers.contentView,
filtersMode: true,
schema: this.schema,
modal: this.modal,
filtersHide: this.hideFilters,
showButtonText: this.showButtonText,
clearButton: this.clearButton,
clearButtonText: this.clearButtonText,
searchButton: this.searchButton,
searchButtonText: this.searchButtonText,
editMode: false,
mapsvg: this.mapsvg,
data: {},
admin: false,
events: {
"changed.field": (formElement, field, value)=> {
const filters={};
let _value=value;
if(field==="regions"){
_value={};
_value.region_ids=value instanceof Array ? value:[value];
_value.table_name=this.mapsvg.options.database.regionsTableName;
if(_value.region_ids.length===0||_value.region_ids[0]===""){
_value=null;
}}
filters[field]=_value;
this.query.setFilters(filters);
_this.events.trigger("changed.field", _this, [field, value]);
_this.events.trigger("changed.fields", _this, [field, value]);
},
"changed.search": (formElement, value)=> {
this.query.setSearch(value);
_this.events.trigger("changed.search", _this, [value]);
},
cleared: (formBuilder)=> {
this.query.clearFilters();
this.events.trigger("cleared", _this, []);
},
loaded: (formBuilder)=> {
$$x(formBuilder.container).find(".mapsvg-form-builder").css({
padding: _this.padding,
});
this.updateScroll();
this.events.trigger("loaded");
},
},
});
}
reset(){
this.formBuilder&&this.formBuilder.reset();
}
update(query){
const _query=Object.assign({}, query.filters);
_query.search=query.search;
this.formBuilder&&this.formBuilder.update(_query);
}
setFiltersCounter(){
if(this.hideFilters){
const filtersCounter=Object.keys(this.query.filters).length;
const filtersCounterString=filtersCounter===0 ? "":filtersCounter.toString();
this.formBuilder &&
this.formBuilder.showFiltersButton &&
$$x(this.formBuilder.showFiltersButton.domElements.main)
.find("button")
.html(this.showButtonText + " <b>" + filtersCounterString + "</b>");
}}
setEventHandlers(){
super.setEventHandlers();
const _this=this;
$$x(this.containers.view).on("click", ".mapsvg-btn-show-filters", function (){
_this.events.trigger("click.btn.showFilters");
});
$$x(this.containers.view).on("click", "#mapsvg-search-container button", function (){
_this.events.trigger("click.btn.searchButton");
});
}}
const $$y=jQuery;
class PopoverController extends Controller {
constructor(options){
super(options);
this.autoresize=true;
this.point=options.point;
this.yShift=options.yShift;
this.mapObject=options.mapObject;
this.id=this.mapObject.id + "_" + Math.random();
$$y(this.containers.main).data("popover-id", this.id);
}
setPoint(point){
this.point=point;
}
getToolbarTemplate(){
if(this.withToolbar)
return '<div class="mapsvg-popover-close"></div>';
else
return "";
}
viewDidLoad(){
super.viewDidLoad.call(this);
if(MapSVG.isPhone &&
this.mapsvg.options.popovers.mobileFullscreen &&
!this.mobileCloseBtn){
this.mobileCloseBtn=$$y('<button class="mapsvg-mobile-modal-close">' +
this.mapsvg.getData().options.mobileView.labelClose +
"</button>")[0];
$$y(this.containers.view).append(this.mobileCloseBtn);
}
this.adjustScreenPosition();
$$y(this.containers.main).toggleClass("mapsvg-popover-animate", true);
$$y(this.containers.main).toggleClass("mapsvg-popover-visible", true);
this.adjustHeight();
this.updateScroll();
this.autoresize&&this.resizeSensor.setScroll();
this.events.trigger("shown", this, [this]);
}
adjustHeight(){
$$y(this.containers.main).height($$y(this.containers.main).find(".mapsvg-auto-height").outerHeight() +
(this.containers.toolbar ? $$y(this.containers.toolbar).outerHeight():0));
}
adjustScreenPosition(){
if(this.point){
const pos=this.mapsvg.converter.convertSVGToPixel(this.point);
pos.y -=this.yShift;
pos.x=Math.round(pos.x);
pos.y=Math.round(pos.y);
this.setScreenPosition(pos.x, pos.y);
}}
moveSrceenPositionBy(deltaX, deltaY){
const oldPos=this.screenPoint, x=oldPos.x - deltaX, y=oldPos.y - deltaY;
this.setScreenPosition(x, y);
}
setScreenPosition(x, y){
this.screenPoint=new ScreenPoint(x, y);
$$y(this.containers.main).css({
transform: "translateX(-50%) translate(" + x + "px," + y + "px)",
});
}
setEventHandlers(){
$$y("body").off(".popover.mapsvg");
$$y(this.containers.view).on("click touchend", ".mapsvg-popover-close, .mapsvg-mobile-modal-close", (e)=> {
e.stopImmediatePropagation();
this.close();
});
$$y("body").on("mouseup.popover.mapsvg touchend.popover.mapsvg", (e)=> {
if(this.mapsvg.isScrolling ||
$$y(e.target).closest(".mapsvg-directory").length ||
$$y(e.target).closest(".mapsvg-popover").length ||
$$y(e.target).hasClass("mapsvg-btn-map"))
return;
this.close();
});
}
close(){
if($$y(this.containers.main).data("popover-id")!=this.id ||
!$$y(this.containers.main).is(":visible"))
return;
this.destroy();
if(this.mapObject instanceof Region){
this.mapsvg.deselectRegion(this.mapObject);
}
if(this.mapObject instanceof Marker){
this.mapsvg.deselectAllMarkers();
}
this.events.trigger("closed", this, [this]);
}
destroy(){
$$y(this.containers.main).toggleClass("mapsvg-popover-animate", false);
$$y(this.containers.main).toggleClass("mapsvg-popover-visible", false);
super.destroy.call(this);
}
show(){
$$y(this.containers.main).toggleClass("mapsvg-popover-animate", true);
$$y(this.containers.main).toggleClass("mapsvg-popover-visible", true);
}}
const $$z=jQuery;
class Tooltip extends Controller {
constructor(options){
super(options);
this.scrollable=false;
this.withToolbar=false;
this.autoresize=false;
this.screenPoint=new ScreenPoint(0, 0);
this.posOriginal={};
this.posShifted={};
this.posShiftedPrev={};
this.mirror={};
this.noPadding=true;
this.setPosition(options.position);
this.setSize(options.minWidth, options.maxWidth);
}
setSize(minWidth, maxWidth){
this.minWidth=minWidth;
this.maxWidth=maxWidth;
this.containers.main.style["min-width"]=this.minWidth + "px";
this.containers.main.style["max-width"]=this.maxWidth + "px";
}
setPosition(position){
const ex=position.split("-");
if(ex[0].indexOf("top")!=-1||ex[0].indexOf("bottom")!=-1){
this.posOriginal.topbottom=ex[0];
}
if(ex[0].indexOf("left")!=-1||ex[0].indexOf("right")!=-1){
this.posOriginal.leftright=ex[0];
}
if(ex[1]){
this.posOriginal.leftright=ex[1];
}
this.containers.main.className=this.containers.main.className.replace(/(^|\s)mapsvg-tt-\S+/g, "");
this.containers.main.classList.add("mapsvg-tt-" + position);
}
setScreenPoint(x, y){
this.screenPoint.x=x;
this.screenPoint.y=y;
}
viewDidLoad(){
super.viewDidLoad.call(this);
}
viewDidAppear(){
super.viewDidAppear();
this.events.trigger("shown", this, [this]);
}
setScreenPosition(x, y){
this.setScreenPoint(x, y);
this.containers.main.style.transform =
"translateX(-50%) translate(" + x + "px," + y + "px)";
}
setEventHandlers(){
const event="mousemove.tooltip.mapsvg-" + this.mapsvg.id;
$$z("body")
.off(event)
.on(event, (e)=> {
MapSVG.mouse=MapSVG.mouseCoords(e);
this.containers.main.style.left =
e.clientX +
$$z(window).scrollLeft() -
$$z(this.mapsvg.containers.map).offset().left +
"px";
this.containers.main.style.top =
e.clientY +
$$z(window).scrollTop() -
$$z(this.mapsvg.containers.map).offset().top +
"px";
const m=new ScreenPoint(e.clientX + $$z(window).scrollLeft(), e.clientY + $$z(window).scrollTop());
const _tbbox=this.containers.main.getBoundingClientRect();
const _mbbox=this.mapsvg.containers.map.getBoundingClientRect();
const tbbox={
top: _tbbox.top + $$z(window).scrollTop(),
bottom: _tbbox.bottom + $$z(window).scrollTop(),
left: _tbbox.left + $$z(window).scrollLeft(),
right: _tbbox.right + $$z(window).scrollLeft(),
width: _tbbox.width,
height: _tbbox.height,
};
const mbbox={
top: _mbbox.top + $$z(window).scrollTop(),
bottom: _mbbox.bottom + $$z(window).scrollTop(),
left: _mbbox.left + $$z(window).scrollLeft(),
right: _mbbox.right + $$z(window).scrollLeft(),
width: _mbbox.width,
height: _mbbox.height,
};
if(m.x > mbbox.right ||
m.y > mbbox.bottom ||
m.x < mbbox.left ||
m.y < mbbox.top){
return;
}
if(this.mirror.top||this.mirror.bottom){
if(this.mirror.top&&m.y > this.mirror.top){
this.mirror.top=0;
delete this.posShifted.topbottom;
}
else if(this.mirror.bottom&&m.y < this.mirror.bottom){
this.mirror.bottom=0;
delete this.posShifted.topbottom;
}}else{
if(tbbox.bottom < mbbox.top + tbbox.height){
this.posShifted.topbottom="bottom";
this.mirror.top=m.y;
}
else if(tbbox.top > mbbox.bottom - tbbox.height){
this.posShifted.topbottom="top";
this.mirror.bottom=m.y;
}}
if(this.mirror.right||this.mirror.left){
if(this.mirror.left&&m.x > this.mirror.left){
this.mirror.left=0;
delete this.posShifted.leftright;
}
else if(this.mirror.right&&m.x < this.mirror.right){
this.mirror.right=0;
delete this.posShifted.leftright;
}}else{
if(tbbox.right < mbbox.left + tbbox.width){
this.posShifted.leftright="right";
this.mirror.left=m.x;
}
else if(tbbox.left > mbbox.right - tbbox.width){
this.posShifted.leftright="left";
this.mirror.right=m.x;
}}
let pos=$$z.extend({}, this.posOriginal, this.posShifted);
const _pos=[];
pos.topbottom&&_pos.push(pos.topbottom);
pos.leftright&&_pos.push(pos.leftright);
pos=_pos.join("-");
if(this.posShifted.topbottom!=this.posOriginal.topbottom ||
this.posShifted.leftright!=this.posOriginal.leftright){
this.containers.main.className=this.containers.main.className.replace(/(^|\s)mapsvg-tt-\S+/g, "");
this.containers.main.classList.add("mapsvg-tt-" + pos);
this.posShiftedPrev=pos;
}});
}
setContent(template, data){
this.containers.main.innerHTML=template(data);
return this;
}
show(){
this.containers.main.classList.add("mapsvg-tooltip-visible");
return this;
}
hide(){
this.containers.main.classList.remove("mapsvg-tooltip-visible");
return this;
}}
const $$A=jQuery;
class MapSVGMap {
constructor(containerId, mapParams, externalParams){
this.markerOptions={ src: MapSVG.urls.root + "markers/pin1_red.png" };
const options=mapParams.options;
this.updateOutdatedOptions(options);
this.dirtyFields=[];
this.containerId=containerId;
this.options=$$A.extend(true, {}, DefaultOptions, options);
this.options.source=this.urlToRelativePath(this.options.source);
this.editMode=this.options.editMode;
delete this.options.editMode;
this.id=mapParams.id;
this.svgFileLastChanged=mapParams.svgFileLastChanged;
this.regions=new ArrayIndexed("id");
this.objects=new ArrayIndexed("id");
this.events=new Events(this);
this.highlightedRegions=[];
this.editRegions={ on: false };
this.editMarkers={ on: false };
this.editData={ on: false };
this.controllers={};
this.containers={
map: document.getElementById(this.containerId),
scrollpane: $$A('<div class="mapsvg-scrollpane"></div>')[0],
scrollpaneWrap: $$A('<div class="mapsvg-scrollpane-wrap"></div>')[0],
layers: $$A('<div class="mapsvg-layers-wrap"></div>')[0],
};
this.containers.map.appendChild(this.containers.layers);
this.containers.map.appendChild(this.containers.scrollpaneWrap);
this.containers.scrollpaneWrap.appendChild(this.containers.scrollpane);
this.whRatio=0;
this.isScrolling=false;
this.markerOptions={};
this.svgDefault={};
this.scale=1;
this._scale=1;
this.selected_id=[];
this.regions=new ArrayIndexed("id");
if(!this.options.database.regionsTableName){
this.options.database.regionsTableName="regions_" + this.id;
}
if(!this.options.database.objectsTableName){
this.options.database.objectsTableName="objects_" + this.id;
}
this.regionsRepository=new Repository("region", "regions/" + this.options.database.regionsTableName);
this.regionsRepository.query.update({ perpage: 0 });
this.objectsRepository=new Repository("object", "objects/" + this.options.database.objectsTableName);
if(this.options.database.noFiltersNoLoad){
this.objectsRepository.setNoFiltersNoLoad(true);
}
this.objectsRepository.query.update({
perpage: this.options.database.pagination.on
? this.options.database.pagination.perpage
: 0,
});
this.schemaRepository=new SchemaRepository();
this.markers=new ArrayIndexed("id");
this.markersClusters=new ArrayIndexed("id");
this._viewBox=new ViewBox(0, 0, 0, 0);
this.viewBox=new ViewBox(0, 0, 0, 0);
this.zoomLevel=0;
this.scroll={
tx: 0,
ty: 0,
vxi: 0,
vyi: 0,
x: 0,
y: 0,
dx: 0,
dy: 0,
vx: 0,
vy: 0,
gx: 0,
gy: 0,
touchScrollStart: 0,
};
this.layers={};
this.geoCoordinates=false;
this.geoViewBox=new GeoViewBox(new GeoPoint(0, 0), new GeoPoint(0, 0));
this.eventsPreventList={};
this.googleMaps={
loaded: false,
initialized: false,
map: null,
zoomLimit: true,
maxZoomService: null,
};
this.afterLoadBlockers=1;
this.loaded=false;
if(this.id){
this.afterLoadBlockers +=2;
}
if(this.options.googleMaps.on){
this.afterLoadBlockers++;
}
if(this.filtersShouldBeShown()){
this.afterLoadBlockers++;
}
this.init();
}
urlToRelativePath(url){
if(url.indexOf("//")===0)
url=url.replace(/^\/\/[^/]+/, "").replace("//", "/");
else
url=url.replace(/^.*:\/\/[^/]+/, "").replace("//", "/");
return url;
}
setGroups(groups){
const _this=this;
if(!this.groups){
_this.groups=new ArrayIndexed("id", _this.options.groups, {
autoId: true,
unique: true,
});
}else{
this.options.groups=this.groups;
}
_this.groups.forEach(function (g){
g.objects &&
g.objects.length &&
g.objects.forEach(function (obj){
_this.containers.svg
.querySelector("#" + obj.value)
.classList.toggle("mapsvg-hidden", !g.visible);
});
});
}
getGroupSelectOptions(){
const _this=this;
const optionGroups=[];
const options=[];
const options2=[];
$$A(_this.containers.svg)
.find("g")
.each(function (index){
const id=$$A(this)[0].getAttribute("id");
if(id){
const title=$$A(this)[0].getAttribute("title");
options.push({ label: title||id, value: id });
}});
optionGroups.push({ title: "SVG Layers / Groups", options: options });
$$A(_this.containers.svg)
.find("path,ellipse,circle,polyline,polygon,rectangle,img,text")
.each(function (index){
const id=$$A(this)[0].getAttribute("id");
if(id){
const title=$$A(this)[0].getAttribute("title");
options2.push({ label: title||id, value: id });
}});
optionGroups.push({ title: "Other SVG objects", options: options2 });
return optionGroups;
}
setLayersControl(options){
const _this=this;
if(options)
$$A.extend(true, this.options.layersControl, options);
if(this.options.layersControl.on){
if(!this.containers.layersControl){
this.containers.layersControl=document.createElement("div");
this.containers.layersControl.classList.add("mapsvg-layers-control");
this.containers.layersControlLabel=document.createElement("div");
this.containers.layersControlLabel.classList.add("mapsvg-layers-label");
this.containers.layersControl.appendChild(this.containers.layersControlLabel);
const layersControlWrap=document.createElement("div");
layersControlWrap.classList.add("mapsvg-layers-list-wrap");
this.containers.layersControl.appendChild(layersControlWrap);
this.containers.layersControlListNano=document.createElement("div");
this.containers.layersControlListNano.classList.add("nano");
layersControlWrap.appendChild(this.containers.layersControlListNano);
this.containers.layersControlList=document.createElement("div");
this.containers.layersControlList.classList.add("mapsvg-layers-list");
this.containers.layersControlList.classList.add("nano-content");
this.containers.layersControlListNano.appendChild(this.containers.layersControlList);
this.containers.mapContainer.appendChild(this.containers.layersControl);
}
this.containers.layersControl.style.display="block";
this.containers.layersControlLabel.innerHTML=this.options.layersControl.label;
this.containers.layersControlLabel.style.display="block";
this.containers.layersControlList.innerHTML="";
while (this.containers.layersControlList.firstChild){
this.containers.layersControlList.removeChild(this.containers.layersControlList.firstChild);
}
this.containers.layersControl.classList.remove("mapsvg-top-left", "mapsvg-top-right", "mapsvg-bottom-left", "mapsvg-bottom-right");
this.containers.layersControl.classList.add("mapsvg-" + this.options.layersControl.position);
if(this.options.menu.on &&
!this.options.menu.customContainer &&
this.options.layersControl.position.indexOf("left")!==-1){
this.containers.layersControl.style.left=this.options.menu.width;
}
this.containers.layersControl.style.maxHeight=this.options.layersControl.maxHeight;
this.options.groups.forEach((g)=> {
const item=document.createElement("div");
item.classList.add("mapsvg-layers-item");
item.setAttribute("data-group-id", g.id);
item.innerHTML =
'<input type="checkbox" class="ios8-switch ios8-switch-sm" ' +
(g.visible ? "checked":"") +
" /><label>" +
g.title +
"</label>";
this.containers.layersControlList.appendChild(item);
});
$$A(this.containers.layersControlListNano).nanoScroller({
preventPageScrolling: true,
iOSNativeScrolling: true,
});
$$A(this.containers.layersControl).off();
$$A(this.containers.layersControl).on("click", ".mapsvg-layers-item", function (){
const id=$$A(this).data("group-id");
const input=$$A(this).find("input");
input.prop("checked", !input.prop("checked"));
_this.groups.forEach(function (g){
if(g.id===id)
g.visible = !g.visible;
});
_this.setGroups();
});
$$A(this.containers.layersControlLabel).off();
$$A(this.containers.layersControlLabel).on("click", ()=> {
$$A(_this.containers.layersControl).toggleClass("closed");
});
$$A(this.containers.layersControl).toggleClass("closed", !this.options.layersControl.expanded);
}else{
if(this.containers.layersControl){
this.containers.layersControl.style.display="none";
}}
}
loadDataObjects(params){
return this.objectsRepository.find(params);
}
loadDirectory(){
if(!this.editMode &&
this.options.menu.source==="database" &&
!this.objectsRepository.loaded){
return;
}
if(this.options.menu.on){
this.controllers.directory.loadItemsToDirectory();
}
this.setPagination();
}
setPagination(){
const _this=this;
this.containers.pagerMap&&$$A(this.containers.pagerMap).empty().remove();
this.containers.pagerDir&&$$A(this.containers.pagerDir).empty().remove();
if(_this.options.database.pagination.on &&
_this.options.database.pagination.perpage!==0){
this.containers.directory.classList.toggle("mapsvg-with-pagination", ["directory", "both"].indexOf(_this.options.database.pagination.showIn)!==-1);
this.containers.map.classList.toggle("mapsvg-with-pagination", ["map", "both"].indexOf(_this.options.database.pagination.showIn)!==-1);
if(_this.options.menu.on){
this.containers.pagerDir=_this.getPagination();
_this.controllers.directory.addPagination(this.containers.pagerDir);
}
this.containers.pagerMap=_this.getPagination();
this.containers.map.appendChild(this.containers.pagerMap);
}}
getPagination(callback){
const _this=this;
const pager=$$A('<nav class="mapsvg-pagination"><ul class="pager"><!--<li class="mapsvg-first"><a href="#">First</a></li>--><li class="mapsvg-prev"><a href="#">&larr; ' +
_this.options.database.pagination.prev +
" " +
_this.options.database.pagination.perpage +
'</a></li><li class="mapsvg-next"><a href="#">' +
_this.options.database.pagination.next +
" " +
_this.options.database.pagination.perpage +
' &rarr;</a></li><!--<li class="mapsvg-last"><a href="#">Last</a></li>--></ul></nav>');
if(this.objectsRepository.onFirstPage()&&this.objectsRepository.onLastPage()){
pager.hide();
}else{
pager.find(".mapsvg-prev").removeClass("disabled");
pager.find(".mapsvg-first").removeClass("disabled");
pager.find(".mapsvg-last").removeClass("disabled");
pager.find(".mapsvg-next").removeClass("disabled");
this.objectsRepository.onLastPage() &&
pager.find(".mapsvg-next").addClass("disabled") &&
pager.find(".mapsvg-last").addClass("disabled");
this.objectsRepository.onFirstPage() &&
pager.find(".mapsvg-prev").addClass("disabled") &&
pager.find(".mapsvg-first").addClass("disabled");
}
pager
.on("click", ".mapsvg-next:not(.disabled)", (e)=> {
e.preventDefault();
if(this.objectsRepository.onLastPage())
return;
const query=new Query({ page: this.objectsRepository.query.page + 1 });
this.objectsRepository.find(query).done(function (){
callback&&callback();
});
})
.on("click", ".mapsvg-prev:not(.disabled)", function (e){
e.preventDefault();
if(_this.objectsRepository.onFirstPage())
return;
const query=new Query({ page: _this.objectsRepository.query.page - 1 });
_this.objectsRepository.find(query).done(function (){
callback&&callback();
});
})
.on("click", ".mapsvg-first:not(.disabled)", function (e){
e.preventDefault();
if(_this.objectsRepository.onFirstPage())
return;
const query=new Query({ page: 1 });
_this.objectsRepository.find(query).done(function (){
callback&&callback();
});
})
.on("click", ".mapsvg-last:not(.disabled)", function (e){
e.preventDefault();
if(_this.objectsRepository.onLastPage())
return;
const query=new Query({ lastpage: true });
_this.objectsRepository.find(query).done(function (){
callback&&callback();
});
});
return pager[0];
}
deleteMarkers(){
while (this.markers.length){
this.markerDelete(this.markers[0]);
}}
deleteClusters(){
if(this.markersClusters){
this.markersClusters.forEach(function (markerCluster){
markerCluster.destroy();
});
this.markersClusters.clear();
}}
addLocations(){
const _this=this;
this.firstDataLoad=this.firstDataLoad===undefined;
let locationField=this.objectsRepository.getSchema().getFieldByType("location");
if(!locationField){
return;
}
locationField=locationField.name;
if(locationField){
if(this.firstDataLoad){
this.setMarkerImagesDependency();
}
_this.deleteMarkers();
_this.deleteClusters();
_this.clusters={};
_this.clustersByZoom=[];
if(this.objectsRepository.getLoaded().length > 0){
this.objectsRepository.getLoaded().forEach(function (object){
if(object[locationField]){
if(object[locationField].img &&
(object[locationField].geoPoint||object[locationField].svgPoint)){
new Marker({
location: object[locationField],
object: object,
mapsvg: _this,
});
}}
});
if(_this.options.clustering.on){
_this.startClusterizer();
}else{
this.objectsRepository.getLoaded().forEach(function (object){
if(object.location&&object.location.marker){
_this.markerAdd(object.location.marker);
}});
_this.mayBeFitMarkers();
}}
}}
addClustersFromWorker(zoomLevel, clusters){
const _this=this;
_this.clustersByZoom[zoomLevel]=[];
for (const cell in clusters){
const markers=clusters[cell].markers.map(function (marker){
return _this.objectsRepository.objects.findById(marker.id).location.marker;
});
_this.clustersByZoom[zoomLevel].push(new MarkerCluster({
markers: markers,
svgPoint: new SVGPoint(clusters[cell].x, clusters[cell].y),
cellX: clusters[cell].cellX,
cellY: clusters[cell].cellY,
}, _this));
}
if(_this.zoomLevel===zoomLevel){
_this.clusterizeMarkers();
}}
startClusterizer(){
if(!this.objectsRepository||this.objectsRepository.getLoaded().length===0){
return;
}
const locationField=this.objectsRepository.getSchema().getFieldByType("location");
if(!locationField){
return false;
}
if(!this.clusterizerWorker){
this.clusterizerWorker=new Worker(MapSVG.urls.root + "js/mapsvg/Core/clustering.js");
this.clusterizerWorker.onmessage=(evt)=> {
if(evt.data.clusters){
this.addClustersFromWorker(evt.data.zoomLevel, evt.data.clusters);
}};}
const objectsData=[];
this.objectsRepository
.getLoaded()
.filter((o)=> {
return o.location&&o.location.marker;
})
.forEach((o)=> {
objectsData.push({
id: o.id,
x: o.location.marker.svgPoint.x,
y: o.location.marker.svgPoint.y,
});
});
this.clusterizerWorker.postMessage({
objects: objectsData,
cellSize: 50,
mapWidth: this.containers.map.clientWidth,
zoomLevels: this.zoomLevels,
zoomLevel: this.zoomLevel,
zoomDelta: this.zoomDelta,
svgViewBox: this.svgDefault.viewBox,
});
this.events.on("zoom", ()=> {
this.clusterizerWorker.postMessage({
message: "zoom",
zoomLevel: this.zoomLevel,
});
});
}
clusterizeMarkers(skipFitMarkers){
$$A(this.layers.markers)
.children()
.each((i, obj)=> {
$$A(obj).detach();
});
this.markers.clear();
this.markersClusters.clear();
this.clustersByZoom &&
this.clustersByZoom[this.zoomLevel] &&
this.clustersByZoom[this.zoomLevel].forEach((cluster)=> {
if(this.options.googleMaps.on &&
this.googleMaps.map &&
this.googleMaps.map.getZoom() >=17){
this.markerAdd(cluster.markers[0]);
}else{
if(cluster.markers.length > 1){
this.markersClusterAdd(cluster);
}else{
this.markerAdd(cluster.markers[0]);
}}
});
if(this.editingMarker){
this.markerAdd(this.editingMarker);
}
if(!skipFitMarkers){
this.mayBeFitMarkers();
}
if(this.options.labelsMarkers.on){
this.setLabelsMarkers();
}}
getCssUrl(){
return MapSVG.urls.root + "css/mapsvg.css";
}
isGeo(){
return this.mapIsGeo;
}
functionFromString(string){
let func;
let error;
const fn=string.trim();
if(fn.indexOf("{")==-1||fn.indexOf("function")!==0||fn.indexOf("(")==-1){
return new SyntaxError("MapSVG user function error: no function body.");
}
const fnBody=fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"));
const params=fn.substring(fn.indexOf("(") + 1, fn.indexOf(")"));
try {
func=new Function(params, fnBody);
}
catch (err){
error=err;
}
if(!error)
return func;
else
return error;
}
getOptions(forTemplate, forWeb){
const options=$$A.extend(true, {}, this.options);
function clearEmpties(o){
for (const k in o){
if(!o[k]||typeof o[k]!=="object"){
continue;
}
clearEmpties(o[k]);
if(Object.keys(o[k]).length===0){
delete o[k];
}}
}
clearEmpties(options.regions);
$$A.extend(true, options, this.optionsDelta);
options.viewBox=this._viewBox.toArray();
options.filtersSchema=this.filtersSchema.getFieldsAsArray();
if(options.filtersSchema.length > 0){
options.filtersSchema.forEach((field)=> {
if(field.type==="distance"){
field.value="";
}});
}
delete options.markers;
if(forTemplate){
options.svgFilename=options.source.split("/").pop();
options.svgFiles=MapSVG.svgFiles;
}
if(forWeb)
$$A.each(options, (key, val)=> {
if(JSON.stringify(val)==JSON.stringify(this.defaults[key]))
delete options[key];
});
delete options.backend;
return options;
}
restoreDeltaOptions(){
this.update(this.optionsDelta);
this.optionsDelta={};}
setEvents(functions){
let compiledFunction;
for (const eventName in functions){
if(typeof functions[eventName]==="string"){
compiledFunction =
functions[eventName]!=""
? this.functionFromString(functions[eventName])
: null;
if(!compiledFunction ||
compiledFunction.error ||
compiledFunction instanceof TypeError ||
compiledFunction instanceof SyntaxError){
continue;
}}
else if(typeof functions[eventName]==="function"){
compiledFunction=functions[eventName];
}
this.events.off(eventName);
this.events.on(eventName, compiledFunction);
if(eventName.indexOf("directory")!==-1){
const event=eventName.split(".")[0];
if(this.controllers&&this.controllers.directory){
this.controllers.directory.events.off(event);
this.controllers.directory.events.on(event, compiledFunction);
}}
}
$$A.extend(true, this.options.events, functions);
}
setActions(options){
$$A.extend(true, this.options.actions, options);
}
setDetailsView(options){
options=options||this.options.detailsView||{};
$$A.extend(true, this.options.detailsView, options);
if(this.options.detailsView.location==="top"&&this.options.menu.position==="left"){
this.options.detailsView.location="leftSidebar";
}
else if(this.options.detailsView.location==="top" &&
this.options.menu.position==="right"){
this.options.detailsView.location="rightSidebar";
}
if(this.options.detailsView.location==="near" ||
this.options.detailsView.location==="mapContainer"){
this.options.detailsView.location="map";
}
if(!this.containers.detailsView){
this.containers.detailsView=$$A('<div class="mapsvg-details-container"></div>')[0];
}
$$A(this.containers.detailsView).toggleClass("mapsvg-details-container-relative", !(MapSVG.isPhone&&this.options.detailsView.mobileFullscreen) &&
!this.shouldBeScrollable(this.options.detailsView.location));
if(this.options.detailsView.location==="custom"){
$$A("#" + this.options.detailsView.containerId).append($$A(this.containers.detailsView));
}else{
if(MapSVG.isPhone&&this.options.detailsView.mobileFullscreen){
$$A("body").append($$A(this.containers.detailsView));
$$A(this.containers.detailsView).addClass("mapsvg-container-fullscreen");
}else{
this.containers[this.options.detailsView.location].append(this.containers.detailsView);
}
if(this.options.detailsView.margin){
$$A(this.containers.detailsView).css("margin", this.options.detailsView.margin);
}
$$A(this.containers.detailsView).css("width", this.options.detailsView.width);
}}
setMobileView(options){
$$A.extend(true, this.options.mobileView, options);
}
attachDataToRegions(object){
this.regions.forEach(function (region){
region.objects=[];
});
this.objectsRepository.getLoaded().forEach((obj, index)=> {
const regions=obj.getRegionsForTable(this.options.database.regionsTableName);
if(regions&&regions.length){
regions.forEach((region)=> {
const r=this.getRegion(region.id);
if(r)
r.objects.push(obj);
});
}});
}
setTemplates(templates){
this.templates=this.templates||{};
for (let name in templates){
if(name!=undefined){
this.options.templates[name]=templates[name];
let t=this.options.templates[name];
if(name=="directoryItem"||name=="directoryCategoryItem"){
const dirItemTemplate=this.options.templates.directoryItem;
t =
'{{#each items}}<div id="mapsvg-directory-item-{{#if id_no_spaces}}{{id_no_spaces}}{{else}}{{id}}{{/if}}" class="mapsvg-directory-item" data-object-id="{{id}}">' +
dirItemTemplate +
"</div>{{/each}}";
if(this.options.menu.categories &&
this.options.menu.categories.on &&
this.options.menu.categories.groupBy){
const t2=this.options.templates["directoryCategoryItem"];
t =
'{{#each items}}{{#with category}}<div id="mapsvg-category-item-{{value}}" class="mapsvg-category-item" data-category-value="{{value}}">' +
t2 +
'</div><div class="mapsvg-category-block" data-category-id="{{value}}">{{/with}}' +
t +
"</div>{{/each}}";
}
name="directory";
}
try {
this.options.templates[name]=t;
this.templates[name]=Handlebars.compile(t, { strict: false });
}
catch (err){
console.error(err);
this.templates[name]=Handlebars.compile("", { strict: false });
}
if(this.editMode &&
(name=="directory"||name=="directoryCategoryItem") &&
this.controllers &&
this.controllers.directory){
this.controllers.directory.templates.main=this.templates[name];
this.loadDirectory();
}}
}}
update(options){
for (const key in options){
if(key=="regions"){
for (const id in options.regions){
const region=this.getRegion(id);
region&&region.update(options.regions[id]);
if(options.regions[id].disabled!=undefined){
this.deselectRegion(region);
this.options.regions[id]=this.options.regions[id]||{};
this.options.regions[id].disabled=region.disabled;
}}
}else{
const setter="set" + MapSVG.ucfirst(key);
if(typeof this[setter]=="function")
this[setter](options[key]);
else {
this.options[key]=options[key];
}}
}}
getDirtyFields(){
return this.getData();
}
clearDirtyFields(){
this.dirtyFields=[];
}
setTitle(title){
title&&(this.options.title=title);
}
setExtension(extension){
if(extension){
this.options.extension=extension;
}else{
delete this.options.extension;
}}
setDisableLinks(on){
on=MapSVG.parseBoolean(on);
if(on){
$$A(this.containers.map).on("click.a.mapsvg", "a", function (e){
e.preventDefault();
});
}else{
$$A(this.containers.map).off("click.a.mapsvg");
}
this.disableLinks=on;
}
setLoadingText(val){
this.options.loadingText=val;
}
setLockAspectRatio(onoff){
this.options.lockAspectRatio=MapSVG.parseBoolean(onoff);
}
setMarkerEditHandler(handler){
this.markerEditHandler=handler;
}
setChoroplethSourceField(field){
this.options.choropleth.sourceField=field;
this.redrawChoropleth();
}
setRegionEditHandler(handler){
this.regionEditHandler=handler;
}
setDisableAll(on){
on=MapSVG.parseBoolean(on);
$$A.extend(true, this.options, { disableAll: on });
$$A(this.containers.map).toggleClass("mapsvg-disabled-regions", on);
}
setRegionStatuses(_statuses){
this.options.regionStatuses={};
const colors={};
_statuses.forEach((statusOptions)=> {
this.options.regionStatuses[statusOptions.value]=statusOptions;
colors[statusOptions.value]=statusOptions.color.length
? statusOptions.color
: undefined;
});
this.setColors({ status: colors });
}
setColorsIgnore(val){
this.options.colorsIgnore=MapSVG.parseBoolean(val);
this.regionsRedrawColors();
}
setColors(colors){
for (const i in colors){
if(i==="status"){
for (const s in colors[i]){
MapSVG.fixColorHash(colors[i][s]);
}}else{
if(typeof colors[i]=="string"){
MapSVG.fixColorHash(colors[i]);
}}
}
$$A.extend(true, this.options, { colors: colors });
if(colors&&colors.status)
this.options.colors.status=colors.status;
if(this.options.colors.markers){
for (const z in this.options.colors.markers){
for (const x in this.options.colors.markers[z]){
this.options.colors.markers[z][x]=parseInt(this.options.colors.markers[z][x]);
}}
}
if(this.options.colors.background)
$$A(this.containers.map).css({ background: this.options.colors.background });
if(this.options.colors.hover){
this.options.colors.hover = !isNaN(this.options.colors.hover)
? parseInt(this.options.colors.hover + "")
: this.options.colors.hover;
}
if(this.options.colors.selected){
this.options.colors.selected = !isNaN(this.options.colors.selected)
? parseInt(this.options.colors.selected + "")
: this.options.colors.selected;
}
$$A(this.containers.leftSidebar).css({
"background-color": this.options.colors.leftSidebar,
});
$$A(this.containers.rightSidebar).css({
"background-color": this.options.colors.rightSidebar,
});
$$A(this.containers.header).css({ "background-color": this.options.colors.header });
$$A(this.containers.footer).css({ "background-color": this.options.colors.footer });
if($$A(this.containers.detailsView)&&this.options.colors.detailsView!==undefined){
$$A(this.containers.detailsView).css({
"background-color": this.options.colors.detailsView,
});
}
if($$A(this.containers.directory)&&this.options.colors.directory!==undefined){
$$A(this.containers.directory).css({
"background-color": this.options.colors.directory,
});
}
if($$A(this.containers.filtersModal)&&this.options.colors.modalFilters!==undefined){
$$A(this.containers.filtersModal).css({
"background-color": this.options.colors.modalFilters,
});
}
if($$A(this.containers.filters)&&this.options.colors.directorySearch){
$$A(this.containers.filters).css({
"background-color": this.options.colors.directorySearch,
});
}
else if($$A(this.containers.filters)){
$$A(this.containers.filters).css({
"background-color": "",
});
}
if(!this.containers.clustersCss){
this.containers.clustersCss=($$A("<style></style>").appendTo("body")[0]);
}
let css="";
if(this.options.colors.clusters){
css +="background-color: " + this.options.colors.clusters + ";";
}
if(this.options.colors.clustersBorders){
css +="border-color: " + this.options.colors.clustersBorders + ";";
}
if(this.options.colors.clustersText){
css +="color: " + this.options.colors.clustersText + ";";
}
$$A(this.containers.clustersCss).html(".mapsvg-marker-cluster {" + css + "}");
if(!this.containers.clustersHoverCss){
this.containers.clustersHoverCss=($$A("<style></style>").appendTo("body")[0]);
}
let cssHover="";
if(this.options.colors.clustersHover){
cssHover +="background-color: " + this.options.colors.clustersHover + ";";
}
if(this.options.colors.clustersHoverBorders){
cssHover +="border-color: " + this.options.colors.clustersHoverBorders + ";";
}
if(this.options.colors.clustersHoverText){
cssHover +="color: " + this.options.colors.clustersHoverText + ";";
}
$$A(this.containers.clustersHoverCss).html(".mapsvg-marker-cluster:hover {" + cssHover + "}");
if(!this.containers.markersCss){
this.containers.markersCss=$$A("<style></style>").appendTo("head")[0];
}
const markerCssText=".mapsvg-with-marker-active .mapsvg-marker {\n" +
"  opacity: " +
this.options.colors.markers.inactive.opacity / 100 +
";\n" +
"  -webkit-filter: grayscale(" +
(100 - this.options.colors.markers.inactive.saturation) +
"%);\n" +
"  filter: grayscale(" +
(100 - this.options.colors.markers.inactive.saturation) +
"%);\n" +
"}\n" +
".mapsvg-with-marker-active .mapsvg-marker-active {\n" +
"  opacity: " +
this.options.colors.markers.active.opacity / 100 +
";\n" +
"  -webkit-filter: grayscale(" +
(100 - this.options.colors.markers.active.saturation) +
"%);\n" +
"  filter: grayscale(" +
(100 - this.options.colors.markers.active.saturation) +
"%);\n" +
"}\n" +
".mapsvg-with-marker-hover .mapsvg-marker {\n" +
"  opacity: " +
this.options.colors.markers.unhovered.opacity / 100 +
";\n" +
"  -webkit-filter: grayscale(" +
(100 - this.options.colors.markers.unhovered.saturation) +
"%);\n" +
"  filter: grayscale(" +
(100 - this.options.colors.markers.unhovered.saturation) +
"%);\n" +
"}\n" +
".mapsvg-with-marker-hover .mapsvg-marker-hover {\n" +
"  opacity: " +
this.options.colors.markers.hovered.opacity / 100 +
";\n" +
"  -webkit-filter: grayscale(" +
(100 - this.options.colors.markers.hovered.saturation) +
"%);\n" +
"  filter: grayscale(" +
(100 - this.options.colors.markers.hovered.saturation) +
"%);\n" +
"}\n";
$$A(this.containers.markersCss).html(markerCssText);
$$A.each(this.options.colors, (key, color)=> {
if(color===null||color=="")
delete this.options.colors[key];
});
this.regionsRedrawColors();
}
setTooltips(options){
if(options.on!==undefined)
options.on=MapSVG.parseBoolean(options.on);
$$A.extend(true, this.options, { tooltips: options });
if(!this.containers.tooltip){
this.containers.tooltip=$$A("<div />").addClass("mapsvg-tooltip")[0];
$$A(this.containers.map).append(this.containers.tooltip);
this.controllers.tooltip=new Tooltip({
mapsvg: this,
container: this.containers.tooltip,
position: this.options.tooltips.position,
maxWidth: this.options.tooltips.maxWidth,
minWidth: this.options.tooltips.minWidth,
});
this.controllers.tooltip._init();
}
if(typeof this.options.tooltips.position!=="undefined"){
this.controllers.tooltip.setPosition(this.options.tooltips.position);
}
if(typeof this.options.tooltips.maxWidth!=="undefined" ||
typeof this.options.tooltips.minWidth!=="undefined"){
this.controllers.tooltip.setSize(this.options.tooltips.minWidth, this.options.tooltips.maxWidth);
}}
setPopovers(options){
if(options.on!==undefined)
options.on=MapSVG.parseBoolean(options.on);
$$A.extend(this.options.popovers, options);
if(!this.containers.popover){
this.containers.popover=$$A("<div />").addClass("mapsvg-popover")[0];
this.layers.popovers.append(this.containers.popover);
}
$$A(this.containers.popover).css({
width: this.options.popovers.width + (this.options.popovers.width=="auto" ? "":"px"),
"max-width": this.options.popovers.maxWidth + "%",
"max-height": (this.options.popovers.maxHeight * $$A(this.containers.wrap).outerHeight()) / 100 +
"px",
});
if(this.options.popovers.mobileFullscreen&&MapSVG.isPhone){
$$A("body").toggleClass("mapsvg-fullscreen-popovers", true);
$$A(this.containers.popover).appendTo("body");
}}
setRegionPrefix(prefix){
this.options.regionPrefix=prefix;
}
setInitialViewBox(v){
if(typeof v=="string")
v=v
.trim()
.split(" ")
.map(function (v){
return parseFloat(v);
});
this._viewBox.update(new ViewBox(v));
if(this.options.googleMaps.on){
this.options.googleMaps.center=this.googleMaps.map.getCenter().toJSON();
this.options.googleMaps.zoom=this.googleMaps.map.getZoom();
}
this.zoomLevel=0;
this.setZoomLevels();
}
setViewBoxOnStart(){
this.viewBoxFull=this.svgDefault.viewBox;
this.viewBoxFake=this.viewBox;
this.whRatioFull=this.viewBoxFull.width / this.viewBox.width;
this.containers.svg.setAttribute("viewBox", this.viewBoxFull.toString());
if((MapSVG.device.ios||MapSVG.device.android)&&this.svgDefault.viewBox.width > 1500){
this.iosDownscaleFactor=this.svgDefault.viewBox.width > 9999 ? 100:10;
this.containers.svg.style.width =
(this.svgDefault.viewBox.width / this.iosDownscaleFactor).toString() + "px";
}else{
this.containers.svg.style.width=this.svgDefault.viewBox.width + "px";
}
this.vbStart=true;
}
setViewBox(viewBox, adjustGoogleMap=true){
let initial=false;
if(typeof viewBox==="undefined"||(viewBox.width===0&&viewBox.height===0)){
viewBox=this.svgDefault.viewBox;
initial=true;
}
const isZooming=viewBox.width!=this.viewBox.width||viewBox.height!=this.viewBox.height;
this.viewBox.update(viewBox);
this.whRatio=this.viewBox.width / this.viewBox.height;
!this.vbStart&&this.setViewBoxOnStart();
if(initial){
if(this._viewBox.width===0&&this._viewBox.height===0){
this._viewBox.update(this.viewBox);
}
this._scale=1;
}
this.scale=this.getScale();
this.superScale=(this.whRatioFull * this.svgDefault.viewBox.width) / this.viewBox.width;
const w=this.svgDefault.viewBox.width / this.containers.map.clientWidth;
this.superScale=this.superScale / w;
if((MapSVG.device.ios||MapSVG.device.android)&&this.svgDefault.viewBox.width > 1500){
this.superScale *=this.iosDownscaleFactor;
}
this.scroll.tx=Math.round((this.svgDefault.viewBox.x - this.viewBox.x) * this.scale);
this.scroll.ty=Math.round((this.svgDefault.viewBox.y - this.viewBox.y) * this.scale);
if(this.googleMaps.map&&adjustGoogleMap!==false){
const googlePrevZoom=this.googleMaps.map.getZoom();
this.googleMaps.map.setCenter(this.getCenterGeoPoint());
this.googleMaps.map.setZoom(this.getZoomForGoogle());
}else{
this.containers.scrollpane.style.transform =
"translate(" + this.scroll.tx + "px," + this.scroll.ty + "px)";
this.containers.svg.style.transform="scale(" + this.superScale + ")";
this.syncZoomLevelWithGoogle();
}
this.movingItemsAdjustScreenPosition();
if(isZooming){
this.adjustStrokes();
this.toggleSvgLayerOnZoom();
if(this.options.clustering.on){
this.throttle(this.clusterizeOnZoom, 400, this);
}else{
this.events.trigger("zoom");
}}
return true;
}
syncZoomLevelWithGoogle(){
if(this.googleMaps.map &&
this.googleMaps.map.getZoom()!==this.getZoomForGoogle() &&
typeof this.zoomDelta!=="undefined"){
this.zoomLevel=this.googleMaps.map.getZoom() - this.zoomDelta;
}}
getCenterGeoPoint(){
return this.converter.convertSVGToGeo(this.getCenterSvgPoint());
}
getCenterSvgPoint(){
return new SVGPoint(this.viewBox.x + this.viewBox.width / 2, this.viewBox.y + this.viewBox.height / 2);
}
getZoomForGoogle(){
if(typeof this.zoomLevel==="string"){
this.zoomLevel=parseInt(this.zoomLevel);
}
return this.zoomLevel + this.zoomDelta;
}
getZoomRange(){
const range={ min: 0, max: 0 };
if(this.options.googleMaps.on){
range.min=Math.max(0, this.options.zoom.limit[0] + this.zoomDelta) - this.zoomDelta;
range.max=Math.min(22, this.options.zoom.limit[1] + this.zoomDelta) - this.zoomDelta;
}else{
range.min=this.options.zoom.limit[0];
range.max=this.options.zoom.limit[1];
}
return range;
}
enableMovingElementsAnimation(){
$$A(this.containers.map).removeClass("no-transitions-markers no-transitions-labels no-transitions-bubbles");
}
disableMovingElementsAnimation(){
$$A(this.containers.map).addClass("no-transitions-markers no-transitions-labels no-transitions-bubbles");
}
clusterizeOnZoom(){
if(this.options.googleMaps.on&&this.googleMaps.map&&this.zoomDelta){
this.zoomLevel=this.googleMaps.map.getZoom() - this.zoomDelta;
}
this.events.trigger("zoom");
this.clusterizeMarkers(true);
}
throttle(method, delay, scope, params){
clearTimeout(method._tId);
method._tId=setTimeout(function (){
method.apply(scope, params);
}, delay);
}
setViewBoxByGoogleMapBounds(){
const googleMapBounds=this.googleMaps.map.getBounds();
if(!googleMapBounds)
return;
const googleMapBoundsJSON=googleMapBounds.toJSON();
if(googleMapBoundsJSON.west==-180&&googleMapBoundsJSON.east==180){
const center=this.googleMaps.map.getCenter().toJSON();
}
const ne=new GeoPoint(googleMapBounds.getNorthEast().lat(), googleMapBounds.getNorthEast().lng());
const sw=new GeoPoint(googleMapBounds.getSouthWest().lat(), googleMapBounds.getSouthWest().lng());
const xyNE=this.converter.convertGeoToSVG(ne);
const xySW=this.converter.convertGeoToSVG(sw);
if(xyNE.x < xySW.y){
const mapPointsWidth=(this.svgDefault.viewBox.width / this.converter.mapLonDelta) * 360;
xySW.x=-(mapPointsWidth - xySW.y);
}
const width=xyNE.x - xySW.x;
const height=xySW.y - xyNE.y;
const viewBox=new ViewBox(xySW.x, xyNE.y, width, height);
this.setViewBox(viewBox);
}
redraw(){
this.disableAnimation();
if(MapSVG.browser.ie){
$$A(this.containers.svg).css({ height: this.svgDefault.viewBox.height });
}
if(this.options.googleMaps.on&&this.googleMaps.map){
google.maps.event.trigger(this.googleMaps.map, "resize");
}else{
this.setViewBox(this.viewBox);
}
$$A(this.containers.popover) &&
$$A(this.containers.popover).css({
"max-height": (this.options.popovers.maxHeight * $$A(this.containers.wrap).outerHeight()) /
100 +
"px",
});
if(this.controllers&&this.controllers.directory){
this.controllers.directory.updateTopShift();
this.controllers.directory.updateScroll();
}
this.movingItemsAdjustScreenPosition();
this.adjustStrokes();
this.enableAnimation();
}
setSize(width, height, responsive){
this.options.width=width;
this.options.height=height;
this.options.responsive =
responsive!=null&&responsive!=undefined
? MapSVG.parseBoolean(responsive)
: this.options.responsive;
if(!this.options.width&&!this.options.height){
this.options.width=this.svgDefault.width;
this.options.height=this.svgDefault.height;
}
else if(!this.options.width&&this.options.height){
this.options.width =
(this.options.height * this.svgDefault.width) / this.svgDefault.height;
}
else if(this.options.width&&!this.options.height){
this.options.height =
(this.options.width * this.svgDefault.height) / this.svgDefault.width;
}
this.whRatio=this.options.width / this.options.height;
this.scale=this.getScale();
this.setResponsive(responsive);
if(this.options.choropleth.on&&this.options.choropleth.bubbleMode){
this.redrawBubbles();
}
this.movingItemsAdjustScreenPosition();
}
setResponsive(on){
on=on!=undefined ? MapSVG.parseBoolean(on):this.options.responsive;
$$A(this.containers.map).css({
width: "100%",
height: "0",
"padding-bottom": (this.viewBox.height * 100) / this.viewBox.width + "%",
});
if(on){
$$A(this.containers.wrap).css({
width: "100%",
height: "auto",
});
}else{
$$A(this.containers.wrap).css({
width: this.options.width + "px",
height: this.options.height + "px",
});
}
$$A.extend(true, this.options, { responsive: on });
if(!this.resizeSensor){
this.resizeSensor=new ResizeSensor(this.containers.map, ()=> {
this.redraw();
});
}
this.redraw();
}
setScroll(options, skipEvents){
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
options.limit!=undefined&&(options.limit=MapSVG.parseBoolean(options.limit));
$$A.extend(true, this.options, { scroll: options });
!skipEvents&&this.setEventHandlers();
}
setZoom(options){
options=options||{};
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
options.fingers!=undefined&&(options.fingers=MapSVG.parseBoolean(options.fingers));
options.mousewheel!=undefined &&
(options.mousewheel=MapSVG.parseBoolean(options.mousewheel));
options.delta=2;
if(options.limit){
if(typeof options.limit=="string")
options.limit=options.limit.split(";");
options.limit=[parseInt(options.limit[0]), parseInt(options.limit[1])];
}
if(!this.zoomLevels){
this.setZoomLevels();
}
$$A.extend(true, this.options, { zoom: options });
$$A(this.containers.scrollpaneWrap).off("wheel.mapsvg");
if(this.options.zoom.mousewheel){
if(MapSVG.browser.firefox){
this.firefoxScroll={ insideIframe: false, scrollX: 0, scrollY: 0 };
$$A(this.containers.scrollpaneWrap)
.on("mouseenter", ()=> {
this.firefoxScroll.insideIframe=true;
this.firefoxScroll.scrollX=window.scrollX;
this.firefoxScroll.scrollY=window.scrollY;
})
.on("mouseleave", ()=> {
this.firefoxScroll.insideIframe=false;
});
$$A(document).scroll(()=> {
if(this.firefoxScroll.insideIframe)
window.scrollTo(this.firefoxScroll.scrollX, this.firefoxScroll.scrollY);
});
}
$$A(this.containers.scrollpaneWrap).on("wheel.mapsvg", (event)=> {
event.preventDefault();
this.mouseWheelZoom(event);
return false;
});
$$A(this.layers.markers).on("wheel.mapsvg", (event)=> {
event.preventDefault();
this.mouseWheelZoom(event);
return false;
});
}
this.canZoom=true;
}
mouseWheelZoom(event){
event.preventDefault();
const d=Math.sign(-event.originalEvent.deltaY);
const center=this.getSvgPointAtClick(event.originalEvent);
d > 0 ? this.zoomIn(center):this.zoomOut(center);
}
setControls(options){
options=options||{};
$$A.extend(true, this.options, { controls: options });
this.options.controls.zoom=MapSVG.parseBoolean(this.options.controls.zoom);
this.options.controls.zoomReset=MapSVG.parseBoolean(this.options.controls.zoomReset);
this.options.controls.userLocation=MapSVG.parseBoolean(this.options.controls.userLocation);
this.options.controls.previousMap=MapSVG.parseBoolean(this.options.controls.previousMap);
const loc=this.options.controls.location||"right";
if(!this.containers.controls){
const buttons=$$A("<div />").addClass("mapsvg-buttons");
const zoomGroup=$$A("<div />").addClass("mapsvg-btn-group").appendTo(buttons);
const zoomIn=$$A("<div />").addClass("mapsvg-btn-map mapsvg-in");
zoomIn.on("touchend click", (e)=> {
if(e.cancelable){
e.preventDefault();
}
e.stopPropagation();
this.zoomIn();
});
const zoomOut=$$A("<div />").addClass("mapsvg-btn-map mapsvg-out");
zoomOut.on("touchend click", (e)=> {
if(e.cancelable){
e.preventDefault();
}
e.stopPropagation();
this.zoomOut();
});
zoomGroup.append(zoomIn).append(zoomOut);
const location=$$A("<div />").addClass("mapsvg-btn-map mapsvg-btn-location");
location.on("touchend click", (e)=> {
if(e.cancelable){
e.preventDefault();
}
e.stopPropagation();
this.showUserLocation((location)=> {
if(this.options.scroll.on){
this.centerOn(location.marker);
}});
});
const userLocationIcon='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 447.342 447.342" style="enable-background:new 0 0 447.342 447.342;" xml:space="preserve"><path d="M443.537,3.805c-3.84-3.84-9.686-4.893-14.625-2.613L7.553,195.239c-4.827,2.215-7.807,7.153-7.535,12.459 c0.254,5.305,3.727,9.908,8.762,11.63l129.476,44.289c21.349,7.314,38.125,24.089,45.438,45.438l44.321,129.509 c1.72,5.018,6.325,8.491,11.63,8.762c5.306,0.271,10.244-2.725,12.458-7.535L446.15,18.429 C448.428,13.491,447.377,7.644,443.537,3.805z"/></svg>';
location.html(userLocationIcon);
const locationGroup=$$A("<div />").addClass("mapsvg-btn-group").appendTo(buttons);
locationGroup.append(location);
const zoomResetIcon='<svg height="14px" version="1.1" viewBox="0 0 14 14" width="14px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g fill="#000000" transform="translate(-215.000000, -257.000000)"><g id="fullscreen" transform="translate(215.000000, 257.000000)"><path d="M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z" /></g></g></g></svg>';
const zoomResetButton=$$A("<div />")
.html(zoomResetIcon)
.addClass("mapsvg-btn-map mapsvg-btn-zoom-reset");
zoomResetButton.on("touchend click", (e)=> {
if(e.cancelable){
e.preventDefault();
}
e.stopPropagation();
this.viewBoxReset(true);
});
const zoomResetGroup=$$A("<div />").addClass("mapsvg-btn-group").appendTo(buttons);
zoomResetGroup.append(zoomResetButton);
const previousMapIcon='<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="mapsvg-previous-map-icon" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" sodipodi:docname="undo.svg" inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata id="metadata19"><rdf:RDF><cc:Work rdf:about="">' +
'<dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs id="defs17" /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1920" inkscape:window-height="1017" id="namedview15" showgrid="false" inkscape:zoom="1.0103686" inkscape:cx="181.33521" inkscape:cy="211.70893" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="Capa_1" /> <g id="g6" transform="matrix(0.53219423,0,0,0.52547259,122.72749,106.63302)">' +
'<g id="g4"><path d="m 142.716,293.147 -94,-107.602 94,-107.602 c 7.596,-8.705 6.71,-21.924 -1.995,-29.527 -8.705,-7.596 -21.917,-6.703 -29.527,1.995 L 5.169,171.782 c -6.892,7.882 -6.892,19.65 0,27.532 l 106.026,121.372 c 4.143,4.729 9.94,7.157 15.771,7.157 4.883,0 9.786,-1.702 13.755,-5.169 8.706,-7.603 9.598,-20.822 1.995,-29.527 z" id="path2" inkscape:connector-curvature="0" /></g></g><g id="g12" transform="matrix(0.53219423,0,0,0.52547259,122.72749,106.63302)"><g id="g10"> <path d="M 359.93,164.619 H 20.926 C 9.368,164.619 0,173.986 0,185.545 c 0,11.558 9.368,20.926 20.926,20.926 H 359.93 c 60.776,0 110.218,49.441 110.218,110.211 0,60.77 -49.442,110.211 -110.218,110.211 H 48.828 c -11.558,0 -20.926,9.368 -20.926,20.926 0,11.558 9.368,20.926 20.926,20.926 H 359.93 C 443.774,468.745 512,400.526 512,316.682 512,232.838 443.781,164.619 359.93,164.619 Z" ' +
'id="path8" inkscape:connector-curvature="0" /></g></g></svg>';
const previousMapButton=$$A("<div />")
.html(previousMapIcon)
.addClass("mapsvg-btn-map mapsvg-btn-previous-map");
previousMapButton.on("touchend click", (e)=> {
if(e.cancelable){
e.preventDefault();
}
e.stopPropagation();
this.loadPreviousMap();
});
const previousMapGroup=$$A("<div />").addClass("mapsvg-btn-group").appendTo(buttons);
previousMapGroup.append(previousMapButton);
this.containers.controls=buttons[0];
this.controls={
zoom: zoomGroup[0],
userLocation: locationGroup[0],
zoomReset: zoomResetGroup[0],
previousMap: previousMapGroup[0],
};
$$A(this.containers.map).append($$A(this.containers.controls));
}
$$A(this.controls.zoom).toggle(this.options.controls.zoom);
$$A(this.controls.userLocation).toggle(this.options.controls.userLocation);
$$A(this.controls.zoomReset).toggle(this.options.controls.zoomReset);
$$A(this.controls.previousMap).toggle(this.options.controls.previousMap&&this.options.previousMapsIds.length > 0);
$$A(this.containers.controls).removeClass("left");
$$A(this.containers.controls).removeClass("right");
(loc=="right"&&$$A(this.containers.controls).addClass("right")) ||
(loc=="left"&&$$A(this.containers.controls).addClass("left"));
}
setZoomLevels(){
if(!this.zoomLevels){
this.zoomLevels=new ArrayIndexed("zoomLevel");
}else{
this.zoomLevels.clear();
}
for (let i=-20; i < 0; i++){
const _scale=1 / Math.pow(this.options.zoom.delta, Math.abs(i));
this.zoomLevels.push({
zoomLevel: i,
_scale: _scale,
viewBox: new ViewBox(0, 0, this._viewBox.width / _scale, this._viewBox.height / _scale),
});
}
for (let z=0; z <=20; z++){
const _scale=Math.pow(this.options.zoom.delta, Math.abs(z));
this.zoomLevels.push({
zoomLevel: z,
_scale: _scale,
viewBox: new ViewBox(0, 0, this._viewBox.width / _scale, this._viewBox.height / _scale),
});
}}
setCursor(type){
type=type=="pointer" ? "pointer":"default";
this.options.cursor=type;
if(type=="pointer")
$$A(this.containers.map).addClass("mapsvg-cursor-pointer");
else
$$A(this.containers.map).removeClass("mapsvg-cursor-pointer");
}
setMultiSelect(on, deselect){
this.options.multiSelect=MapSVG.parseBoolean(on);
if(deselect!==false)
this.deselectAllRegions();
}
_new_setChoropleth(options){
options=options||this.options.choropleth;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
if(typeof options.coloring==="undefined" ||
typeof options.coloring.palette==="undefined" ||
typeof options.coloring.palette.colors==="undefined"){
if(typeof options.sourceFieldSelect==="undefined" ||
typeof options.sourceFieldSelect.variants==="undefined"){
$$A.extend(true, this.options.choropleth, options);
}else{
this.options.choropleth.sourceFieldSelect.variants =
options.sourceFieldSelect.variants;
}}else{
const paletteColorsIndexes=Object.keys(options.coloring.palette.colors);
if(paletteColorsIndexes.length > 1 ||
(paletteColorsIndexes[0]=="0" &&
Object.keys(options.coloring.palette.colors[0]).length > 1)){
this.options.choropleth.coloring.palette.colors=options.coloring.palette.colors;
}else{
const paletteColorIndex=Object.keys(options.coloring.palette.colors)[0];
$$A.extend(true, this.options.choropleth.coloring.palette.colors[paletteColorIndex], options.coloring.palette.colors[paletteColorIndex]);
}}
this.updateChoroplethMinMax();
if(this.options.choropleth.on &&
this.options.choropleth.sourceFieldSelect.on &&
this.options.choropleth.sourceFieldSelect.variants){
if(!this.containers.choroplethSourceSelect){
const sourceSelectOptions=[];
this.options.choropleth.sourceFieldSelect.variants.forEach((variant)=> {
sourceSelectOptions.push($$A('<option value="' +
variant +
'" ' +
(variant===this.options.choropleth.sourceField
? "selected"
: "") +
">" +
variant +
"</option>"));
});
this.containers.choroplethSourceSelect={
container: $$A('<div class="mapsvg-choropleth-source-field"></div>')[0],
select: $$A('<select id="mapsvg-choropleth-source-field-select" class="mapsvg-select2"></select>')[0],
options: sourceSelectOptions,
};
$$A(this.containers.choroplethSourceSelect.select).append(this.containers.choroplethSourceSelect.options);
$$A(this.containers.choroplethSourceSelect.container).append($$A(this.containers.choroplethSourceSelect.select));
$$A(this.containers.map).append($$A(this.containers.choroplethSourceSelect.container));
$$A(this.containers.choroplethSourceSelect.select).mselect2();
$$A(this.containers.choroplethSourceSelect.select)
.mselect2()
.on("select2:select select2:unselecting", (e)=> {
if(e.cancelable){
e.preventDefault();
}
e.stopPropagation();
this.setChoropleth({ sourceField: $$A(e.target).mselect2().val() });
});
}else{
$$A(this.containers.choroplethSourceSelect.select).mselect2("destroy");
$$A(this.containers.choroplethSourceSelect.select).find("option").remove();
this.containers.choroplethSourceSelect.options=[];
this.options.choropleth.sourceFieldSelect.variants.forEach((variant)=> {
this.containers.choroplethSourceSelect.options.push($$A('<option value="' +
variant +
'" ' +
(variant===this.options.choropleth.sourceField
? "selected"
: "") +
">" +
variant +
"</option>")[0]);
});
$$A(this.containers.choroplethSourceSelect.select).append(this.containers.choroplethSourceSelect.options);
$$A(this.containers.choroplethSourceSelect.select).mselect2({ width: "100%" });
}}
if((!this.options.choropleth.on||!this.options.choropleth.sourceFieldSelect.on) &&
this.containers.choroplethSourceSelect &&
$$A(this.containers.choroplethSourceSelect.container).is(":visible")){
$$A(this.containers.choroplethSourceSelect.container).hide();
}
else if(this.options.choropleth.on &&
this.options.choropleth.sourceFieldSelect.on &&
this.containers.choroplethSourceSelect &&
!$$A(this.containers.choroplethSourceSelect.container).is(":visible")){
$$A(this.containers.choroplethSourceSelect.container).show();
}
$$A(this.containers.map).find(".mapsvg-choropleth-legend").remove();
if(this.options.choropleth.on&&this.options.choropleth.coloring.legend.on){
const legend=this.options.choropleth.coloring.legend;
let coloring="";
if(this.options.choropleth.coloring.mode==="gradient"){
coloring +=
'<div class="mapsvg-choropleth-legend-gradient-no-data">' +
this.options.choropleth.coloring.noData.description +
"</div>";
let legendGradient="";
for (let chunkIdx=1; chunkIdx < 5; chunkIdx++){
legendGradient +=
'<div class="mapsvg-choropleth-legend-gradient-chunk">' +
((this.options.choropleth.coloring.gradient.values.maxAdjusted * chunkIdx) /
5 +
this.options.choropleth.coloring.gradient.values.min) +
"</div>";
}
coloring +=
'<div class="mapsvg-choropleth-legend-gradient-colors">' +
legendGradient +
"</div>";
}else{
coloring +=
'<div class="mapsvg-choropleth-legend-palette-color-wrap" data-idx="no-data">' +
'<div class="mapsvg-choropleth-legend-palette-color"></div>' +
'<div class="mapsvg-choropleth-legend-palette-color-description">' +
this.options.choropleth.coloring.noData.description +
"</div>" +
"</div>";
coloring +=
'<div class="mapsvg-choropleth-legend-palette-color-wrap" data-idx="out-of-range">' +
'<div class="mapsvg-choropleth-legend-palette-color"></div>' +
'<div class="mapsvg-choropleth-legend-palette-color-description">' +
this.options.choropleth.coloring.palette.outOfRange.description +
"</div>" +
"</div>";
const paletteColors=this.options.choropleth.coloring.palette.colors;
paletteColors.forEach((paletteColor, idx)=> {
let paletteColorElementText="";
if(paletteColor.description){
paletteColorElementText=paletteColor.description;
}else{
if(idx===0&&!paletteColor.valueFrom&&paletteColor.valueFrom!==0){
if(legend.layout==="vertical"){
paletteColorElementText="Less then " + paletteColor.valueTo;
}else{
paletteColorElementText="< " + paletteColor.valueTo;
}}
else if(idx===paletteColors.length - 1&&!paletteColor.valueTo){
if(legend.layout==="vertical"){
paletteColorElementText=paletteColor.valueFrom + " or more";
}else{
paletteColorElementText=paletteColor.valueFrom + " <";
}}else{
paletteColorElementText =
paletteColor.valueFrom + " &#8804; " + paletteColor.valueTo;
}}
coloring +=
'<div class="mapsvg-choropleth-legend-palette-color-wrap" data-idx="' +
idx +
'">' +
'<div class="mapsvg-choropleth-legend-palette-color"></div>' +
'<div class="mapsvg-choropleth-legend-palette-color-description">' +
paletteColorElementText +
"</div>" +
"</div>";
});
}
this.containers.legend={
title: $$A('<div class="mapsvg-choropleth-legend-title">' + legend.title + "</div>")[0],
text: $$A('<div class="mapsvg-choropleth-legend-text">' + legend.text + "</div>")[0],
coloring: $$A('<div class="mapsvg-choropleth-legend-' +
this.options.choropleth.coloring.mode +
'">' +
coloring +
"</div>")[0],
description: $$A('<div class="mapsvg-choropleth-legend-description">' +
legend.description +
"</div>")[0],
container: $$A("<div />").addClass("mapsvg-choropleth-legend mapsvg-choropleth-legend-" +
legend.layout +
" mapsvg-choropleth-legend-container-" +
legend.container)[0],
};
$$A(this.containers.legend.container)
.append(this.containers.legend.title)
.append(this.containers.legend.text)
.append(this.containers.legend.coloring)
.append(this.containers.legend.description);
$$A(this.containers.map).append(this.containers.legend.container);
this.setChoroplethLegendCSS();
this.regionsRepository.events.on("updated", ()=> {
this.redrawChoropleth();
});
this.objectsRepository.events.on("updated", ()=> {
this.redrawChoropleth();
});
}
if(this.options.choropleth.on&&this.options.choropleth.coloring.mode==="gradient"){
const colors=this.options.choropleth.coloring.gradient.colors;
if(colors){
colors.lowRGB=tinycolor(colors.low).toRgb();
colors.highRGB=tinycolor(colors.high).toRgb();
colors.diffRGB={
r: colors.highRGB.r - colors.lowRGB.r,
g: colors.highRGB.g - colors.lowRGB.g,
b: colors.highRGB.b - colors.lowRGB.b,
a: colors.highRGB.a - colors.lowRGB.a,
};
this.containers.legend&&this.setChoroplethLegendCSS();
}}
this.redrawChoropleth();
}
redrawChoropleth(){
this.updateChoroplethMinMax();
this.redrawBubbles();
this.regionsRedrawColors();
}
updateChoroplethMinMax(){
if(this.options.choropleth.on){
const gradient=this.options.choropleth.coloring.gradient, values=[];
gradient.values.min=0;
gradient.values.max=null;
if(this.options.choropleth.source==="regions"){
this.regions.forEach((region)=> {
const choropleth=region.data&&region.data[this.options.choropleth.sourceField];
choropleth!=undefined&&choropleth!==""&&values.push(choropleth);
});
}else{
this.objectsRepository.objects.forEach((object)=> {
const choropleth=object[this.options.choropleth.sourceField];
choropleth!=undefined&&choropleth!==""&&values.push(choropleth);
});
}
if(values.length > 0){
gradient.values.min=Math.min.apply(null, values);
gradient.values.max=Math.max.apply(null, values);
gradient.values.maxAdjusted=gradient.values.max - gradient.values.min;
}}
}
setChoroplethLegendCSS(){
const gradient=this.options.choropleth.coloring.gradient, legend=this.options.choropleth.coloring.legend, noData=this.options.choropleth.coloring.noData, outOfRange=this.options.choropleth.coloring.palette.outOfRange;
$$A(".mapsvg-choropleth-legend").css({
width: legend.width,
height: legend.height,
});
if(this.options.choropleth.coloring.mode==="gradient"){
if(legend.layout==="horizontal"){
$$A(".mapsvg-choropleth-legend-horizontal .mapsvg-choropleth-legend-gradient-colors").css({
background: "linear-gradient(to right," +
gradient.colors.low +
" 1%," +
gradient.colors.high +
" 100%)",
});
}else{
$$A(".mapsvg-choropleth-legend-vertical .mapsvg-choropleth-legend-gradient-colors").css({
background: "linear-gradient(to bottom," +
gradient.colors.low +
" 1%," +
gradient.colors.high +
" 100%)",
});
}
$$A(".mapsvg-choropleth-legend-gradient-no-data").css({
"background-color": noData.color,
});
}else{
const paletteColors=this.options.choropleth.coloring.palette.colors;
paletteColors.forEach(function (paletteColor, idx){
$$A('.mapsvg-choropleth-legend-palette-color-wrap[data-idx="' +
idx +
'"] .mapsvg-choropleth-legend-palette-color').css({
"background-color": paletteColor.color,
});
});
$$A('.mapsvg-choropleth-legend-palette-color-wrap[data-idx="no-data"] .mapsvg-choropleth-legend-palette-color').css({
"background-color": noData.color,
});
$$A('.mapsvg-choropleth-legend-palette-color-wrap[data-idx="out-of-range"] .mapsvg-choropleth-legend-palette-color').css({
"background-color": outOfRange.color,
});
}}
setCss(css){
this.options.css =
css||(this.options.css ? this.options.css.replace(/%id%/g, "" + this.id):"");
this.liveCss=this.liveCss||$$A("<style></style>").appendTo("head")[0];
$$A(this.liveCss).html(this.options.css);
}
setFilters(options){
options=options||this.options.filters;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
options.hide!=undefined&&(options.hide=MapSVG.parseBoolean(options.hide));
$$A.extend(true, this.options, { filters: options });
if(!MapSVG.googleMapsApiLoaded &&
this.options.filters.on &&
this.filtersSchema.getField("distance")){
this.loadGoogleMapsAPI(()=> {
return 1;
}, ()=> {
return 1;
});
}
if(["leftSidebar", "rightSidebar", "header", "footer", "custom", "map"].indexOf(this.options.filters.location)===-1){
this.options.filters.location="leftSidebar";
}
if(this.options.filters.on){
if(this.formBuilder){
this.formBuilder.destroy();
}
if(!this.containers.filters){
this.containers.filters=$$A('<div class="mapsvg-filters-wrap"></div>')[0];
}else{
$$A(this.containers.filters).empty();
$$A(this.containers.filters).show();
}
$$A(this.containers.filters).css({
"background-color": this.options.colors.directorySearch,
});
if($$A(this.containers.filtersModal)){
$$A(this.containers.filtersModal).css({ width: this.options.filters.width });
}
if(this.options.filters.location==="custom"){
$$A(this.containers.filters)
.removeClass("mapsvg-filter-container-custom")
.addClass("mapsvg-filter-container-custom");
if($$A("#" + this.options.filters.containerId).length){
$$A("#" + this.options.filters.containerId).append(this.containers.filters);
}else{
$$A(this.containers.filters).hide();
console.error("MapSVG: filter container #" +
this.options.filters.containerId +
" does not exists");
}}else{
if(MapSVG.isPhone){
$$A(this.containers.header).append($$A(this.containers.filters));
this.setContainers({ header: { on: true }});
}else{
const location=MapSVG.isPhone ? "header":this.options.filters.location;
if(this.options.menu.on &&
this.controllers.directory &&
this.options.menu.location===this.options.filters.location){
$$A(this.controllers.directory.containers.view)
.find(".mapsvg-directory-filter-wrap")
.append($$A(this.containers.filters));
this.controllers.directory.updateTopShift();
}else{
$$A(this.containers[location]).append($$A(this.containers.filters));
this.controllers.directory&&this.controllers.directory.updateTopShift();
}}
}
this.loadFiltersController(this.containers.filters, false);
this.updateFiltersState();
}else{
if($$A(this.containers.filters)){
$$A(this.containers.filters).empty();
$$A(this.containers.filters).hide();
}}
if(this.options.menu.on &&
this.controllers.directory &&
this.options.menu.location===this.options.filters.location){
this.controllers.directory.updateTopShift();
}}
updateFiltersState(){
if(this.options.filters&&this.options.filters.on&&this.controllers.filters){
this.controllers.filters.update(this.objectsRepository.query);
this.updateFilterTags();
}}
setGlobalDistanceFilter(){
if(this.objectsRepository &&
this.objectsRepository.query.filters &&
this.objectsRepository.query.filters.distance){
const dist=this.objectsRepository.query.filters.distance;
MapSVG.distanceSearch=this.objectsRepository.query.filters.distance;
}else{
MapSVG.distanceSearch=null;
}}
updateFilterTags(){
$$A(this.containers.filterTags)&&$$A(this.containers.filterTags).empty();
for (const field_name in this.objectsRepository.query.filters){
let field_value=this.objectsRepository.query.filters[field_name];
let _field_name=field_name;
const filterField=this.filtersSchema.getField(_field_name);
if(field_name=="regions"){
_field_name="";
field_value=field_value.region_ids.map((id)=> this.getRegion(id).title);
}else{
_field_name=filterField&&filterField.label;
}
if(field_name!=="distance"){
if(!this.containers.filterTags){
this.containers.filterTags=$$A('<div class="mapsvg-filter-tags"></div>')[0];
if($$A(this.containers.filters)) ;
else {
if(this.options.menu.on&&this.controllers.directory){
$$A(this.controllers.directory.containers.toolbar).append(this.containers.filterTags);
this.controllers.directory.updateTopShift();
}else{
$$A(this.containers.map).append(this.containers.filterTags);
if(this.options.zoom.buttons.on){
if(this.options.layersControl.on){
if(this.options.layersControl.position=="top-left"){
$$A(this.containers.filterTags).css({
right: 0,
bottom: 0,
});
}else{
$$A(this.containers.filterTags).css({
bottom: 0,
});
}}else{
if(this.options.zoom.buttons.location=="left"){
$$A(this.containers.filterTags).css({
right: 0,
});
}}
}}
}
$$A(this.containers.filterTags).on("click", ".mapsvg-filter-delete", (e)=> {
const filterField=$$A(e.target).data("filter");
$$A(e.target).parent().remove();
this.objectsRepository.query.removeFilter(filterField);
this.deselectAllRegions();
this.loadDataObjects();
});
}
$$A(this.containers.filterTags).append('<div class="mapsvg-filter-tag">' +
(_field_name ? _field_name + ": ":"") +
field_value +
' <span class="mapsvg-filter-delete" data-filter="' +
field_name +
'">×</span></div>');
}}
}
setContainers(options){
const _this=this;
if(!this.containersCreated){
this.containers.wrapAll=document.createElement("div");
this.containers.wrapAll.classList.add("mapsvg-wrap-all");
this.containers.wrapAll.id="mapsvg-map-" + this.id;
this.containers.wrapAll.setAttribute("data-map-id", this.id ? this.id.toString():"");
this.containers.wrap=document.createElement("div");
this.containers.wrap.classList.add("mapsvg-wrap");
this.containers.mapContainer=document.createElement("div");
this.containers.mapContainer.classList.add("mapsvg-map-container");
this.containers.leftSidebar=document.createElement("div");
this.containers.leftSidebar.className =
"mapsvg-sidebar mapsvg-top-container mapsvg-sidebar-left";
this.containers.rightSidebar=document.createElement("div");
this.containers.rightSidebar.className =
"mapsvg-sidebar mapsvg-top-container mapsvg-sidebar-right";
this.containers.header=document.createElement("div");
this.containers.header.className="mapsvg-header mapsvg-top-container";
this.containers.footer=document.createElement("div");
this.containers.footer.className="mapsvg-footer mapsvg-top-container";
_this.containers.wrapAll=$$A('<div class="mapsvg-wrap-all"></div>')
.attr("id", "mapsvg-map-" + this.id)
.attr("data-map-id", this.id)[0];
_this.containers.wrap=$$A('<div class="mapsvg-wrap"></div>')[0];
_this.containers.mapContainer=$$A('<div class="mapsvg-map-container"></div>')[0];
_this.containers.leftSidebar=$$A('<div class="mapsvg-sidebar mapsvg-top-container mapsvg-sidebar-left"></div>')[0];
_this.containers.rightSidebar=$$A('<div class="mapsvg-sidebar mapsvg-top-container mapsvg-sidebar-right"></div>')[0];
_this.containers.header=$$A('<div class="mapsvg-header mapsvg-top-container"></div>')[0];
_this.containers.footer=$$A('<div class="mapsvg-footer mapsvg-top-container"></div>')[0];
$$A(_this.containers.wrapAll).insertBefore(_this.containers.map);
$$A(_this.containers.wrapAll).append(_this.containers.header);
$$A(_this.containers.wrapAll).append(_this.containers.wrap);
$$A(_this.containers.wrapAll).append(_this.containers.footer);
$$A(_this.containers.mapContainer).append(_this.containers.map);
$$A(_this.containers.wrap).append(_this.containers.leftSidebar);
$$A(_this.containers.wrap).append(_this.containers.mapContainer);
$$A(_this.containers.wrap).append(_this.containers.rightSidebar);
_this.containersCreated=true;
}
options=options||_this.options.containers||{};
for (const contName in options){
if(options[contName].on!==undefined){
options[contName].on=MapSVG.parseBoolean(options[contName].on);
}
if(options[contName].width){
if(typeof options[contName].width!="string" ||
(options[contName].width.indexOf("px")===-1 &&
options[contName].width.indexOf("%")===-1 &&
options[contName].width!=="auto")){
options[contName].width=options[contName].width + "px";
}
$$A(_this.containers[contName]).css({ "flex-basis": options[contName].width });
}
if(options[contName].height){
if(typeof options[contName].height!="string" ||
(options[contName].height.indexOf("px")===-1 &&
options[contName].height.indexOf("%")===-1 &&
options[contName].height!=="auto")){
options[contName].height=options[contName].height + "px";
}
$$A(_this.containers[contName]).css({
"flex-basis": options[contName].height,
height: options[contName].height,
});
}
$$A.extend(true, _this.options, { containers: options });
let on=_this.options.containers[contName].on;
if(MapSVG.isPhone &&
_this.options.menu.hideOnMobile &&
_this.options.menu.location===contName &&
["leftSidebar", "rightSidebar"].indexOf(contName)!==-1){
on=false;
}
else if(MapSVG.isPhone &&
_this.options.menu.location==="custom" &&
["leftSidebar", "rightSidebar"].indexOf(contName)!==-1){
on=false;
$$A(_this.containers.wrapAll).addClass("mapsvg-hide-map-list-buttons");
}
else if(MapSVG.isPhone &&
!_this.options.menu.hideOnMobile &&
_this.options.menu.location===contName &&
["leftSidebar", "rightSidebar"].indexOf(contName)!==-1){
$$A(_this.containers.wrapAll).addClass("mapsvg-hide-map-list-buttons");
$$A(_this.containers.wrapAll).addClass("mapsvg-directory-visible");
}
$$A(_this.containers[contName]).toggle(on);
}
_this.setDetailsView();
}
shouldBeScrollable(container){
const _this=this;
switch (container){
case "map":
case "leftSidebar":
case "rightSidebar":
return true;
case "custom":
return false;
case "header":
case "footer":
if(_this.options.containers[container].height &&
_this.options.containers[container].height!=="auto" &&
_this.options.containers[container].height!=="100%"){
return true;
}else{
return false;
}
default:
return false;
}}
setDirectory(options){
return this.setMenu(options);
}
setMenu(options){
options=options||this.options.menu;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
options.search!=undefined&&(options.search=MapSVG.parseBoolean(options.search));
options.showMapOnClick!=undefined &&
(options.showMapOnClick=MapSVG.parseBoolean(options.showMapOnClick));
options.searchFallback!=undefined &&
(options.searchFallback=MapSVG.parseBoolean(options.searchFallback));
options.customContainer!=undefined &&
(options.customContainer=MapSVG.parseBoolean(options.customContainer));
$$A.extend(true, this.options, { menu: options });
this.controllers=this.controllers||{};
if(!this.containers.directory){
this.containers.directory=$$A('<div class="mapsvg-directory"></div>')[0];
}
$$A(this.containers.directory).toggleClass("flex", this.shouldBeScrollable(this.options.menu.location));
if(this.options.menu.on){
if(!this.controllers.directory){
this.controllers.directory=new DirectoryController({
container: this.containers.directory,
template: this.options.templates.directory,
mapsvg: this,
repository: this.options.menu.source==="regions"
? this.regionsRepository
: this.objectsRepository,
scrollable: this.shouldBeScrollable(this.options.menu.location),
events: {
click: (e, regionOrObject, mapsvg)=> {
this.events.trigger("click.directoryItem", this, [
e,
regionOrObject,
mapsvg,
]);
},
mouseover: (e, regionOrObject, mapsvg)=> {
this.events.trigger("mouseover.directoryItem", this, [
e,
regionOrObject,
mapsvg,
]);
},
mouseout: (e, regionOrObject, mapsvg)=> {
this.events.trigger("mouseout.directoryItem", this, [
e,
regionOrObject,
mapsvg,
]);
},
},
});
this.controllers.directory._init();
}
if(options.source){
this.controllers.directory.repository =
this.options.menu.source==="regions"
? this.regionsRepository
: this.objectsRepository;
}
if(options.sortBy||options.sortDirection){
this.controllers.directory.repository.query.update({
sort: [
{
field: this.options.menu.sortBy,
order: this.options.menu.sortDirection,
},
],
});
}
this.setFilterOut();
if(options.location){
this.controllers.directory.scrollable=this.shouldBeScrollable(this.options.menu.location);
}
let $container;
if(MapSVG.isPhone&&this.options.menu.hideOnMobile){
$container=$$A(this.containers.leftSidebar);
}else{
$container =
this.options.menu.location!=="custom"
? $$A(this.containers[this.options.menu.location])
: $$A("#" + this.options.menu.containerId);
}
$container.append(this.containers.directory);
if(this.options.colors.directory){
$$A(this.containers.directory).css({
"background-color": this.options.colors.directory,
});
}
this.setFilters();
this.setTemplates({ directoryItem: this.options.templates.directoryItem });
if((this.options.menu.source==="regions"&&this.regionsRepository.loaded) ||
(this.options.menu.source==="database"&&this.objectsRepository.loaded)){
if(this.editMode &&
(options.sortBy||options.sortDirection||options.filterout)){
this.controllers.directory.repository.reload();
}
this.loadDirectory();
}}else{
this.controllers.directory&&this.controllers.directory.destroy();
this.controllers.directory=null;
}}
setDatabase(options){
options=options||this.options.database;
if(options.pagination){
if(options.pagination.on!=undefined){
options.pagination.on=MapSVG.parseBoolean(options.pagination.on);
}
if(options.pagination.perpage!=undefined){
options.pagination.perpage=parseInt(options.pagination.perpage);
}}
$$A.extend(true, this.options, { database: options });
if(options.pagination){
if(options.pagination.on!==undefined||options.pagination.perpage){
const query=new Query({
perpage: this.options.database.pagination.on
? this.options.database.pagination.perpage
: 0,
});
this.objectsRepository.find(query);
}else{
this.setPagination();
}}
}
updateGoogleMapsMaxZoom(geoPoint){
this.googleMaps.maxZoomService.getMaxZoomAtLatLng(geoPoint, (result)=> {
if(result.status==="OK"){
this.googleMaps.currentMaxZoom=result.zoom;
}});
}
setGoogleMaps(options){
options=options||this.options.googleMaps;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
if(!this.googleMaps){
this.googleMaps={ loaded: false, initialized: false, map: null, overlay: null };}
$$A.extend(true, this.options, { googleMaps: options });
if(this.options.googleMaps.on){
$$A(this.containers.map).toggleClass("mapsvg-with-google-map", true);
if(!MapSVG.googleMapsApiLoaded){
this.loadGoogleMapsAPI(()=> {
this.setGoogleMaps();
}, ()=> {
this.setGoogleMaps({ on: false });
});
}else{
if(!this.googleMaps.map){
this.containers.googleMaps=$$A('<div class="mapsvg-layer mapsvg-layer-gm" id="mapsvg-google-maps-' +
this.id +
'"></div>').prependTo(this.containers.map)[0];
$$A(this.containers.googleMaps).css({
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0,
"z-index": "0",
});
this.googleMaps.map=new google.maps.Map(this.containers.googleMaps, {
mapTypeId: options.type,
fullscreenControl: false,
keyboardShortcuts: false,
mapTypeControl: false,
scaleControl: false,
scrollwheel: false,
streetViewControl: false,
zoomControl: false,
styles: options.styleJSON,
tilt: 0,
});
const southWest=new google.maps.LatLng(this.geoViewBox.sw.lat, this.geoViewBox.sw.lng);
const northEast=new google.maps.LatLng(this.geoViewBox.ne.lat, this.geoViewBox.ne.lng);
const bounds=new google.maps.LatLngBounds(southWest, northEast);
this.googleMaps.overlay=this.createGoogleMapOverlay(bounds, this.googleMaps.map);
if(!this.options.googleMaps.center||!this.options.googleMaps.zoom){
this.googleMaps.map.fitBounds(bounds, 0);
}else{
this.googleMaps.map.setZoom(this.options.googleMaps.zoom);
this.googleMaps.map.setCenter(this.options.googleMaps.center);
}
this.googleMaps.initialized=true;
this.googleMaps.maxZoomService=new google.maps.MaxZoomService();
this.googleMaps.map.addListener("idle", ()=> {
this.isZooming=false;
});
google.maps.event.addListenerOnce(this.googleMaps.map, "idle", ()=> {
setTimeout(()=> {
$$A(this.containers.map).addClass("mapsvg-fade-in");
setTimeout(()=> {
$$A(this.containers.map).removeClass("mapsvg-google-map-loading");
$$A(this.containers.map).removeClass("mapsvg-fade-in");
if(!this.options.googleMaps.center ||
!this.options.googleMaps.zoom){
this.options.googleMaps.center=this.googleMaps.map
.getCenter()
.toJSON();
this.options.googleMaps.zoom=this.googleMaps.map.getZoom();
}
this.zoomDelta=this.options.googleMaps.zoom - this.zoomLevel;
this.updateGoogleMapsMaxZoom(this.options.googleMaps.center);
this.setInitialViewBox(this.viewBox);
this.toggleSvgLayerOnZoom();
this.events.trigger("googleMapsLoaded");
this.afterLoadBlockers--;
this.finalizeMapLoading();
}, 300);
}, 1);
});
this.events.on("googleMapsBoundsChanged", (bounds)=> {
this.setViewBoxByGoogleMapsOverlay();
});
}else{
$$A(this.containers.map).toggleClass("mapsvg-with-google-map", true);
$$A(this.containers.googleMaps)&&$$A(this.containers.googleMaps).show();
if(options.type){
this.googleMaps.map.setMapTypeId(options.type);
}
this.setViewBoxByGoogleMapsOverlay();
}}
}else{
$$A(this.containers.map).toggleClass("mapsvg-with-google-map", false);
$$A(this.containers.googleMaps)&&$$A(this.containers.googleMaps).hide();
this.googleMaps.initialized=false;
}
if(this.converter){
this.converter.setWorldShift(this.options.googleMaps.on);
}}
createGoogleMapOverlay(bounds, map){
class GoogleMapsOverlay extends google.maps.OverlayView {
constructor(bounds, googleMapInstance, mapsvg){
super();
this.bounds_=bounds;
this.map_=googleMapInstance;
this.mapsvg=mapsvg;
this.setMap(googleMapInstance);
this.prevCoords={
sw: { x: 0, y: 0 },
sw2: { x: 0, y: 0 },
ne: { x: 0, y: 0 },
ne2: { x: 0, y: 0 },
};}
draw(){
this.mapsvg.events.trigger("googleMapsBoundsChanged", this.map_, [
this.getPixelBounds(),
this.map_,
]);
}
onAdd(){
this.element=document.createElement("div");
this.element.style.borderStyle="none";
this.element.style.borderWidth="0px";
this.element.style.position="absolute";
const panes=this.getPanes();
panes.overlayLayer.appendChild(this.element);
}
getPixelBounds(){
const overlayProjection=this.getProjection();
if(!overlayProjection)
return;
const geoSW=this.bounds_.getSouthWest();
const geoNE=this.bounds_.getNorthEast();
const coords={
sw: overlayProjection.fromLatLngToDivPixel(geoSW),
ne: overlayProjection.fromLatLngToDivPixel(geoNE),
sw2: overlayProjection.fromLatLngToContainerPixel(geoSW),
ne2: overlayProjection.fromLatLngToContainerPixel(geoNE),
};
const ww=overlayProjection.getWorldWidth();
if(this.prevCoords.sw){
if(coords.ne.x < coords.sw.x){
if(Math.abs(this.prevCoords.sw.x - coords.sw.x) >
Math.abs(this.prevCoords.ne.x - coords.ne.x)){
coords.sw.x=coords.sw.x - ww;
}else{
coords.ne.x=coords.ne.x + ww;
}
if(Math.abs(this.prevCoords.sw2.x - coords.sw2.x) >
Math.abs(this.prevCoords.ne2.x - coords.ne2.x)){
coords.sw2.x=coords.sw2.x - ww;
}else{
coords.ne2.x=coords.ne2.x + ww;
}}
}
this.prevCoords=coords;
return { sw: coords.sw2, ne: coords.ne2 };}}
return new GoogleMapsOverlay(bounds, map, this);
}
loadGoogleMapsAPI(callback, fail){
if(!this.options.googleMaps.apiKey){
console.error("MapSVG: can't load Google API because no API key has been provided");
return;
}
if(window.google!==undefined&&google.maps){
MapSVG.googleMapsApiLoaded=true;
}
if(MapSVG.googleMapsApiLoaded){
if(typeof callback=="function"){
callback();
}
return;
}
MapSVG.googleMapsLoadCallbacks=MapSVG.googleMapsLoadCallbacks||[];
if(typeof callback=="function"){
MapSVG.googleMapsLoadCallbacks.push(callback);
}
if(MapSVG.googleMapsApiIsLoading){
return;
}
MapSVG.googleMapsApiIsLoading=true;
window.gm_authFailure=()=> {
if(MapSVG.GoogleMapBadApiKey){
MapSVG.GoogleMapBadApiKey();
}else{
if(this.editMode){
alert("Google maps API key is incorrect.");
}else{
console.error("MapSVG: Google maps API key is incorrect.");
}}
};
this.googleMapsScript=document.createElement("script");
this.googleMapsScript.onload=()=> {
MapSVG.googleMapsApiLoaded=true;
MapSVG.googleMapsLoadCallbacks.forEach((_callback)=> {
if(typeof callback=="function")
_callback();
});
};
const gmLibraries=[];
if(this.options.googleMaps.drawingTools){
gmLibraries.push("drawing");
}
if(this.options.googleMaps.geometry){
gmLibraries.push("geometry");
}
let libraries="";
if(gmLibraries.length > 0){
libraries="&libraries=" + gmLibraries.join(",");
}
this.googleMapsScript.src =
"https://maps.googleapis.com/maps/api/js?language=" +
this.options.googleMaps.language +
"&key=" +
this.options.googleMaps.apiKey +
libraries;
document.head.appendChild(this.googleMapsScript);
}
loadDetailsView(obj){
this.controllers.popover&&this.controllers.popover.close();
if(this.controllers.detailsView)
this.controllers.detailsView.destroy();
this.controllers.detailsView=new DetailsController({
autoresize: MapSVG.isPhone &&
this.options.detailsView.mobileFullscreen &&
this.options.detailsView.location!=="custom"
? false
: this.options.detailsView.autoresize,
container: this.containers.detailsView,
template: obj instanceof Region
? this.options.templates.detailsViewRegion
: this.options.templates.detailsView,
mapsvg: this,
data: obj.getData(),
modal: MapSVG.isPhone &&
this.options.detailsView.mobileFullscreen &&
this.options.detailsView.location!=="custom",
scrollable: (MapSVG.isPhone &&
this.options.detailsView.mobileFullscreen &&
this.options.detailsView.location!=="custom") ||
this.shouldBeScrollable(this.options.detailsView.location),
withToolbar: !(MapSVG.isPhone &&
this.options.detailsView.mobileFullscreen &&
this.options.detailsView.location!=="custom")&&this.shouldBeScrollable(this.options.detailsView.location),
events: {
shown: (detailsController)=> {
this.events.trigger("shown.detailsView", this, [this, detailsController]);
$$A(window).trigger("shown.detailsView", [this, detailsController]);
},
closed: (detailsController)=> {
this.deselectAllRegions();
this.deselectAllMarkers();
this.controllers &&
this.controllers.directory &&
this.controllers.directory.deselectItems();
this.events.trigger("closed.detailsView", [this, detailsController]);
},
},
});
this.controllers.detailsView._init();
}
loadFiltersModal(){
if(this.options.filters.modalLocation!="custom"){
if(!this.containers.filtersModal){
this.containers.filtersModal=$$A('<div class="mapsvg-details-container mapsvg-filters-wrap"></div>')[0];
}
this.setColors();
$$A(this.containers.filtersModal).css({ width: this.options.filters.width });
if(MapSVG.isPhone){
$$A("body").append($$A(this.containers.filtersModal));
$$A(this.containers.filtersModal).css({ width: "" });
}else{
$$A(this.containers[this.options.filters.modalLocation]).append($$A(this.containers.filtersModal));
}}else{
this.containers.filtersModal=$$A("#" + this.options.filters.containerId)[0];
$$A(this.containers.filtersModal).css({ width: "" });
}
this.loadFiltersController(this.containers.filtersModal, true);
}
loadFiltersController(container, modal=false){
if(!this.filtersShouldBeShown()){
return;
}
let filtersInDirectory, filtersHide;
if(MapSVG.isPhone){
filtersInDirectory=true;
filtersHide=this.options.filters.hideOnMobile;
}else{
filtersInDirectory =
this.options.menu.on &&
this.controllers.directory &&
this.options.menu.location===this.options.filters.location;
filtersHide=this.options.filters.hide;
}
const scrollable=modal ||
(!filtersInDirectory &&
["leftSidebar", "rightSidebar"].indexOf(this.options.filters.location)!==-1);
this.filtersRepository =
this.options.filters.source==="regions"
? this.regionsRepository
: this.objectsRepository;
if(this.options.filters.searchButton){
this.changedFields=null;
this.changedSearch=null;
}else{
this.changedSearch=()=> {
this.filtersRepository.query.searchFallback=this.filtersSchema.getFieldByType("search").searchFallback;
this.throttle(this.filtersRepository.reload, 400, this.filtersRepository);
};
this.changedFields=()=> {
this.throttle(this.filtersRepository.reload, 400, this.filtersRepository);
};}
this.controllers.filters=new FiltersController({
container: container,
query: this.filtersRepository.query,
mapsvg: this,
schema: this.filtersSchema,
template: '<div class="mapsvg-filters-container"></div>',
scrollable: scrollable,
modal: modal,
withToolbar: MapSVG.isPhone ? false:modal,
width: $$A(container).hasClass("mapsvg-map-container")
? this.options.filters.width
: "100%",
hide: this.options.filters.hide,
hideOnMobile: this.options.filters.hideOnMobile,
showButtonText: this.options.filters.showButtonText,
clearButton: this.options.filters.clearButton,
clearButtonText: this.options.filters.clearButtonText,
searchButton: this.options.filters.searchButton,
searchButtonText: this.options.filters.searchButtonText,
padding: this.options.filters.padding,
events: {
cleared: ()=> {
this.deselectAllRegions();
this.filtersRepository.reload();
},
"changed.fields": this.changedFields,
"changed.search": this.changedSearch,
"click.btn.searchButton": ()=> {
this.filtersRepository.reload();
},
loaded: ()=> {
this.controllers.directory&&this.controllers.directory.updateTopShift();
this.afterLoadBlockers--;
this.finalizeMapLoading();
},
"click.btn.showFilters": ()=> {
this.loadFiltersModal();
},
},
});
this.controllers.filters._init();
}
filtersShouldBeShown(){
return (this.options.filters.on &&
this.options.filtersSchema &&
this.options.filtersSchema.length > 0);
}
textSearch(text, fallback=false){
const query=new Query({
filters: { search: text },
searchFallback: fallback,
});
this.filtersRepository.find(query);
}
getRegion(id){
return this.regions.findById(id);
}
getRegions(){
return this.regions;
}
getMarker(id){
return this.markers.findById(id);
}
checkId(id){
if(this.getRegion(id))
return { canUse: false, error: "This ID is already being used by a Region" };
else if(this.getMarker(id))
return { canUse: false, error: "This ID is already being used by another Marker" };
else
return { canUse: true, error: "" };}
regionsRedrawColors(){
this.regions.forEach((region)=> {
region.setFill();
});
}
redrawBubbles(){
$$A(this.containers.map).removeClass("bubbles-regions-on bubbles-database-on");
if(this.options.choropleth.on&&this.options.choropleth.bubbleMode){
$$A(this.containers.map).addClass("bubbles-" + this.options.choropleth.source + "-on");
}
this.regions.forEach(function (region){
region.drawBubble();
});
const markersBubbleMode=this.options.choropleth.on &&
this.options.choropleth.source=="database" &&
this.options.choropleth.bubbleMode;
this.markers.forEach(function (marker){
marker.setBubbleMode(markersBubbleMode);
});
}
destroy(){
if(this.controllers&&this.controllers.directory){
this.controllers.directory.mobileButtons.remove();
}
$$A(this.containers.map)
.empty()
.insertBefore($$A(this.containers.wrapAll))
.attr("style", "")
.removeClass("mapsvg mapsvg-responsive");
this.controllers.popover&&this.controllers.popover.close();
if(this.controllers.detailsView)
this.controllers.detailsView.destroy();
$$A(this.containers.detailsView).remove();
$$A(this.containers.popover).remove();
$$A(this.containers.tooltip).remove();
$$A(this.containers.wrapAll).remove();
}
getData(){
return {
id: this.id,
title: this.options.title,
options: this.getOptions(false, false),
};}
mayBeFitMarkers(){
if(!this.lastTimeFitWas){
this.lastTimeFitWas=Date.now() - 99999;
}
this.fitDelta=Date.now() - this.lastTimeFitWas;
if(this.fitDelta > 1000 &&
!this.firstDataLoad &&
!this.fitOnDataLoadDone &&
this.options.fitMarkers){
this.fitMarkers();
this.fitOnDataLoadDone=true;
}
if(this.firstDataLoad &&
(this.options.fitMarkersOnStart ||
(this.options.fitMarkers&&this.options.database.loadOnStart===false))){
this.firstDataLoad=false;
if(this.options.googleMaps.on&&!this.googleMaps.map){
this.events.on("googleMapsLoaded", ()=> {
this.fitMarkers();
});
}else{
this.fitMarkers();
}}
this.lastTimeFitWas=Date.now();
}
fitMarkers(){
const dbObjects=this.objectsRepository.getLoaded();
if(!dbObjects||dbObjects.length===0){
return;
}
if(this.options.googleMaps.on&&typeof google!=="undefined"){
const lats=[];
const lngs=[];
if(dbObjects.length > 1){
dbObjects.forEach((object)=> {
if(object.location&&object.location.geoPoint){
lats.push(object.location.geoPoint.lat);
lngs.push(object.location.geoPoint.lng);
}});
const minlat=Math.min.apply(null, lats), maxlat=Math.max.apply(null, lats);
const minlng=Math.min.apply(null, lngs), maxlng=Math.max.apply(null, lngs);
const bbox=new google.maps.LatLngBounds({ lat: minlat, lng: minlng }, { lat: maxlat, lng: maxlng });
this.googleMaps.map.fitBounds(bbox, 0);
}else{
if(dbObjects[0].location &&
dbObjects[0].location.geoPoint.lat &&
dbObjects[0].location.geoPoint.lng){
const coords={
lat: dbObjects[0].location.geoPoint.lat,
lng: dbObjects[0].location.geoPoint.lng,
};
if(this.googleMaps.map){
this.googleMaps.map.setCenter(coords);
this.googleMaps.map.setZoom(this.options.fitSingleMarkerZoom);
}}
}}else{
if(this.options.clustering.on){
const arr=[];
this.markersClusters.forEach((c)=> {
arr.push(c);
});
this.markers.forEach((m)=> {
arr.push(m);
});
this.zoomTo(arr);
return;
}else{
this.zoomTo(this.markers);
return;
}}
}
setFitSingleMarkerZoom(zoom){
this.options.fitSingleMarkerZoom=parseInt(zoom);
}
showUserLocation(callback){
this.getUserLocation((geoPoint)=> {
this.userLocation=null;
this.userLocation=new Location({
geoPoint: geoPoint,
img: MapSVG.urls.root + "/markers/user-location.svg",
});
this.userLocationMarker&&this.userLocationMarker.delete();
this.userLocationMarker=new Marker({
location: this.userLocation,
mapsvg: this,
width: 15,
height: 15,
});
$$A(this.userLocationMarker.element).addClass("mapsvg-user-location");
this.userLocationMarker.centered=true;
this.getLayer("markers").append(this.userLocationMarker.element);
this.userLocationMarker.adjustScreenPosition();
callback&&callback(this.userLocation);
});
}
getUserLocation(callback){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function (position){
const pos=new GeoPoint(position.coords.latitude, position.coords.longitude);
callback&&callback(pos);
});
}else{
return false;
}}
getScale(){
const scale2=this.containers.map.clientWidth / this.viewBox.width;
return scale2||1;
}
getViewBox(){
return this.viewBox;
}
viewBoxSetBySize(width, height){
this.setSize(width, height);
this._viewBox.update(this.viewBoxGetBySize(width, height));
this.setViewBox(this._viewBox);
$$A(window).trigger("resize");
this.setSize(width, height);
this.setZoomLevels();
return this.viewBox;
}
viewBoxGetBySize(width, height){
const new_ratio=width / height;
const old_ratio=this.svgDefault.viewBox.width / this.svgDefault.viewBox.height;
const vb=this.svgDefault.viewBox.clone();
if(new_ratio!=old_ratio){
if(new_ratio > old_ratio){
vb.width=this.svgDefault.viewBox.height * new_ratio;
vb.x=this.svgDefault.viewBox.x - (vb.width - this.svgDefault.viewBox.width) / 2;
}else{
vb.height=this.svgDefault.viewBox.width / new_ratio;
vb.y=this.svgDefault.viewBox.y - (vb.height - this.svgDefault.viewBox.height) / 2;
}}
return vb;
}
viewBoxReset(toInitial){
if(this.options.googleMaps.on&&this.googleMaps.map){
if(!toInitial){
this.options.googleMaps.center=null;
this.options.googleMaps.zoom=null;
}
if(!this.options.googleMaps.center||!this.options.googleMaps.zoom){
const southWest=new google.maps.LatLng(this.geoViewBox.sw.lat, this.geoViewBox.sw.lng);
const northEast=new google.maps.LatLng(this.geoViewBox.ne.lat, this.geoViewBox.ne.lng);
const bounds=new google.maps.LatLngBounds(southWest, northEast);
this.googleMaps.map.fitBounds(bounds, 0);
this.options.googleMaps.center=this.googleMaps.map.getCenter().toJSON();
this.options.googleMaps.zoom=this.googleMaps.map.getZoom();
}else{
this.googleMaps.map.setZoom(this.options.googleMaps.zoom);
this.googleMaps.map.setCenter(this.options.googleMaps.center);
}}else{
if(toInitial){
const v=this._viewBox||this.svgDefault.viewBox;
this.zoomLevel=0;
this._scale=1;
this.setViewBox(v);
}else{
this.setViewBox();
}}
return this.viewBox;
}
getGeoViewBox(){
const v=this.viewBox;
const p1=new SVGPoint(v.x, v.y);
const p2=new SVGPoint(v.x + v.width, v.y);
const p3=new SVGPoint(v.x, v.y);
const p4=new SVGPoint(v.x, v.y + v.height);
const leftLon=this.converter.convertSVGToGeo(p1).lng;
const rightLon=this.converter.convertSVGToGeo(p2).lng;
const topLat=this.converter.convertSVGToGeo(p3).lat;
const bottomLat=this.converter.convertSVGToGeo(p4).lat;
return [leftLon, topLat, rightLon, bottomLat];
}
setStrokes(){
$$A(this.containers.svg)
.find("path, polygon, circle, ellipse, rect, line, polyline")
.each((index, elem)=> {
const width=MapObject.getComputedStyle("stroke-width", elem);
if(width){
$$A(elem).attr("data-stroke-width", width.replace("px", ""));
}});
}
adjustStrokes(){
$$A(this.containers.svg)
.find("path, polygon, circle, ellipse, rect, line, polyline")
.each((index, elem)=> {
const width=elem.getAttribute("data-stroke-width");
if(width){
$$A(elem).css("stroke-width", Number(width) / this.scale);
}});
}
zoomIn(center){
if(this.canZoom){
this.isZooming=true;
this.canZoom=false;
setTimeout(()=> {
this.isZooming=false;
this.canZoom=true;
}, 700);
this.zoom(1, center);
}}
zoomOut(center){
if(this.canZoom){
this.isZooming=true;
this.canZoom=false;
setTimeout(()=> {
this.isZooming=false;
this.canZoom=true;
}, 700);
this.zoom(-1, center);
}}
zoomTo(mapObjects, zoomToLevel){
if(mapObjects instanceof Marker||mapObjects instanceof MarkerCluster){
return this.zoomToMarkerOrCluster(mapObjects, zoomToLevel);
}else{
const convertedObjects = !Array.isArray(mapObjects) ? [mapObjects]:mapObjects;
const bbox=this.getGroupBBox(convertedObjects);
return this.fitViewBox(bbox, zoomToLevel);
}}
zoomToMarkerOrCluster(mapObject, zoomToLevel){
this.zoomLevel=zoomToLevel||1;
const foundZoomLevel=this.zoomLevels.get(this.zoomLevel);
if(!foundZoomLevel){
return false;
}
const vb=foundZoomLevel.viewBox;
if(this.canZoom){
this.isZooming=true;
this.canZoom=false;
setTimeout(()=> {
this.isZooming=false;
this.canZoom=true;
}, 700);
const vbNew=new ViewBox(mapObject.svgPoint.x - vb.width / 2, mapObject.svgPoint.y - vb.height / 2, vb.width, vb.height);
this.setViewBox(vbNew);
this._scale=foundZoomLevel._scale;
return true;
}
return false;
}
getGroupBBox(mapObjects){
let _bbox;
const xmax=[];
const ymax=[];
const xmin=[];
const ymin=[];
for (let i=0; i < mapObjects.length; i++){
_bbox=mapObjects[i].getBBox();
xmin.push(_bbox.x);
ymin.push(_bbox.y);
const _w=_bbox.x + _bbox.width;
const _h=_bbox.y + _bbox.height;
xmax.push(_w);
ymax.push(_h);
}
const _xmin=Math.min(...xmin);
const _ymin=Math.min(...ymin);
const width=Math.max(...xmax) - _xmin;
const height=Math.max(...ymax) - _ymin;
let padding=10;
const point1=new ScreenPoint(padding, 0);
const point2=new ScreenPoint(0, 0);
padding =
this.converter.convertPixelToSVG(point1).x - this.converter.convertPixelToSVG(point2).x;
return new ViewBox(_xmin - padding, _ymin - padding, width + padding * 2, height + padding * 2);
}
fitViewBox(fitViewBox, forceZoomLevel){
let viewBoxPrev;
let foundZoomLevelNumber=0;
let foundZoomLevel;
let newViewBox;
this.zoomLevels.forEach((zoomLevel)=> {
if(viewBoxPrev&&viewBoxPrev.x!==undefined){
if(fitViewBox.fitsInViewBox(viewBoxPrev) &&
zoomLevel.viewBox.fitsInViewBox(fitViewBox, true)){
foundZoomLevelNumber=forceZoomLevel ? forceZoomLevel:zoomLevel.zoomLevel;
foundZoomLevel=this.zoomLevels.get(foundZoomLevelNumber);
newViewBox=new ViewBox(fitViewBox.x - foundZoomLevel.viewBox.width / 2 + fitViewBox.width / 2, fitViewBox.y - foundZoomLevel.viewBox.height / 2 + fitViewBox.height / 2, foundZoomLevel.viewBox.width, foundZoomLevel.viewBox.height);
}}
viewBoxPrev=zoomLevel&&zoomLevel.viewBox;
});
if(foundZoomLevel){
if(this.canZoom){
this.isZooming=true;
this.canZoom=false;
setTimeout(()=> {
this.isZooming=false;
this.canZoom=true;
}, 700);
this.zoomLevel=foundZoomLevelNumber;
this._scale=foundZoomLevel._scale;
this.setViewBox(newViewBox);
return true;
}}else{
return false;
}}
zoomToRegion(region, zoomToLevel){
this.fitViewBox(region.getBBox(), zoomToLevel);
return true;
}
centerOn(region, yShift){
if(this.options.googleMaps.on){
yShift=yShift ? (yShift + 12) / this.getScale():0;
$$A(this.containers.map).addClass("scrolling");
const latLng=region.getCenterLatLng(yShift);
this.googleMaps.map.panTo(latLng);
setTimeout(()=> {
$$A(this.containers.map).removeClass("scrolling");
}, 100);
}else{
yShift=yShift ? (yShift + 12) / this.getScale():0;
const bbox=region.getBBox();
const vb=this.viewBox;
const newViewBox=new ViewBox(bbox.x - vb.width / 2 + bbox.width / 2, bbox.y - vb.height / 2 + bbox.height / 2 - yShift, vb.width, vb.height);
this.setViewBox(newViewBox);
}}
zoom(delta, center){
let newViewBox=new ViewBox(0, 0, 0, 0);
const d=delta > 0 ? 1:-1;
if(!this.zoomLevels.get(this.zoomLevel + d))
return;
const newZoomLevel=this.zoomLevel + d;
const zoomIn=d > 0;
const zoomOut=d < 0;
const zoomRange=this.getZoomRange();
const isInZoomRange=this.zoomLevel >=zoomRange.min&&this.zoomLevel <=zoomRange.max;
const goingOutOfZoomRange=isInZoomRange&&(newZoomLevel > zoomRange.max||newZoomLevel < zoomRange.min);
const outOfRangeAndMovingAway = !isInZoomRange &&
((zoomIn&&newZoomLevel > zoomRange.max)||(zoomOut&&newZoomLevel < zoomRange.min));
if(goingOutOfZoomRange||outOfRangeAndMovingAway){
return;
}
this.zoomLevel=newZoomLevel;
const z=this.zoomLevels.get(this.zoomLevel);
this._scale=z._scale;
newViewBox=z.viewBox;
let shift=[];
if(center){
const koef=zoomIn ? 0.5:-1;
newViewBox.x=this.viewBox.x + (center.x - this.viewBox.x) * koef;
newViewBox.y=this.viewBox.y + (center.y - this.viewBox.y) * koef;
}else{
shift=[
(this.viewBox.width - newViewBox.width) / 2,
(this.viewBox.height - newViewBox.height) / 2,
];
newViewBox.x=this.viewBox.x + shift[0];
newViewBox.y=this.viewBox.y + shift[1];
}
this.shiftViewBoxToScrollBoundaries(newViewBox);
this.setViewBox(newViewBox);
}
toggleSvgLayerOnZoom(){
if(this.options.googleMaps.on &&
this.googleMaps.map &&
this.options.zoom.hideSvg &&
this.googleMaps.map.getZoom() >=this.options.zoom.hideSvgZoomLevel){
if(!$$A(this.containers.svg).hasClass("mapsvg-invisible")){
$$A(this.containers.svg).animate({ opacity: 0 }, 400, "linear", ()=> {
$$A(this.containers.svg).addClass("mapsvg-invisible");
});
}}else{
if($$A(this.containers.svg).hasClass("mapsvg-invisible")){
$$A(this.containers.svg).animate({ opacity: 1 }, 400, "linear", ()=> {
$$A(this.containers.svg).removeClass("mapsvg-invisible");
});
}}
}
shiftViewBoxToScrollBoundaries(newViewBox){
if(this.options.scroll.limit){
if(newViewBox.x < this.svgDefault.viewBox.x)
newViewBox.x=this.svgDefault.viewBox.x;
else if(newViewBox.x + newViewBox.width >
this.svgDefault.viewBox.x + this.svgDefault.viewBox.width)
newViewBox.x =
this.svgDefault.viewBox.x + this.svgDefault.viewBox.width - newViewBox.width;
if(newViewBox.y < this.svgDefault.viewBox.y)
newViewBox.y=this.svgDefault.viewBox.y;
else if(newViewBox.y + newViewBox.height >
this.svgDefault.viewBox.y + this.svgDefault.viewBox.height)
newViewBox.y =
this.svgDefault.viewBox.y + this.svgDefault.viewBox.height - newViewBox.height;
}
return newViewBox;
}
markerDelete(marker){
if(this.editingMarker&&this.editingMarker.id==marker.id){
this.unsetEditingMarker();
}
if(this.markers.findById(marker.id)){
this.markers.delete(marker.id);
}
marker.delete();
marker=null;
if(this.markers.length===0)
this.options.markerLastID=0;
}
markersClusterAdd(markersCluster){
this.layers.markers.append(markersCluster.elem);
this.markersClusters.push(markersCluster);
markersCluster.adjustScreenPosition();
}
markerAdd(marker){
$$A(marker.element).hide();
marker.adjustScreenPosition();
this.layers.markers.append(marker.element);
this.markers.push(marker);
marker.mapped=true;
setTimeout(function (){
$$A(marker.element).show();
}, 100);
}
markerRemove(marker){
if(this.editingMarker&&this.editingMarker.id==marker.id){
this.editingMarker=null;
delete this.editingMarker;
}
if(this.markers.findById(marker.id)){
this.markers.findById(marker.id).element.remove();
this.markers.delete(marker.id);
marker=null;
}
if(this.markers.length===0)
this.options.markerLastID=0;
}
markerId(){
this.options.markerLastID=this.options.markerLastID + 1;
const id="marker_" + this.options.markerLastID;
if(this.getMarker(id))
return this.markerId();
else
return id;
}
movingItemsAdjustScreenPosition(){
this.markersAdjustScreenPosition();
this.popoverAdjustScreenPosition();
this.bubblesRegionsAdjustScreenPosition();
this.labelsRegionsAdjustScreenPosition();
}
movingItemsMoveScreenPositionBy(deltaX, deltaY){
this.markersMoveScreenPositionBy(deltaX, deltaY);
this.popoverMoveScreenPositionBy(deltaX, deltaY);
this.bubblesRegionsMoveScreenPositionBy(deltaX, deltaY);
this.labelsRegionsMoveScreenPositionBy(deltaX, deltaY);
}
labelsRegionsAdjustScreenPosition(){
if($$A(this.containers.map).is(":visible")){
this.regions.forEach(function (region){
region.adjustLabelScreenPosition();
});
}}
bubblesRegionsAdjustScreenPosition(){
if($$A(this.containers.map).is(":visible")){
this.regions.forEach(function (region){
region.adjustBubbleScreenPosition();
});
}}
labelsRegionsMoveScreenPositionBy(deltaX, deltaY){
if($$A(this.containers.map).is(":visible")){
this.regions.forEach(function (region){
region.moveLabelScreenPositionBy(deltaX, deltaY);
});
}}
bubblesRegionsMoveScreenPositionBy(deltaX, deltaY){
if($$A(this.containers.map).is(":visible")){
this.regions.forEach((region)=> {
region.moveBubbleScreenPositionBy(deltaX, deltaY);
});
}}
markersAdjustScreenPosition(){
this.markers.forEach((marker)=> {
marker.adjustScreenPosition();
});
this.markersClusters.forEach((cluster)=> {
cluster.adjustScreenPosition();
});
if(this.userLocationMarker){
this.userLocationMarker.adjustScreenPosition();
}}
markersMoveScreenPositionBy(deltaX, deltaY){
this.markers.forEach((marker)=> {
marker.moveSrceenPositionBy(deltaX, deltaY);
});
this.markersClusters.forEach((cluster)=> {
cluster.moveSrceenPositionBy(deltaX, deltaY);
});
if(this.userLocationMarker){
this.userLocationMarker.moveSrceenPositionBy(deltaX, deltaY);
}}
setEditingMarker(marker){
this.editingMarker=marker;
if(!this.editingMarker.mapped){
this.editingMarker.needToRemove=true;
this.markerAdd(this.editingMarker);
}}
unsetEditingMarker(){
if(this.editingMarker&&this.editingMarker.needToRemove){
this.markerRemove(this.editingMarker);
}
this.editingMarker=null;
}
getEditingMarker(){
return this.editingMarker;
}
scrollStart(e, mapsvg){
if($$A(e.target).hasClass("mapsvg-btn-map") ||
$$A(e.target).closest(".mapsvg-choropleth").length)
return;
if(this.editMarkers.on&&$$A(e.target).hasClass("mapsvg-marker"))
return;
e.preventDefault();
$$A(this.containers.map).addClass("no-transitions");
const ce=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0]
? e.originalEvent.touches[0]
: e;
this.scrollStarted=true;
this.scroll={
tx: this.scroll.tx||0,
ty: this.scroll.ty||0,
vxi: this.viewBox.x,
vyi: this.viewBox.y,
x: ce.clientX,
y: ce.clientY,
dx: 0,
dy: 0,
vx: 0,
vy: 0,
gx: ce.clientX,
gy: ce.clientY,
touchScrollStart: 0,
};
if(e.type.indexOf("mouse")===0){
$$A(document).on("mousemove.scroll.mapsvg", (e)=> {
this.scrollMove(e);
});
if(this.options.scroll.spacebar){
$$A(document).on("keyup.scroll.mapsvg", (e)=> {
if(e.keyCode==32){
this.scrollEnd(e, mapsvg);
}});
}else{
$$A(document).on("mouseup.scroll.mapsvg", (e)=> {
this.scrollEnd(e, mapsvg);
});
}}
}
scrollMove(e){
e.preventDefault();
if(!this.isScrolling){
this.isScrolling=true;
$$A(this.containers.map).addClass("scrolling");
}
const ce=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0]
? e.originalEvent.touches[0]
: e;
this.panBy(this.scroll.gx - ce.clientX, this.scroll.gy - ce.clientY);
this.scroll.gx=ce.clientX;
this.scroll.gy=ce.clientY;
this.scroll.dx=this.scroll.x - ce.clientX;
this.scroll.dy=this.scroll.y - ce.clientY;
let vx=this.scroll.vxi + this.scroll.dx / this.scale;
let vy=this.scroll.vyi + this.scroll.dy / this.scale;
if(this.options.scroll.limit){
if(vx < this.svgDefault.viewBox.x)
vx=this.svgDefault.viewBox.x;
else if(this.viewBox.width + vx >
this.svgDefault.viewBox.x + this.svgDefault.viewBox.width)
vx=this.svgDefault.viewBox.x + this.svgDefault.viewBox.width - this.viewBox.width;
if(vy < this.svgDefault.viewBox.y)
vy=this.svgDefault.viewBox.y;
else if(this.viewBox.height + vy >
this.svgDefault.viewBox.y + this.svgDefault.viewBox.height)
vy =
this.svgDefault.viewBox.y +
this.svgDefault.viewBox.height -
this.viewBox.height;
}
this.scroll.vx=vx;
this.scroll.vy=vy;
}
scrollEnd(e, mapsvg, noClick){
setTimeout(()=> {
this.enableAnimation();
this.scrollStarted=false;
this.isScrolling=false;
}, 100);
if(this.googleMaps&&this.googleMaps.overlay){
this.googleMaps.overlay.draw();
}
$$A(this.containers.map).removeClass("scrolling");
$$A(document).off("keyup.scroll.mapsvg");
$$A(document).off("mousemove.scroll.mapsvg");
$$A(document).off("mouseup.scroll.mapsvg");
if(noClick!==true&&Math.abs(this.scroll.dx) < 5&&Math.abs(this.scroll.dy) < 5){
if(this.editMarkers.on)
this.clickAddsMarker&&this.markerAddClickHandler(e);
else if(this.objectClickedBeforeScroll)
if(this.objectClickedBeforeScroll instanceof Marker){
this.markerClickHandler(e, this.objectClickedBeforeScroll);
}
else if(this.objectClickedBeforeScroll instanceof Region){
this.regionClickHandler(e, this.objectClickedBeforeScroll);
}
else if(this.objectClickedBeforeScroll instanceof MarkerCluster){
this.markerClusterClickHandler(e, this.objectClickedBeforeScroll);
}}
this.viewBox.x=this.scroll.vx||this.viewBox.x;
this.viewBox.y=this.scroll.vy||this.viewBox.y;
}
setViewBoxByGoogleMapsOverlay(){
const bounds=this.googleMaps.overlay.getPixelBounds();
const scale=(bounds.ne.x - bounds.sw.x) / this.svgDefault.viewBox.width;
const vb=new ViewBox(this.svgDefault.viewBox.x - bounds.sw.x / scale, this.svgDefault.viewBox.y - bounds.ne.y / scale, this.containers.map.offsetWidth / scale, this.containers.map.offsetHeight / scale);
this.setViewBox(vb, false);
}
panBy(x, y){
let tx=this.scroll.tx - x;
let ty=this.scroll.ty - y;
const scrolled={ x: true, y: true };
if(this.options.scroll.limit){
const svg=$$A(this.containers.svg)[0].getBoundingClientRect();
const bounds=$$A(this.containers.map)[0].getBoundingClientRect();
if((svg.left - x > bounds.left&&x < 0)||(svg.right - x < bounds.right&&x > 0)){
tx=this.scroll.tx;
scrolled.x=false;
}
if((svg.top - y > bounds.top&&y < 0)||(svg.bottom - y < bounds.bottom&&y > 0)){
ty=this.scroll.ty;
scrolled.y=false;
}}
$$A(this.containers.scrollpane).css({
transform: "translate(" + tx + "px," + ty + "px)",
});
this.scroll.tx=tx;
this.scroll.ty=ty;
if(scrolled.x||scrolled.y){
const moveX=scrolled.x ? x:0;
const moveY=scrolled.y ? y:0;
this.movingItemsMoveScreenPositionBy(moveX, moveY);
if(this.googleMaps.map){
let point=this.googleMaps.map.getCenter();
const projection=this.googleMaps.overlay.getProjection();
const pixelpoint=projection.fromLatLngToDivPixel(point);
pixelpoint.x +=moveX;
pixelpoint.y +=moveY;
point=projection.fromDivPixelToLatLng(pixelpoint);
this.googleMaps.map.setCenter(point);
}}
return scrolled;
}
setObjectClickedBeforeScroll(object){
this.objectClickedBeforeScroll=object;
}
touchStart(_e, mapsvg){
_e.preventDefault();
if(this.scrollStarted){
this.scrollEnd(_e, mapsvg, true);
}
const e=_e.originalEvent;
if(this.options.zoom.fingers&&e.touches&&e.touches.length==2){
this.touchZoomStart=true;
this.scaleDistStart=Math.hypot(e.touches[0].pageX - e.touches[1].pageX, e.touches[0].pageY - e.touches[1].pageY);
}
else if(e.touches&&e.touches.length==1){
this.scrollStart(_e, mapsvg);
}
$$A(document)
.on("touchmove.scroll.mapsvg", (e)=> {
e.preventDefault();
this.touchMove(e, this);
})
.on("touchend.scroll.mapsvg", (e)=> {
e.preventDefault();
this.touchEnd(e, this);
});
}
touchMove(_e, mapsvg){
_e.preventDefault();
const e=_e.originalEvent;
if(this.options.zoom.fingers&&e.touches&&e.touches.length==2){
if(!MapSVG.ios){
e.scale =
Math.hypot(e.touches[0].pageX - e.touches[1].pageX, e.touches[0].pageY - e.touches[1].pageY) / this.scaleDistStart;
}
if(e.scale!=1&&this.canZoom){
const d=e.scale > 1 ? 1:-1;
const cx=e.touches[0].pageX >=e.touches[1].pageX
? e.touches[0].pageX -
(e.touches[0].pageX - e.touches[1].pageX) / 2 -
$$A(this.containers.map).offset().left
: e.touches[1].pageX -
(e.touches[1].pageX - e.touches[0].pageX) / 2 -
$$A(this.containers.map).offset().left;
const cy=e.touches[0].pageY >=e.touches[1].pageY
? e.touches[0].pageY -
(e.touches[0].pageY - e.touches[1].pageY) -
$$A(this.containers.map).offset().top
: e.touches[1].pageY -
(e.touches[1].pageY - e.touches[0].pageY) -
$$A(this.containers.map).offset().top;
const center=this.converter.convertPixelToSVG(new ScreenPoint(cx, cy));
if(d > 0)
this.zoomIn(center);
else
this.zoomOut(center);
}}
else if(e.touches&&e.touches.length==1){
this.scrollMove(_e);
}}
touchEnd(_e, mapsvg){
_e.preventDefault();
const e=_e.originalEvent;
if(this.touchZoomStart){
this.touchZoomStart=false;
}
else if(this.scrollStarted){
this.scrollEnd(_e, mapsvg);
}
$$A(document).off("touchmove.scroll.mapsvg");
$$A(document).off("touchend.scroll.mapsvg");
}
getSelected(){
return this.selected_id;
}
selectRegion(id, skipDirectorySelection){
let region;
if(typeof id=="string"){
region=this.getRegion(id);
}else{
region=id;
}
if(!region)
return;
let ids;
if(this.options.multiSelect&&!this.editRegions.on){
if(region.selected){
this.deselectRegion(region);
if(!skipDirectorySelection&&this.options.menu.on){
if(this.options.menu.source=="database"){
if(region.objects&&region.objects.length){
ids=region.objects.map((obj)=> {
return obj.id.toString();
});
}}else{
ids=[region.id];
}
this.controllers.directory.deselectItems();
}
return;
}}
else if(this.selected_id.length > 0){
this.deselectAllRegions();
if(!skipDirectorySelection&&this.options.menu.on){
if(this.options.menu.source=="database"){
if(region.objects&&region.objects.length){
ids=region.objects.map((obj)=> {
return obj.id.toString();
});
}}else{
ids=[region.id];
}
this.controllers.directory.deselectItems();
}}
this.selected_id.push(region.id);
region.select();
const skip=this.options.actions.region.click.filterDirectory;
if(!skip &&
!skipDirectorySelection &&
this.options.menu.on &&
this.controllers &&
this.controllers.directory){
if(this.options.menu.source=="database"){
if(region.objects&&region.objects.length){
ids=region.objects.map((obj)=> {
return obj.id.toString();
});
}else{
ids=[region.id];
}}else{
ids=[region.id];
}
this.controllers.directory.selectItems(ids);
}
if(this.options.actions.region.click.addIdToUrl &&
!this.options.actions.region.click.showAnotherMap){
window.location.hash="/m/" + region.id;
}}
deselectAllRegions(){
$$A.each(this.selected_id, (index, id)=> {
this.deselectRegion(this.getRegion(id));
});
}
deselectRegion(region){
if(!region)
region=this.getRegion(this.selected_id[0]);
if(region){
region.deselect();
const i=$$A.inArray(region.id, this.selected_id);
this.selected_id.splice(i, 1);
}
if(this.options.actions.region.click.addIdToUrl){
if(window.location.hash.indexOf(region.id)!==-1){
history.replaceState(null, null, " ");
}}
}
highlightRegions(regions){
regions.forEach((region)=> {
if(region&&!region.selected&&!region.disabled){
this.highlightedRegions.push(region);
region.highlight();
}});
}
unhighlightRegions(){
this.highlightedRegions.forEach((region)=> {
if(region&&!region.selected&&!region.disabled)
region.unhighlight();
});
this.highlightedRegions=[];
}
selectMarker(marker){
if(!(marker instanceof Marker))
return;
this.deselectAllMarkers();
marker.select();
this.selected_marker=marker;
$$A(this.layers.markers).addClass("mapsvg-with-marker-active");
if(this.options.menu.on&&this.options.menu.source=="database"){
this.controllers.directory.deselectItems();
this.controllers.directory.selectItems(marker.object.id);
}}
deselectAllMarkers(){
this.selected_marker&&this.selected_marker.deselect();
$$A(this.layers.markers).removeClass("mapsvg-with-marker-active");
}
deselectMarker(marker){
if(marker){
marker.deselect();
}}
highlightMarker(marker){
$$A(this.layers.markers).addClass("mapsvg-with-marker-hover");
marker.highlight();
this.highlighted_marker=marker;
}
unhighlightMarker(){
$$A(this.layers.markers).removeClass("mapsvg-with-marker-hover");
this.highlighted_marker&&this.highlighted_marker.unhighlight();
}
convertMouseToSVG(e){
const mc=MapSVG.mouseCoords(e);
const x=mc.x - $$A(this.containers.map).offset().left;
const y=mc.y - $$A(this.containers.map).offset().top;
const screenPoint=new ScreenPoint(x, y);
return this.converter.convertPixelToSVG(screenPoint);
}
pickChoroplethColor(choroplethValue){
const w=(choroplethValue - this.options.choropleth.coloring.gradient.values.min) /
this.options.choropleth.coloring.gradient.values.maxAdjusted;
const rgba={
r: Math.round(this.options.choropleth.coloring.gradient.colors.diffRGB.r * w +
this.options.choropleth.coloring.gradient.colors.lowRGB.r),
g: Math.round(this.options.choropleth.coloring.gradient.colors.diffRGB.g * w +
this.options.choropleth.coloring.gradient.colors.lowRGB.g),
b: Math.round(this.options.choropleth.coloring.gradient.colors.diffRGB.b * w +
this.options.choropleth.coloring.gradient.colors.lowRGB.b),
a: Math.round(this.options.choropleth.coloring.gradient.colors.diffRGB.a * w +
this.options.choropleth.coloring.gradient.colors.lowRGB.a),
};
return rgba;
}
isRegionDisabled(id, svgfill){
if(this.options.regions[id]&&(this.options.regions[id].disabled||svgfill=="none")){
return true;
}
else if((this.options.regions[id]==undefined ||
MapSVG.parseBoolean(this.options.regions[id].disabled)) &&
(this.options.disableAll||svgfill=="none"||id=="labels"||id=="Labels")){
return true;
}else{
return false;
}}
loadMap(id, container){
if(!(container instanceof HTMLElement)){
console.error("Can't load a new map: container was not provided.");
return;
}
const previousMapsIds=[...this.options.previousMapsIds];
const currentMapId=this.id;
if(previousMapsIds[previousMapsIds.length - 1]!==id){
previousMapsIds.push(currentMapId);
}else{
previousMapsIds.pop();
}
let showPreviousMapButton;
if(typeof this.options.actions.region.click.showAnotherMapContainerId!=="undefined" &&
this.options.actions.region.click.showAnotherMapContainerId!==""){
showPreviousMapButton=false;
}else{
showPreviousMapButton=this.options.controls.previousMap;
}
const mapsRepo=new MapsRepository();
const sameContainer=container===this.containers.map;
mapsRepo.findById(id).done((map)=> {
sameContainer&&this.destroy();
const newMap=new MapSVGMap(container.getAttribute("id"), map);
newMap.events.on("afterLoad", function (){
this.options.previousMapsIds=previousMapsIds;
this.options.controls.previousMap=showPreviousMapButton;
this.setControls(this.options.controls);
});
});
}
loadPreviousMap(){
const previousMapId=this.options.previousMapsIds[this.options.previousMapsIds.length - 1];
const container=document.getElementById(this.containerId);
this.loadMap(previousMapId, container);
}
markerClusterClickHandler(e, markerCluster){
this.objectClickedBeforeScroll=null;
if(this.eventsPreventList["click"])
return;
this.zoomTo(markerCluster.markers);
return;
}
regionClickHandler(e, region){
this.objectClickedBeforeScroll=null;
if(this.eventsPreventList["click"])
return;
this.selectRegion(region.id);
if(this.editRegions.on){
this.regionEditHandler.call(region);
return;
}
const actions=this.options.actions;
if(actions.region.click.zoom){
this.zoomTo(region, parseInt(actions.region.click.zoomToLevel));
}
if(actions.region.click.filterDirectory){
const query=new Query({
filters: {
regions: {
table_name: this.regionsRepository.getSchema().name,
region_ids: [region.id],
},
},
});
this.objectsRepository.query.resetFilters();
this.setFilterOut();
this.objectsRepository.find(query).done(()=> {
if(this.controllers.popover){
this.controllers.popover.redraw(region.forTemplate());
}
if(this.controllers.detailsView){
this.controllers.detailsView.redraw(region.forTemplate());
}});
this.updateFiltersState();
}
if(actions.region.click.showDetails){
this.loadDetailsView(region);
}
if(actions.region.click.showPopover){
if(actions.region.click.zoom){
setTimeout(()=> {
this.showPopover(region);
}, 400);
}else{
this.showPopover(region);
}}
else if(e&&e.type.indexOf("touch")!==-1&&actions.region.touch.showPopover){
if(actions.region.click.zoom){
setTimeout(()=> {
this.showPopover(region);
}, 400);
}else{
this.showPopover(region);
}}
if(actions.region.click.goToLink){
const linkParts=actions.region.click.linkField.split(".");
let url;
if(linkParts.length > 1){
const obj=linkParts.shift();
const attr="." + linkParts.join(".");
if(obj=="Region"){
if(region.data){
try {
url=eval("region.data" + attr);
}
catch (err){
console.log("No such field as region.data" + attr);
}}
}else{
if(region.objects&&region.objects[0]){
try {
url=eval("region.objects[0]" + attr);
}
catch (err){
console.log("No such field as region.objects[0]" + attr);
}}
}
if(url&&!this.disableLinks){
if(this.editMode){
alert("Redirect: " + url + "\nLinks are disabled in the preview.");
return;
}
if(actions.region.click.newTab){
const win=window.open(url, "_blank");
win.focus();
}else{
window.location.href=url;
}}
}}
if(actions.region.click.showAnotherMap){
if(this.editMode){
alert('"Show another map" action is disabled in the preview');
return;
}
const linkParts=actions.region.click.showAnotherMapField.split(".");
if(linkParts.length > 1){
const obj=linkParts.shift();
const attr="." + linkParts.join(".");
let map_id;
if(obj=="Region"){
if(region.data)
map_id=eval("region.data" + attr);
}else{
if(region.objects&&region.objects[0])
map_id=eval("region.objects[0]" + attr);
}
if(map_id){
const container=actions.region.click.showAnotherMapContainerId
? $$A("#" + actions.region.click.showAnotherMapContainerId)[0]
: $$A(this.containers.map)[0];
this.loadMap(map_id, container);
}}
}
this.events.trigger("click.region", region, [e, region, this]);
}
markerClickHandler(e, marker){
this.objectClickedBeforeScroll=null;
if(this.eventsPreventList["click"])
return;
const actions=this.options.actions;
this.selectMarker(marker);
const passingObject=marker.object;
if(actions.marker.click.zoom){
this.zoomTo(marker, parseInt(actions.marker.click.zoomToLevel));
}
if(actions.marker.click.filterDirectory){
const query=new Query({ filters: { id: marker.object.id }});
this.objectsRepository.find(query);
this.updateFiltersState();
}
if(actions.marker.click.showDetails)
this.loadDetailsView(passingObject);
if(actions.marker.click.showPopover){
if(actions.marker.click.zoom){
setTimeout(()=> {
this.showPopover(passingObject);
}, 500);
}else{
this.showPopover(passingObject);
}}
else if(e&&e.type.indexOf("touch")!==-1&&actions.marker.touch.showPopover){
if(actions.marker.click.zoom){
setTimeout(()=> {
this.showPopover(passingObject);
}, 500);
}else{
this.showPopover(passingObject);
}}
if(actions.marker.click.goToLink){
const linkParts=actions.marker.click.linkField.split(".");
let url;
if(linkParts.length > 1){
const obj=linkParts.shift();
const attr="." + linkParts.join(".");
try {
url=eval("passingObject" + attr);
}
catch (err){
console.log("MapSVG: No such field as passingObject" + attr);
}
if(url&&!this.disableLinks)
if(this.editMode){
alert("Redirect: " + url + "\nLinks are disabled in the preview.");
return;
}
if(actions.marker.click.newTab){
const win=window.open(url, "_blank");
win.focus();
}else{
window.location.href=url;
}}
}
this.events.trigger("click.marker", marker, [e, marker, this]);
}
fileExists(url){
if(url.substr(0, 4)=="data")
return true;
const http=new XMLHttpRequest();
http.open("HEAD", url, false);
http.send();
return http.status!=404;
}
hideMarkers(){
this.markers.forEach(function (marker){
marker.hide();
});
$$A(this.containers.wrap).addClass("mapsvg-edit-marker-mode");
}
hideMarkersExceptOne(id){
this.markers.forEach(function (marker){
if(typeof id==="undefined"||(marker.object&&id!=marker.object.id)){
marker.hide();
}});
$$A(this.containers.wrap).addClass("mapsvg-edit-marker-mode");
}
showMarkers(){
this.markers.forEach(function (m){
m.show();
});
this.deselectAllMarkers();
$$A(this.containers.wrap).removeClass("mapsvg-edit-marker-mode");
}
markerAddClickHandler(e){
if($$A(e.target).hasClass("mapsvg-marker"))
return;
const svgPoint=this.getSvgPointAtClick(e);
const geoPoint=this.isGeo() ? this.converter.convertSVGToGeo(svgPoint):null;
if(!$$A.isNumeric(svgPoint.x)||!$$A.isNumeric(svgPoint.y))
return;
if(this.editingMarker){
if(geoPoint){
this.editingMarker.location.setGeoPoint(geoPoint);
}else{
this.editingMarker.location.setSvgPoint(svgPoint);
}
return;
}
const location=new Location({
svgPoint: svgPoint,
geoPoint: geoPoint,
img: this.options.defaultMarkerImage,
});
const marker=new Marker({
location: location,
mapsvg: this,
});
this.markerAdd(marker);
this.markerEditHandler&&this.markerEditHandler.call(location, location);
}
getSvgPointAtClick(e){
const mc=MapSVG.mouseCoords(e);
const x=mc.x - $$A(this.containers.map).offset().left;
const y=mc.y - $$A(this.containers.map).offset().top;
const screenPoint=new ScreenPoint(x, y);
return this.converter.convertPixelToSVG(screenPoint);
}
setDefaultMarkerImage(src){
this.options.defaultMarkerImage=src;
}
setMarkerImagesDependency(){
this.locationField=this.objectsRepository.schema.getFieldByType("location");
if(this.locationField &&
this.locationField.markersByFieldEnabled &&
this.locationField.markerField &&
Object.values(this.locationField.markersByField).length > 0){
this.setMarkersByField=true;
}else{
this.setMarkersByField=false;
}}
getMarkerImage(fieldValueOrObject, location){
let fieldValue;
if(this.setMarkersByField){
if(typeof fieldValueOrObject==="object"){
fieldValue=fieldValueOrObject[this.locationField.markerField];
if(this.locationField.markerField==="regions"){
fieldValue=fieldValue[0]&&fieldValue[0].id;
}
else if(typeof fieldValue==="object"&&fieldValue.length){
fieldValue=fieldValue[0].value;
}}else{
fieldValue=fieldValueOrObject;
}
if(this.locationField.markersByField[fieldValue]){
return this.locationField.markersByField[fieldValue];
}}
return location&&location.imagePath
? location.imagePath
: this.options.defaultMarkerImage
? this.options.defaultMarkerImage
: MapSVG.urls.root + "markers/_pin_default.png";
}
setMarkersEditMode(on, clickAddsMarker){
this.editMarkers.on=MapSVG.parseBoolean(on);
this.clickAddsMarker=this.editMarkers.on;
this.setEventHandlers();
}
setRegionsEditMode(on){
this.editRegions.on=MapSVG.parseBoolean(on);
this.deselectAllRegions();
this.setEventHandlers();
}
setEditMode(on){
this.editMode=on;
}
setDataEditMode(on){
this.editData.on=MapSVG.parseBoolean(on);
this.deselectAllRegions();
this.setEventHandlers();
}
download(){
window.location.href=window.location.origin + this.options.source;
}
popoverAdjustScreenPosition(){
if(this.controllers.popover instanceof PopoverController){
this.controllers.popover.adjustScreenPosition();
}}
popoverMoveScreenPositionBy(deltaX, deltaY){
if(this.controllers.popover instanceof PopoverController){
this.controllers.popover.moveSrceenPositionBy(deltaX, deltaY);
}}
showPopover(object){
const mapObject=object instanceof Region
? object
: object.location&&object.location.marker
? object.location.marker
: null;
if(!mapObject)
return;
let point;
if(mapObject instanceof Marker){
point=mapObject.svgPoint;
}else{
point=mapObject.getCenterSVG();
}
this.controllers.popover&&this.controllers.popover.destroy();
this.controllers.popover=new PopoverController({
container: this.containers.popover,
point: point,
yShift: mapObject instanceof Marker ? mapObject.height:0,
template: object instanceof Region
? this.options.templates.popoverRegion
: this.options.templates.popoverMarker,
mapsvg: this,
data: object.getData(),
mapObject: mapObject,
scrollable: true,
withToolbar: !(MapSVG.isPhone&&this.options.popovers.mobileFullscreen),
events: {
shown: (popover)=> {
if(this.options.popovers.centerOn){
const shift=popover.containers.main.offsetHeight / 2;
if(this.options.popovers.centerOn &&
!(MapSVG.isPhone&&this.options.popovers.mobileFullscreen)){
this.centerOn(mapObject, shift);
}}
this.popoverShowingFor=mapObject;
this.events.trigger("shown.popover", this, [this, popover]);
$$A(window).trigger("shown.popover", [this, popover]);
},
closed: (popover)=> {
this.options.popovers.resetViewboxOnClose&&this.viewBoxReset(true);
this.popoverShowingFor=null;
this.events.trigger("closed.popover", this, [this, popover]);
},
resize: (popover)=> {
if(this.options.popovers.centerOn){
const shift=popover.containers.main.offsetHeight / 2;
if(this.options.popovers.centerOn &&
!(MapSVG.isPhone&&this.options.popovers.mobileFullscreen)){
this.centerOn(mapObject, shift);
}}
},
},
});
this.controllers.popover._init();
}
hidePopover(){
this.controllers.popover&&this.controllers.popover.close();
}
popoverOffHandler(e){
if(this.isScrolling ||
$$A(e.target).closest(".mapsvg-popover").length ||
$$A(e.target).hasClass("mapsvg-btn-map"))
return;
this.controllers.popover&&this.controllers.popover.close();
}
mouseOverHandler(e, object){
if(this.eventsPreventList["mouseover"]){
return;
}
if(object instanceof Marker){
if(this.options.actions.marker.mouseover.showTooltip){
this.showTooltip(object);
}}
if(object instanceof Region){
if(this.options.actions.region.mouseover.showTooltip){
this.showTooltip(object);
}}
let ids;
if(this.options.menu.on){
if(this.options.menu.source=="database"){
if(object instanceof Region&&object.objects.length){
ids=object.objects.map((obj)=> {
return obj.id;
});
}
if(object instanceof Marker){
ids=object.object ? [object.object.id]:[];
}}else{
if(object instanceof Region){
ids=[object.id];
}
if(this instanceof Marker &&
object.object.regions &&
object.object.regions.length){
ids=object.object.regions.map((obj)=> {
return obj.id;
});
}}
this.controllers.directory.highlightItems(ids);
}
if(object instanceof Region){
if(!object.selected)
object.highlight();
this.events.trigger("mouseover.region", object, [e, this]);
}else{
this.highlightMarker(object);
this.events.trigger("mouseover.marker", object, [e, this]);
}}
showTooltip(object){
let name, _object;
if(object instanceof Region){
name="tooltipRegion";
_object=object;
}
else if(object instanceof Marker){
name="tooltipMarker";
_object=object.object;
}else{
name="tooltipMarker";
_object=object;
}
if(_object!=null&&this.popoverShowingFor!==object){
this.controllers.tooltip.setMainTemplate(this.options.templates[name]);
this.controllers.tooltip.redraw(_object.getData());
this.controllers.tooltip.show();
}}
mouseOutHandler(e, object){
if(this.eventsPreventList["mouseout"]){
return;
}
if(this.controllers.tooltip)
this.controllers.tooltip.hide();
if(object instanceof Region){
if(!object.selected)
object.unhighlight();
this.events.trigger("mouseout.region", object, [e, this]);
}else{
this.unhighlightMarker();
this.events.trigger("mouseout.marker", object, [e, this]);
}
let ids;
if(this.options.menu.on){
if(this.options.menu.source=="database"){
if(object instanceof Marker){
const marker=object;
ids=marker.object ? [marker.object.id]:[];
}}
this.controllers.directory.unhighlightItems();
}}
eventsPrevent(event){
this.eventsPreventList[event]=true;
}
eventsRestore(event){
if(event){
this.eventsPreventList[event]=false;
}else{
this.eventsPreventList={};}}
setEventHandlers(){
const _this=this;
$$A(_this.containers.map).off(".common.mapsvg");
$$A(_this.containers.scrollpane).off(".common.mapsvg");
$$A(document).off(".scroll.mapsvg");
$$A(document).off(".scrollInit.mapsvg");
if(_this.editMarkers.on){
$$A(_this.containers.map).on("touchstart.common.mapsvg mousedown.common.mapsvg", ".mapsvg-marker", function (e){
e.originalEvent.preventDefault();
const marker=_this.getMarker($$A(this).attr("id"));
const startCoords=MapSVG.mouseCoords(e);
marker.drag(startCoords, _this.scale);
});
}
if(!_this.editMarkers.on){
$$A(_this.containers.map)
.on("mouseover.common.mapsvg", ".mapsvg-region", function (e){
const id=$$A(this).attr("id");
_this.mouseOverHandler.call(_this, e, _this.getRegion(id));
})
.on("mouseleave.common.mapsvg", ".mapsvg-region", function (e){
const id=$$A(this).attr("id");
_this.mouseOutHandler.call(_this, e, _this.getRegion(id));
});
}
if(!_this.editRegions.on){
$$A(_this.containers.map)
.on("mouseover.common.mapsvg", ".mapsvg-marker", function (e){
const id=$$A(this).attr("id");
_this.mouseOverHandler.call(_this, e, _this.getMarker(id));
})
.on("mouseleave.common.mapsvg", ".mapsvg-marker", function (e){
const id=$$A(this).attr("id");
_this.mouseOutHandler.call(_this, e, _this.getMarker(id));
});
}
if(_this.options.scroll.spacebar){
$$A(document).on("keydown.scroll.mapsvg", function (e){
if(!(document.activeElement.tagName==="INPUT" &&
$$A(document.activeElement).attr("type")==="text") &&
!_this.isScrolling &&
e.keyCode==32){
e.preventDefault();
$$A(_this.containers.map).addClass("mapsvg-scrollable");
$$A(document)
.on("mousemove.scrollInit.mapsvg", function (e){
_this.isScrolling=true;
$$A(document).off("mousemove.scrollInit.mapsvg");
_this.scrollStart(e, _this);
})
.on("keyup.scroll.mapsvg", function (e){
if(e.keyCode==32){
$$A(document).off("mousemove.scrollInit.mapsvg");
$$A(_this.containers.map).removeClass("mapsvg-scrollable");
}});
}});
}
else if(!_this.options.scroll.on){
if(!_this.editMarkers.on){
$$A(_this.containers.map).on("touchstart.common.mapsvg", ".mapsvg-region", function (e){
_this.scroll.touchScrollStart=$$A(window).scrollTop();
});
$$A(_this.containers.map).on("touchstart.common.mapsvg", ".mapsvg-marker", function (e){
_this.scroll.touchScrollStart=$$A(window).scrollTop();
});
$$A(_this.containers.map).on("touchend.common.mapsvg mouseup.common.mapsvg", ".mapsvg-region", function (e){
if(e.cancelable){
e.preventDefault();
}
if(!_this.scroll.touchScrollStart ||
_this.scroll.touchScrollStart===$$A(window).scrollTop()){
_this.regionClickHandler(e, _this.getRegion($$A(this).attr("id")));
}});
$$A(_this.containers.map).on("touchend.common.mapsvg mouseup.common.mapsvg", ".mapsvg-marker", function (e){
if(e.cancelable){
e.preventDefault();
}
if(!_this.scroll.touchScrollStart ||
_this.scroll.touchScrollStart===$$A(window).scrollTop()){
_this.markerClickHandler.call(_this, e, _this.getMarker($$A(this).attr("id")));
}});
$$A(_this.containers.map).on("touchend.common.mapsvg mouseup.common.mapsvg", ".mapsvg-marker-cluster", function (e){
if(e.cancelable){
e.preventDefault();
}
if(!_this.scroll.touchScrollStart ||
_this.scroll.touchScrollStart==$$A(window).scrollTop()){
const cluster=$$A(this).data("cluster");
_this.zoomTo(cluster.markers);
}});
}else{
if(_this.clickAddsMarker)
$$A(_this.containers.map).on("touchend.common.mapsvg mouseup.common.mapsvg", function (e){
if(e.cancelable){
e.preventDefault();
}
_this.markerAddClickHandler(e);
});
}}else{
$$A(_this.containers.map).on("touchstart.common.mapsvg mousedown.common.mapsvg", function (e){
if($$A(e.target).hasClass("mapsvg-popover") ||
$$A(e.target).closest(".mapsvg-popover").length){
if($$A(e.target).hasClass("mapsvg-popover-close")){
if(e.type=="touchstart"){
if(e.cancelable){
e.preventDefault();
}}
}
return;
}
if(e.type=="touchstart"){
if(e.cancelable){
e.preventDefault();
}}
let obj;
if(e.target &&
$$A(e.target).attr("class") &&
$$A(e.target).attr("class").indexOf("mapsvg-region")!=-1){
obj=_this.getRegion($$A(e.target).attr("id"));
_this.setObjectClickedBeforeScroll(obj);
}
else if(e.target &&
$$A(e.target).attr("class") &&
$$A(e.target).attr("class").indexOf("mapsvg-marker")!=-1 &&
$$A(e.target).attr("class").indexOf("mapsvg-marker-cluster")===-1){
if(_this.editMarkers.on){
return;
}
obj=_this.getMarker($$A(e.target).attr("id"));
_this.setObjectClickedBeforeScroll(obj);
}
else if(e.target &&
$$A(e.target).attr("class") &&
$$A(e.target).attr("class").indexOf("mapsvg-marker-cluster")!=-1){
if(_this.editMarkers.on){
return;
}
obj=$$A(e.target).data("cluster");
_this.setObjectClickedBeforeScroll(obj);
}
if(e.type=="mousedown"){
_this.scrollStart(e, _this);
}else{
_this.touchStart(e, _this);
}});
}
$$A(_this.containers.map).on("mouseleave.common.mapsvg", ".mapsvg-choropleth-gradient-wrap", (e)=> {
this.controllers.tooltip.hide();
});
}
setLabelsRegions(options){
options=options||this.options.labelsRegions;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
$$A.extend(true, this.options, { labelsRegions: options });
if(this.options.labelsRegions.on){
this.regions.forEach((region)=> {
if(!region.label){
region.label=jQuery('<div class="mapsvg-region-label" />')[0];
$$A(this.layers.labels).append(region.label);
}
try {
$$A(region.label).html(this.templates.labelRegion(region.forTemplate()));
}
catch (err){
console.error('MapSVG: Error in the "Region Label" template');
}});
this.labelsRegionsAdjustScreenPosition();
}else{
this.regions.forEach((region)=> {
if(region.label){
$$A(region.label).remove();
region.label=null;
delete region.label;
}});
}}
setLabelsMarkers(options){
options=options||this.options.labelsMarkers;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
$$A.extend(true, this.options, { labelsMarkers: options });
if(this.options.labelsMarkers.on){
this.markers.forEach((marker)=> {
try {
marker.setLabel(this.templates.labelMarker(marker.object));
}
catch (err){
console.error('MapSVG: Error in the "Marker Label" template');
}});
}else{
this.markers.forEach((marker)=> {
marker.setLabel("");
});
}}
addLayer(name){
this.layers[name]=$$A('<div class="mapsvg-layer mapsvg-layer-' + name + '"></div>')[0];
this.containers.layers.appendChild(this.layers[name]);
return this.layers[name];
}
getLayer(name){
return this.layers[name];
}
getDb(){
return this.objectsRepository;
}
getDbRegions(){
return this.regionsRepository;
}
regionAdd(svgObject){
const region=new Region(svgObject, this);
region.setStatus(1);
this.regions.push(region);
this.regions.sort(function (a, b){
return a.id==b.id ? 0:+(a.id > b.id)||-1;
});
return region;
}
regionDelete(id){
if(this.regions.findById(id)){
this.regions.findById(id).elem.remove();
this.regions.delete(id);
}
else if($$A("#" + id).length){
$$A("#" + id).remove();
}}
reloadRegions(){
this.regions.clear();
$$A(this.containers.svg).find(".mapsvg-region").removeClass("mapsvg-region");
$$A(this.containers.svg)
.find(".mapsvg-region-disabled")
.removeClass("mapsvg-region-disabled");
$$A(this.containers.svg)
.find("path, polygon, circle, ellipse, rect")
.each((index, element)=> {
const elem=element;
if($$A(elem).closest("defs").length)
return;
if(elem.getAttribute("data-stroke-width")){
elem.style["stroke-width"]=elem.getAttribute("data-stroke-width");
}
if(elem.getAttribute("id")){
if(!this.options.regionPrefix ||
(this.options.regionPrefix &&
elem.getAttribute("id").indexOf(this.options.regionPrefix)===0)){
const region=new Region(elem, this);
this.regions.push(region);
}}
});
}
reloadRegionsFull(){
const statuses=this.regionsRepository.getSchema().getFieldByType("status");
this.regions.forEach((region)=> {
const _region=this.regionsRepository.getLoaded().findById(region.id);
if(_region){
region.setData(_region);
if(statuses&&_region.status!==undefined&&_region.status!==null){
region.setStatus(_region.status);
}}else{
if(this.options.filters.filteredRegionsStatus ||
this.options.filters.filteredRegionsStatus===0 ||
(this.options.menu.source==="regions" &&
this.options.menu.filterout &&
this.options.menu.filterout.field==="status" &&
this.options.menu.filterout.val) ||
this.options.menu.filterout.val===0){
const status=this.options.filters.filteredRegionsStatus ||
this.options.filters.filteredRegionsStatus===0
? this.options.filters.filteredRegionsStatus
: this.options.menu.filterout.val;
region.setStatus(status);
}}
});
this.loadDirectory();
this.setChoropleth();
this.setLayersControl();
this.setGroups();
if(this.options.labelsRegions.on){
this.setLabelsRegions();
}}
fixMarkersWorldScreen(){
if(this.googleMaps.map)
setTimeout(()=> {
const markers={ left: 0, right: 0, leftOut: 0, rightOut: 0 };
if(this.markers.length > 1){
this.markers.forEach((m)=> {
if($$A(m.element).offset().left <
$$A(this.containers.map).offset().left +
this.containers.map.clientWidth / 2){
markers.left++;
if($$A(m.element).offset().left < $$A(this.containers.map).offset().left){
markers.leftOut++;
}}else{
markers.right++;
if($$A(m.element).offset().left >
$$A(this.containers.map).offset().left +
this.containers.map.clientWidth){
markers.rightOut++;
}}
});
if((markers.left===0&&markers.rightOut) ||
(markers.right===0&&markers.leftOut)){
const k=markers.left===0 ? 1:-1;
const ww=(this.svgDefault.viewBox.width / this.converter.mapLonDelta) *
360 *
this.getScale();
this.googleMaps.map.panBy(k * ww, 0);
}}
}, 600);
}
updateOutdatedOptions(options){
if(options.menu&&(options.menu.position||options.menu.customContainer)){
if(options.menu.customContainer){
options.menu.location="custom";
}else{
options.menu.position=options.menu.position==="left" ? "left":"right";
options.menu.location =
options.menu.position==="left" ? "leftSidebar":"rightSidebar";
if(!options.containers||!options.containers[options.menu.location]){
options.containers=options.containers||{};
options.containers[options.menu.location]={ on: false, width: "200px" };}
options.containers[options.menu.location].width=options.menu.width;
if(MapSVG.parseBoolean(options.menu.on)){
options.containers[options.menu.location].on=true;
}}
delete options.menu.position;
delete options.menu.width;
delete options.menu.customContainer;
}
if(options.detailsView &&
(options.detailsView.location==="mapContainer" ||
options.detailsView.location==="near" ||
options.detailsView.location==="top")){
options.detailsView.location="map";
}
if(!options.controls){
options.controls={};
options.controls.zoom =
options.zoom &&
options.zoom.on &&
(!options.zoom.buttons||options.zoom.buttons.location!=="hide");
options.controls.location =
options.zoom&&options.zoom.buttons&&options.zoom.buttons.location!=="hide"
? options.zoom.buttons.location
: "right";
}
if(options.colors&&!options.colors.markers){
options.colors.markers={
base: { opacity: 100, saturation: 100 },
hovered: { opacity: 100, saturation: 100 },
unhovered: { opacity: 100, saturation: 100 },
active: { opacity: 100, saturation: 100 },
inactive: { opacity: 100, saturation: 100 },
};}
if(options.tooltipsMode){
options.tooltips.mode=options.tooltipsMode;
delete options.tooltipsMode;
}
if(options.popover){
options.popovers=options.popover;
delete options.popover;
}}
init(){
MapSVG.addInstance(this);
if(this.options.source===""){
throw new Error("MapSVG: please provide SVG file source.");
}
this.disableAnimation();
this.setEvents(this.options.events);
this.events.trigger("beforeLoad");
if(this.options.googleMaps.apiKey &&
(this.editMode ||
this.options.googleMaps.on ||
(this.options.filters.on &&
this.options.filtersSchema &&
this.options.filtersSchema.find((f)=> f.type==="distance")))){
this.loadGoogleMapsAPI(()=> {
return 1;
}, ()=> {
return 1;
});
}
this.containers.map.classList.add("mapsvg");
this.setCss();
if(this.options.colors&&this.options.colors.background){
this.containers.map.style.background=this.options.colors.background;
}
this.setContainers(this.options.containers);
this.setColors();
this.addLoadingMessage();
this.addLayer("markers");
this.addLayer("labels");
this.addLayer("bubbles");
this.addLayer("popovers");
this.addLayer("scrollpane");
this.loadExtensions();
$$A.ajax({ url: this.options.source + "?v=" + this.svgFileLastChanged })
.fail((resp)=> {
this.svgLoadingFailed(resp);
})
.done((xmlData)=> {
this.renderSvgData(xmlData);
});
return this;
}
getContainer(name){
return this.containers[name];
}
renderSvgData(xmlData){
const svgTag=$$A(xmlData).find("svg");
this.containers.svg=svgTag[0];
if(svgTag.attr("width")&&svgTag.attr("height")){
this.svgDefault.width=parseFloat(svgTag.attr("width").replace(/px/g, ""));
this.svgDefault.height=parseFloat(svgTag.attr("height").replace(/px/g, ""));
this.svgDefault.viewBox=svgTag.attr("viewBox")
? new ViewBox(svgTag.attr("viewBox").split(" "))
: new ViewBox(0, 0, this.svgDefault.width, this.svgDefault.height);
}
else if(svgTag.attr("viewBox")){
this.svgDefault.viewBox=new ViewBox(svgTag.attr("viewBox").split(" "));
this.svgDefault.width=this.svgDefault.viewBox.width;
this.svgDefault.height=this.svgDefault.viewBox.height;
}else{
const msg="MapSVG: width/height and viewBox are missing in the SVG file. Can't parse the file because of that.";
if(this.editMode){
alert(msg);
}else{
console.error(msg);
}
return false;
}
this.geoViewBox=this.getGeoViewBoxFromSvgTag(this.containers.svg);
if(this.options.viewBox&&this.options.viewBox.length==4){
this._viewBox=new ViewBox(this.options.viewBox);
}else{
this._viewBox=new ViewBox(this.svgDefault.viewBox);
}
svgTag.attr("preserveAspectRatio", "xMidYMid meet");
svgTag.removeAttr("width");
svgTag.removeAttr("height");
$$A(this.containers.scrollpane).append(svgTag);
this.setStrokes();
this.reloadRegions();
this.setSize(this.options.width, this.options.height, this.options.responsive);
if(this.options.disableAll){
this.setDisableAll(true);
}
this.setViewBox(this._viewBox);
this.converter=new Converter(this.containers.map, this.svgDefault.viewBox, this.viewBox);
if(this.geoViewBox){
this.converter.setGeoViewBox(this.geoViewBox);
}
this.setResponsive(this.options.responsive);
this.setScroll(this.options.scroll, true);
this.setZoom(this.options.zoom);
this.setControls(this.options.controls);
this.setGoogleMaps();
this.setTooltips(this.options.tooltips);
this.setPopovers(this.options.popovers);
if(this.options.cursor)
this.setCursor(this.options.cursor);
this.setTemplates(this.options.templates);
this.loadExtensions();
this.filtersSchema=new Schema({ fields: this.options.filtersSchema });
this.objectsRepository.events.on("load", ()=> {
this.showLoadingMessage();
});
this.objectsRepository.events.on("loaded", ()=> {
this.setGlobalDistanceFilter();
this.fitOnDataLoadDone=false;
this.addLocations();
this.fixMarkersWorldScreen();
this.attachDataToRegions();
this.loadDirectory();
if(this.options.labelsMarkers.on){
this.setLabelsMarkers();
}
if(this.options.templates.labelRegion.indexOf("{{objects")!==-1){
this.setLabelsRegions();
}
if(this.options.filters.on &&
this.options.filters.source==="database" &&
this.controllers.filters &&
this.controllers.filters.hideFilters){
this.controllers.filters.setFiltersCounter();
}
this.hideLoadingMessage();
this.events.trigger("databaseLoaded");
this.updateFiltersState();
this.setChoropleth();
});
this.objectsRepository.events.on("schemaChanged", ()=> {
this.objectsRepository.reload();
});
this.objectsRepository.events.on("updated", (obj)=> {
this.attachDataToRegions(obj);
this.reloadRegionsFull();
});
this.objectsRepository.events.on("created", (obj)=> {
this.attachDataToRegions(obj);
this.reloadRegionsFull();
});
this.objectsRepository.events.on("deleted", (id)=> {
this.attachDataToRegions();
this.reloadRegionsFull();
});
this.regionsRepository.events.on("load", ()=> {
this.showLoadingMessage();
});
this.regionsRepository.events.on("loaded", ()=> {
this.hideLoadingMessage();
this.reloadRegionsFull();
if(this.options.filters.on &&
this.options.filters.source==="regions" &&
this.controllers.filters &&
this.controllers.filters.hideFilters){
this.controllers.filters.setFiltersCounter();
}
this.events.trigger("regionsLoaded");
});
this.regionsRepository.events.on("updated", (regionData)=> {
this.reloadRegionsFull();
});
this.regionsRepository.events.on("created", (regionData)=> {
this.reloadRegionsFull();
});
this.regionsRepository.events.on("deleted", (regionData)=> {
this.reloadRegionsFull();
});
this.setMenu();
this.setFilters();
this.setFilterOut();
this.setEventHandlers();
this.afterLoadBlockers--;
if(!this.id){
this.finalizeMapLoading();
return;
}
if(!this.options.data_regions){
this.regionsRepository.find().done((data)=> {
this.afterLoadBlockers--;
this.finalizeMapLoading();
});
}else{
this.regionsRepository.loadDataFromResponse(this.options.data_regions);
this.afterLoadBlockers--;
}
if(!this.options.data_objects){
if(this.options.database.loadOnStart||this.editMode){
this.objectsRepository.find().done((data)=> {
this.afterLoadBlockers--;
this.finalizeMapLoading();
});
}else{
this.afterLoadBlockers--;
this.finalizeMapLoading();
}}else{
if(this.editMode||this.options.database.loadOnStart){
this.objectsRepository.loadDataFromResponse(this.options.data_objects);
this.afterLoadBlockers--;
}else{
this.afterLoadBlockers--;
}
delete this.options.data_regions;
delete this.options.data_objects;
this.finalizeMapLoading();
}}
setFilterOut(){
if(this.options.menu.filterout.field){
const f={};
f[this.options.menu.filterout.field]=this.options.menu.filterout.val;
if(this.options.menu.source=="regions") ;
else {
this.objectsRepository.query.setFilterOut(f);
}}else{
this.objectsRepository.query.setFilterOut(null);
}}
getGeoViewBoxFromSvgTag(svgTag){
const geo=$$A(svgTag).attr("mapsvg:geoViewBox")||$$A(svgTag).attr("mapsvg:geoviewbox");
if(geo){
const geoParts=geo.split(" ").map((p)=> parseFloat(p));
if(geoParts.length==4){
this.mapIsGeo=true;
this.geoCoordinates=true;
const sw=new GeoPoint(geoParts[3], geoParts[0]);
const ne=new GeoPoint(geoParts[1], geoParts[2]);
return new GeoViewBox(sw, ne);
}}else{
return null;
}}
svgLoadingFailed(resp){
if(resp.status==404){
let msg="MapSVG: file not found - " +
this.options.source +
"\n\nIf you moved MapSVG from another server please read the following docs page: https://mapsvg.com/docs/installation/moving";
if(this.editMode){
msg +=
"\n\nIf you know the correct path for the SVG file, please write it and press OK:";
const oldSvgPath=this.options.source;
const userSvgPath=prompt(msg, oldSvgPath);
if(userSvgPath!==null){
$$A.ajax({ url: userSvgPath + "?v=" + this.svgFileLastChanged })
.fail(function (){
location.reload();
})
.done((xmlData)=> {
this.options.source=userSvgPath;
this.renderSvgData(xmlData);
const mapsRepo=new MapsRepository();
mapsRepo.update(this);
});
}else{
location.reload();
}}else{
console.error(msg);
}}else{
const msg="MapSVG: can't load SVG file for unknown reason. Please contact support: https://mapsvg.ticksy.com";
if(this.editMode){
alert(msg);
}else{
console.error(msg);
}}
}
addLoadingMessage(){
this.containers.loading=document.createElement("div");
this.containers.loading.className="mapsvg-loading";
const loadingTextBlock=document.createElement("div");
loadingTextBlock.className="mapsvg-loading-text";
loadingTextBlock.innerHTML=this.options.loadingText;
const spinner=document.createElement("div");
spinner.className="spinner-border spinner-border-sm";
this.containers.loading.appendChild(spinner);
this.containers.loading.appendChild(loadingTextBlock);
this.containers.map.appendChild(this.containers.loading);
if(this.options.googleMaps.on){
$$A(this.containers.map).addClass("mapsvg-google-map-loading");
}}
hideLoadingMessage(){
$$A(this.containers.loading).hide();
}
showLoadingMessage(){
$$A(this.containers.loading).show();
}
disableAnimation(){
this.containers.map.classList.add("no-transitions");
}
enableAnimation(){
$$A(this.containers.map).removeClass("no-transitions");
}
loadExtensions(){
if(this.options.extension &&
$$A().mapSvg.extensions &&
$$A().mapSvg.extensions[_this.options.extension]){
const ext=$$A().mapSvg.extensions[_this.options.extension];
ext&&ext.common(this);
}}
finalizeMapLoading(){
if(this.afterLoadBlockers > 0||this.loaded){
return;
}
this.selectRegionByIdFromUrl();
setTimeout(()=> {
this.movingItemsAdjustScreenPosition();
this.adjustStrokes();
setTimeout(()=> {
this.hideLoadingMessage();
$$A(this.containers.loading).find(".mapsvg-loading-text").hide();
this.enableAnimation();
}, 200);
}, 100);
this.loaded=true;
this.events.trigger("afterLoad");
}
selectRegionByIdFromUrl(){
const match=RegExp("[?&]mapsvg_select=([^&]*)").exec(window.location.search);
if(match){
const select=decodeURIComponent(match[1].replace(/\+/g, " "));
this.selectRegion(select);
}
if(window.location.hash){
const query=window.location.hash.replace("#/m/", "");
const region=this.getRegion(query);
if(region&&this.options.actions.map.afterLoad.selectRegion){
this.regionClickHandler(null, region);
}}
}
createForm(options){
return new FormBuilder(options);
}
getApiUrl(path){
const server=new Server();
return server.getUrl(path);
}
getConverter(){
return this.converter;
}
setChoropleth(options){
const _this=this;
options=options||_this.options.choropleth;
options.on!=undefined&&(options.on=MapSVG.parseBoolean(options.on));
$$A.extend(true, _this.options, { choropleth: options });
let needsRedraw=false;
if(!_this.$gauge){
_this.$gauge={};
_this.$gauge.gradient=$$A("<td>&nbsp;</td>").addClass("mapsvg-gauge-gradient");
_this.setGaugeGradientCSS();
_this.$gauge.container=$$A("<div />").addClass("mapsvg-gauge").hide();
_this.$gauge.table=$$A("<table />");
const tr=$$A("<tr />");
_this.$gauge.labelLow=$$A("<td>" + _this.options.choropleth.labels.low + "</td>");
_this.$gauge.labelHigh=$$A("<td>" + _this.options.choropleth.labels.high + "</td>");
tr.append(_this.$gauge.labelLow);
tr.append(_this.$gauge.gradient);
tr.append(_this.$gauge.labelHigh);
_this.$gauge.table.append(tr);
_this.$gauge.container.append(_this.$gauge.table);
$$A(_this.containers.map).append(_this.$gauge.container);
}
if(!_this.options.choropleth.on&&_this.$gauge.container.is(":visible")){
_this.$gauge.container.hide();
needsRedraw=true;
}
else if(_this.options.choropleth.on&&!_this.$gauge.container.is(":visible")){
_this.$gauge.container.show();
needsRedraw=true;
_this.regionsRepository.events.on("change", function (){
_this.redrawGauge();
});
}
if(options.colors){
_this.options.choropleth.colors.lowRGB=tinycolor(_this.options.choropleth.colors.low).toRgb();
_this.options.choropleth.colors.highRGB=tinycolor(_this.options.choropleth.colors.high).toRgb();
_this.options.choropleth.colors.diffRGB={
r: _this.options.choropleth.colors.highRGB.r -
_this.options.choropleth.colors.lowRGB.r,
g: _this.options.choropleth.colors.highRGB.g -
_this.options.choropleth.colors.lowRGB.g,
b: _this.options.choropleth.colors.highRGB.b -
_this.options.choropleth.colors.lowRGB.b,
a: _this.options.choropleth.colors.highRGB.a -
_this.options.choropleth.colors.lowRGB.a,
};
needsRedraw=true;
_this.$gauge&&_this.setGaugeGradientCSS();
}
if(options.labels){
_this.$gauge.labelLow.html(_this.options.choropleth.labels.low);
_this.$gauge.labelHigh.html(_this.options.choropleth.labels.high);
}
needsRedraw&&_this.redrawGauge();
}
redrawGauge(){
const _this=this;
_this.updateGaugeMinMax();
_this.regionsRedrawColors();
}
updateGaugeMinMax(){
const _this=this;
_this.options.choropleth.min=0;
_this.options.choropleth.max=false;
const values=[];
_this.regions.forEach(function (r){
const gauge=r.data&&r.data[_this.options.regionChoroplethField];
gauge!=undefined&&values.push(gauge);
});
if(values.length > 0){
_this.options.choropleth.min=values.length==1 ? 0:Math.min.apply(null, values);
_this.options.choropleth.max=Math.max.apply(null, values);
_this.options.choropleth.maxAdjusted =
_this.options.choropleth.max - _this.options.choropleth.min;
}}
setGaugeGradientCSS(){
const _this=this;
_this.$gauge.gradient.css({
background: "linear-gradient(to right," +
_this.options.choropleth.colors.low +
" 1%," +
_this.options.choropleth.colors.high +
" 100%)",
filter: 'progid:DXImageTransform.Microsoft.gradient(startColorstr="' +
_this.options.choropleth.colors.low +
'", endColorstr="' +
_this.options.choropleth.colors.high +
'",GradientType=1)',
});
}
get $map(){
return $$A(this.getContainer("map"));
}
get $svg(){
return $$A(this.getContainer("svg"));
}
get $popover(){
return $$A(this.getContainer("popover"));
}
get $details(){
return $$A(this.getContainer("detailsView"));
}
get $directory(){
return $$A(this.getContainer("directory"));
}
get database(){
return this.objectsRepository;
}
get regionsDatabase(){
return this.regionsRepository;
}}
exports.MapSVGMap=MapSVGMap;
exports.arrayIndexed=ArrayIndexed;
exports.customObject=CustomObject;
exports.formBuilder=FormBuilder;
exports.geoPoint=GeoPoint;
exports.globals=MapSVG;
exports.location=Location;
exports.map=MapSVGMap;
exports.mapsRepository=MapsRepository;
exports.mapsV2Repository=MapsV2Repository;
exports.marker=Marker;
exports.query=Query;
exports.repository=Repository;
exports.schema=Schema;
exports.schemaRepository=SchemaRepository;
exports.screenPoint=ScreenPoint;
exports.server=Server;
exports.svgPoint=SVGPoint;
Object.defineProperty(exports, '__esModule', { value: true });
})));
(()=>{"use strict";var e,r,a,n={},c={};function __webpack_require__(e){var r=c[e];if(void 0!==r)return r.exports;var a=c[e]={exports:{}};return n[e](a,a.exports,__webpack_require__),a.exports}__webpack_require__.m=n,e=[],__webpack_require__.O=(r,a,n,c)=>{if(!a){var b=1/0;for(o=0;o<e.length;o++){for(var[a,n,c]=e[o],i=!0,t=0;t<a.length;t++)(!1&c||b>=c)&&Object.keys(__webpack_require__.O).every(e=>__webpack_require__.O[e](a[t]))?a.splice(t--,1):(i=!1,c<b&&(b=c));if(i){e.splice(o--,1);var _=n();void 0!==_&&(r=_)}}return r}c=c||0;for(var o=e.length;o>0&&e[o-1][2]>c;o--)e[o]=e[o-1];e[o]=[a,n,c]},__webpack_require__.f={},__webpack_require__.e=e=>Promise.all(Object.keys(__webpack_require__.f).reduce((r,a)=>(__webpack_require__.f[a](e,r),r),[])),__webpack_require__.u=e=>635===e?"code-highlight.38ec4828db8d33cccbe9.bundle.min.js":519===e?"video-playlist.d48e1a11007fe8c248f8.bundle.min.js":375===e?"paypal-button.5c63e4c8f36fb06aff31.bundle.min.js":786===e?"86c7dbc8d8e46f0e7ee5.bundle.min.js":857===e?"stripe-button.b7e32b5d713d60752c7e.bundle.min.js":581===e?"progress-tracker.7b160888e308c5f64701.bundle.min.js":961===e?"animated-headline.bc08854fb1e1a80434b2.bundle.min.js":692===e?"media-carousel.87c2cf115553a2c4f709.bundle.min.js":897===e?"carousel.e2af910b095554625156.bundle.min.js":416===e?"countdown.05b148ca20af32fc8e9f.bundle.min.js":292===e?"hotspot.737497535441dc0bc037.bundle.min.js":325===e?"form.cfd61a9174be80f835c6.bundle.min.js":543===e?"gallery.cca2358f59857ce6f62f.bundle.min.js":970===e?"lottie.55ad84218daed1323133.bundle.min.js":334===e?"nav-menu.3afa8f5eb1fef7c22561.bundle.min.js":887===e?"popup.61d4fcab8891b2e07802.bundle.min.js":535===e?"load-more.7c4417f8a727b79f546f.bundle.min.js":396===e?"posts.844727d8428792223d2f.bundle.min.js":726===e?"portfolio.3d0e387cc28c07bae511.bundle.min.js":316===e?"share-buttons.b99b5ff11c944a3a8ea9.bundle.min.js":829===e?"slides.8e9b74f1b31471377df8.bundle.min.js":158===e?"social.de5cec83bf689b2f1f01.bundle.min.js":404===e?"table-of-contents.86ee3e0cc8c1fff9aab4.bundle.min.js":345===e?"archive-posts.0b71f7023819e3872142.bundle.min.js":798===e?"search-form.9abeafeecde90cf7e0f4.bundle.min.js":6===e?"woocommerce-menu-cart.33fbf47b819947e7a2a7.bundle.min.js":80===e?"woocommerce-purchase-summary.118e54b95a68f0ad8c09.bundle.min.js":354===e?"woocommerce-checkout-page.8391e03a51a57a42528a.bundle.min.js":4===e?"woocommerce-cart.9131ef5e40333f8066dd.bundle.min.js":662===e?"woocommerce-my-account.ab469f426496c628ac6c.bundle.min.js":621===e?"woocommerce-notices.181b8701c45ec5374829.bundle.min.js":787===e?"product-add-to-cart.a4f88a0c19e95b3912b6.bundle.min.js":993===e?"loop.1594a1df76e87a11eda2.bundle.min.js":932===e?"loop-carousel.881847b13e8fe1f8bfc2.bundle.min.js":550===e?"ajax-pagination.505018eb312c83998279.bundle.min.js":727===e?"mega-menu.857df1cf3198ae47b617.bundle.min.js":87===e?"mega-menu-stretch-content.7ed04741ba7d5a80c556.bundle.min.js":912===e?"menu-title-keyboard-handler.b3891112675eb0b0c4d5.bundle.min.js":33===e?"nested-carousel.659b0373371215e60dab.bundle.min.js":225===e?"taxonomy-filter.6526351a1205655def47.bundle.min.js":579===e?"off-canvas.82d118980fb5aa03c82b.bundle.min.js":1===e?"contact-buttons.e1605c5cfaccbff3c14b.bundle.min.js":61===e?"contact-buttons-var-10.11bf4233106e1245bd61.bundle.min.js":249===e?"floating-bars-var-2.5287acd8570f1ce2dde3.bundle.min.js":440===e?"floating-bars-var-3.e9e9c0ea3c6fb0e51c58.bundle.min.js":187===e?"search.f239247b514b4d0e8743.bundle.min.js":void 0,__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},a="elementor-pro:",__webpack_require__.l=(e,n,c,b)=>{if(r[e])r[e].push(n);else{var i,t;if(void 0!==c)for(var _=document.getElementsByTagName("script"),o=0;o<_.length;o++){var u=_[o];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==a+c){i=u;break}}i||(t=!0,(i=document.createElement("script")).charset="utf-8",__webpack_require__.nc&&i.setAttribute("nonce",__webpack_require__.nc),i.setAttribute("data-webpack",a+c),i.src=e),r[e]=[n];var onScriptComplete=(a,n)=>{i.onerror=i.onload=null,clearTimeout(d);var c=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),c&&c.forEach(e=>e(n)),a)return a(n)},d=setTimeout(onScriptComplete.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=onScriptComplete.bind(null,i.onerror),i.onload=onScriptComplete.bind(null,i.onload),t&&document.head.appendChild(i)}},(()=>{var e;__webpack_require__.g.importScripts&&(e=__webpack_require__.g.location+"");var r=__webpack_require__.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var a=r.getElementsByTagName("script");if(a.length)for(var n=a.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=a[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),__webpack_require__.p=e})(),(()=>{var e={978:0};__webpack_require__.f.j=(r,a)=>{var n=__webpack_require__.o(e,r)?e[r]:void 0;if(0!==n)if(n)a.push(n[2]);else if(978!=r){var c=new Promise((a,c)=>n=e[r]=[a,c]);a.push(n[2]=c);var b=__webpack_require__.p+__webpack_require__.u(r),i=new Error;__webpack_require__.l(b,a=>{if(__webpack_require__.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var c=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;i.message="Loading chunk "+r+" failed.\n("+c+": "+b+")",i.name="ChunkLoadError",i.type=c,i.request=b,n[1](i)}},"chunk-"+r,r)}else e[r]=0},__webpack_require__.O.j=r=>0===e[r];var webpackJsonpCallback=(r,a)=>{var n,c,[b,i,t]=a,_=0;if(b.some(r=>0!==e[r])){for(n in i)__webpack_require__.o(i,n)&&(__webpack_require__.m[n]=i[n]);if(t)var o=t(__webpack_require__)}for(r&&r(a);_<b.length;_++)c=b[_],__webpack_require__.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return __webpack_require__.O(o)},r=self.webpackChunkelementor_pro=self.webpackChunkelementor_pro||[];r.forEach(webpackJsonpCallback.bind(null,0)),r.push=webpackJsonpCallback.bind(null,r.push.bind(r))})()})();
(self.webpackChunkelementor_pro=self.webpackChunkelementor_pro||[]).push([[313],{6550(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isScrollSnapActive=t.escapeHTML=void 0;t.escapeHTML=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"};return e.replace(/[&<>'"]/g,e=>t[e]||e)};t.isScrollSnapActive=()=>"yes"===(elementorFrontend.isEditMode()?elementor.settings.page.model.attributes?.scroll_snap:elementorFrontend.config.settings.page?.scroll_snap)},3e3(e,t,n){"use strict";var s=n(6784);n(2258);var i=s(n(4906)),o=s(n(2450)),r=s(n(4409)),a=s(n(7937)),l=s(n(8098)),c=s(n(6275)),d=s(n(3268)),u=s(n(4992));class ElementorProFrontend extends elementorModules.ViewModule{onInit(){super.onInit(),this.config=ElementorProFrontendConfig,this.modules={},this.initOnReadyComponents()}bindEvents(){jQuery(window).on("elementor/frontend/init",this.onElementorFrontendInit.bind(this))}initModules(){let e={motionFX:i.default,sticky:o.default,codeHighlight:r.default,videoPlaylist:a.default,payments:l.default,progressTracker:c.default};elementorProFrontend.trigger("elementor-pro/modules/init/before"),e=elementorFrontend.hooks.applyFilters("elementor-pro/frontend/handlers",e),jQuery.each(e,(e,t)=>{this.modules[e]=new t}),this.modules.linkActions={addAction:(...e)=>{elementorFrontend.utils.urlActions.addAction(...e)}}}onElementorFrontendInit(){this.initModules()}initOnReadyComponents(){this.utils={controls:new d.default,DropdownMenuHeightController:u.default}}}window.elementorProFrontend=new ElementorProFrontend},3268(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=class Controls{getControlValue(e,t,n){let s;return s="object"==typeof e[t]&&n?e[t][n]:e[t],s}getResponsiveControlValue(e,t,n=""){const s=elementorFrontend.getCurrentDeviceMode(),i=this.getControlValue(e,t,n);if("widescreen"===s){const s=this.getControlValue(e,`${t}_widescreen`,n);return s||0===s?s:i}const o=elementorFrontend.breakpoints.getActiveBreakpointsList({withDesktop:!0});let r=s,a=o.indexOf(s),l="";for(;a<=o.length;){if("desktop"===r){l=i;break}const s=`${t}_${r}`,c=this.getControlValue(e,s,n);if(c||0===c){l=c;break}a++,r=o[a]}return l}}},4992(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=class DropdownMenuHeightController{constructor(e){this.widgetConfig=e}calculateStickyMenuNavHeight(){this.widgetConfig.elements.$dropdownMenuContainer.css(this.widgetConfig.settings.menuHeightCssVarName,"");const e=this.widgetConfig.elements.$dropdownMenuContainer.offset().top-jQuery(window).scrollTop();return elementorFrontend.elements.$window.height()-e}calculateMenuTabContentHeight(e){return elementorFrontend.elements.$window.height()-e[0].getBoundingClientRect().top}isElementSticky(){return this.widgetConfig.elements.$element.hasClass("elementor-sticky")||this.widgetConfig.elements.$element.parents(".elementor-sticky").length}getMenuHeight(){return this.isElementSticky()?this.calculateStickyMenuNavHeight()+"px":this.widgetConfig.settings.dropdownMenuContainerMaxHeight}setMenuHeight(e){this.widgetConfig.elements.$dropdownMenuContainer.css(this.widgetConfig.settings.menuHeightCssVarName,e)}reassignMobileMenuHeight(){const e=this.isToggleActive()?this.getMenuHeight():0;return this.setMenuHeight(e)}reassignMenuHeight(e){if(!this.isElementSticky()||0===e.length)return;const t=elementorFrontend.elements.$window.height()-e[0].getBoundingClientRect().top;e.height()>t&&(e.css("height",this.calculateMenuTabContentHeight(e)+"px"),e.css("overflow-y","scroll"))}resetMenuHeight(e){this.isElementSticky()&&(e.css("height","initial"),e.css("overflow-y","visible"))}isToggleActive(){const e=this.widgetConfig.elements.$menuToggle;return this.widgetConfig.attributes?.menuToggleState?"true"===e.attr(this.widgetConfig.attributes.menuToggleState):e.hasClass(this.widgetConfig.classes.menuToggleActiveClass)}}},2258(e,t,n){"use strict";n.p=ElementorProFrontendConfig.urls.assets+"js/"},4409(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class _default extends elementorModules.Module{constructor(){super(),elementorFrontend.elementsHandler.attachHandler("code-highlight",()=>n.e(635).then(n.bind(n,7193)))}}t.default=_default},4906(e,t,n){"use strict";var s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(820));class _default extends elementorModules.Module{constructor(){super(),elementorFrontend.elementsHandler.attachHandler("global",i.default,null)}}t.default=_default},820(e,t,n){"use strict";var s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(739));class _default extends elementorModules.frontend.handlers.Base{__construct(...e){super.__construct(...e),this.toggle=elementorFrontend.debounce(this.toggle,200)}getDefaultSettings(){return{selectors:{container:".elementor-widget-container"}}}getDefaultElements(){const e=this.getSettings("selectors");let t=this.$element.find(e.container);return 0===t.length&&(t=this.$element),{$container:t}}bindEvents(){elementorFrontend.elements.$window.on("resize",this.toggle)}unbindEvents(){elementorFrontend.elements.$window.off("resize",this.toggle)}addCSSTransformEvents(){this.getElementSettings("motion_fx_motion_fx_scrolling")&&!this.isTransitionEventAdded&&(this.isTransitionEventAdded=!0,this.elements.$container.on("mouseenter",()=>{this.elements.$container.css("--e-transform-transition-duration","")}))}initEffects(){this.effects={translateY:{interaction:"scroll",actions:["translateY"]},translateX:{interaction:"scroll",actions:["translateX"]},rotateZ:{interaction:"scroll",actions:["rotateZ"]},scale:{interaction:"scroll",actions:["scale"]},opacity:{interaction:"scroll",actions:["opacity"]},blur:{interaction:"scroll",actions:["blur"]},mouseTrack:{interaction:"mouseMove",actions:["translateXY"]},tilt:{interaction:"mouseMove",actions:["tilt"]}}}prepareOptions(e){const t=this.getElementSettings(),n="motion_fx"===e?"element":"background",s={};jQuery.each(t,(n,i)=>{const o=new RegExp("^"+e+"_(.+?)_effect"),r=n.match(o);if(!r||!i)return;const a={},l=r[1];jQuery.each(t,(t,n)=>{const s=new RegExp(e+"_"+l+"_(.+)"),i=t.match(s);if(!i)return;"effect"!==i[1]&&("object"==typeof n&&(n=Object.keys(n.sizes).length?n.sizes:n.size),a[i[1]]=n)});const c=this.effects[l],d=c.interaction;s[d]||(s[d]={}),c.actions.forEach(e=>s[d][e]=a)});let i,o,r=this.$element;const a=this.getElementType();if("element"===n&&!["section","container"].includes(a)){let e;i=r,e="column"===a?".elementor-widget-wrap":".elementor-widget-container",o=r.find("> "+e),r=0===o.length?this.$element:o}const l={type:n,interactions:s,elementSettings:t,$element:r,$dimensionsElement:i,refreshDimensions:this.isEdit,range:t[e+"_range"],classes:{element:"elementor-motion-effects-element",parent:"elementor-motion-effects-parent",backgroundType:"elementor-motion-effects-element-type-background",container:"elementor-motion-effects-container",layer:"elementor-motion-effects-layer",perspective:"elementor-motion-effects-perspective"}};return l.range||"fixed"!==this.getCurrentDeviceSetting("_position")||(l.range="page"),"fixed"===this.getCurrentDeviceSetting("_position")&&(l.isFixedPosition=!0),"background"===n&&"column"===this.getElementType()&&(l.addBackgroundLayerTo=" > .elementor-element-populated"),l}activate(e){const t=this.prepareOptions(e);jQuery.isEmptyObject(t.interactions)||(this[e]=new i.default(t))}deactivate(e){this[e]&&(this[e].destroy(),delete this[e])}toggle(){const e=elementorFrontend.getCurrentDeviceMode(),t=this.getElementSettings();["motion_fx","background_motion_fx"].forEach(n=>{const s=t[n+"_devices"];(!s||-1!==s.indexOf(e))&&(t[n+"_motion_fx_scrolling"]||t[n+"_motion_fx_mouse"])?this[n]?this.refreshInstance(n):this.activate(n):this.deactivate(n)})}refreshInstance(e){const t=this[e];if(!t)return;const n=this.prepareOptions(e);t.setSettings(n),t.refresh()}onInit(){super.onInit();const e=window.matchMedia("(prefers-reduced-motion: reduce)");e&&e.matches||(this.initEffects(),this.addCSSTransformEvents(),this.toggle())}onElementChange(e){if(/motion_fx_((scrolling)|(mouse)|(devices))$/.test(e))return"motion_fx_motion_fx_scrolling"===e&&this.addCSSTransformEvents(),void this.toggle();const t=e.match(".*?(motion_fx|_transform)");if(t){const e=t[0].match("(_transform)")?"motion_fx":t[0];this.refreshInstance(e),this[e]||this.activate(e)}/^_position/.test(e)&&["motion_fx","background_motion_fx"].forEach(e=>{this.refreshInstance(e)})}onDestroy(){super.onDestroy(),["motion_fx","background_motion_fx"].forEach(e=>{this.deactivate(e)})}}t.default=_default},3039(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class _default extends elementorModules.Module{getMovePointFromPassedPercents(e,t){return+(t/e*100).toFixed(2)}getEffectValueFromMovePoint(e,t){return e*t/100}getStep(e,t){return"element"===this.getSettings("type")?this.getElementStep(e,t):this.getBackgroundStep(e,t)}getElementStep(e,t){return-(e-50)*t.speed}getBackgroundStep(e,t){const n=this.getSettings("dimensions.movable"+t.axis.toUpperCase());return-this.getEffectValueFromMovePoint(n,e)}getDirectionMovePoint(e,t,n){let s;return e<n.start?"out-in"===t?s=0:"in-out"===t?s=100:(s=this.getMovePointFromPassedPercents(n.start,e),"in-out-in"===t&&(s=100-s)):e<n.end?"in-out-in"===t?s=0:"out-in-out"===t?s=100:(s=this.getMovePointFromPassedPercents(n.end-n.start,e-n.start),"in-out"===t&&(s=100-s)):"in-out"===t?s=0:"out-in"===t?s=100:(s=this.getMovePointFromPassedPercents(100-n.end,100-e),"in-out-in"===t&&(s=100-s)),s}translateX(e,t){e.axis="x",e.unit="px",this.transform("translateX",t,e)}translateY(e,t){e.axis="y",e.unit="px",this.transform("translateY",t,e)}translateXY(e,t,n){this.translateX(e,t),this.translateY(e,n)}tilt(e,t,n){const s={speed:e.speed/10,direction:e.direction};this.rotateX(s,n),this.rotateY(s,100-t)}rotateX(e,t){e.axis="x",e.unit="deg",this.transform("rotateX",t,e)}rotateY(e,t){e.axis="y",e.unit="deg",this.transform("rotateY",t,e)}rotateZ(e,t){e.unit="deg",this.transform("rotateZ",t,e)}scale(e,t){const n=this.getDirectionMovePoint(t,e.direction,e.range);this.updateRulePart("transform","scale",1+e.speed*n/1e3)}transform(e,t,n){n.direction&&(t=100-t),this.updateRulePart("transform",e,this.getStep(t,n)+n.unit)}setCSSTransformVariables(e){this.CSSTransformVariables=[],jQuery.each(e,(e,t)=>{const n=e.match(/_transform_(.+?)_effect/m);if(n&&t){if("perspective"===n[1])return void this.CSSTransformVariables.unshift(n[1]);if(this.CSSTransformVariables.includes(n[1]))return;this.CSSTransformVariables.push(n[1])}})}opacity(e,t){const n=this.getDirectionMovePoint(t,e.direction,e.range),s=e.level/10,i=1-s+this.getEffectValueFromMovePoint(s,n);this.$element.css({opacity:i,"will-change":"opacity"})}blur(e,t){const n=this.getDirectionMovePoint(t,e.direction,e.range),s=e.level-this.getEffectValueFromMovePoint(e.level,n);this.updateRulePart("filter","blur",s+"px")}updateRulePart(e,t,n){this.rulesVariables[e]||(this.rulesVariables[e]={}),this.rulesVariables[e][t]||(this.rulesVariables[e][t]=!0,this.updateRule(e));const s=`--${t}`;this.$element[0].style.setProperty(s,n)}updateRule(e){let t="";t+=this.concatTransformCSSProperties(e),t+=this.concatTransformMotionEffectCSSProperties(e),this.$element.css(e,t)}concatTransformCSSProperties(e){let t="";return"transform"===e&&jQuery.each(this.CSSTransformVariables,(e,n)=>{const s=n;n.startsWith("flip")&&(n=n.replace("flip","scale"));const i=n.startsWith("rotate")||n.startsWith("skew")?"deg":"px",o=n.startsWith("scale")?1:0+i;t+=`${n}(var(--e-transform-${s}, ${o}))`}),t}concatTransformMotionEffectCSSProperties(e){let t="";return jQuery.each(this.rulesVariables[e],e=>{t+=`${e}(var(--${e}))`}),t}runAction(e,t,n,...s){t.affectedRange&&(t.affectedRange.start>n&&(n=t.affectedRange.start),t.affectedRange.end<n&&(n=t.affectedRange.end)),this[e](t,n,...s)}refresh(){this.rulesVariables={},this.CSSTransformVariables=[],this.$element.css({transform:"",filter:"",opacity:"","will-change":""})}onInit(){this.$element=this.getSettings("$targetElement"),this.refresh()}}t.default=_default},3323(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class _default extends elementorModules.ViewModule{__construct(e){this.motionFX=e.motionFX,this.intersectionObservers||this.setElementInViewportObserver()}setElementInViewportObserver(){this.intersectionObserver=elementorModules.utils.Scroll.scrollObserver({callback:e=>{e.isInViewport?this.onInsideViewport():this.removeAnimationFrameRequest()}});const e="page"===this.motionFX.getSettings("range")?elementorFrontend.elements.$body[0]:this.motionFX.elements.$parent[0];this.intersectionObserver.observe(e)}onInsideViewport=()=>{this.run(),this.animationFrameRequest=requestAnimationFrame(this.onInsideViewport)};runCallback(...e){this.getSettings("callback")(...e)}removeIntersectionObserver(){this.intersectionObserver&&this.intersectionObserver.unobserve(this.motionFX.elements.$parent[0])}removeAnimationFrameRequest(){this.animationFrameRequest&&cancelAnimationFrame(this.animationFrameRequest)}destroy(){this.removeAnimationFrameRequest(),this.removeIntersectionObserver()}onInit(){super.onInit()}}t.default=_default},5481(e,t,n){"use strict";var s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(3323));class MouseMoveInteraction extends i.default{bindEvents(){MouseMoveInteraction.mouseTracked||(elementorFrontend.elements.$window.on("mousemove",MouseMoveInteraction.updateMousePosition),MouseMoveInteraction.mouseTracked=!0)}run(){const e=MouseMoveInteraction.mousePosition,t=this.oldMousePosition;if(t.x===e.x&&t.y===e.y)return;this.oldMousePosition={x:e.x,y:e.y};const n=100/innerWidth*e.x,s=100/innerHeight*e.y;this.runCallback(n,s)}onInit(){this.oldMousePosition={},super.onInit()}}t.default=MouseMoveInteraction,MouseMoveInteraction.mousePosition={},MouseMoveInteraction.updateMousePosition=e=>{MouseMoveInteraction.mousePosition={x:e.clientX,y:e.clientY}}},2647(e,t,n){"use strict";var s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(3323));class _default extends i.default{run(){if(pageYOffset===this.windowScrollTop)return!1;this.onScrollMovement(),this.windowScrollTop=pageYOffset}onScrollMovement(){this.updateMotionFxDimensions(),this.updateAnimation(),this.resetTransitionVariable()}resetTransitionVariable(){this.motionFX.$element.css("--e-transform-transition-duration","100ms")}updateMotionFxDimensions(){this.motionFX.getSettings().refreshDimensions&&this.motionFX.defineDimensions()}updateAnimation(){let e;e="page"===this.motionFX.getSettings("range")?elementorModules.utils.Scroll.getPageScrollPercentage():this.motionFX.getSettings("isFixedPosition")?elementorModules.utils.Scroll.getPageScrollPercentage({},window.innerHeight):elementorModules.utils.Scroll.getElementViewportPercentage(this.motionFX.elements.$parent),this.runCallback(e)}}t.default=_default},739(e,t,n){"use strict";var s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(2647)),o=s(n(5481)),r=s(n(3039));class _default extends elementorModules.ViewModule{getDefaultSettings(){return{type:"element",$element:null,$dimensionsElement:null,addBackgroundLayerTo:null,interactions:{},refreshDimensions:!1,range:"viewport",classes:{element:"motion-fx-element",parent:"motion-fx-parent",backgroundType:"motion-fx-element-type-background",container:"motion-fx-container",layer:"motion-fx-layer",perspective:"motion-fx-perspective"}}}bindEvents(){this.defineDimensions=this.defineDimensions.bind(this),elementorFrontend.elements.$window.on("resize elementor-pro/motion-fx/recalc",this.defineDimensions)}unbindEvents(){elementorFrontend.elements.$window.off("resize elementor-pro/motion-fx/recalc",this.defineDimensions)}addBackgroundLayer(){const e=this.getSettings();this.elements.$motionFXContainer=jQuery("<div>",{class:e.classes.container}),this.elements.$motionFXLayer=jQuery("<div>",{class:e.classes.layer}),this.updateBackgroundLayerSize(),this.elements.$motionFXContainer.prepend(this.elements.$motionFXLayer);(e.addBackgroundLayerTo?this.$element.find(e.addBackgroundLayerTo):this.$element).prepend(this.elements.$motionFXContainer)}removeBackgroundLayer(){this.elements.$motionFXContainer.remove()}updateBackgroundLayerSize(){const e=this.getSettings(),t={x:0,y:0},n=e.interactions.mouseMove,s=e.interactions.scroll;n&&n.translateXY&&(t.x=10*n.translateXY.speed,t.y=10*n.translateXY.speed),s&&(s.translateX&&(t.x=10*s.translateX.speed),s.translateY&&(t.y=10*s.translateY.speed)),this.elements.$motionFXLayer.css({width:100+t.x+"%",height:100+t.y+"%"})}defineDimensions(){const e=this.getSettings("$dimensionsElement")||this.$element,t=e.offset(),n={elementHeight:e.outerHeight(),elementWidth:e.outerWidth(),elementTop:t.top,elementLeft:t.left};n.elementRange=n.elementHeight+innerHeight,this.setSettings("dimensions",n),"background"===this.getSettings("type")&&this.defineBackgroundLayerDimensions()}defineBackgroundLayerDimensions(){const e=this.getSettings("dimensions");e.layerHeight=this.elements.$motionFXLayer.height(),e.layerWidth=this.elements.$motionFXLayer.width(),e.movableX=e.layerWidth-e.elementWidth,e.movableY=e.layerHeight-e.elementHeight,this.setSettings("dimensions",e)}initInteractionsTypes(){this.interactionsTypes={scroll:i.default,mouseMove:o.default}}prepareSpecialActions(){const e=this.getSettings(),t=!(!e.interactions.mouseMove||!e.interactions.mouseMove.tilt);this.elements.$parent.toggleClass(e.classes.perspective,t)}cleanSpecialActions(){const e=this.getSettings();this.elements.$parent.removeClass(e.classes.perspective)}runInteractions(){const e=this.getSettings();this.actions.setCSSTransformVariables(e.elementSettings),this.prepareSpecialActions(),jQuery.each(e.interactions,(e,t)=>{this.interactions[e]=new this.interactionsTypes[e]({motionFX:this,callback:(...e)=>{jQuery.each(t,(t,n)=>this.actions.runAction(t,n,...e))}}),this.interactions[e].run()})}destroyInteractions(){this.cleanSpecialActions(),jQuery.each(this.interactions,(e,t)=>t.destroy()),this.interactions={}}refresh(){this.actions.setSettings(this.getSettings()),"background"===this.getSettings("type")&&(this.updateBackgroundLayerSize(),this.defineBackgroundLayerDimensions()),this.actions.refresh(),this.destroyInteractions(),this.runInteractions()}destroy(){this.destroyInteractions(),this.actions.refresh();const e=this.getSettings();this.$element.removeClass(e.classes.element),this.elements.$parent.removeClass(e.classes.parent),"background"===e.type&&(this.$element.removeClass(e.classes.backgroundType),this.removeBackgroundLayer())}onInit(){super.onInit();const e=this.getSettings();this.$element=e.$element,this.elements.$parent=this.$element.parent(),this.$element.addClass(e.classes.element),this.elements.$parent=this.$element.parent(),this.elements.$parent.addClass(e.classes.parent),"background"===e.type&&(this.$element.addClass(e.classes.backgroundType),this.addBackgroundLayer()),this.defineDimensions(),e.$targetElement="element"===e.type?this.$element:this.elements.$motionFXLayer,this.interactions={},this.actions=new r.default(e),this.initInteractionsTypes(),this.runInteractions()}}t.default=_default},8098(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class _default extends elementorModules.Module{constructor(){super(),elementorFrontend.elementsHandler.attachHandler("paypal-button",()=>n.e(375).then(n.bind(n,466))),elementorFrontend.elementsHandler.attachHandler("stripe-button",()=>Promise.all([n.e(786),n.e(857)]).then(n.bind(n,9036)))}}t.default=_default},6275(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class _default extends elementorModules.Module{constructor(){super(),elementorFrontend.elementsHandler.attachHandler("progress-tracker",()=>n.e(581).then(n.bind(n,287)))}}t.default=_default},2450(e,t,n){"use strict";var s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(2121));class _default extends elementorModules.Module{constructor(){super(),elementorFrontend.elementsHandler.attachHandler("section",i.default,null),elementorFrontend.elementsHandler.attachHandler("container",i.default,null),elementorFrontend.elementsHandler.attachHandler("widget",i.default,null)}}t.default=_default},2121(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=n(6550);t.default=elementorModules.frontend.handlers.Base.extend({currentConfig:{},debouncedReactivate:null,bindEvents(){elementorFrontend.addListenerOnce(this.getUniqueHandlerID()+"sticky","resize",this.reactivateOnResize)},unbindEvents(){elementorFrontend.removeListeners(this.getUniqueHandlerID()+"sticky","resize",this.reactivateOnResize)},isStickyInstanceActive(){return void 0!==this.$element.data("sticky")},getResponsiveSetting(e){const t=this.getElementSettings();return elementorFrontend.getCurrentDeviceSetting(t,e)},getResponsiveSettingList:e=>["",...Object.keys(elementorFrontend.config.responsive.activeBreakpoints)].map(t=>t?`${e}_${t}`:e),getConfig(){const e=this.getElementSettings(),t={to:e.sticky,offset:this.getResponsiveSetting("sticky_offset"),effectsOffset:this.getResponsiveSetting("sticky_effects_offset"),classes:{sticky:"elementor-sticky",stickyActive:"elementor-sticky--active elementor-section--handles-inside",stickyEffects:"elementor-sticky--effects",spacer:"elementor-sticky__spacer"},isRTL:elementorFrontend.config.is_rtl,isScrollSnapActive:(0,s.isScrollSnapActive)(),handleScrollbarWidth:elementorFrontend.isEditMode()},n=elementorFrontend.elements.$wpAdminBar,i=this.isContainerElement(this.$element[0])&&!this.isContainerElement(this.$element[0].parentElement);return n.length&&"top"===e.sticky&&"fixed"===n.css("position")&&(t.offset+=n.height()),e.sticky_parent&&!i&&(t.parent=".e-con, .e-con-inner, .elementor-widget-wrap"),t},activate(){this.currentConfig=this.getConfig(),this.$element.sticky(this.currentConfig)},deactivate(){this.isStickyInstanceActive()&&this.$element.sticky("destroy")},run(e){if(this.getElementSettings("sticky")){var t=elementorFrontend.getCurrentDeviceMode();-1!==this.getElementSettings("sticky_on").indexOf(t)?!0===e?this.reactivate():this.isStickyInstanceActive()||this.activate():this.deactivate()}else this.deactivate()},reactivateOnResize(){clearTimeout(this.debouncedReactivate),this.debouncedReactivate=setTimeout(()=>{const e=this.getConfig();JSON.stringify(e)!==JSON.stringify(this.currentConfig)&&this.run(!0)},300)},reactivate(){this.deactivate(),this.activate()},onElementChange(e){-1!==["sticky","sticky_on"].indexOf(e)&&this.run(!0);-1!==[...this.getResponsiveSettingList("sticky_offset"),...this.getResponsiveSettingList("sticky_effects_offset"),"sticky_parent"].indexOf(e)&&this.reactivate()},onDeviceModeChange(){setTimeout(()=>this.run(!0))},onInit(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),elementorFrontend.isEditMode()&&elementor.listenTo(elementor.channels.deviceMode,"change",()=>this.onDeviceModeChange()),this.run()},onDestroy(){elementorModules.frontend.handlers.Base.prototype.onDestroy.apply(this,arguments),this.deactivate()},isContainerElement:e=>["e-con","e-con-inner"].some(t=>e?.classList.contains(t))})},7937(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class _default extends elementorModules.Module{constructor(){super(),elementorFrontend.hooks.addAction("frontend/element_ready/video-playlist.default",e=>{n.e(519).then(n.bind(n,4161)).then(({default:t})=>{elementorFrontend.elementsHandler.addHandler(t,{$element:e,toggleSelf:!1})})})}}t.default=_default},6784(e){e.exports=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}},e=>{var t;t=3e3,e(e.s=t)}]);