1flexbe_cli.entity.setClientJs("element","social01",{isPure:!0});flexbe_cli.entity.setClientJs("element","text01",{isPure:!0});function At(t,e){e=e.sort((s,n)=>n-s);let i=e[0];return e.forEach(s=>{t<i&&t<=s&&(i=s)}),i}var It=150,lt=2160,St={avif:null,webp:null};function Et(){let t=typeof flexbe_cli=="object"&&flexbe_cli.vars?.site.images||{};return{lazy:!0,lazy_priority:!1,avif:!1,webp:!1,avif_support:St.avif||t.avif_support,webp_support:St.webp||t.webp_support,slow_network:!1,maxSize:lt,minSize:It,quality_map:{jpg:70,webp:70,avif:55}}}async function P(t){return new Promise((e,i)=>{let s=new Image,n=()=>{e(s),setTimeout(()=>{typeof s.remove=="function"&&s.remove()},10)};"decode"in s&&!/\.svg/.test(t)?(s.src=t,s.decode().then(n).catch(i)):(s.onerror=i,s.onload=n,s.src=t)})}function ne(t){if(typeof t!="string")return t;t=t.replace(/(\/img\/[\d_q]+)\/[\w-]+(\.\w{3,4})/i,"$1$2");let[,e,i,s,n]=t.match(/\/img\/(\d+)_?(\d+)?_?q?(\d+)?\.(\w{3,4})/i)||[];return{id:+e,ext:n,name:`${e}.${n}`,size:i?+i:0,quality:s?+s:null}}function Ft(t,e){let i=e.avif_support,s=e.webp_support,n=e.avif,a=e.webp,o=t.ext;return i&&n?o="avif":s&&a?o="webp":t.ext==="webp"&&(s?o="webp":o=t.transparent?"png":"jpg"),o}function ae(t,e=null,i=null){i={...Et(),...i};let{id:s,ext:n}=t;if(!s)return"";let a=i.maxSize||lt;!e&&t.ext==="webp"&&!i.webp_support&&(e=Math.min(t.width||a,a));let o=t.animated??n==="gif",r=`/img/${s}.${n}`;if(!e||o||n==="svg")return r;let c=Ft(t,i),l=i.slow_network&&kt(),d=i.quality_map??{jpg:70,webp:70,avif:55};switch(l&&(d={jpg:50,webp:50,avif:45}),c){case"png":return`/img/${s}_${e}.png`;case"avif":case"webp":case"jpg":return`/img/${s}_${e}_q${d[c]}.${c}`;case"gif":break;default:return r}}function oe(t){let e=String(t).match(/\.(jpg|jpeg|png|gif|svg|bmp|webp)$/i);return e?.[1]?e[1]:""}function re(t){return t!=="transparent"?t:"#000000"}function D(t){if(typeof t=="string"&&(t=ne(t)),!t||typeof t!="object")return{};let e=t.img_ext||t.ext,i=t.img_id||t.id,s=t.img_name||t.name;(!e||e==="false")&&(e=s?oe(s):"jpg");let n=t.img_border||t.border,a=re(t.img_average||t.average),o=t.img_preview||t.preview||"",r=t.img_width||t.width||0,c=t.img_height||t.height||0,l=+(+t.img_proportion||+t.proportion||0).toFixed(2),d=t.img_animated||t.animated||e==="gif",h=t.img_transparent||t.transparent||0;return{id:i,ext:e,average:a,preview:o,width:r,height:c,proportion:l,border:n,animated:d,transparent:h}}function S(t,e=0,i){return ae(D(t),e==="%optimalWidth%"?e:Math.round(e)||parseInt(e,10)||null,i)}async function ct(t){let e=t,i=typeof t=="object"&&(+t.proportion||+t.img_proportion)||0;if(i&&(i<2||i<5&&i%1>0)&&(i*=100),typeof e=="string"||!i){typeof e=="object"&&(e=S(t,50));let s=await P(e);i=s.naturalHeight/s.naturalWidth*100}return i}function kt(){return typeof navigator>"u"?!1:(navigator.connection?.effectiveType||"4g")!=="4g"}async function F(t,e,i){i={...Et(),...i};let s=t.width||0,n=t.img_scale||t.scale||"cover",a=e.height/e.width,o=await ct(t)/100,r=i.slow_network&&kt()?Math.min(1.5,globalThis.devicePixelRatio):Math.min(2,globalThis.devicePixelRatio),c=Ft(t,i),l,d;a>o&&n==="contain"||a<o&&n==="cover"?(l=e.width,d=l*o):(d=e.height,l=d/o),r>1&&(l*=r,d*=r),i.sizes&&(l=At(l,i.sizes),d=l*o);let h=i.minSize||It,p=i.maxSize||lt;return l<=h&&/webp|jpg/.test(c)&&(l=l/r*2,d=l*o),s&&l>s&&(l=s,d=l*o),l>p&&(l=p,d=l*o),{width:Math.ceil(l),height:Math.ceil(d)}}var dt=new WeakMap,le=()=>Math.floor(Math.random()*999999999),Tt=t=>{let{is:e,component:i}=t;return dt.has(i)||dt.set(i,le()),`.component-${e}-${dt.get(i)}`},b=class{static is="";require=[];core=null;owner=null;root=null;component=null;$component=null;componentWidth=null;componentHeight=null;isInited=!1;isLoaded=!1;isUpdated=!1;isOpen=null;isVisible=null;inScreen=!1;inBeside=!1;inView=!1;inFocus=!1;wasVisible=null;wasScreen=!1;wasBeside=!1;wasView=!1;wasFocus=!1;get is(){return this.constructor.is}constructor({component:t,core:e,reason:i}){this.core=e,this.owner=e.area,this.root=e.root,this.component=t,this.$component=$(t),this.isUpdated=i==="update"}onInit(){}onLoad(){}onVisible(t){}onScreen(t){}onBeside(t){}onView(t){}onFocus(t){}onResize(t){}onOpen(t){}onClose(t){}onHideShowUI(t){}onDestroy(){}#t(){this._clearEvents();let t=Tt(this);
1$(this.owner).on(`tween${t}`,e=>this.#e(e.detail)),$(this.root).on(`open${t}`,e=>this._onOpen(e.detail)),$(this.root).on(`close${t}`,e=>this._onClose(e.detail))}_clearEvents(){let t=Tt(this);$(this.owner).off(t),$(this.root).off(t)}#e({force:t=!1}={}){let e=this.componentWidth==null||this.componentHeight==null,i=this.core.isVisible,s=i&&this.component.offsetWidth||0,n=i&&this.component.offsetHeight||0,a=!!(s||n),o=a&&this.core.inBeside,r=a&&this.core.inScreen,c=a&&this.core.inView,l=a&&this.core.inFocus,d=this.componentWidth!==s,h=this.componentHeight!==n,p=t||a&&!e&&(d||h);a&&(this.componentWidth=s,this.componentHeight=n),a!==this.isVisible&&this._onVisible({state:a}),p&&this._onResize({force:t}),o!==this.inBeside&&this._onBeside({state:o}),r!==this.inScreen&&this._onScreen({state:r}),c!==this.inView&&this._onView({state:c}),l!==this.inFocus&&this._onFocus({state:l})}_onInit(){this.isInited=!0,typeof this.onInit=="function"&&this.onInit(),this.#e(),this.#t(),flexbe_cli.require(this.require,()=>this._onLoad())}_onLoad(){this.isLoaded=!0,typeof this.onLoad=="function"&&this.onLoad(),this.require.length&&this.#e()}_onVisible({state:t}){if(this.isVisible==null){this.isVisible=t,this.wasVisible=t;return}let e=t&&!this.wasVisible;this.isVisible=t,this.onVisible({state:t,first:e}),t&&(this.wasVisible=!0)}_onScreen({state:t}){let e=t&&!this.wasScreen;this.inScreen=t,this.onScreen({state:t,first:e}),t&&(this.wasScreen=!0)}_onView({state:t}){let e=t&&!this.wasView;this.inView=t,this.onView({state:t,first:e}),t&&(this.wasView=!0)}_onBeside({state:t}){let e=t&&!this.wasBeside;this.inBeside=t,this.onBeside({state:t,first:e}),t&&(this.wasBeside=!0)}_onFocus({state:t}){let e=t&&!this.wasFocus;this.inFocus=t,this.onFocus({state:t,first:e}),t&&(this.wasFocus=!0)}_onResize(t){this.onResize(t)}_onOpen(t){this.isOpen=!0,this.#e(),this.onOpen(t)}_onClose(t){this.isOpen=!1,this.#e(),this.onClose(t)}_onWindowResize(){this.onWindowResize&&(this.#e(),this.onWindowResize())}_onHideShowUI(t){this.onHideShowUI(t)}destroy(){this._clearEvents(),this.onDestroy()}};var Ai=Object.freeze({value:"auto",title:"AUTO",auto:!0,selectValue:"auto"}),Si=Object.freeze({value:"fill",title:"FILL",fill:!0,selectValue:"fill",tip:typeof tr=="function"&&tr("editor::units::fill_tip")}),Ii=Object.freeze({value:"px",title:"PX",step:1,altStep:5}),Ei=Object.freeze({value:"pt",title:"PT",step:1,altStep:.1}),Fi=Object.freeze({value:"em",title:"EM",step:.1,altStep:.01}),ki=Object.freeze({value:"rem",title:"REM",step:.1,altStep:.01}),Ti=Object.freeze({value:"vh",title:"VH",step:1,altStep:.1,tip:typeof tr=="function"&&tr("editor::units::vh_tip")}),Pi=Object.freeze({value:"vw",title:"VW",step:1,altStep:.1,tip:typeof tr=="function"&&tr("editor::units::vw_tip")}),Di=Object.freeze({value:"cqw",title:"CQW",step:1,altStep:.1}),Mi=Object.freeze({value:"cqw",title:"CQH",step:1,altStep:.1}),Ri=Object.freeze({value:"ch",title:"CH",step:1,altStep:5,tip:typeof tr=="function"&&tr("editor::units::ch_tip")}),Li=Object.freeze({value:"%",title:"%",step:1,altStep:.1});function Pt(t,e,i=1){let s=t.getBoundingClientRect();return{x:(e.clientX-s.left)/i,y:(e.clientY-s.top)/i}}var G=class extends b{static is="backgroundElement";constructor(...t){super(...t),this.$glareElement=this.$component.find("> .bg-glare-hover").eq(0),this.$bgElement=this.$component.find(".bg-fill").eq(0),this.$hoverElement=this.$component.find(".bg-fill-hover").eq(0),this.lazy=this.$bgElement.data("img-lazy"),this.isImgLoaded=this.$bgElement.data("img-loaded"),this.bgType=this.$bgElement.data("type"),this.hoverType=this.$hoverElement.data("hover-type"),this.hasImagePlaceholder=!!this.$bgElement.data("img-has-placeholder"),this.imageLoadingOptions=flexbe_cli.vars.site.images}async onInit(){this.$bgElement.on("setImage",async()=>{this.isVisible&&!this.isImgLoading&&!this.isImgLoaded&&(this.setImageParams(),await this.loadImage())}),this.$glareElement.length&&this.$component.off("mousemove.bg-glare").on("mousemove.bg-glare",t=>{let{x:e,y:i}=Pt(this.$component[0],t);this.$glareElement.css({"--bgGlareX":`${e}px`,"--bgGlareY":`${i}px`})})}async onBeside({state:t,first:e}){t&&e&&(this.lazy&&this.bgType==="image"&&!this.isImgLoaded&&(this.setImageParams(),await this.loadImage()),this.hoverType==="image"&&(this.setHoverImageParams(),await this.loadHoverImage()),this.dispatchEffects())}onWindowResize(){this.dispatchEffects()}getComponentSize(){return{width:this.componentWidth,height:this.componentHeight}}
1dispatchEffects(){let t=flexbe_cli.resize.responsiveMode==="mobile",e=this.$component.hasClass("hover-trigger"),i=this.$component.hasClass("hover-trigger-am"),s=t?i:e;this.$component.toggleClass("js-hover",s)}async loadImage(){this.isImgLoading=!0;let t=0;if(!this.image.original){let{width:i}=await F(this.image,this.getComponentSize(),this.imageLoadingOptions);t=i}let e=S(this.image,t,this.imageLoadingOptions);this.hasImagePlaceholder&&await P(e),this.setImage(this.$bgElement,e),this.isImgLoading=!1,this.isImgLoaded=!0}async loadHoverImage(){let t=0;if(!this.hoverImage.original){let{width:i}=await F(this.hoverImage,this.getComponentSize(),this.imageLoadingOptions);t=i}let e=S(this.hoverImage,t,this.imageLoadingOptions);this.setImage(this.$hoverElement,e)}setImage(t,e){t.css("background-image",`url(${e})`),this.$component.find(".bg-preview").eq(0).addClass("invisible")}setImageParams(){let{$bgElement:t}=this;this.image={id:t.data("img-id"),ext:t.data("img-ext"),width:t.data("img-width"),animated:t.data("img-animated"),transparent:t.data("img-transparent"),proportion:t.data("img-proportion"),original:t.is("[data-img-original]"),type:"background",scale:"cover"}}setHoverImageParams(){let{$hoverElement:t}=this;this.hoverImage={id:t.data("img-id"),ext:t.data("img-ext"),width:t.data("img-width"),animated:t.data("img-animated"),transparent:t.data("img-transparent"),proportion:t.data("img-proportion"),original:t.is("[data-img-original]"),type:"background",scale:"cover"}}};flexbe_cli.entity.setClientJs("element","zone",{components:[G],onInit(){this.setMeta()},onUpdate(){this.setMeta()},setMeta(){let t=this.lastViewport,e=this.hideHidden;this.lastViewport=flexbe_cli.resize.viewportWidth,this.hideHidden=flexbe_cli.is_admin&&$("body").hasClass("hide-hidden"),this.needFixOrder=this.needFixOrder||this.lastViewport!==t||this.hideHidden!==e},onResize(){this.inScreen&&this.isVisible&&this.fixElementOrder()},fixElementOrder(){if(this.setMeta(),!this.needFixOrder)return;this.needFixOrder=!1;let t=this.$area.find(".elements-list");t.find("[data-hidden]").length&&t.each((e,i)=>{let s=$(i).find(".element-item--static"),n=s.filter(":visible");s.removeClass("is-first-child is-last-child"),n.first().addClass("is-first-child"),n.last().addClass("is-last-child")})}});var ce=t=>crypto.getRandomValues(new Uint8Array(t)),de=(t,e,i)=>{let s=256-256%t.length;if(s===256){let a=t.length-1;return(o=e)=>{if(!o)return"";let r="";for(;;){let c=i(o),l=o;for(;l--;)if(r+=t[c[l]&a],r.length>=o)return r}}}let n=Math.ceil(1.6*256*e/s);return(a=e)=>{if(!a)return"";let o="";for(;;){let r=i(n),c=n;for(;c--;)if(r[c]<s&&(o+=t[r[c]%t.length],o.length>=a))return o}}},he=(t,e=21)=>de(t,e|0,ce),ue="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Yi=he(ue,8),pe=typeof crypto<"u"&&typeof crypto.getRandomValues=="function"?()=>crypto.getRandomValues(new Uint8Array(1))[0]&15:()=>Math.floor(Math.random()*16);function Y(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>{let e=parseInt(t);return((e^pe())>>e/4).toString(16)})}function k(t,e,i){let s;return typeof e=="function"&&typeof t=="function"&&(t()?e():(i&&setTimeout(()=>{clearInterval(s),e()},i),s=setInterval(()=>{t()&&(clearInterval(s),e())},25))),()=>clearInterval(s)}function Dt(t,e,i=1){return 1-t>i&&(t=i),(1-Math.cos(Math.PI*t*e))/2}var fe=[0,"parallax","parallax-fade","zoom","zoom-return"],me=class{imgParams={w:0,h:0,r:1,x:.5,y:.5};canvasSize={w:0,h:0,y:0};winSize={w:0,h:0};overlayOpacity=1;constructor(t,e,i="parallax",s=null){this.id=t,this.shouldRender=!1,this.mode=typeof i=="number"?fe[i]:i,this.fadeAnimation=this.mode.includes("fade"),this.parallaxFactor=this.mode.includes("fixed")?1:this.mode.includes("parallax")?.4:0,this.zoomFactor=this.mode.includes("zoom")?.2:0,this.zoomLimit=this.mode==="zoom"?.5:this.mode==="zoom-return"?1:0,this.offCanvas=document.createElement("canvas"),this.offCtx=this.offCanvas.getContext("2d",{alpha:!1}),this.component=e[0],this.canvas=this.component.querySelector("canvas"),this.overlay=this.component.querySelector(".overlay"),this.ctx=this.canvas.getContext("2d",{alpha:!1}),this.init(s),this.reflow()}init(t){!t||!t.url||(this.img=document.createElement("img"),this.img.onload=()=>{this.ready=!0,this.imgParams={w:this.img.width,h:this.img.height,r:this.img.height/this.img.width,x:+t.x.replace("%","")/100,y:+t.y.replace("%","")/100},this.dispatchEvents(),this.draw(),requestAnimationFrame(()=>{$(this.canvas).addClass("ready")})},this.img.src=t.url)}
1dispatchEvents(){flexbe_cli.events.off(`.bg_${this.id}`),$(window).off(`.bg_${this.id}`),$(window).on(`scroll.bg_${this.id}`,()=>{this.draw()}),$(window).on(`resize.bg_${this.id}`,()=>{this.reflow()}),flexbe_cli.is_admin&&(flexbe_cli.events.on(`entity_render:style.bg_${this.id}`,t=>{t.id===this.id&&this.reflow()}),flexbe_cli.events.on(`layout_change.bg_${this.id}`,()=>{this.reflow()}))}toggleRendering(t){this.shouldRender=t}getZoomCoords(t){let e=1;if(this.zoomFactor){let s=100-Dt(t*.01,2,this.zoomLimit)*100;e=1+this.zoomFactor/100*s}let i={w:0,h:0,x:0,y:0};return i.w=this.canvasSize.w*e,i.h=this.canvasSize.h*e,i.x=(i.w-this.canvas.width)/2,i.y=(i.h-this.canvasSize.h)/2,i}reflow(){let t=this.canvas.getBoundingClientRect();this.canvasSize={w:t.width,h:t.height,y:t.top+window.pageYOffset};let{viewportWidth:e,viewportHeight:i}=flexbe_cli.resize;this.winSize.h=flexbe_cli.run.is_mobile?Math.max(this.winSize.h,i):i,this.winSize.w=e,this.fadeAnimation&&(this.overlayOpacity=parseFloat(getComputedStyle(this.component).getPropertyValue("--componentBgOpacity")||1)),this.draw()}draw(){if(!this.shouldRender||!this.ready||this.pending)return;this.pending=!0;let t=flexbe_cli.scroll.latest+this.winSize.h-this.canvasSize.y,e=100-t/(this.canvasSize.h+this.winSize.h)*100;this.drawOffscreen(),this.drawCanvas(t,e),this.drawOverlay(e),this.pending=!1}drawOffscreen(){let{canvasSize:t,zoomFactor:e,winSize:i,parallaxFactor:s,imgParams:n,offCanvas:a,offCtx:o,img:r}=this,c=e?t.h:t.h+(i.h-t.h)*s,l=t.w,d=l,h=l*n.r,p=0,u=(h-c)*n.y*-1;c/l>n.r&&(d=c/n.r,h=c,p=(d-l)*n.x*-1,u=0),a.width!==l&&(a.width=l),a.height!==c&&(a.height=c),o.drawImage(r,p,u,d,h)}drawCanvas(t,e){if(this.canvas.width!==this.canvasSize.w&&(this.canvas.width=this.canvasSize.w),this.canvas.height!==this.canvasSize.h&&(this.canvas.height=this.canvasSize.h),this.zoomFactor){let i=this.getZoomCoords(e);try{this.ctx.drawImage(this.offCanvas,Math.ceil(i.x*-1),Math.ceil(t*this.parallaxFactor-this.winSize.h*this.parallaxFactor-i.y),i.w,i.h)}catch{}}else try{this.ctx.drawImage(this.offCanvas,0,Math.ceil((t-this.winSize.h)*this.parallaxFactor))}catch{}}drawOverlay(t){if(this.fadeAnimation&&this.overlay){let e=1-(1-this.overlayOpacity)*Dt(t*.01,2,1);this.overlay.style.setProperty("--componentBgOpacity",e)}}destroy(){this.destroyed=!0,cancelAnimationFrame(this._raf),flexbe_cli.events.off(`.bg_${this.id}`),$(window).off(`.bg_${this.id}`),$(this.canvas).removeClass("ready"),this.offCanvas?.remove(),this.img?.remove()}},ge=class{destroyed=!1;constructor(t,e,i){this.background=t,this.core=t.core,this.$component=t.$component,this.video=e,typeof i=="function"&&(this.onInited=i),this.initVideo()}initVideo(){this.$container=$('<div class="layer video-holder"></div>'),this.$overlay=this.$component.find(".layer.overlay"),this.insertVideo(),this.video.type==="custom"?this.initMP4():this.video.type==="vimeo"?this.initVimeo():this.video.type==="youtube"?this.initYoutube():this.video.type==="
1kinescope"?this.initKinescope():this.initEmbed(),$(document).on(`visibilitychange.bg_effect_${this.core.id}`,()=>{this.background.onscreen&&!document.hidden&&setTimeout(()=>{this.play()},50)})}initVimeo(){let t=0,e=()=>{let i=this.vPlayer;return Promise.all([i.getVideoWidth(),i.getVideoHeight()]).then(s=>{let[n,a]=s;return n/a<2.5&&n/a>.4||t===3?{width:n,height:a}:(t+=1,e())})};flexbe_cli.require(["https://player.vimeo.com/api/player.js"],()=>{this.destroyed||(this.vPlayer=new window.Vimeo.Player(this.$videoElement[0]),e().then(i=>(this.video.width=i.width,this.video.height=i.height,this.fitToSize(),this.play(),null)).catch(()=>{}))})}initYoutube(){let t=()=>{this.yPlayer=new window.YT.Player(this.$videoElement[0],{events:{onReady:()=>{this.fitToSize(),this.play()}}})};!window.YT&&!window.onYouTubeIframeAPIReady?(window.onYouTubeIframeAPIReady=()=>{window.youtubeBGQueue.forEach(e=>e()),window.youtubeBGQueue=null,window.onYouTubeIframeAPIReady=null},window.youtubeBGQueue=[],window.youtubeBGQueue.push(t),flexbe_cli.require(["https://www.youtube.com/iframe_api"])):window.onYouTubeIframeAPIReady?window.youtubeBGQueue.push(t):t()}initKinescope(){this.fitToSize(),flexbe_cli.require(["https://player.kinescope.io/latest/iframe.player.js"],async()=>{this.destroyed||(this.kPlayer=await window.Kinescope.IframePlayer.create(this.$videoElement.attr("id"),{url:this.video.link,behavior:{background:!0,preload:"auto",loop:!0,muted:!0,autoPlay:"viewable",autoPause:!1}}),this.play())})}initEmbed(){this.fitToSize(),this.play()}initMP4(){this.$videoElement[0].oncanplay=()=>{this.play()},this.$videoElement[0].onloadeddata=()=>{this.video.width=this.$videoElement[0].videoWidth,this.video.height=this.$videoElement[0].videoHeight,this.fitToSize(),this.ready()}}insertVideo(){this.video.type==="custom"?(this.$videoElement=$(`<video src="${this.video.link}" 2 controlslist="nodownload" 3 loop="true" 4 muted="true" 5 autoplay="true" 6 playsinline="true" 7 disablePictureInPicture 8 disableRemotePlayback 9 pip="false" 10 ></video>`),this.$videoElement[0].disablePictureInPicture=!0,this.$videoElement[0].disableRemotePlayback=!0):this.$videoElement=$(`<iframe 11 id="${Y()}" 12 src="${this.video.link}" 13 width="${this.video.width}" 14 height="${this.video.height}" 15 allow="autoplay; encrypted-media; fullscreen; screen-wake-lock; accelerometer; clipboard-write;" 16 ></iframe>`),this.$container.append(this.$videoElement),this.$overlay.length&&this.$container.append(this.$overlay),this.$component.prepend(this.$container),this.onInited&&this.onInited(this.$container)}fitToSize(){if(this.video){let t=this.$container.width(),e=this.$container.height(),i=this.video.width/this.video.height;i>t/e?this.$videoElement.css({width:`${e*i}px`,height:"100%"}):this.$videoElement.css({width:"100%",height:`${t/i}px`})}this.videoIsResized=!0}ready(){k(()=>this.videoIsResized,()=>{this.$component.addClass("video-loaded")},5e3)}play(){this.$videoElement&&this.$videoElement[0]&&this.$videoElement[0].play?(this.$videoElement[0].play(),$(document).one("touchstart.video-bg",()=>{this.$videoElement[0].play()}),this.ready()):this.video.type==="vimeo"?k(()=>this.vPlayer&&this.vPlayer.play,()=>{setTimeout(()=>{this.vPlayer.play(),this.ready()},50)},5e3):this.video.type==="youtube"?k(()=>this.yPlayer&&this.yPlayer.playVideo,()=>{this.yPlayer.playVideo(),this.ready()}
16,5e3):this.video.type==="kinescope"?k(()=>this.kPlayer&&this.kPlayer.play,()=>{this.kPlayer.play(),this.ready()},5e3):this.ready()}pause(){this.video.type==="vimeo"&&this.vPlayer?this.vPlayer.pause():this.video.type==="youtube"&&this.yPlayer&&this.yPlayer.pauseVideo?this.yPlayer.pauseVideo():this.video.type==="kinescope"&&this.kPlayer?.pause?this.kPlayer.pause():this.$videoElement&&this.$videoElement[0]&&this.$videoElement[0].pause&&this.$videoElement[0].pause()}destroy(){this.destroyed=!0,this.pause(),this.kPlayer&&this.kPlayer.destroy(),$(document).off(`.bg_effect_${this.core.id}`)}},ve=[800,1366,1920,2160],I=class extends b{static is="background";constructor(...t){super(...t);let{$component:e}=this,i=e.data();this.data={type:i.type||"color",hasImagePlaceholder:!!i.hasPlaceholder,imageLoadingOptions:flexbe_cli.vars.site.images,isLazyLoading:!!i.lazy,isImgLoaded:!!i.loaded,effect:i.effect,effectMobile:i.effectMobile??i.effect,videoId:i.videoId||null,videoType:i.videoType||null,videoLink:i.videoLink||null,videoWidth:i.videoWidth||640,videoHeight:i.videoHeight||360,videoPreview:i.videoPreview||"color",infinityVideo:i.infinityVideo??!1,mobileVideoEnabled:i.mobileVideoEnabled||!1,videoParallaxFactor:.4},this.image={url:null,id:i.imgId,ext:i.imgExt,x:i.imgX,y:i.imgY,proportion:i.imgProportion,width:i.imgWidth,animated:i.imgAnimated,transparent:i.imgTransparent,scale:"cover",type:"background",original:!!i.imgOriginal}}async onInit(){this.data.isLazyLoading||await this.loadImage(),this.$component.on("setImage",async()=>{this.isVisible&&!this.isImgLoading&&!this.data.isImgLoaded&&await this.loadImage()})}onScreen({state:t}){this.videoInstance&&(this.data.infinityVideo||(t?this.videoInstance.play():this.videoInstance.pause())),this.onscreen=t,!(!t||this.played)&&this.playVideo()}async onBeside({state:t,first:e}
16){t&&e&&(await this.loadImage(),this.imageEffectInit(),this.videoEffectInit()),this.played||this.playVideo(),this.bgEffect&&(this.bgEffect.toggleRendering(t),this.bgEffect.draw())}onResize(){this.bgEffect&&requestAnimationFrame(()=>{this.bgEffect.reflow()}),this.data.type==="video"&&(this.videoInstance?(this.videoInstance.fitToSize(),this.data.effect&&this.fixHolder&&this.setParallax&&setTimeout(()=>{this.fixHolder(),this.setParallax()},100),setTimeout(()=>{this.videoInstance.fitToSize()},150)):this.fixHolder&&this.fixHolder())}async loadImage(){if(!(this.image.id&&(this.data.type==="image"||this.data.type==="video"&&this.data.videoPreview==="image")))return;this.isImgLoading=!0;let t={width:this.componentWidth||this.component.offsetWidth,height:this.componentHeight||this.component.offsetHeight},{width:e}=this.image.original?{width:0}:await F(this.image,t,{...this.data.imageLoadingOptions,sizes:ve});if(this.image.url=S(this.image,e,this.data.imageLoadingOptions),!this.data.isImgLoaded){if(this.data.hasImagePlaceholder)try{await P(this.image.url)}catch(i){console.error("Background preload error",i);return}this.setImage(this.image.url)}this.isImgLoading=!1}setImage(t){this.$component.find(".image-holder").css("background-image",`url(${t})`),this.$component.addClass("image-loaded"),this.isImgLoading=!1,this.data.isImgLoaded=!0}imageEffectInit(){if(this.data.type!=="image"||!this.data.effect||flexbe_cli.vars.globals.isScreenshot)return;let{owner:t,$component:e,data:i,image:s}=this,n=t._core?.id||t.getAttribute("data-id");typeof t._bgEffects=="object"&&t._bgEffects.destroy();let a=i.effect!=="fixed";a&&i.effectMobile==="off"&&flexbe_cli.run.is_screen_mobile&&(a=!1),a&&(this.bgEffect=new me(n,e,i.effect,s),t._bgEffects=this.bgEffect)}videoEffectInit(){if(this.data.type!=="video"||this.data.effect!=="parallax"||flexbe_cli.vars.globals.isScreenshot)return;let t=this.$component.find(".video-holder, .image-holder"),e=this.owner._core,i=this.data,s=()=>e.tween.height+(flexbe_cli.resize.viewportHeight-e.tween.height)*i.videoParallaxFactor,n=()=>{t.css("height",`${s()}px`)},a=()=>{if(this.data.effectMobile==="off"&&flexbe_cli.run.is_screen_mobile){t.css("top","");return}let o=1-this.data.videoParallaxFactor,r=Math.floor((flexbe_cli.scroll.latest-e.tween.start)*-o)||0;t.css("top",`${r}px`)};n(),a(),e.$area.off(`fixHeaderHeight.component-bg-${e.id}`).on(`fixHeaderHeight.component-bg-${e.id}`,()=>{a()}),$(window).off(`scroll.component-bg-${e.id}`).on(`scroll.component-bg-${e.id}`,()=>{this.onscreen&&a()}),this.fixHolder=n,this.setParallax=a}playVideo(){if(flexbe_cli.run.is_screen_mobile&&!this.data.mobileVideoEnabled||flexbe_cli.vars.globals.isCriticalCss||flexbe_cli.vars.globals.isScreenshot||flexbe_cli.vars.globals.isBot)return!1;let t=this.data,e={id:t.videoId,type:t.videoType,link:t.videoLink,width:t.videoWidth,height:t.videoHeight};return this.data.type!=="video"||!e.id&&!e.link?!1:(this.played=!0,this.videoInstance||(this.videoInstance=new ge(this,e,()=>{this.videoEffectInit()})),!0)}onDestroy(){this.core.$area.off(`fixHeaderHeight.component-bg-${this.core.id}`),$(window).off(`scroll.component-bg-${this.core.id}`),this.bgEffect&&this.bgEffect.destroy(),this.videoInstance&&this.videoInstance.destroy()}};var ye=new Array(70).fill(1).map((t,e)=>50+50*e),L=class extends b{static is="icon";isCreated;isImgLoaded;isLazyLoading;image;imageLoadingOptions;async onInit(){this.$component.on("setImage",async()=>{this.isVisible&&!this.isImgLoaded&&(this.isCreated||this.create(),await this.loadImage())})}async onBeside({state:t}){t&&(this.isCreated||this.create(),this.isLazyLoading&&!this.isImgLoaded&&await this.loadImage())}async onResize(){this.isCreated&&await this.loadImage()}create(){let t=this.$component.data();this.imageLoadingOptions=flexbe_cli.vars.site.images,this.isLazyLoading=!!t.imgLazy,this.image={url:t.imgUrl||null,id:t.imgId,ext:t.imgExt,proportion:t.imgProportion,width:t.imgWidth,animated:t.imgAnimated,transparent:t.imgTransparent,scale:t.imgScale,type:"background"},this.isCreated=!0}async loadImage(){let t=this.$component.find(".vector-icon use"),e=this.$component.find(".custom-icon");if(t.length&&t.attr("href",this.image.url),e.length){let i=this.image.url;if(this.image.id){let s={width:this.componentWidth,height:this.componentHeight},{width:n}=await F(this.image,s,{...this.imageLoadingOptions,sizes:ye});i=S(this.image,n,this.imageLoadingOptions)}i&&e.css("background-image",`url(${i})`)}this.isImgLoaded=!0}};flexbe_cli.entity.setClientJs("modal","BASIC",{components:[I,L],onOpen(){this.$scroll=this.$area.find(".scroller"),this.$content=this.$area.find(".modal
16-content"),this.$close=this.$scroll.find("> .close--outside"),this.dispatchClasses(),this.$scroll.on("scroll.close-check",$.throttle(()=>{this.dispatchClasses()},60))},onClose(){this.$scroll.off("scroll.close-check")},dispatchClasses(){if(flexbe_cli.resize.responsiveMode!=="mobile"||!this.$close.length)return;let t=this.$scroll[0].scrollTop,e=this.$content[0].offsetTop,i=this.$close[0].offsetHeight;this.$close.toggleClass("stuck",e-t<i)}});flexbe_cli.entity.setClientJs("modal","GRID",{components:[I],onClose(){this.$area.find(".component-form .is_error").removeClass("is_error")}});var K="default",J=class{#t=new Map;#e=null;strict=!1;constructor(t,e=!1){this.#e=t||this,this.strict=e}#i(t,e,i){(Array.isArray(t)?t:t.split(" ")).forEach(s=>{let[n,...a]=s.includes(".")?s.split("."):[s,K],o=a.join(".")||K;this.#t.has(n)||this.#t.set(n,new Map),this.#t.get(n).set(e,{once:i,namespace:o})})}on(t,e){return this.#i(t,e,!1),this}one(t,e){return this.#i(t,e,!0),this}off(t,e){return(Array.isArray(t)?t:t.split(" ")).forEach(i=>{let[s,...n]=i.includes(".")?i.split("."):[i,K],a=n.join(".")||K;(s?[this.#t.get(s)]:[...this.#t.values()]).filter(Boolean).forEach(o=>{Array.from(o.entries()).forEach(([r,c])=>{(!e||e===r)&&c.namespace===a&&o.delete(r)}),o.size===0&&this.#t.delete(s)})}),this}clear(){return this.#t.clear(),this}async trigger(t,...e){let[i,...s]=t.split("."),n=s.join("."),a=this.#t.get(i),o=this.#t.get("*"),r=[];return a&&a.forEach((c,l)=>{(!n||c.namespace.startsWith(n))&&(r.push(Promise.resolve(l.call(this.#e,...e))),c.once&&a.delete(l))}),o&&o.forEach((c,l)=>{r.push(Promise.resolve(l.call(this.#e,t,...e)))}),this.strict&&r.length===0&&console.warn(`No listeners for event: ${t}`),Promise.all(r)}async emit(t,...e){return this.trigger(t,...e)}},_s=1200*1e3,xs=5*1e3;function Mt(t,e={}){let i=Object.keys(e),s=Object.values(e);return new Function(...i,`return \`${t}\`;`)(...s)}var be={selectClass:"",dropdownClass:"",selectedClass:"selected",optionSelector:"option",attrValue:"value",position:"over",padding:10,title:!1},ht=(t,e)=>{if(!t)return;let i=t.value;t.innerHTML="";let s=t.getAttribute("data-placeholder");if(s){let n=document.createElement("option");n.value="",n.textContent=s,t.appendChild(n)}e.forEach(n=>{let a=document.createElement("option");a.value=n.value,a.textContent=n.label,t.appendChild(a)}),e.some(n=>n.value===i)&&(t.value=i),(t.querySelector(`option[value="${i}"]`)||t.querySelector("option")).setAttribute("selected","selected")},O=class{static create(t){return new this(t)}static getInstance(t){return $(t).data("selectComponent")}constructor(t){this.opts=t,this.config={...be,...t.config},this.element=t.element,this.$select=$(this.element),this.isNativeSelect=this.$select.is("select"),this.selectAllDevice=this.$select.data("type")==="select",this.blurTimeOut=!1,this.blurListTimeOut=!1,this.focused=!1,this.active=!1,this.$select.data("selectComponent",this),this.createSelect()}createSelect(){this.$customSelect=$(` 17 <div class="dropdown-container ${this.config.selectClass}"> 18 <div tabindex="0" class="dropdown-select"> 19 <span class="dropdown-select__content selected"></span> 20 21 <span class="arrow"> 22 <svg viewBox="0 0 10 6" xmlns="http://www.w3.org/2000/svg"> 23 <path fill="currentColor" d="M 1.4 6.99441e-15L 0 1.34043L 5 6L 10 1.34043L 8.6 0L 5 3.34998L 1.4 6.99441e-15Z"/> 24 </svg> 25 </span> 26 </div> 27 </div> 28 `),this.$customSelect__content=this.$customSelect.find(".dropdown-select__content"),this.$select.after(this.$customSelect),this.syncSelect(),this.$select.on("syncSelectUI",()=>this.syncSelect()),this.selectAllDevice||flexbe_cli.run.is_screen_desktop?(this.$customSelect.off("click.selected").on("click.selected",".dropdown-select",t=>{clearTimeout(this.blurListTimeOut),this.active?this.collapse():this.activate(t)}),this.$customSelect.off("focus.selectFocus").on("focus.selectFocus",".dropdown-select",()=>
28{this.focused=!0,this.$listWrapper||this.createList()}),this.isNativeSelect&&this.$select.off("change.changeSelect").on("change.changeSelect",t=>{let e=t.currentTarget.value;if(this.$listWrapper){let i=this.$listWrapper.find(".dropdown-select-ul li");i.removeClass(this.config.selectedClass),i.filter((s,n)=>n.getAttribute(this.config.attrValue)===e).addClass(this.config.selectedClass)}this.$customSelect__content.text(e),typeof this.opts.onChange=="function"&&this.opts.onChange(t)}),this.$customSelect.off("blur.selectBlur").on("blur.selectBlur",".dropdown-select",t=>{setTimeout(()=>{this.collapse()},500)}),this.$customSelect.off("keydown.selectKeydown").on("keydown.selectKeydown",".dropdown-select",t=>{if(this.focused&&[13,27,32,38,40].includes(t.keyCode)){t.preventDefault();let e=this.$list.find(`.option-e.${this.config.selectedClass}`).filter(i=>!$(i).attr("disabled"));if(t.keyCode===40)t.preventDefault(),this.select(e.next(),!1),this.scrollToSelected();else if(t.keyCode===38)t.preventDefault(),this.select(e.prev(),!1),this.scrollToSelected();else if(!this.active&&t.keyCode===32)t.preventDefault(),this.activate(t);else if(this.active&&[13,27,32].includes(t.keyCode))return t.preventDefault(),this.collapse(),!1}})):this.$select.off("change.selected").on("change.selected",t=>{let e=t.target.value||$(t.currentTarget.options[0]).text();this.$customSelect__content.text(e)})}syncSelect(){let t=this.$select.children(this.config.optionSelector).filter((i,s)=>(s.selected??$(s).attr("selected"))||$(s).hasClass(this.config.selectedClass)).eq(0),e=t.html()||"\u2014";this.$customSelect__content.attr(this.config.attrValue,t.attr(this.config.attrValue)),this.$customSelect__content.html(e)}createList(){let t=this.$select.children(this.config.optionSelector);this.$listWrapper=$(` 29 <div class="select-container-in-body"> 30 <div class="overlay"></div> 31 <ul class="dropdown-select-ul scroller ${this.config.dropdownClass}" tabindex="0"></ul> 32 </div> 33 `),this.$list=this.$listWrapper.find(".dropdown-select-ul"),t.each((e,i)=>{let s=$(i),n=(i.selected??s.attr("selected"))||s.hasClass(this.config.selectedClass),a=(i.disabled??s.attr("disabled"))||s.hasClass("disabled"),o=(i.locked??s.attr("locked"))||s.hasClass("locked"),r=this.isNativeSelect?s.val():s.attr(this.config.attrValue),c=s.html().trim()||"\u2014",l="";this.config.title&&(l=s.attr("data-title"));let d=$(`<li title='${l}' class="option-e"></li>`);n&&!a&&d.addClass(this.config.selectedClass),a&&d.attr("disabled","disabled"),o&&d.attr("locked","locked"),d.attr(this.config.attrValue,r),d.html(c),this.$list.append(d)})}select(t,e){if(!t[0])return;if(t.attr("disabled")){clearTimeout(this.blurTimeOut),this.$list.off("blur.listBlur").on("blur.listBlur",()=>{this.focused=!1,this.blurListTimeOut=setTimeout(()=>{this.$listWrapper&&this.collapse()},200)});return}let i=t.attr(this.config.attrValue),s=this.$select.children(this.config.optionSelector);t.siblings("li").removeClass(this.config.selectedClass),t.addClass(this.config.selectedClass),s.removeAttr("selected").removeClass(this.config.selectedClass),s.filter(`[${this.config.attrValue}='${i}']`).addClass(this.config.selectedClass).attr("selected","selected"),this.$select.val(i),this.$select.trigger("change"),this.$select.closest(".is_error").removeClass("is_error"),this.syncSelect(),e&&this.collapse()}scrollToSelected(){let t=this.$list[0].offsetHeight;if(this.$list[0].scrollHeight<=t)return!1;let e=this.$list.children(".option-e").find(`.${this.config.selectedClass}`)[0];e&&e.scrollIntoView()}collapse(){clearTimeout(this.blurTimeOut),this.active=!1,this.$listWrapper.removeClass("active rise"),this.$listWrapper.detach(),typeof this.opts.onCollapse=="function"&&this.opts.onCollapse()}activate(t){if(this.active)return!1;
33this.active=!0,this.createList();let e=this.config.padding||0,i=this.$customSelect[0].getBoundingClientRect(),s={left:i.left+window.scrollX,top:i.top+window.scrollY,width:i.width,height:i.height};this.config.position==="under"&&(s.top=s.top+s.height+e),this.$listWrapper.off("click.closeSelect").on("click.closeSelect",".overlay",n=>{this.collapse();let a=document.elementFromPoint(n.clientX,n.clientY);a&&a.focus()}),this.$listWrapper.off("click.selectLi").on("click.selectLi",".dropdown-select-ul li",n=>{let a=$(n.currentTarget);this.select(a,!0),typeof this.opts.onSelect=="function"&&this.opts.onSelect(n)}),this.$listWrapper.off("mousewheel.selectUl").on("mousewheel.selectUl",".dropdown-select-ul",n=>{let a=n.currentTarget.scrollHeight,o=n.currentTarget.clientHeight;return!(n.currentTarget.scrollTop===a-o&&n.deltaY>0||n.currentTarget.scrollTop===0&&n.deltaY<0)}),$("body").append(this.$listWrapper),clearTimeout(this.blurTimeOut),this.$list.css({left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`}),this.$listWrapper.outerWidth(),this.$listWrapper.toggleClass("rise",!!this.$select.closest(".m_modal, .w_widget").length),this.$listWrapper.addClass("active"),this.scrollToSelected(),typeof this.opts.onActivate=="function"&&this.opts.onActivate(t)}reset(){let t=this.$select.children(this.config.optionSelector);this.select(t)}destroy(){clearTimeout(this.blurTimeOut),clearTimeout(this.blurListTimeOut),this.$select.off("syncSelectUI change.changeSelect change.selected"),this.$customSelect?.off().remove(),this.$list?.off(),this.$listWrapper?.off().remove(),this.$select.removeData("selectComponent")}};function Q(t,e){let i=$(t),s=i.attr("data-calendar"),n=i.attr("data-calendar-range")||"any",a=i.attr("data-calendar-work-days")??"0,1,2,3,4,5,6",o=31,r=11,c=new Date().getFullYear()+3;s==="datetime"&&(c=new Date().getMonth()>=8?new Date().getFullYear()+1:new Date().getFullYear());let l=new Date(new Date().getFullYear()-100,0,1),d=new Date(c,r,o);(s==="datetime"||n==="future")&&(l=new Date),s==="date"&&n==="past"&&(d=new Date);let h={type:s,lowerLimit:l,upperLimit:d,dateRange:n,locale:flexbe_cli.locale.translation.calendar,dateFormat:flexbe_cli.locale.dateFormat,showDateSelector:s==="date"&&n!=="future",insertTo:e,workDays:a.length?a.split(","):[],workTime:null};if(s==="datetime"){let p=i.attr("data-calendar-time-interval")||30,u=i.attr("data-calendar-time-start")||"00:00",f=i.attr("data-calendar-time-finish")||"00:00";h.workTime={interval:p,start:{hour:+u.substring(0,2),minute:+u.substring(3,5)},finish:{hour:+f.substring(0,2),minute:+f.substring(3,5)}}}i.calendar(h)}var M={notStarted:0,inProgress:1,done:2,error:3,abort:4},$e=4*1024*1024,we=class Vt extends J{request;id;file;status=M.notStarted;name;uri;progress=0;static async getFileHash(e){let i=e.name,s=await _e(e);return flexbe_cli.helpers.hashCode(i+s.slice(0,$e))}constructor(e){super(),this.file=e,this.name=e.name}async init(){this.id=await Vt.getFileHash(this.file)}upload(){this.trigger("start");let e=flexbe_cli.helpers.upload(this.file,{onProgress:(i,s)=>{s.lengthComputable&&(this.progress=s.loaded/s.total),this.trigger("progress",{jqXhr:i,progress:this.progress})},onSuccess:(i,s)=>{this.uri=i.fileUri,this.status=M.done,this.trigger("success",{jqXHR:i,textStatus:s})},onError:(i,s)=>{this.progress=1,this.status=s==="abort"?M.abort:M.error,this.trigger("error",{jqXHR:i,textStatus:s})},onComplete:(i,s)=>{this.trigger("complete",{jqXHR:i,textStatus:s})}});return this.request=e,this.status=M.inProgress,e}async abort(){!this.request||this.status!==M.inProgress||(this.status=M.abort,this.request.abort())}};async function _e(t){return new Promise(e=>{let i=new FileReader;i.addEventListener("load",s=>{e(s.target.result)}),i.readAsBinaryString(t)})}var A={};function X(t,e,i){let s=(n,a,o)=>{let r=n.find(".form-field-hidden"),c=Array.from(a).map(h=>h.uri).filter(h=>h),l=n.find('input[type="hidden"]'),d=new Set;l.each((h,p)=>{let u=$(p).attr("name");if(u?.includes("[fields]")){let f=u.split("[fields]")[0];d.add(f)}}),d.size===0&&d.add(""),d.forEach(h=>{let p=h?`${h}[fields][${o}][value][]`:`fields[${o}][value][]`;n.find(`input[name$="${p}
33"]`).remove(),c.forEach(u=>{r.append($(`<input class="value" type="hidden" name="${p}" value="${u}">`))})})};t.on(`change${e}`,".file-input--original",async n=>{let a=Object.values(n.currentTarget.files),o=null,r=[];if(!a.length)return;let c=$(n.currentTarget),l=c.closest("[data-field-id]"),d=l.find(".file-list"),h=l.attr("data-field-id"),p=l.attr("data-size"),u=l.attr("data-accept")?l.attr("data-accept").split(", "):[],f=(g,v)=>Mt(i,{id:v,fileName:g});if(p){let g=parseFloat(p);p.replace(/[^a-zA-Z]/g,"").toLowerCase()==="kb"?o=g*1e3:o=g*1e3*1e3}a=a.filter(g=>{let v=`.${g.name.split(".").pop().toLowerCase()}`;return u.length&&!u.includes(v)?(r.push(flexbe_cli.locale.tr("form::error_file_accept",{name:g.name})),!1):o&&g.size>o?(r.push(flexbe_cli.locale.tr("form::error_file_size",{name:g.name,size:p})),!1):!0}),A[h]||(A[h]=[]);let m=a.map(g=>new we(g));await Promise.all(m.map(async g=>g.init())),m=m.filter(g=>!A[h].find(v=>v.id===g.id)),m.forEach(g=>{let v=$(f(g.name,g.id));g.on("start",()=>{l.addClass("loading"),l.removeClass("is_error"),d.append(v)}),g.on("progress",({progress:w})=>{let x=124.853-124.853*w;v.find(".circle-loader__path").css({"stroke-dashoffset":`${x}`})}),g.on("success",()=>{s(l,A[h],h)}),g.on("error",w=>{w?.textStatus!=="abort"&&(v.addClass("is-error"),l.addClass("is_error"),l.find(".error-text").append(flexbe_cli.locale.tr("form::error_file")))}),g.on("complete",()=>{v.removeClass("loading"),A[h].every(w=>w.progress===1)&&l.removeClass("loading")}),g.upload()}),l.find(".error-text").html(""),r.length&&(l.addClass("is_error_info"),l.find(".error-text").html(r.join("<br>")).append("<br>"),r=[]),A[h].push(...m),c.val("")}),t.on(`click${e}`,".clear-files",n=>{let a=$(n.currentTarget).parents(".file-item"),o=$(n.currentTarget).closest("[data-field-id]"),r=o.attr("data-field-id"),c=a.attr("data-id"),l=A[r].find(d=>d.id===c);o.removeClass("is_error is_error_info"),o.find(".error-text").html(""),A[r]=A[r].filter(d=>d.id!==l.id),a.remove(),l.abort(),s(o,A[r],r)})}function Z(){A={}}var xe={phone:{RU:["+7 (***) ***-**-**","8 (***) ***-**-**"],KZ:["+7 (***) ***-**-**","8 (***) ***-**-**"],UA:["+38 (***) ***-****"],BY:["+375 ** *******"],US:["+1 (***) ***-****"]}};function Ce(t){let e=String(t).toLowerCase(),i=flexbe_cli.vars.site.country,s=xe[e]?.[i];return s&&typeof s=="string"&&(s=[s]),Object.assign([],s)}function tt(t){if(typeof window.IMask>"u")return;let e=t.getAttribute("data-type")||t.getAttribute("type"),i={signed:!0,lazy:!0,padFractionalZeros:!0,definitions:["phone","tel"].includes(e)?{"*":/\d/,"#":/\d/}:{"#":/\d/,"@":/[A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u
330EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./}},s=t.required,n=t.getAttribute("data-mask");n&&!/[ #()*@{}]/.test(n)?n=Ce(n):n=[n];try{if(n=n.filter(r=>/[ #()*@_{}]/.test(r)),n=n.map(r=>r.replace(/0/g,"\\0")),n.length===0)throw{message:"Mask is empty"};n.length===1?n=String(n[0]):n=n.map(r=>({...i,mask:r}));let a=new window.IMask(t,{...i,mask:n,dispatch:(r,c)=>{let l=c.compiledMasks;if(l.length===1)return l[0];let d=(c.value+r).replace(/\W/g,"");return l.find(h=>{let p=h.mask.replace(/\W/g,"")[0];return d[0]===p})||l[0]}}),o=()=>{a.masked.isComplete||!s&&!a.value?t.setAttribute("data-mask-complete",!0):t.removeAttribute("data-mask-complete"),t.setAttribute("value",a.value)};t.value&&o(),a.on("accept",o),$(t).on("focus",()=>{requestAnimationFrame(()=>{$(t).trigger("click")})}),t._mask=a}catch(a){a instanceof Error&&console.error("MASK ERROR:",{masks:n,errorMessage:a.message}),t.removeAttribute("data-mask")}}var et=class{constructor(t){this.$legend=t.find(".range-legend"),this.$component=t.find(".range-outer"),this.$input=t.find("input"),this.startEdge=this.$component.data("start"),this.isDouble=!!this.$component.data("double"),this.endEdge=this.$component.data("end"),this.range=this.endEdge-this.startEdge,this.barWidth=this.$component.width(),this.step=this.$component.data("step")||1,this.steps=Math.round(this.range/this.step),this.legendType=this.$legend.data("type"),this.legendText=+this.$legend.data("text")==1,this.animated=!0,this.duration=this.steps<10?300*(1/this.steps):!1,this.fractExponent=Math.max(this.getFract(this.startEdge),this.getFract(this.endEdge),this.getFract(this.step)),this.fractDevider=10**this.fractExponent,this.$value=$(".range-value",this.$component),this.$endRunner=$(".range-runner-right",this.$component),this.$endRunnerTip=$(".runner-tip",this.$endRunner),this.$endRunnerValue=$(".value",this.$endRunner),this.$startRunner=$(".range-runner-left",this.$component),this.$startRunnerValue=$(".value",this.$startRunner),this.$startRunnerTip=$(".runner-tip",this.$startRunner),this.startRunnerWidth=this.$startRunner.width(),this.maxAllowedLeft=20,this.maxAllowedRight=flexbe_cli.resize.viewportWidth-20,this.defaultShift=this.$endRunner.width()/2,this.activeRunner=!1,this.startValue=+this.startEdge;let e=String(this.$input.attr("value")).replace(/[^\d-]/g,"");if(this.isDouble){let i=e.split("-");this.startValue=i[1]?Number(i[0]):+this.startEdge,this.endValue=i[1]?Number(i[1]):+this.endEdge,e=`${this.startValue} \u2014 ${this.endValue}`}else this.endValue=e?Number(e):+this.startEdge,this.startValue=+this.startEdge,e=this.endValue;this.$input.attr("value",e),this.endParams={},this.drawLegend(),this.updateTooltip(this.$startRunnerTip),this.updateTooltip(this.$endRunnerTip),this.setEvents(),this.setRunnersValue()}formatN(t){let e=flexbe_cli.locale.formatNumber(t,this.fractExponent);return`${t<0?"-":""}${e}`}getFract(t){let e=`${t}`.split(".");return e[1]&&e[1].length||0}drawLegend(){if(this.legendText)return!1;let t=this.$legend.find(".from"),e=this.$legend.find(".to");if(t.text(this.formatN(this.startEdge)),e.text(this.formatN(this.endEdge)),this.legendT
33ype!=="complex")return!1;this.$legend.find(".legend-point:not(.from, .to)").off("click").remove(),this.$legend.removeClass("complex").addClass("limits");let i=[`${this.formatN(this.startEdge)}`.length,`${this.formatN(this.endEdge)}`.length,`${this.formatN(this.step)}`.length],s=(i[0]+i[1]+i[2])/3,n=Math.max(this.startEdge,this.endEdge),a=[this.step*5*this.fractDevider/this.fractDevider];for(let u=1;u<=12;u++){let f=10**u*this.step;f<n&&p(a,f,this.fractDevider)}let o,r=Math.ceil(this.$legend.find(i[0]>i[1]?".from":".to").width()/Math.max(i[1],i[0])),c=Math.round(this.barWidth*.83/(r*s)),l=this.range>0?1:-1;for(let u=Math.min(c,10);u>=3;u--){let f=h(this.step,Math.abs(this.steps),u,a);if(f&&Number.isInteger(f/this.step)&&Number.isInteger(this.range/f)){o=f;break}}if(!o||!Number.isInteger(this.range/(o*l))||this.range/(o*l)<3)for(let u=Math.min(Math.round(Math.abs(this.range)/this.step),c,10);u>=2;u-=1){let f=this.roundFraction(Math.abs(this.range)/u);if(f%this.step===0){o=f;break}}let d=this.roundFraction(Math.abs(this.range)/o);if(o&&Number.isInteger(d)){let u=[];for(let m=1;m<d;m+=1){let g=Math.round((this.startEdge+o*m*l)*this.fractDevider)/this.fractDevider;u.push(`<div class="legend-point" data-value="${g}">${this.formatN(g)}</div>`)}d>2&&(this.$legend.attr("data-count",d),this.$legend.removeClass("limits").addClass("complex"));let f=$(u.join(""));this.$legend.find(".from").after(f)}else this.$legend.removeClass("complex").addClass("limits");this.$legend.find(".legend-point:not(.to), .legend-point:not(.from)").each((u,f)=>{$(f).on("click",()=>{if(this.updateBarWidth(),this.isDouble){let m=(this.startValue+this.endValue)/2,g=+$(f).data("value"),v=this.startEdge<this.endEdge?1:-1;g*v>=m*v?this.endValue=g:this.startValue=g}else this.endValue=$(f).data("value");this.setRunnersValue()})});function h(u,f,m,g){return g.includes(f/m*u)?f/m*u:g.includes((f+1)/m*u)?(f+1)/m*u:g.includes((f+2)/m*u)?(f+2)/m*u:g.includes((f+3)/m*u)?(f+3)/m*u:g.includes((f+4)/m*u)?(f+4)/m*u:g.includes((f+5)/m*u)?(f+5)/m*u:g.includes((f+6)/m*u)?(f+6)/m*u:g.includes((f+7)/m*u)?(f+7)/m*u:g.includes((f+8)/m*u)?(f+8)/m*u:g.includes((f+9)/m*u)?(f+9)/m*u:!1}function p(u,f,m){for(let g=1;g<10;g+=1)u.push(Math.round(f*g*m)/m),u.push(Math.round(f*g*m+f/2)/m)}}roundFraction(t){return Math.round(t*1e10)/1e10}setRunnersValue(t=!1){if(!Number.isFinite(this.endValue)||!Number.isFinite(this.range)||this.isDouble&&!Number.isFinite(this.startValue))return!1;let e=this.startEdge<this.endEdge?1:-1;this.activeRunner==="start"?this.startValue*e<=this.startEdge*e?this.startValue=this.startEdge:this.startValue*e>=this.endValue*e&&(this.startValue=this.endValue):this.endValue*e>=this.endEdge*e?this.endValue=this.endEdge:this.endValue*e<=this.startValue*e&&(this.endValue=this.startValue);let i=this.isDouble?this.startValue:this.startEdge,s=this.isDouble?(this.startValue-this.startEdge)/(this.range/100):0,n=(this.endValue-i)/(this.range/100);if(this.endValue=Math.round(this.endValue*this.fractDevider)/this.fractDevider,this.startValue=Math.round(this.startValue*this.fractDevider)/this.fractDevider,requestAnimationFrame(()=>{this.$endRunnerValue.text(this.formatN(this.endValue)),this.$startRunnerValue.text(this.formatN(this.startValue))}),this.activeRunner==="end"?this.updateTooltip(this.$endRunnerTip):this.updateTooltip(this.$startRunnerTip),this.$value.css({width:`${n}%`,marginLeft:`${s}%`}),!t){let a;this.isDouble?a=`${this.startValue} \u2014 ${this.endValue}`:a=this.endValue,this.$input.attr("value")!==String(a)&&(this.$input.attr("value",a),this.$input.trigger("change"))}}updateTooltip(t){let e=t.closest(".range-runner");if(e&&e.length){let i=t.innerWidth(),s=t.closest(".range-runner")[0].getBoundingClientRect().left+this.startRunnerWidth/2,n;i/2>s+this.maxAllowedLeft?n=i/2-(s-this.maxAllowedLeft):i/2+s>this.maxAllowedRight?n=this.maxAllowedRight-s-i/2:n=0,t.css({transform:`translateX(${n}px)`})}}getValueFromLength(t){let e=this.range/(this.barWidth/t);return(Math.round(e/this.step)+this.startEdge/this.step)*this.step}applyEndPosition(t){let e=this.activeRunner==="start"?"startValue":"endValue";return this[e]=this.getValueFromLength(t),this.setRunnersValue(),!0}touchHandler(t){if(!this.endParams.active||t.touches.length!==1)return $("body")[0].removeEventListener("touchmove",this.touchHandler),!1;this.toggleAnimation(!1),t.preventDefault(),t.stopPropagation();let e=t.touches[0].pageX-this.endParams.left-this.endParams.shift;return this.applyEndPosition(e),!0}startWatchingEvents(t=this.defaultShift){this.endParams={active:!0,left:this.$component.offset().left,shift:t},clearTimeout(this.calmRunnersTimeout),this.activeRunner==="end"?this.$endRunner.addClass("active"):this.$startRunner.addClass("active")}toggleAnimation(t){t?Math.abs(this.barWidth/this.steps)<15?this.$component.addClass("animated"):(this.$component.removeClass("active-animation"),this.duration&&this.$component.removeClass(`animation-speed-${12-Math.abs(Math.round(this.steps))}`)):Math.abs(this.barWidth/this.steps)<15?this.$component.removeClass("animated"):(this.$component.addClass("active-animation"),this.duration&&this.$component.addClass(`animation-speed-${12-Math.abs(Math.round(this.steps))}`))}afterRunnerReleased(){this.endParams.active&&(this.activeRunner==="start"?this.$startRunner.focus():this.$endRunner.focus()),this.endParams.active=!1,this.debounceActive(),this.barWidth/this.steps<15?this.$component.addClass("animated"):this.$component.removeClass("active-animation"),this.toggleAnimation(!0)}updateBarWidth(){let t=this.$component.width();
33t!==this.barWidth&&(this.barWidth=t,this.legendType==="complex"&&this.drawLegend())}setEvents(){let t=$(window),e=this;this.$component.on("resize",()=>{this.updateBarWidth()}),this.$component.on("touchstart",s=>{if(s.touches.length!==1)return!1;if(this.isDouble){let a=(this.$endRunner.offset().left+this.$startRunner.offset().left)/2;this.activeRunner=s.touches[0].pageX>=a?"end":"start",this.activeRunner==="start"?(this.$startRunner.addClass("upper-runner"),this.$endRunner.removeClass("upper-runner")):(this.$endRunner.addClass("upper-runner"),this.$startRunner.removeClass("upper-runner"))}else this.activeRunner="end";s.stopPropagation(),this.updateBarWidth();let n=s.touches[0].pageX-this.$value.offset().left;this.startWatchingEvents(),this.applyEndPosition(n-this.defaultShift),t[0].addEventListener("touchmove",this.touchHandler.bind(this),{passive:!1}),t.on("touchend.range",()=>{this.afterRunnerReleased(),t[0].removeEventListener("touchmove",this.touchHandler),t.off("touchend.range")})}),this.$component.on("mousedown",s=>{let n=s.pageX-this.$component.offset().left;if(this.isDouble){let a=(this.$endRunner.offset().left+this.$startRunner.offset().left)/2;this.activeRunner=s.pageX>=a?"end":"start",this.activeRunner==="start"?(this.$startRunner.addClass("upper-runner"),this.$endRunner.removeClass("upper-runner")):(this.$endRunner.addClass("upper-runner"),this.$startRunner.removeClass("upper-runner"))}this.updateBarWidth(),this.startWatchingEvents(),this.applyEndPosition(n-this.defaultShift),this.activeRunner==="start"?this.$startRunner.focus():this.$endRunner.focus(),t.on("mousemove.dragRange",i),t.on("mouseup.range",()=>{this.afterRunnerReleased(),t.off("mousemove.dragRange"),t.off("mouseup.range")})}),this.$endRunner.on("touchstart",s=>{if(s.touches.length!==1)return!1;s.stopPropagation(),this.updateBarWidth(),this.activeRunner="end",this.$startRunner.removeClass("upper-runner"),this.$endRunner.addClass("upper-runner"),s.stopPropagation(),this.startWatchingEvents(s.touches[0].pageX-this.$endRunner.offset().left),this.toggleAnimation(!1),t[0].addEventListener("touchmove",this.touchHandler.bind(this),{passive:!1}),t.on("touchend.range",()=>{this.afterRunnerReleased(),t[0].removeEventListener("touchmove",this.touchHandler),t.off("touchend.range")})}),this.$startRunner.on("touchstart",s=>{if(s.touches.length!==1)return!1;s.stopPropagation(),this.updateBarWidth(),this.activeRunner="start",this.$startRunner.addClass("upper-runner"),this.$endRunner.removeClass("upper-runner"),s.stopPropagation(),this.startWatchingEvents(s.touches[0].pageX-this.$startRunner.offset().left),this.toggleAnimation(!1),t[0].addEventListener("touchmove",this.touchHandler.bind(this),{passive:!1}),t.on("touchend.range",()=>{this.afterRunnerReleased(),t[0].removeEventListener("touchmove",this.touchHandler),t.off("touchend.range")})}),this.$endRunner.on("mousedown",s=>{s.stopPropagation(),this.activeRunner="end",this.$startRunner.removeClass("upper-runner"),this.$endRunner.addClass("upper-runner"),this.updateBarWidth(),this.$endRunner.focus(),this.startWatchingEvents(s.pageX-this.$endRunner.offset().left),this.toggleAnimation(!1),t.on("mousemove.dragRange",i),t.on("mouseup.range",()=>{this.afterRunnerReleased(),t.off("mousemove.dragRange"),t.off("mouseup.range")})}),this.$startRunner.on("mousedown",s=>{s.stopPropagation(),this.activeRunner="start",this.$startRunner.addClass("upper-runner"),this.$endRunner.removeClass("upper-runner"),this.updateBarWidth(),this.$startRunner.focus(),this.startWatchingEvents(s.pageX-this.$startRunner.offset().left),this.toggleAnimation(!1),t.on("mousemove.dragRange",i),t.on("mouseup.range",()=>{this.afterRunnerReleased(),t.off("mousemove.dragRange"),t.off("mouseup.range")})}),this.$legend.find(".legend-point.to, .legend-point.from").each((s,n)=>{$(n).on("click",()=>{if(this.updateBarWidth(),this.isDouble){let a=this.startEdge<this.endEdge?1:-1,o=(this.startValue+this.endValue)/2,r=+$(n).data("value");r*a>=o*a?this.endValue=r:this.startValue=r}else this.endValue=$(n).data("value");this.setRunnersValue()})}),this.$input.on("change",()=>{if(this.isDouble){let s=this.$input.val().split(" \u2014 ");this.startValue=+s[0],this.endValue=+s[1]}else this.endValue=+this.$input.val();this.setRunnersValue(!0)}),this.$startRunner.on("keyup",s=>{s.preventDefault(),this.activeRunner="start",this.handleKeydown(s,this.$startRunner)}),this.$endRunner.on("keyup",s=>{s.preventDefault(),this.activeRunner="end",this.handleKeydown(s,this.$endRunner)}
33),this.$startRunner.on("keydown",s=>{this.activeRunner="start",this.handleKeyup(s,this.$startRunner)}),this.$endRunner.on("keydown",s=>{this.activeRunner="end",this.handleKeyup(s,this.$endRunner)}),this.$startRunner.on("blur",()=>{this.handleBlur()});function i(s){if(!e.endParams.active)return t.off("mousemove.dragRange"),!1;e.toggleAnimation(!1);let n=s.pageX-e.endParams.left-e.endParams.shift;return e.applyEndPosition(n),!0}}handleBlur(){this.movingInterval&&(clearInterval(this.movingInterval),this.movingInterval=!1),this.movingDebounceTimeout&&(clearTimeout(this.movingDebounceTimeout),this.movingDebounceTimeout=!1)}handleKeydown(t,e){if(this.movingInterval&&(clearInterval(this.movingInterval),this.movingInterval=!1),this.movingDebounceTimeout&&(clearTimeout(this.movingDebounceTimeout),this.movingDebounceTimeout=!1),[37,38,39,40].includes(t.keyCode)){let i=t.shiftKey?10:1,s=this.activeRunner==="start"?"startValue":"endValue";t.keyCode===38||t.keyCode===39?this[s]=(this[s]/this.step+i)*this.step:(t.keyCode===37||t.keyCode===40)&&(this[s]=(this[s]/this.step-i)*this.step),e.addClass("active"),this.debounceActive(),this.setRunnersValue()}}handleKeyup(t,e){t.keyCode!==9&&[37,38,39,40].includes(t.keyCode)&&(t.preventDefault(),e.addClass("active"),this.debounceActive(),this.startDebouncedMove(t))}startDebouncedMove(t){this.movingDebounceTimeout&&(clearTimeout(this.movingDebounceTimeout),this.movingDebounceTimeout=!1),this.movingDebounceTimeout=setTimeout(()=>{this.movingInterval=setInterval(()=>{this.debounceActive();let e=t.shiftKey?10:1,i=this.activeRunner==="start"?"startValue":"endValue";t.keyCode===38||t.keyCode===39?this[i]=(Math.round(this[i]/this.step)+e)*this.step:(t.keyCode===37||t.keyCode===40)&&(this[i]=(Math.round(this[i]/this.step)-e)*this.step),this.setRunnersValue()},50)},300)}debounceActive(){this.calmRunnersTimeout&&clearTimeout(this.calmRunnersTimeout),this.calmRunnersTimeout=setTimeout(()=>{this.$endRunner.removeClass("active"),this.$startRunner.removeClass("active")},500)}};function ut(t){let e=[],i="",s=!1;for(let n=0;n<t.length;n++){let a=t[n];a==="["?(i&&(e.push(i),i=""),s=!0):a==="]"?((i||s)&&(e.push(i||"[]"),i=""),s=!1):i+=a}return i&&e.push(i),e}function q(t,e,i){let s=ut(e);if(s.length===1){Rt(t,s[0],i);return}let n=t,a=s[s.length-1];for(let o=0;o<s.length-1;o++){let r=s[o];n[r]||(n[r]=o===s.length-2&&a==="[]"?[]:{}),n=n[r]}a==="[]"?n.push(i):Rt(n,a,i)}function Rt(t,e,i){e in t?Array.isArray(t[e])?t[e].push(i):t[e]=[t[e],i]:t[e]=i}function Bt(t,e,i){if(e instanceof File&&e.size===0)return!1;if(e instanceof File)return console.warn(`File object found in form data: ${t}. Files should be uploaded separately.`),!1;let s=t.match(/^(.*?)fields\[(\w+)\]\[(\w+)\](\[\])?$/);if(s){let n=s[1],a=s[2],o=s[3],r=s[4]==="[]",c=n?`${n.replace(/\[$/,"")}.fields`:"fields";i[c]||(i[c]=new Map);let l=i[c];l.has(a)||l.set(a,{id:a});let d=l.get(a);return r?(Array.isArray(d[o])||(d[o]=[]),d[o].push(e)):d[o]=e,!0}return!1}var zt=class{},Ae=class extends zt{_token=null;_widgetId=null;_loaded=!1;get rendered(){return!!this._widgetId}get loaded(){return this._loaded&&!!window.grecaptcha}get token(){return this._token}constructor(){super(),window.grecaptcha&&(this._loaded=!0)}async load({language:t}){if(this._loaded||window.grecaptcha){this._loaded=!0;return}return new Promise(e=>{let i=`https://www.google.com/recaptcha/api.js?render=explicit&hl=${t}`;flexbe_cli.require(i,()=>{let s=setInterval(()=>{window.grecaptcha&&(this._loaded=!0,clearInterval(s),e())},50);setTimeout(()=>{clearInterval(s),this._loaded||e()},5e3)})})}render(t,e){let i={size:e.visibility==="invisible"?"invisible":"normal",sitekey:e.captcha.visible?e.captcha.env.RECAPTCHA_VISIBLE_SITE_KEY||"":e.captcha.env.RECAPTCHA_INVISIBLE_SITE_KEY||"",callback:s=>{this._token!==s&&(this._token=s,e.callbacks.onSuccess(s))},"expired-callback":()=>{this._token=null,e.callbacks.onExpired()},"error-callback":()=>{this._token=null,e.callbacks.onError()}};window.grecaptcha.ready(()=>{try{this._widgetId=window.grecaptcha.render(t,i)}catch(s){console.error("Google reCAPTCHA render error:",s)}})}reset(){if(this._widgetId!==null&&window.grecaptcha)try{window.grecaptcha.reset(this._widgetId)}catch(t){console.error("Google reCAPTCHA reset error:",t)}this._token=null}executeInvisible(){window.grecaptcha&&(window.grecaptcha.ready(()=>{window.grecaptcha.execute(this._widgetId)}),setTimeout(()=>{$('iframe[title="recaptcha challenge"]').parent().parent().css("z-index",2e3)},100))}},Se=class extends zt{_token=null;_widgetId=null;_loaded=!1;_unsubscribeCallbacks=[];get rendered(){return!!this._widgetId}get loaded(){return this._loaded&&!!window.smartCaptcha}get token(){return this._token}constructor(){super(),window.smartCaptcha&&(this._loaded=!0)}async load(){if(this._loaded||window.smartCaptcha){this._loaded=!0;return}return new Promise(t=>{let e="https://captcha-api.yandex.ru/captcha.js?render=onload&onload=yandexCaptchaOnload";flexbe_cli.events.on("yandexCaptchaOnload",()=>{this._loaded=!0,t()}),window.yandexCaptchaOnload||(window.yandexCaptchaOnload=()=>{flexbe_cli.events.trigger("yandexCaptchaOnload")}),flexbe_cli.require(e)})}render(t,e){if(!this.loaded)return;this._unsubscribeCallbacks.forEach(s=>s()),this._unsubscribeCallbacks=[];let i={sitekey:e.captcha.client_key,hl:e.language,invisible:e.visibility==="invisible",hideShield:!0,callback:s=>{this._token!==s&&(this._token=s,e.callbacks.onSuccess(s))}};try{this._widgetId=window.smartCaptcha.render(t,i),this._unsubscribeCallbacks.push(window.smartCaptcha.subscribe(this._widgetId,"token-expired",()=>e.callbacks.onExpired())),this._unsubscribeCallbacks.push(window.smartCaptcha.subscribe(this._widgetId,"network-error",()=>e.callbacks.onError())),this._unsubscribeCallbacks.push(window.smartCaptcha.subscribe(this._widgetId,"javascript-error",()=>e.callbacks.onError()))}catch(s){console.error("Yandex SmartCaptcha render error:",s)}}reset(){if(this._widgetId!=null&&window.smartCaptcha)try{window.smartCaptcha.reset(this._widgetId)}catch(t){console.error("Yandex SmartCaptcha reset error:",t)}this._token=null,this._unsubscribeCallbacks.forEach(t=>t()),this._unsubscribeCallbacks=[]}executeInvisible(){if(window.smartCaptcha)try{window.smartCaptcha.execute(this._widgetId)}catch(t){console.error("Yandex SmartCaptcha execute error:",t)}}},Lt="captcha-modal",Ie=class{provider;options;_modal=null;isVisible=!1;isInvisible=!1;isOptional=!1;inModal=!1;constructor(t){this.options={...this.getDefaultsOptions(),...t},this.isVisible=!!this.options.visible,this.isInvisible=!this.options.visible,this.isOptional=this.options.isOptional,this.inModal=this.options.inModal,this.provider=this.createProvider(this.options.provider),this.init().catch(console.error)}getDefaultsOptions(){let t=flexbe_cli.vars.site.captcha||{},e=flexbe_cli.is_admin||!1,i=t.provider||"google",s=!!t.enabled,n=!!t.visible,a=flexbe_cli.vars.site.language||"en",o=!!t.isOptional;return!n&&e&&(s=!1),{isOptional:o,provider:i,enabled:s,visible:n,language:a}}createProvider(t){if(t==="yandex")return new Se;if(t==="google")return new Ae;throw new Error("Unknown captcha provider")}get enabled(){return this.options.enabled}get loaded(){return this.provider.loaded}get token(){return this.provider.token}
33async init(){this.enabled&&await this.provider.load({language:this.options.language})}async renderCaptcha({target:t="form",visibility:e}){let i=null;if(e=e||(this.options.visible?"visible":"invisible"),t==="modal"?(e="visible",i=(await this.createModal()).$area[0].querySelector(".captcha"),this.provider.rendered&&this.reset()):t==="form"&&(i=this.options.form.querySelector(".captcha")),!i){console.warn("Captcha target element not found");return}this.provider.render(i,{language:this.options.language,captcha:flexbe_cli.vars.site.captcha,visibility:e,callbacks:{onExpired:()=>{this.options.onExpired&&this.options.onExpired()},onError:()=>{this.options.onError&&this.options.onError()},onSuccess:s=>{this.options.onSuccess&&this.options.onSuccess(s),this.closeModal()}}})}async createModal(){this.closeModal(),$(".m_captcha-modal").remove();let t=$(` 34 <div class="m_modal m_captcha-modal" data-is="modal" data-id="captcha-modal" data-m-id="CAPTCHA"> 35 <div class="modal-data" data-overlay="true"> 36 <div class="component-bg"><div class="layer overlay"></div></div> 37 38 <div class="modal-content" data-contrast="dark" data-v="1" data-as="1"> 39 <div class="close close-times"></div> 40 41 <div class="captcha-title"> 42 ${flexbe_cli.locale.tr("quiz::captcha_label")} 43 </div> 44 45 <div id="captcha-${this.options.id}" class="captcha captcha-visible"></div> 46 </div> 47 </div> 48 </div> 49 `);return flexbe_cli.modal.$list.append(t),this._modal=(await flexbe_cli.entity.initArea(t))[0],await flexbe_cli.events.trigger("ui_modal_open",{id:Lt,options:{hash:!1,rise:!0,onClose:()=>{this.token||this.options.onError&&this.options.onError(),this.provider.rendered&&this.reset(),this._modal=null,setTimeout(()=>{t.remove()},300)}}}),this._modal}closeModal(){this._modal&&flexbe_cli.events.trigger("ui_modal_close",{id:Lt})}runInvisibleChallenge(){!this.enabled||!this.loaded||this.provider.executeInvisible()}getToken(){return this.provider.token}reset(){this.provider.reset()}},it=Ie;var st=(t,e=0)=>(...i)=>new Promise(s=>{setTimeout(()=>s(t(...i)),e)}),Ee=(t,e=0)=>flexbe_cli.is_admin?t:st(t,e);var Nt=(t,e=0,...i)=>Ee(t,e)(...i),Rs=Symbol("ref");function R(t,e,i,s={}){let n=$(t),a=e?`[data-component="${e}"]`:"[data-component]";n.is(a)&&n.trigger(i,s),$(t).find(a).each((o,r)=>{$(r).trigger(i,s)})}function H(t=[]){t.forEach(st(e=>{R(e,"image","setImage")}))}function Fe(t){let e={},i={};for(let[s,n]of t.entries())Bt(s,n,i)||q(e,s,n);for(let[s,n]of Object.entries(i))q(e,s,Array.from(n.values()));return e}function ke(t,e={}){let i={fields:[],...e};t.forEach((s,n)=>{Object.prototype.hasOwnProperty.call(i,n)?Array.isArray(i[n])?i[n].push(s):i[n]=[i[n],s]:i[n]=s});try{for(let s in i)if(s.startsWith("fields[")){let n=s.match(/^fields\[(\w+)\]\[(\w+)\]$/);if(n){let a=n[1],o=n[2],r=i.fields.find(c=>c.id===a);r||(r={id:a},i.fields.push(r)),r[o]=i[s],delete i[s]}else{let a=s.match(/^fields\[(\w+)\]\[(\w+)\]\[\]$/);if(a){let o=a[1],r=a[2],c=i.fields.find(l=>l.id===o);c||(c={id:o},i.fields.push(c)),Array.isArray(c[r])||(c[r]=[]),c[r].push(i[s]),delete i[s]}}}typeof i.products=="string"&&(i.products=JSON.parse(i.products)),(i["pay[price]"]||i["pay[desc]"])&&(i.pay={price:Number(i["pay[price]"]),desc:String(i["pay[desc]"])})}catch(s){console.error(s)}return["is_ajax","captcha-token","roistatVisit","jsform","goal_html","goal","forceUpdateProduct","action","utmData","abTest","pay[price]","pay[desc]","results","fileOriginal","g-recaptcha-response"].forEach(s=>{delete i[s]}),Object.entries(i).forEach(([s,n])=>{n==null&&delete i[s]}),i}var Te=".form-field-text__input, .dropdown-select",Pe=".form-field-date__input",pt="next",V="result",De=class extends b{static is="quiz";constructor(...t){super(...t),this.id=this.core.id,this.eventId=`.quiz${this.id}`,this.products=null,this.pay=null,this.captchaSubmitToken=null,this.createQuiz()}onInit(){this.$masked=this.$form.find("[data-mask]"),this.$file=this.$component.find(".form-field-file"),this.require=[],this.$masked.length&&(this.needInitMasks=!0,this.require.push("/_s/lib/imask/imask.min.js")),this.$file.length&&(this.$itemTemplateFile=this.$itemTemplateFile||this.$file.find("template").clone()),this.$calendars=this.$form.find("[data-calendar]"),this.$calendars.length&&(this.needInitCalendar=!0,this.require.push("/_s/lib/scroll-lock/scroll-lock.min.js"),this.require.push("/_s/lib/calendar/dist/js/calendar.js?v2.3.13","/_s/lib/calendar/dist/css/calendar.min.css?v2.3.5"))}onLoad(){(this.core.wasScreen||this.core.wasBeside)&&(this.needInitMasks&&this.initFieldMask(),this.needInitCalendar&&this.initFieldDate()),this.isLoaded=!0}onScreen({state:t}){if(!t)return!1;this.initQuiz()}onBeside({state:t}){if(!t)return!1;this.initQuiz()}onOpen(t={}){this.initQuiz(),this.started||this.startQuiz(),t&&t.data&&this.setData(t.data)}onResize(){this.$component.find(".range-outer").trigger("resize")}createQuiz(){this.timeouts=[],this.history=[],this.swiper=[],this.$area=this.core.$area,this.$root=this.core.$root,this.$form=this.$component.is("form")?this.$component:this.$component.find("form"),this.$steps=this.$component.find(".quiz-steps"),this.$actions=this.$component.find(".quiz-actions"),this.$progress=this.$component.find(".quiz-progress"),this.$scroller=this.$root.find(".scroller"),this.$stepsWrapper=this.$steps.find(".steps-wrapper"),this.$outerWrapper=this.$area.find('[data-quiz-part="wrapper"]'),this.$welcomeScreen=this.$outerWrapper.find('[data-quiz-part="welcome"]'),this.$progress.length||(this.$progress=this.$area.find('[data-quiz-part="progress"]')),this.rootMod
49al=this.core.is==="modal"?this.core:!1,this.hasWelcome=!!this.rootModal||this.$welcomeScreen.length>0,this.autoNextEnabled=+this.$steps.attr("data-autonext")||0,this.currentId=null,this.currentIndex=-1,this.total=parseInt(this.$component.attr("data-total-steps"),10)}initQuiz(){if(this.inited)return;this.inited=!0,this.$form.attr("action",`/mod/project/${flexbe_cli.group_id}/lead/send/`),this.resetForm(),this.bindEvents(),this.initFields(),this.initControls(),this.initCaptcha();let t=flexbe_cli.is_admin&&this.$area.data("initialQuizStepId"),e=flexbe_cli.is_admin&&this.$area.data("initialQuizStepIndex");t?this.toStep({id:t,index:e,animated:!1}):this.hasWelcome||this.startQuiz({animated:!1})}onHideShowUI(){this.resetForm()}bindEvents(){flexbe_cli.events.off(this.eventId),this.$form.off(this.eventId),this.$scroller.off(this.eventId),flexbe_cli.events.on(`quiz_command${this.eventId}`,t=>{this.id===t.id&&(t.command==="welcome"?this.toWelcome():t.command==="start"?this.startQuiz():t.command==="step"&&this.toStep({id:t.stepId,index:t.stepIndex,force:t.force,animated:t.animated,scrl:t.scroll}))}),this.$form.on(`change${this.eventId}`,".policy-data-warning__input",t=>{let e=t.currentTarget.getAttribute("data-policy-id");this.$form.find(".policy-data-warning__input").filter((i,s)=>s.getAttribute("data-policy-id")===e).prop("checked",t.currentTarget.checked)}),this.$form.on(`input${this.eventId} change${this.eventId}`,"input, textarea",t=>{let e=t.currentTarget,i=e.value,s=$(e);s.attr("value",i),s.closest(".is_error").removeClass("is_error")}),this.$form.on(`keydown${this.eventId}`,"input, textarea",t=>{let e=t.currentTarget,i=e.getAttribute("data-check"),s=t.key||"",n=t.ctrlKey||t.metaKey;if(i==="phone"&&!e._mask&&!n&&s.length===1&&/[^\d ()+-]/.test(s)||i==="email"&&/[\s,]/.test(s))return!1}),this.needInitCalendar&&this.core.is==="modal"&&setTimeout(()=>{this.$calendars.toArray().forEach(t=>{let e=$(t).data("calendar");this.$scroller.on(`scroll${this.eventId}`,()=>{e.main.toPosition()})})},150),this.$form.on(`submit${this.eventId}`,t=>(t.preventDefault(),t.stopPropagation(),this.onSubmit()))}initControls(){$("body").off(`keydown${this.eventId}`).on(`keydown${this.eventId}`,t=>{let e=t.key==="Tab",i=t.key==="Enter";if(!i&&!e)return;let s=this.inFocus,n=t.metaKey||t.ctrlKey,a=t.shiftKey;if(!(!s||t.target.tagName==="TEXTAREA"&&i&&!n)){if(a&&e)this.toPrevStep();else if(!a&&!n){let o=this.$currentStep.find(":focus").closest(".field").next(".field");this.focusField(o)||this.toNextStep()}return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1}}),this.$component.off("click.control").on("click.control","[data-quiz-action]",t=>{let e=t.currentTarget.getAttribute("data-quiz-action");e==="welcome"?this.toWelcome():e==="prev"?this.toPrevStep():e==="next"&&this.toNextStep(),t.preventDefault()})}setProgress(){let t=this.$progress.find(".progress-loader-bar .current"),e=this.total,i=t.data("unit"),s=this.realIndex+1;flexbe_cli.is_admin&&this.realIndex===-1&&this.currentId!=="welcome"&&(s=(+this.$currentStep.prevAll('[data-linked="linked"]').first().attr("data-real-index")+1||0)+1);let n=parseInt(s*100/e,10)||0;if(s=Math.max(0,Math.min(e,s)),n=Math.max(0,Math.min(100,n)),t.length&&i){let a=`${n}%`;i==="step"?a=`${s} / ${e}`:i==="none"&&(a=""),t.attr("data-value",a)}this.$progress.attr("data-current-progress",n),this.$progress.attr("data-current",s),this.$progress.attr("data-total",e),this.$progress.find(".progress-text .current").text(s),this.$progress.find(".progress-text .total").text(e),this.$progress.find(".progress-percent .current").text(n),this.$progress.find(".progress-loader-bar .current").css("width",`${n}%`),this.$progress.find(".progress-loader-circle .current").attr("stroke-dashoffset",`${Math.abs(100-n)}`)}setActionButtons(){let t=this.hasWelcome||this.history.length>1||!!(flexbe_cli.is_admin&&this.realIndex!==0&&this.currentIndex>0);flexbe_cli.is_admin&&this.rootModal&&(!this.realIndex||!this.currentIndex)&&(t=!1),this.$actions.toggleClass("show-prev",t)}toWelcome({scrl:t=!0}={}){if(!this.hasWelcome)return this.startQuiz({scrl:t}),!0;if(this.started=!1,this.currentIndex=-1,this.realIndex=-1,this.currentId="welcome",this.$area.data("initialQuizStepId",this.currentId),this.$area.data("initialQuizStepIndex",this.currentIndex),this.$outerWrapper.attr("data-active-step",this.currentId),this.$outerWrapper.attr("data-active-index",this.currentIndex),this.$outerWrapper.toggleClass("quiz-state-welcome",!0),this.$outerWrapper.toggleClass("quiz-state-started",!1),this.rootMod
49al)flexbe_cli.run.is_preview&&flexbe_cli.events.trigger("ui_modal_close",{id:this.rootModal.id});else if(this.$outerWrapper.length){let e=this.$welcomeScreen.outerHeight()||0;this.$outerWrapper.css("minHeight",e)}return this.setProgress(),this.setActionButtons(),t&&this.core.is==="block"&&flexbe_cli.run.is_preview&&flexbe_cli.scroll.toElement(this.$area),flexbe_cli.events.trigger("quiz_event",{event:"welcome",sender:"core",quiz:this}),!0}startQuiz({animated:t,scrl:e}={}){this.sessionId=parseInt(Date.now()/1e3,10),this.$area.closest(".m_modal").length||flexbe_cli.stat.goals.reachGoal(flexbe_cli.stat.goals.getGoal("quiz"));let i=this.$stepsWrapper.find('.step[data-type="root"][data-linked="linked"]').first();i.length&&this.toStep({$step:i,force:!0,animated:t,scrl:e})}autoNextStep(){!this.autoNextEnabled||this.$currentStep.find(".quiz-fields").data("count")>1||setTimeout(()=>{this.toNextStep()},150)}toPrevStep(){let t=this.history[this.history.length-2];if(!t){let e=this.$currentStep.prevAll('.step[data-type="root"][data-linked="linked"]').first();return e.length?this.toStep({$step:e}):this.hasWelcome&&this.toWelcome(),!1}return this.toStep(t),!0}gatherStepAnswers(t=this.$currentStep){let e=t.find("[data-field-id]").toArray().map(i=>{let s=$(i),n=s.attr("data-field-id"),a=s.find("input, textarea").not('[type="hidden"]'),o=s.find("[data-goto]"),r=s.attr("data-type"),c=s.find(`[name="vars[${n}]"]`).val(),l=a.attr("type"),d=o,h=a.val();["checkbox","radio","image"].includes(r)?d=o.filter(":checked"):r==="select"?(d=d.filter((m,g)=>g.selected),l="select"):r==="file"&&(h=s.find("input.value").map((m,g)=>g.value).toArray());let p=d.toArray(),u=p.map(m=>m.getAttribute("data-goto")).filter(m=>m),f=p.map(m=>({id:m.getAttribute("data-id"),value:m.value})).filter(m=>m.id);return{id:n,title:c,type:r,inputType:l,value:h,variants:f,goto:u}});return{fields:e,answers:e.map(i=>{let s={id:i.id,title:i.title,type:i.type};return["radio","checkbox","select","image"].includes(i.inputType)?s.variants=i.variants:s.value=i.value,s})}}toNextStep(){if(!this.validateStep(this.$currentStep))return!1;let t=this.$currentStep,{fields:e,answers:i}=this.gatherStepAnswers(t),s=e.flatMap(o=>o.goto)[0]||t.attr("data-goto")||pt,n=this.getNextStep(s,t),a=this.history.find(o=>o.id===this.currentId);a&&(a.fields=e,a.answers=i,a.toId=n,a.goal=this.$currentStep.attr("data-goal"),a.htmlGoal=this.$currentStep.attr("data-html-goal")),this.toStep({id:n})}getNextStep(t,e=this.$currentStep){if(t===V){let s=this.history.map(a=>a.$step[0]),n=this.$stepsWrapper.find('[data-type="root"][data-linked="linked"][data-required]').filter((a,o)=>!s.includes(o));return n.length?n.eq(0).attr("data-id"):V}let i=t;return(t===pt||!this.getStepNodeById(i).length)&&(i=e.nextAll('.step[data-type="root"][data-linked="linked"]').first().attr("data-id")),t===pt&&!i?this.getNextStep(V,e):i}getStepNodeById(t){return this.$stepsWrapper.find(`.step[data-id="${t}"]`)}getStepNodeByIndex(t){return this.$stepsWrapper.find(`.step[data-index="${t}"]`)}toStep({id:t,index:e,$step:i,force:s,scrl:n=!0,animated:a=!0}){if(this.inStepAnimation)return!1;let o=this.history.find(m=>m.id===this.currentId);if(t===V){this.toResult();return}if((!i||!i.length)&&t!=null&&(i=this.getStepNodeById(t)),(!i||!i.length)&&e!=null&&(i=this.getStepNodeByIndex(e)),!i||!i.length)return!1;if(t=t??i.attr("data-id"),e=parseInt(e??i.attr("data-index"),10),t===this.currentId)return this.enableStep(i),!1;let r=flexbe_cli.is_admin?parseInt(i.attr("data-real-index"),10):e,c=e>this.currentIndex;a||this.$area.addClass("noanimate"),i.find(".is_error").removeClass("is_error");let l=i.outerHeight(),d={$step:i,id:t,title:i.find(".step-title").text().trim(),index:e,realIndex:r,fields:[],answers:[]},h=[];s?(h=this.history,this.history=[]):(h=this.history.filter(m=>m.index>=d.index),this.history=this.history.filter(m=>!h.includes(m))),h.forEach(m=>{this.disableStep(m.$step)}),this.enableStep(i),this.started=!0,this.history.push(d),this.$component.addClass("quiz-started"),a&&this.$component.addClass("step-change-animation");let p=flexbe_cli.helpers.scrollParent(this.$component[0])||document.scrollingElement,u=p.scrollTop||0,f=this.$stepsWrapper.outerHeight();if(this.$area.data("initialQuizStepId",t),this.$area.data("initialQuizStepIndex",e),this.$outerWrapper.attr("data-active-step",t),this.$outerWrapper.attr("data-active-index",e),this.$outerWrapper.toggleClass("quiz-state-welcome",!1),this.$outerWrapper.toggleClass("quiz-state-started",!0),i.toggleClass("higher",l>f),a&&this.$stepsWrapper.css("height",`${f}px`),flexbe_cli.theme_id===4&&this.$outerWrapper.css("minHeight",`${f}px`),i.prevAll().removeClass("active next").addClass("prev"),i.nextAll().removeClass("active prev").addClass("next"),i.removeClass("next prev").addClass("active"),this.currentId=t,this.currentIndex=e,this.realIndex=r,this.$currentStep=i,this.core.updateTween(),this.setProgress(),this.setActionButtons(),this.initImages(),flexbe_cli.theme_id===2){let m=this.$area.find(".b_head");m.length&&flexbe_cli.header.fixHeaderHeight(this.$area,m)}return this.timeouts=this.timeouts.filter(m=>clearTimeout(m)),this.timeouts.push(setTimeout(()=>{a||this.$area.removeClass("noanimate")},20)),a?(this.inStepAnimation=!0,this.timeouts.push(setTimeout(()=>{this.$stepsWrapper.css("height",""),this.$component.removeClass("step-change-animation"),i.find(".range-outer").trigger("resize"),this.inStepAnimation=!1},250)),n&&(this.timeouts.push(setTimeout(()=>{let m=this.$area.get(0).getBoundingClientRect();this.$stepsWrapper.css("height",`${l}px`);let g=p.scrollTop,v=this.$area.get(0).getBoundingClientRect().bottom-m.bottom-(u-g);v&&p.scrollTo(0,g+v)},150)),flexbe_cli.run.is_preview&&this.timeouts.push(setTimeout(()=>{let m=this.$component;
49this.$area.outerHeight()<=flexbe_cli.resize.viewportHeight&&(m=this.$area),flexbe_cli.scroll.toElement(m,{centered:!0,force:!1,complete:()=>{flexbe_cli.run.is_mobile||this.focusField(i)}})},450)))):i.find(".range-outer").trigger("resize"),flexbe_cli.events.trigger("quiz_event",{event:"step",sender:"core",quiz:this,payload:{fromId:o?.id,fromTitle:o?.title,fromAnswers:o?.answers,toNext:c,toId:t,sessionId:this.sessionId},answerGoals:{goal:o?.goal,htmlGoal:o?.htmlGoal}}),!0}toResult({force:t}={}){let e=t||this.validateStep();return!t&&(this.busy||!e)?!1:(this.$form.get(0).dispatchEvent(new Event("submit",{cancelable:!0})),!0)}validateStep(t=this.$currentStep){let e=!0;return!t||!t.length?!0:(t.find(".policy-data-warning--checkbox").each((i,s)=>{let n=$(s),a=n.find(".policy-data-warning__input")[0];a&&!a.checked&&(e=!1,n.addClass("is_error animate"))}),t.find(".field[data-type]").each((i,s)=>{let n=$(s),a=n.attr("data-type");n.removeClass("is_error");let o;if(a==="captcha"){if(!this.captcha)return;o=this.captcha.getToken()?!1:flexbe_cli.locale.tr("form::captcha_not_checked")}else o=this.checkField(n);o&&(n.outerWidth(),n.addClass("is_error animate"),setTimeout(()=>{n.removeClass("animate")},500),a==="file"?n.find(".error-text").text(o):n.find(".error").text(o),e&&this.focusField(n,500),e=!1)}),e)}validateHistorySteps(){let t=this.history.every(s=>this.validateStep(s.$step));if(!this.history.length||!t)return!1;let e=this.history.at(-1),i=e.fields.flatMap(s=>s.goto)[0]||e.$step.attr("data-goto")||V;return this.getNextStep(i,e.$step)===V}getResult(){let t=this.$form.find("input[name=results]").data("value")||[],e=t.filter(i=>i.id!=="default").find(i=>this.checkResultCondition(i));return e||(e=t.find(i=>i.id==="default")||t[0]),typeof e.action!="object"&&(e.action={pay:e.pay,name:e.action,modal_id:e.modal_id,action_redirect:e.action_redirect}),e}checkResultCondition(t){let e=t.conditions||{},i=e.union,s=e.list||[],n=this.history.reduce((r,c)=>r.concat(c.fields),[]),a=s.map(r=>({condition:r,field:n.find(c=>String(c.id)===String(r.field))}));if(!a.length)return!1;return a=a[i==="and"?"every":"some"](({condition:r,field:c})=>{let l=!0;if(!c)return!1;if(r.type==="vars"){let d=c.variants||[],h=(r.variants||[]).map(p=>`${p}`);if(!d.length)return!!r.emptyVariant;if(r.unionExtra||(l=d.every(p=>h.includes(`${p.id}`))),l){let p=r.union;(c.inputType==="radio"||c.inputType==="select")&&(p="or"),l=h[p==="and"?"every":"some"](u=>d.find(f=>f.id===u))}}else if(r.type==="range"){let d=`${c.value}`.replace(/\s+/g,"").split(/\s[â-]\s/).map(g=>+g).filter(g=>typeof g=="number"&&!Number.isNaN(g)),h=Math.min.apply(null,d),p=Math.max.apply(null,d),u=h!==p,f=+r.rangeLimitFrom,m=+r.rangeLimitTo;if(r.operator==="equal")return u?h<=f&&f<=p:f===h;o(f)&&o(m)&&(f=Math.min(r.rangeLimitFrom,r.rangeLimitTo),m=Math.max(r.rangeLimitTo,r.rangeLimitFrom)),l&&o(f)&&(l=f<=h),l&&o(m)&&(l=p<=m)}else if(r.type==="text"){let d=r.fill,h=(c.value||"").trim().replace(/ +/g," ").replace(/\+/g,"\u2214"),p=r.answers.map(u=>`${u}`.toLowerCase().replace(/\+/g,"\u2214")).filter(u=>u);if(d==="fill")return!!h;if(d==="empty")return!h;if(d==="include")return p.some(u=>new RegExp(`^${u}|\\s${u}`,"i").test(h));if(d==="exclude")return p.every(u=>!new RegExp(`^${u}|\\s${u}`,"i").test(h))}else if(r.type==="file"){let d=r.fill,h=c.value;if(d==="fill")return!!h.length;if(d==="empty")return!h.length}return l}),a;function o(r){return!Number.isNaN(+r)&&r!=null&&r!==""}}checkField(t){let e=t.find("input, textarea, select").not('[type="hidden"]'),i=e[0],s=t[0];if(!i)return;let n=s.getAttribute("data-type"),a=i.required||t.is('[data-required="true"]'),o=i.getAttribute("data-check")||!1,r=i._mask&&i.getAttribute("data-mask")||!1,c;["checkbox","radio","image"].includes(n)?c=!!e.closest(":checked").length:n==="file"?c=t.find("input.value"):c=i.value.trim();let l=a&&!c?"form::required":!1;if(r)!a&&!c||i.getAttribute("data-mask-complete")||(n==="phone"&&c?l="form::phone":n==="text"&&c?l="form::text":l="form::required");else if(o){if(c.length&&n==="email")/^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\wÐÐ-ÑÑ-]+\.)+[A-Za-zÐÐ-ÑÑ]{2,}))$/.test(c)||(l="form::email");else if(c.length&&n==="phone")/[^\d\s()+-]/.test(c)?l="form::digits":c.replace(/\D/g,"").length<5&&(l="form::phone_minlength");else if(n==="file")a&&!c.length?l="form::required":t.hasClass("loading")?l="form::loading":l=!1;else if(n==="date"||n==="datetime"){let d=$(i).data("calendar"),h=d&&d.input.checkError();h&&(l=h)}}return l=l&&flexbe_cli.locale.tr(l)||!1,l}disableStep(t){t.find("input, textarea, select").prop("disabled",!0)}enableStep(t){t.find("input, textarea, select").prop("disabled",!1)}focusField(t,e=200){if(!t||!t.length||flexbe_cli.run.is_ios)return!1;let i=t.find(Te).not(Pe).first();return i.length?(e?setTimeout(()=>i.focus(),e):i.focus(),!0):!1}initImages(){setTimeout(()=>{let t=$(this.component).find(".step.active");$(t).find(".component-image").length&&R(t,"image","setImage")},100)}initFields(){this.initFieldImage(),this.initFieldCheckbox(),this.initFieldRadio(),this.initFieldSelect(),this.initFieldTextarea(),this.initField
49File(),this.initFieldRange(),this.isLoaded&&(this.needInitMasks&&this.initFieldMask(),this.needInitCalendar&&this.initFieldDate())}initFieldImage(){this.$component.off("click.fieldImages").on("click.fieldImages",".form-field-image-item",t=>{let e=t.currentTarget.querySelector("input"),i=!e.checked;e.checked=i,i&&e.type==="radio"&&this.autoNextStep()})}initFieldFile(){let t=this.$component,e=this.eventId,i=this.$itemTemplateFile?.html();X(t,e,i)}initFieldCheckbox(){}initFieldRadio(){this.autoNextEnabled&&this.$component.off("change.initRadio").on("change.initRadio",".form-field-radio-item",()=>{this.autoNextStep()})}initFieldSelect(){this.$component.find(".dropdown-container").remove();let t=this.$component.find("select.atom-custom-select"),e={position:"under",dropdownClass:this.$component.hasClass("style-underlined")?"sharp size--large":"size--large"};t.each((i,s)=>{let n=$(s).closest('[data-type="select"]'),a=()=>{n.removeClass("active")},o=()=>{n.addClass("active"),n.siblings('[data-type="select"]').removeClass("active")};
49O.create({element:s,config:e,onChange:this.autoNextStep.bind(this),onSelect:this.autoNextStep.bind(this),onCollapse:a,onActivate:o})})}initFieldTextarea(){this.$component.find("textarea.autosize").each((t,e)=>{let i=e.offsetHeight-e.clientHeight,s=$(e);s.removeAttr("data-autoresize"),s.off("keyup input").on("keyup input",n);function n(a){a.currentTarget.style.height="auto",a.currentTarget.style.height=`${a.currentTarget.scrollHeight+i}px`}})}initFieldRange(){this.$component.find(".form-field-range").each((t,e)=>new et($(e)))}addSubmitting(){this.busy=+Date.now(),this.$component.addClass("submitting"),this.$form.addClass("submitting")}clearSubmitting(t=!1){this.busy&&(this.$component.removeClass("submitting"),this.$form.removeClass("submitting"),t?(this.$component.addClass("success"),this.$component.find(".file-list").empty(),this.$component.find("input.value").remove(),setTimeout(()=>{this.busy=!1,this.$component.removeClass("success")},1e3)):this.busy=!1)}onSubmit(){if(!this.validateHistorySteps())return;this.result=this.getResult();let t={id:this.core.id,name:this.result.name,action:this.result.action.name,pageId:flexbe_cli.p_id,utmData:JSON.stringify(flexbe_cli.utm.data),jsform:parseInt(448312,10)};if(flexbe_cli.stat.u_id&&(t.userId=flexbe_cli.stat.u_id),"roistat"in window&&(t.roistatVisit=window.roistat.visit),this.result.action.name==="pay"&&this.result.action.pay){let e=this.result.action.pay;if(e.desc&&(t["pay[desc]"]=e.desc),e.price&&(t["pay[price]"]=e.price,e.title))if(e.productId){let i=flexbe_cli.ecommerce.productsStore.getProduct(e.productId);if(i){let s=i.currentVariant(e.variantId).getCartData("image");s.img=D(s.img[0]),this.products=[{...s,count:1,id:`product_${e.productId}:${e.variantId||"default"}`}],t.products=JSON.stringify(this.products)}}else this.products=[{title:e.title,id:`${flexbe_cli.p_id}_${flexbe_cli.s_id}`,img:e.img&&D(e.img),count:1,price:e.price}],t.products=JSON.stringify(this.products)}return Object.entries(t).forEach(([e,i])=>{i!=null&&this.addFields([{name:e,value:i,type:"hidden"}],!1)}),this.sendForm(),!1}async sendForm(){if(this.busy)return!1;let t=this.captcha&&this.captcha.getToken();if(this.captcha&&this.captcha.enabled&&!this.captcha.isOptional&&!t){this.captcha.isVisible?this.toStep({id:"captcha"}):this.captchaInvisibleRun();return}this.addSubmitting();let e=new FormData(this.$form.get(0));e.delete("fileOriginal"),e.delete("g-recaptcha-response"),e.delete("smart-token"),t&&e.append("captcha-token",t);let i=flexbe_cli.stat.AB.getCookie();if(e.append("abTest",JSON.stringify(i)),flexbe_cli.run.is_OSX&&typeof e.entries=="function")for(let s of e.entries()){let[n,a]=s;typeof a=="object"&&a instanceof File&&a.size===0&&typeof e.delete=="function"&&e.delete(n)}try{let s=await flexbe_cli.helpers.fetch(this.$form.attr("action"),{type:"POST",dataType:"json",contentType:"application/json",data:JSON.stringify(Fe(e))});typeof s.pay<"u"&&(this.pay=s.pay),this.showDone(e,s),this.captchaRemoveError()}catch(s){let n=s.data||{};if(n.captcha){this.captcha||await this.initCaptcha({enabled:!0,visible:n.captcha==="visible",isOptional:!0}),t?this.captchaAddError():this.captcha.isVisible?(this.captcha.isOptional=!1,this.total=parseInt(this.$component.attr("data-total-steps"),10)+1,this.clearSubmitting(!1),this.toStep({id:"captcha"})):this.captcha.isInvisible&&this.captchaInvisibleRun();return}this.clearSubmitting(!1),console.error("sendForm error: ",s),console.error("Form submitting error!")}}showDone(t,e={}){let i=this.result.action.name,s=this.history.at(-1),n=ke(t,{leadId:e.lead_id,pays:e.pay}),a=()=>{setTimeout(()=>{this.resetForm(),this.toWelcome({scrl:!1})},500)};if(s){let r=s.answers,c=s.id,l=s.title,d=this.result.goals||{};flexbe_cli.events.trigger("quiz_event",{event:"submit",sender:"core",quiz:this,payload:{fromAnswers:r,fromId:c,fromTitle:l,sessionId:this.sessionId},answerGoals:{goal:s.goal,htmlGoal:s.htmlGoal},resultGoals:{mainGoal:flexbe_cli.stat.goals.getGoal("order_done"),goal:d.goal,htmlGoal:d.goal_html},resultGoalsData:{leadId:e.lead_id,formData:n}})}if(typeof this.afterSent=="function"&&this.afterSent(),i==="pay"&&typeof this.pay<"u"&&this.pay!==null&&this.pay.pay_link.length>0){flexbe_cli.stat.ecommerce.savePurchaseSnapshot(this.pay.pay_id,this.products,this.pay.pay_hash,this.pay.price?{value:Number(this.pay.price)||0}:{});let r=`${window.location.origin+window.location.pathname+(window.location.search?`${window.location.search}&`:"?")}pay_id=${this.pay.pay_id}&h=${this.pay.pay_hash}`;try{window.history.pushState(null,null,r),setTimeout(()=>{flexbe_cli.events.trigger("pay",{action:"init"})},200)}catch{setTimeout(()=>{document.location=r},500)}}else if(["redirect","anchor"].includes(i)){let r=this.result.action.action_redirect,c=this.result.action.action_link;r?(flexbe_cli.helpers.gotoLink(r),setTimeout(()=>{a()},1e3)):c&&flexbe_cli.helpers.gotoLink(c)}else if(i==="code"){if(!flexbe_cli.run.is_preview)return;(async c=>{let l=this.result.action.action_code,d=Object.getPrototypeOf(async()=>{}).constructor;await new d("formData",l)(c)})(n).catch(c=>{console.error("Error executing action code:",c)})}else{let r=this.result.action.modal_id,c=this.$component.closest("[data-page-id]").attr("data-page-id");flexbe_cli.events.trigger("ui_modal_open",{id:r,pageId:c})}let o=new Event("submitted",{bubbles:!0});this.$form.get(0).dispatchEvent(o),this.clearSubmitting(!0),a()}resetForm(){this.$form.find(".form-field-file, .file-input-outer").removeClass("active");
49let t=this.$stepsWrapper.find("input, textarea, select"),e=t.not("select").not('[type="hidden"]').not(".form-field-range__input"),i=t.filter("select"),s=t.filter(".form-field-range__input");t.prop("disabled",!0),i.each((n,a)=>{let o=a.querySelector("option"),r=o&&o.value||"";a.value!==r&&(a.value=r,a.dispatchEvent(new Event("change")))}),s.each((n,a)=>{a.value=a.getAttribute("data-value"),a.dispatchEvent(new Event("change"))}),e.each((n,a)=>{let r=a.defaultChecked;["radio","checkbox"].includes(a.type)?a.checked=r:(a.removeAttribute("value"),a.value="",a.removeAttribute("data-mask-complete"),a._mask&&a._mask.updateValue()),a.dispatchEvent(new Event("change"))}),this.captcha&&this.captcha.enabled&&(this.captcha.reset(),this.resetCaptchaSubmitToken(),this.captchaRemoveError()),Z(),this.$form[0].reset()}async initCaptcha(t){this.captcha||(this.captcha=new it({...t,id:this.id,form:this.$component[0],onSuccess:e=>{this.acceptCaptchaToken(e)&&(this.captchaRemoveError(),this.clearSubmitting(),this.toResult({force:!0}))},onError:()=>{this.captchaAddError()}}),await this.captcha.init(),this.captcha.enabled&&await this.captcha.renderCaptcha({target:"form"}))}acceptCaptchaToken(t){return!t||!this.captcha||this.captcha.getToken()!==t||this.captchaSubmitToken===t||this.busy&&this.captchaSubmitToken?!1:(this.captchaSubmitToken=t,!0)}resetCaptchaSubmitToken(){this.captchaSubmitToken=null}captchaAddError(t){if(!this.captcha||!this.captcha.enabled)return;this.resetCaptchaSubmitToken(),t==null&&(t=flexbe_cli.locale.tr("form::captcha_error"));let e=this.$component.find(".captcha-global-error");e.find(".error-text").text(t),e.addClass("show"),this.busy&&this.clearSubmitting()}captchaRemoveError(){if(!this.captcha||!this.captcha.enabled)return;let t=this.$component.find('.field[data-type="captcha"]'),e=this.$component.find(".captcha-global-error");t.removeClass("is_error"),e.removeClass("show")}captchaInvisibleRun(){if(!this.captcha||!this.captcha.enabled||!this.captcha.loaded||this.captcha.isVisible)return;this.addSubmitting(),this.captcha.runInvisibleChallenge();let t=this.busy;setTimeout(()=>{t===this.busy&&this.clearSubmitting()},2500)}setData(t){if(!t)return!1;t&&t.fields&&this.addFields(t.fields),t&&t.items&&this.addItems(t.items)}addFields(t,e=!0){let i=this.$component.find(".form-fields-advanced");!t.length||!i[0]||(e&&this.resetFields(),t.forEach(s=>{i.find(`input[name="${s.name}"]`).remove();let n=$("<input>").attr("type",s.type).attr("name",s.name).attr("value",s.value);i.append(n)}))}resetFields(){let t=this.$component.find(".form-fields-advanced");t[0]&&t.empty()}addItems(t=[]){if(!t||!t.length)return;let e=0,i="",s=[];t=t.map(a=>typeof a!="object"?{}:(a.price=parseFloat(a.price)||0,a.title=typeof a.title=="string"&&a.title.trim()||a.title||"",e+=a.price*a.count||0,a)),this.products=t;try{i=JSON.stringify(t)}catch{}let n={products:i};e&&(n={...n,"pay[price]":e,"pay[desc]":""}),Object.entries(n).forEach(([a,o])=>{s.push({type:"hidden",name:a,value:o})}),this.addFields(s)}initFieldMask(){return typeof IMask>"u"?!1:(this.needInitMasks=!1,this.$masked.each((t,e)=>{tt(e);let i=!!e.getAttribute("data-placeholder"),s=e._mask;i&&s&&($(e).on(`focus${this.eventId}`,()=>{s.updateOptions({lazy:!1})}),$(e).on(`blur${this.eventId}`,()=>{if(!s.unmaskedValue){let n=s.mask.replace(/\*/g,"_"),a=s.value;s.updateOptions({lazy:!0}),(!s.masked.rawInputValue||n===a)&&(s.unmaskedValue="",s.value="",s.updateValue())}}))}),!0)}initFieldDate(){this.needInitCalendar=!1;let t=this.$component.closest(".scroller")[0];return this.$calendars.each((e,i)=>{Q(i,t)}),!0}},Ot=class extends De{setProgress(){let t=this.$progress.find(".progress-loader-bar .current"),e=this.$progress.attr("data-text-style")==="step",i=t.attr("data-unit"),s=this.total,n=this.realIndex;flexbe_cli.is_admin&&this.realIndex===-1&&this.currentId!=="welcome"&&(n=+this.$currentStep.prevAll('[data-linked="linked"]').first().attr("data-real-index")+1||0),n=Math.max(0,Math.min(s-1,n));let a=e?n+1:n,o=parseInt(a*100/s,10);if(this.$progress.attr("data-current",a),this.$progress.attr("data-total",s),this.$progress.attr("data-current-progress",o>0?o:0),t&&i){let r=t.find(".progress-runner"),c=`${o}%`;i==="step"?c=`${a} / ${s}`:i==="none"&&(c=""),r.attr("data-value",c)}this.$progress.find(".progress-text .current").text(a),this.$progress.find(".progress-text .total").text(s),this.$progress.find(".progress-percent .current").text(o),this.$progress.find(".progress-loader-bar .current").css("width",`${o}%`),this.$progress.find(".progress-loader-circle .current").attr("stroke-dashoffset",`${Math.abs(100-o)}`)}};var E={},B=class extends b{static is="image";isImgLoaded=!1;params=null;constructor(t){super(t),this.imageLoadingOptions=flexbe_cli.vars.site.images,this.lazyLoad=this.component.hasAttribute("data-img-lazy"),this.autoLoad=this.component.hasAttribute("data-img-autoload"),this.imageLayer=this.$component.find(".component-image__image").get(0)||this.component,this.overlayLayer=this.$component.find(".component-image__scroll").get(0)}async onInit(){this.autoLoad&&!this.lazyLoad&&await this.loadImage(),this.$component.off(".componentImage"),this.$component.on("setImage.componentImage",$.debounce(async()=>{let t=this.component.getClientRects().length>0;this.autoLoad=!0,this.lazyLoad=!0,t&&!this.isImgLoading&&!this.isImgLoaded&&await this.loadImage()},10))}async onBeside({state:t}){if(!t)return!1;!this.isImgLoaded&&this.autoLoad&&await this.loadImage()}async onResize(){this.isImgLoaded&&this.autoLoad&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(()=>this.loadImage(!0),1e3))}onHideShowUI(t){t==="generation"&&requestAnimationFrame(()=>{this.component&&this.params?.position&&(this.component.style.setProperty("--imagePositionX",this.params.position.x),this.component.style.setProperty("--imagePositionY",this.params.position.y))})}async loadImage(t=!1){if(this._setParams(),!t&&(this.isImgLoaded||this.isImgLoading))return;this._setOverlay();let e,i=this.params;i.original_resolution||(e=await this.getOptimalSize(),e&&E[this.params.id].sizes&&!E[this.params.id].sizes.includes(e)&&E[this.params.id].sizes.push(e)),this.isImgLoading=!0;let s=S(i,e,this.imageLoadingOptions);await this._setImage(s),this.isImgLoading=!1}async getOptimalSize(){let t=this.params,e=await ct(t);t.proportion=e,E[this.params.id]&&(E[this.params.id].params.proportion=e);let i=this.componentWidth||this.component.offsetWidth,s=this.componentHeight||this.component.offsetHeight||i*e/100,{width:n}=await F(this.params,{width:i,height:s},this.imageLoadingOptions),a=n-2,o=Math.max(50,n*1.2);return n=this._getClosestSize(n,a,o),n}async _setImage(t){let{$component:e}=this;if(t){if(this.imageLayer.tagName==="IMG"?(this.imageLayer.removeAttribute("data-inline-src"),this.imageLayer.removeAttribute("data-lazy-src"),this.imageLayer.src=t):this.imageLayer.style.backgroundImage=`url(${t})`,!this.isImgLoaded){if(t)try{await P(t)}catch(i){console.error("Image preload error",i)}e.removeClass("loading"),this.isImgLoaded=!0}e.trigger("load")}}_setOverlay(){let{overlayLayer:t,componentWidth:e,componentHeight:i}=this;if(!t)return;let s="medium";e<=200||i<=150?s="xsmall":e<=400||i<=250?s="small":e>=650&&i>=400&&(s="large"),t.setAttribute("data-size",s),t.getAttribute("data-type")==="hover"&&$(t).on("pointerenter pointerleave",n=>{let a=n.type==="pointerenter";$(t).toggleClass("hover",a)})}
49_setParams(){if(this.params)return;let t=this.component,e=$(t),i={},s=e.attr("data-img-id");if(E[s]?.params)i={...E[s].params};else if(i.id=s,i.ext=e.attr("data-img-ext"),i.proportion=+e.attr("data-img-proportion"),i.position={x:e.attr("data-img-x")||"50%",y:e.attr("data-img-y")||"50%"},!i.ext){let n=(e.attr("data-img-name")||"image.jpg").match(/\.(\D{2,4})$/i)||[];n[1]&&i.ext!==n[1]&&(i.ext=n[1]||!1)}i.action=e.attr("data-action"),i.proportion||(i.proportion=100),i.scale=e.attr("data-img-scale")||"cover",i.original_resolution=t.hasAttribute("data-img-original"),E[i.id]||(E[i.id]={params:{...i},sizes:[]}),i.animated=t.hasAttribute("data-img-animated"),i.transparent=t.hasAttribute("data-img-transparent"),this.params=i}_getClosestSize(t,e=t,i=t+10){let s=E[this.params.id].sizes||[],n,a=1/0;return s.forEach(o=>{let r=Math.abs(o-t);o>=e&&o<=i&&r<a&&(n=o,a=r)}),n??t}};flexbe_cli.entity.setClientJs("modal","QUIZ",{components:[Ot,I,B]});flexbe_cli.entity.setClientJs("widget","ANCHORS",{$list:null,loadAnime(){return new Promise((t,e)=>{typeof anime=="function"&&t(!0),document.readyState==="complete"?flexbe_cli.require("/_s/lib/anime/anime.min.js?321").then(t).catch(e):window.addEventListener("load",()=>{flexbe_cli.require("/_s/lib/anime/anime.min.js?321").then(t).catch(e)})})},async onLoad(){this.$list=this.$widget.find(".anchors-list"),this.list=typeof this.$list.data("anchors")=="object"&&this.$list.data("anchors").list||[];let t=this.list.reduce((i,s)=>i+s.enabled,0)<2,e={style:1,show_title:0,...this.$list.data("anchors")};if((flexbe_cli.run.is_mobile||t)&&!flexbe_cli.is_admin){this.$list.toggleClass("is-empty",t);return}this.style=e.style,this.show_title=e.show_title,this.$list.removeAttr("data-anchors"),await this.loadAnime(),this.drawList(),flexbe_cli.is_admin&&flexbe_cli.events.off("layout_change.anchors").on("layout_change.anchors",i=>{i?.action==="layout_render"&&this.drawList()})},check(){let t=flexbe_cli.block.$blocks.not("[data-overlayed]");this.list=this.list.map(e=>{let i=t.closest(`[data-id="${e.id}"]`),s=i.attr("data-hidden")||"none";
49return!e.enabled||!i[0]||["desktop","all"].includes(s)?null:{id:e.id,title:e.title,enabled:e.enabled,anchor:i.find("._anchor").attr("name")}}).filter(Boolean)},drawList(){flexbe_cli.block.$blocks.length||this.$list.hide(),this.check();let t="";flexbe_cli.is_admin&&this.list.length<2?t=`<svg style="color: #adadad" width="18" height="98" viewBox="0 0 18 98" xmlns="http://www.w3.org/2000/svg"> 50 <g fill="none" fill-rule="evenodd"> 51 <circle opacity=".05" cx="9" cy="5" r="5"/> 52 <circle opacity=".2" cx="9" cy="25" r="5"/> 53 <circle opacity=".2" cx="9" cy="73" r="5"/> 54 <circle opacity=".05" cx="9" cy="93" r="5"/> 55 <path d="M9 40a9 9 0 1 0 0 18 9 9 0 0 0 0-18zm5.126 9.626h-4.5v4.5H8.34v-4.5h-4.5V48.34h4.5v-4.5h1.286v4.5h4.5v1.286z" opacity=".45"/> 56 </g> 57 </svg>`:this.list.length>=2&&(this.list.forEach(e=>{let i=this.show_title&&e.title?` data-title="${e.title}"`:"";t+=`<li${i}><a href="#${e.anchor||e.id}"></a></li>`}),t+='<li class="helper"><a></a></li>'),this.$list.find("ul").html(t),this.$helper=this.$list.find(".helper"),this.animateList(),this.bindEvents()},animateList(){if(!(this.list.length<1)){if(flexbe_cli.is_admin)this.$helper.css({opacity:1,transform:`translateY(${24*this.index}px)`});else{let t=anime({targets:this.$list.find("li").not(this.$helper).get(),duration:300,opacity:[0,1],scale:[.8,1],translateY:[10,0],easing:"easeInOutQuad",autoplay:!1,delay:(e,i)=>i*30,complete:()=>{anime({targets:this.$helper.get(),duration:400,translateY:24*this.index,scale:[2.5,1],opacity:[0,1],easing:"easeInExpo"})}});this.$list.addClass("hide"),setTimeout(()=>{this.$list.removeClass("hide"),t.play()},800)}this.$list.find("li").removeClass("active").eq(this.index).addClass("active")}},index:0,bindEvents(){this.$list.find("li").length<=1||(flexbe_cli.block.$blocks.each((t,e)=>{let i=e._core;i?.inFocus&&this.setBlock(i)}),flexbe_cli.block.$blocks.off("focused.anchors").on("focused.anchors",t=>{let e=t.currentTarget._core;e?.inFocus&&this.setBlock(e)}),this.$list.off("click.anchors").on("click.anchors","li",t=>$(t.target).is("a")?!0:($(t.currentTarget).find("[href]").trigger("click"),t.preventDefault(),!1)))},setBlock(t){let e=this.index,i="#6a6a6a",s=t.content||t.$area.find(".container")[0];if(s){let n=s.closest("[data-contrast]").getAttribute("data-contrast");n?i=n==="light"?"#FFF":"#1B1B1C":i=getComputedStyle(s).color}this.$list.css("color",i),this.list.some((n,a)=>n.id===t.id?(e=a,!0):!1),e=Math.max(0,Math.min(this.list.length-1,e)),e!==this.index&&(this.animate(e),this.index=e)},animate(t){if(this.$list.find("li").removeClass("active"),this.$list.find("li").eq(t).addClass("active"),+this.style==1){let e=24*t,i=t-this.index>0?12:-12;anime.remove(this.$helper[0]),anime({targets:this.$helper[0],translateY:e-i,scaleY:2.5,scaleX:.6,duration:80,easing:"easeInQuad",complete:()=>{anime({targets:this.$helper[0],translateY:e,scaleY:1,scaleX:1,duration:80,easing:"easeOutQuad"})}})}}});flexbe_cli.entity.setClientJs("element","figure",{components:[B],isPure:!0});var qt=(t,e)=>!t||typeof t!="string"?t:t.replace(/\{\{\s*([^}|]+)(?:\s*\|\s*([^}]*))?\s*\}\}/g,(i,s,n)=>e(s.trim(),n?.trim()));var ft=(()=>{if(typeof process<"u"&&{}.LOG_LEVEL){let t={}.LOG_LEVEL.toLowerCase();if(["debug","info","warn","error"].includes(t))return t}return"error"})();function mt(t){let e=`[${t}]`;return{debug:(...i)=>{["debug"].includes(ft)&&console.debug(e,...i)},info:(...i)=>{["debug","info"].includes(ft)&&console.info(e,...i)},warn:(...i)=>{["debug","info","warn"].includes(ft)&&console.warn(e,...i)},error:(...i)=>{console.error(e,...i)}}}var pn=mt("App");function gt(t){if(!t||typeof t!="object")return null;let e=t.shipping_restriction??t.shippingRestriction;return!e||typeof e!="object"||Array.isArray(e)?null:e}function vt(t){return t?.enabled===!0}function Me(t,e,i,s=!1){let n=Re(e,s);try{return new Function("ctx",`with (Math) { with (ctx) { ${n} }}`)(i)}catch(a){throw new Error(`[${t}] Function "${n}" (original: "${e}") can't be evaluated`,{cause:a})}}function Re(t,e=!1){if(t.includes("function(")||t.includes("=>"))return t;if(t=String(t).trim(),!e){t=t.replace(/(\d),(\d)/g,"$1.$2");let i="";for(;i!==t;)i=t,t=t.replace(/[\s]*[+\-*/^%(.;]\s*$/,"");let s=(t.match(/\(/g)||[]).length-(t.match(/\)/g)||[]).length;s>0&&(t+=")".repeat(s))}return t=t.replace(/clamp\(([^,]+),([^,]+),([^\)]+)\)/gi,"min(max($1, $2), $3)"),t=t.replace(/([)\wа-ÑÐ-Я._]+)\s*\^\s*([(\wа-ÑÐ-Я._]+)/g,"$1**$2"),`return (${t})`}function bt(t,e="value",i){if(e==="number")return parseFloat(t);let{d:s,t:n}=flexbe_cli.vars.site.currencyFormat,a=i?.decimalPlaces??0,o=i?.thousandsSeparator?n:"",r=i?.resultText??"",c=flexbe_cli.locale.formatNumber(t,a,{d:s,t:o});return e==="value"||!r?c:qt(r,()=>c)}function nt(t){let e=t.getAttribute("data-calc-value")??t.querySelector("[data-calc-value]")?.getAttribute("data-calc-value")??t.getAttribute("value");if(e!=="")return e}function Le(t){let e=new Map,i=new Set,s=new Proxy({},{ownKeys(){return[...t.keys()]}
57,getOwnPropertyDescriptor(n,a){if(typeof a=="string"&&t.has(a))return{enumerable:!0,configurable:!0,value:s[a]}},has(n,a){return typeof a=="string"&&t.has(a)},get(n,a){if(typeof a=="symbol")return;if(e.has(a))return e.get(a);if(!t.has(a))return;if(i.has(a))throw new Error(`Circular dependency detected on "${a}"`);let o=t.get(a),r;if(typeof o=="number")r=o;else if(o==="-")r=void 0;else if(typeof o=="string"){i.add(a);try{r=Me(a,o,s),e.set(a,r)}finally{i.delete(a)}}return r}});return s}var U=new Map,at="",Ve=class extends HTMLElement{formId="";fieldId="";resultType="value";currentValue=null;currentAnimation=null;constructor(){super(),this.handleUpdate=this.handleUpdate.bind(this),this.attachListeners()}static get observedAttributes(){return["data-form-id","data-result-id","data-result-type"]}connectedCallback(){this.parseAttributes(),this.updateContent()}disconnectedCallback(){this.stopCurrentAnimation(),this.removeListeners()}parseAttributes(){this.formId=this.getAttribute("data-form-id")||"",this.fieldId=this.getAttribute("data-result-id")||"",this.resultType=this.getAttribute("data-result-type")||"value"}attachListeners(){flexbe_cli.events.on("form_event",this.handleUpdate)}removeListeners(){flexbe_cli.events.off("form_event",this.handleUpdate)}handleUpdate(t){t.formId===this.formId&&["calculator_inited","field_changed"].includes(t.type)&&this.updateContent()}updateContent(){if(!this.formId||!this.fieldId){this.textContent=at;return}let t=U.get(this.formId),e=t?.getFieldConfig(this.fieldId);if(!e){this.textContent=at;return}try{let i=t.getFieldValue(this.fieldId,"number"),s=typeof i=="number"&&!Number.isNaN(i)&&isFinite(i);s&&this.currentValue!=null&&e?.smoothAnimation&&typeof anime=="function"?this.animateChange(i):(e?.smoothAnimation&&this.stopCurrentAnimation(),this.textContent=String(t.getFieldValue(this.fieldId,this.resultType)||e.beforeResult||at)),this.currentValue==null&&s&&(this.currentValue=i)}catch{this.textContent=e.beforeResult||at}}stopCurrentAnimation(){this.currentAnimation&&(this.currentAnimation.pause(),this.currentAnimation=null)}animateChange(t){if(this.stopCurrentAnimation(),t==null)return;let e=U.get(this.formId)?.getFieldConfig(this.fieldId);if(!e)return;let i={value:this.currentValue},s=Math.abs(t-this.currentValue),n=Math.min(600,150+s*5);this.currentAnimation=anime({targets:i,value:t,duration:n,easing:"easeInOutQuad",update:()=>{this.textContent=bt(i.value,this.resultType,e)},complete:()=>{this.currentValue=t,this.currentAnimation=null,this.textContent=bt(t,this.resultType,e)}})}};function Ht(t){if(!t.includes("<form-result"))return t;let e=t.match(/data-form-id=['"]([^'"]+)['"]/),i=e?e[1]:null,s=t.match(/data-result-id=['"]([^'"]+)['"]/),n=s?s[1]:null,a=t.match(/data-result-type=['"]([^'"]+)['"]/)?.[1]||"value";return i&&n?U.get(i)?.getFieldValue(n,a):""}customElements.get("form-result")||customElements.define("form-result",Ve);var Be=class{inited=!1;state=null;fieldsValues=new Map;fieldsConfigs=new Map;formInstance;constructor({formInstance:t}){this.formInstance=t}init(){this.formInstance.$component[0].querySelectorAll("[data-calc-name]").forEach(t=>{let e=t.getAttribute("data-calc-name"),i=$(t).closest("[data-type]").attr("data-type");this.fieldsConfigs.set(e,{type:i,input:t.querySelector('input[name*="[value]"]'),beforeResult:t.getAttribute("data-calc-before-result")??"\u2014",resultText:t.getAttribute("data-calc-text")??`{{ ${e} }}`,decimalPlaces:Number(t.getAttribute("data-decimal-places"))||0,thousandsSeparator:t.getAttribute("data-thousands-separator")==="true",smoothAnimation:t.getAttribute("data-smooth-animation")==="true"}),this.updateFieldValue(t)}),this.syncState(),U.set(this.formInstance.id,this),this.inited=!0,flexbe_cli.events.trigger("form_event",{type:"calculator_inited",formId:this.formInstance.id})}destroy(){U.delete(this.formInstance.id),this.inited=!1,this.fieldsValues=new Map,this.state=null}getFieldValue(t,e="value"){let i=this.fieldsConfigs.get(t),s=this.state?.[t];return!s||!isFinite(s)?i?.beforeResult||"":bt(s,e,i)}getFieldConfig(t){return this.fieldsConfigs.get(t)}updateFieldValue(t,e){let i=t.getAttribute("data-calc-name");if(!i)return;let s=$(t).closest("[data-type]").attr("data-type");if(this.fieldsValues.has(i)||this.fieldsValues.set(i,void 0),["radio-radio","select"].includes(s)&&(t.checked||t.selected)&&this.fieldsValues.set(i,nt(t)),s==="checkbox"){let n=t.checked,a=$(t).attr("data-calc-value-off")??0,o=n?nt(t):a;this.fieldsValues.set(i,o)}if(s==="radio-checkbox"&&(!e||e.type==="change")){let n=Number(this.fieldsValues.get(i)??0),a=Number(nt(t)||0),o=t.checked?a:this.inited?-a:0;this.fieldsValues.set(i,n+o)}if(["number","range","hidden","result"].includes(s)){let n=nt(t);s==="number"&&n&&(n=n.replace(/,/g,".")),this.fieldsValues.set(i,n)}}syncState(){this.state=Le(this.fieldsValues);try{[...this.fieldsConfigs.entries()].filter(([t,e])=>e.type==="result").forEach(([t,e])=>{let i=e.input,s=this.getFieldValue(t,"text");i&&(i.value=String(s))})}catch(t){console.debug(t)}}onFieldChange(t,e){e.closest("[data-calc-name]")&&(this.updateFieldValue(e,t),this.syncState())}},ze=class{decimalPlaces;max;min;$input;
57constructor(t){this.$input=t.find('input:not([type="hidden"]'),this.max=Number(this.$input.data("max")),this.min=Number(this.$input.data("min")),this.decimalPlaces=Number(this.$input.data("decimal-places")||0),this.$input[0]&&(this.$input.val(this.normalize(this.$input.val())),this.setEvents())}normalize(t){return t=this.onlyNumber(t),t=this.decimalPlacesValue(t),!Number.isNaN(this.max)&&!Number.isNaN(this.min)&&(t=this.minMaxValue(t)),t}onlyNumber(t){return t=t.replace(/[^\d.,-]/g,""),t.includes("-")&&(t=t.replace(/-/g,""),t=`-${t}`),t=t.replace(/([.,])[.,]*/g,"$1"),t=t.replace(/^([^.,]*[.,][^.,]*)[.,].*$/,"$1"),+this.decimalPlaces||(t=t.replace(/[.,]/g,"")),t}minMaxValue(t){let e=parseFloat(t.replace(",","."));return Number.isNaN(e)||(e>this.max?t=this.max.toString():e<this.min&&(t=this.min.toString())),t}decimalPlacesValue(t){let e=t.split(/[.,]/);return e[1]&&e[1].length>this.decimalPlaces&&(t=t.replace(new RegExp(`([.,]\\d{${this.decimalPlaces}})\\d*`),"$1")),t}setEvents(){this.$input.on("input",t=>{let e=t.currentTarget,i=e.value;i=this.onlyNumber(i),i=this.decimalPlacesValue(i),e.value=i,this.$input.trigger("change")}),this.$input.on("blur",t=>{let e=t.currentTarget,i=e.value;e.value=this.minMaxValue(i),this.$input.trigger("change")}),this.$input.on("keydown",t=>{let e=t.key,i=e==="ArrowUp";if(!i&&e!=="ArrowDown")return;t.preventDefault();let s=t.currentTarget,n=parseFloat(s.value.replace(",","."))||0,a=this.getStepValue(t.originalEvent),o;i?o=n+a:o=n-a,!Number.isNaN(this.max)&&o>this.max&&(o=this.max),!Number.isNaN(this.min)&&o<this.min&&(o=this.min),s.value=this.formatNumber(o),this.$input.trigger("change")})}getStepValue(t){let e=10**-this.decimalPlaces,i=t.shiftKey?10:1,s=t.ctrlKey||t.metaKey?100:1,n=t.altKey?.1:1;return e*i*s*n}formatNumber(t){return this.decimalPlaces===0?Math.round(t).toString():t.toFixed(this.decimalPlaces)}};function Ne(t,e,i={}){let s=!1;return{type:t,target:e,detail:i,get defaultPrevented(){return s},preventDefault(){s=!0}}}function Oe(t){let e={},i=t.querySelectorAll("input, select, textarea"),s=[],n=[],a=0;for(let o of i){let r=o.getAttribute("data-name")||o.name;if(!r||["g-recaptcha-response","smart-token","goal","goal_html","fileOriginal","products","pageId","action_redirect"].includes(r))continue;let c=r.match(/^fields\[(\w+)\]/);if(c){let d=c[1];s.find(h=>h.id===d)||s.push({id:d,isCustom:!1})}else if(r.match(/^shipping\[fields\]\[(\w+)\]/)){let d=r.match(/^shipping\[fields\]\[(\w+)\]/)[1];n.includes(d)||n.push(d)}else!["id","name","action"].includes(r)&&!/^[a-zA-Z_]+\[/.test(r)&&s.push({customIndex:a++,isCustom:!0});let l=o.getAttribute("data-value")||o.value;if(o.type==="file"&&l?.startsWith("[")&&(l=JSON.parse(l)),o.type==="checkbox"||o.type==="radio"){let d=o.checked;if(o.type==="radio"&&!d||o.type==="checkbox"&&r.endsWith("[]")&&!d)continue;o.type==="checkbox"&&!r.endsWith("[]")&&!d&&(l="off")}if(qe(o,r,t)&&!r.includes("shipping[shipping-type]"))if(["id","name","action"].includes(r)||/^[a-zA-Z_]+\[/.test(r))q(e,r,l);else{e.custom||(e.custom=[]);let d=o.getAttribute("data-type")||o.type||"text";e.custom.push({name:r,value:l,type:d})}}return We(e,s,n)}function qe(t,e,i){return t.disabled?!1:e.includes("shipping[")?He(t,e,i):!0}function He(t,e,i){if(e.match(/^shipping\[(id|price|name|type|not_fix_price)\]/))return!0;if(e.includes("shipping[address]")){let s=i.querySelector(".form-fields-address");return!(s&&s.hasAttribute("hidden"))}if(e.includes("shipping[fields]")){let s=null,n=i.querySelector(".form-field-shipping-item--active");n&&(s=n.getAttribute("data-shipping"));let a=t.closest("[data-shipping]");return a?a.getAttribute("data-shipping")===s:!1}return!0}function We(t,e,i){let s={};return Object.keys(t).forEach(n=>{!n.includes("[")&&!n.includes("]")&&(s[n]=t[n])}),(t.fields||t.custom)&&(s.fields=Ue(t.fields||{},t.custom||[],e),delete s.custom),t.shipping&&(s.shipping=je(t.shipping,i)),Object.keys(t).forEach(n=>{if(n!=="fields"&&n!=="shipping"&&(n.includes("[")||n.includes("]"))){let a=ut(n),o=s;for(let r=0;r<a.length-1;r++)o[a[r]]||(o[a[r]]={}),o=o[a[r]];o[a[a.length-1]]=t[n]}}),s}function Ue(t,e,i){let s=new Map;return typeof t=="object"&&Object.keys(t).forEach(n=>{let a=t[n];typeof a=="object"&&a.id&&(a.value===void 0&&(a.value=""),s.set(a.id,a))}),i?i.map(n=>
57n.isCustom?e[n.customIndex]:s.get(n.id)).filter(Boolean):[...Array.from(s.values()),...e]}function je(t,e){let i={};if(["id","price","name","type","not_fix_price"].forEach(s=>{t[s]&&(i[s]=t[s])}),t.fields){let s=new Map;if(Object.keys(t.fields).forEach(n=>{let a=t.fields[n];typeof a=="object"&&a.id&&a.id!=="99999"&&s.set(a.id,a)}),s.size>0){let n=(e?.length?e.filter(a=>s.has(a)):Array.from(s.keys())).map(a=>s.get(a)).filter(a=>a.name?.trim());n.length>0&&(i.fields=n)}}if(t.address){let s={};Object.keys(t.address).forEach(n=>{let a=t.address[n];typeof a=="object"&&a!==null?a.value!==void 0?s[n]=a.value:Object.keys(a).length>0&&(s[n]=Object.values(a)[0]):s[n]=a}),s.state&&(s.region=s.state,delete s.state),Object.keys(s).length>0&&(i.address=s)}return i}function Ge(t,e){let{to:i,from:s,fields:n}=Ut(t);n.forEach((r,c)=>{c>=s&&c<i&&$(r).addClass("allocate-space-for-error")});let a=$(t),o=a.find(".error");a.outerWidth(),a.addClass("is_error"),o.length&&(o.attr("title",e),o.find(".error-text").text(e))}function Ye(t){let e=t.closest(".form-field")[0],{to:i,from:s,fields:n}=Ut(e);t.closest(".is_error").removeClass("is_error"),n.forEach((a,o)=>{o>=s&&o<i&&$(a).removeClass("allocate-space-for-error")})}function Ut(t){if(!t?.hasAttribute("data-type")||["radio-radio","radio-checkbox","checkbox"].includes(t?.getAttribute("data-type")))return{to:0,from:0,fields:[]};let e=Array.from(t.parentElement.children),i=e.indexOf(t)+1,s=getComputedStyle(t.closest(".form-fields")).getPropertyValue("grid-template-columns").split(" ").length,n=s*Math.ceil(i/s);return{to:n,from:n-s,fields:e}}function jt({$field:t,selector:e,attribute:i,attrValue:s}){let n=t.attr("data-default-value");if(n){let a=t.find(e);!isNaN(Number(n))&&Number(n)<=a.length?(a.removeAttr(i),a.eq(Number(n)-1).attr(i,s)):a.each((o,r)=>{let c=$(r);c.val()===n&&(a.removeAttr(i),c.attr(i,s))})}}function Ke(t){let e=t.find('[data-type="radio-radio"]'),i=t.find('[data-type="radio-checkbox"]');e.length&&e.each((s,n)=>{jt({$field:$(n),selector:'input[type="radio"]',attribute:"checked",attrValue:"checked"})}),i.length&&i.each((s,n)=>{let a=$(n),o=a.attr("data-default-value")||"",r=a.find("input.form-field-checkbox__input"),c=o.split(/[,;\s]+/).filter(l=>l!=="").map(l=>isNaN(Number(l))?l:Number(l));r.each((l,d)=>{let h=$(d),p=h.attr("value");(c.includes(p)||c.includes(l+1))&&h.attr("checked","checked")})})}function Je(t){t.find('[data-type="checkbox"]').each((e,i)=>{let s=$(i).attr("data-default-value"),n=$(i).find("input.form-field-checkbox__input");["on",1,"1",!0,"true"].includes(s)&&n.attr("checked","checked"),["off",0,"0",!1,"false"].includes(s)&&n.removeAttr("checked")})}function Qe(t){t.find('.form-field[data-type="phone"]:not([data-hidden])').each((e,i)=>{let s=$(i).find("input").not('[type="hidden"]'),n=s[0];if(!s[0])return;let a=$(n).val();$(n).val(a.replace(/[^0-9+\-_()]/g,""))})}var Xe=(t,{countriesList:e=[],statesList:i=[]}={})=>{let{addressLine1:s,addressLine2:n,country:a,city:o,region:r,zipCode:c}=t||{},l=e.find(p=>p.value===a)?.title||a,d=a==="US"&&i.find(p=>p.value===r)?.title||r,h=[];switch(a){case"RU":h=[s,n,o,d,c,l];break;case"US":h=[s,n,o,`${d}${c?` ${c}`:""}`,l];break;case"EN":h=[s,n,o,d,c,l];break;case"DE":h=[`${c} ${o}`,s,n,d,l];break;case"FR":h=[`${c} ${o}`,s,n,d,l];break;default:h=[s,n,o,d,c,l];break}return h.filter(p=>p&&p.trim().length>0).join(", ")},yt=mt("API"),W={},Ze=class extends Error{data=null;response=null;name="FormError"},ti=class extends Error{name="NetworkError";data=null;response=null},ei={hash:0,abortPrev:!1,dataType:"json",contentType:"application/x-www-form-urlencoded",asJson:!1,data:{}},Wt={codes:{0:"main::error::network",401:"main::error::not_authorized",404:"main::error::page_not_found"},statuses:{parsererror:"main::error::incorrect_answer",error:"main::error::unknown",abort:""}};async function ii(t,e){return si("GET",t,e)}async function si(t,e,i){t=t?String(t).trim().toUpperCase():"POST";let s={...ei,...i,url:e,type:t};s.asJson&&typeof s.data=="object"&&(s.data=JSON.stringify(s.data)),s.data&&typeof s.data=="str
57ing"&&(s.contentType="application/json");let n=`${e}:${s.hash||0}`;return s.abortPrev&&ni(n),new Promise((a,o)=>{W[n]=$.ajax(s).done((l,d,h)=>{let p=h.status,u=d||h.statusText;l?.status??!0?r({payload:l}):c({response:h,payload:l,statusCode:p,statusText:u})}).fail((l,d)=>{let h=l.status,p=d||l.statusText,u=l.responseJSON;p!=="abort"&&c({response:l,payload:u,statusCode:h,statusText:p})});function r({payload:l}){return yt.debug("Request successful",{url:e,type:t,statusCode:200}),a(l)}function c({response:l,payload:d={},statusCode:h,statusText:p="error"}){let u,f=d.message||d.error||d.detail;return typeof f=="object"&&f.message!=null&&(f=f.message),f||(f=Wt.codes[h]||Wt.statuses[p]),h===401&&(yt.warn("Unauthorized request, redirecting to login",{url:e,statusCode:h}),window.location.href=`${flexbe.vars.app.url}/login/`),d.violations&&Array.isArray(d.violations)?(u=new Ze(tr(f)),d.violations=d.violations.map(m=>({...m,name:m.propertyPath.replace(/\[(\w*)]/g,".$1").slice(1)}))):u=new ti(tr(f)),u.response=l,u.data=d,yt.error("Request failed",u,{url:e,statusCode:h,statusText:p}),o(u)}})}function ni(t){try{if(t){let e=W[t];typeof e=="number"&&clearTimeout(e),typeof e=="object"&&(e.abort(),delete W[t])}else Object.values(W).forEach(e=>{typeof e=="object"&&e.abort()}),W={}}catch{}}var z=null,ai=class{$component;shippingStore=flexbe_cli.ecommerce.shippingStore;cartStore=flexbe_cli.ecommerce.cartStore;promotionStore=flexbe_cli.ecommerce.promotionStore;id;$addressFields;$shipping;constructor({$component:t,id:e}){this.$component=t,this.id=e,this.$shipping=this.$component.find('[data-type="shipping"]'),this.$shipping.length&&(this.$addressFields={},this.init())}
57async init(){await this.loadAddressMeta(),this.setupScrollHandlers(),this.setupAddressFields(),this.setupShippingMethods(),this.onSelectMethod(),this.onUpdatePrices(),this.updateScrollClasses(),this.updateShippingAddress(),this.updateShippingSwitchVisibility(),this.updateAddressFieldsConfig(),this.setupEventListeners(),this.$shipping.attr("hidden",null)}setupScrollHandlers(){this.$shipping.find(".form-field-shipping-inner").on("scroll",this.updateScrollClasses.bind(this))}updateScrollClasses(t){(t?$(t.target).closest(".form-field-shipping-inner"):this.$shipping.find(".form-field-shipping-inner")).each((e,i)=>{let s=$(i),n=s.closest(".form-field-shipping-wrap"),a=Math.round(s.scrollTop()),o=i.scrollHeight,r=i.clientHeight;n.removeClass("scroll-up scroll-down"),a>0&&n.addClass("scroll-up"),a<o-r&&n.addClass("scroll-down")})}setupAddressFields(){this.$addressFields={country:this.$shipping.find('[data-field-id="country"] select').eq(0),addressLine1:this.$shipping.find('[data-field-id="addressLine1"] input[name*=value]').eq(0),addressLine2:this.$shipping.find('[data-field-id="addressLine2"] input[name*=value]').eq(0),city:this.$shipping.find('[data-field-id="city"] input[name*=value]').eq(0),region:this.$shipping.find('[data-field-id="region"] input[name*=value]').eq(0),regionRow:this.$shipping.find(".region-field-row").eq(0),state:this.$shipping.find('[data-field-id="state"] select').eq(0),stateRow:this.$shipping.find(".state-field-row").eq(0),zipCode:this.$shipping.find('[data-field-id="zipCode"] input[name*=value]').eq(0)},this.$addressFields.country.on("change",()=>{this.updateCountriesAndStates(),this.updateShippingAddress()}),this.$shipping.on("input change",".form-fields-address input, .form-fields-address select",()=>this.updateShippingAddress())}setupShippingMethods(){let t=this.shippingStore;this.$shipping.on("change",".form-field-switch input[type=radio]",e=>{let i=e.target;t.dispatch("selectType",i.value),this.scrollToActiveMethod(!1)}),this.$shipping.on("change",".form-field-shipping-item input[type=radio]",e=>{let i=e.currentTarget;if(i.checked){let s=i.closest("[data-shipping]")?.getAttribute("data-shipping");s&&t.dispatch("selectMethod",s)}})}setupEventListeners(){setTimeout(()=>{this.shippingStore&&this.shippingStore.on(`dispatch.form-component-${this.id}`,({name:t})=>{t==="selectMethod"&&this.onSelectMethod()}),this.cartStore&&this.cartStore.on(`dispatch.form-component-${this.id}`,()=>{this.onUpdatePrices()}),this.promotionStore&&this.promotionStore.on(`dispatch.form-component-${this.id}`,()=>{this.onUpdatePrices()})},10)}async updateCountriesAndStates(){let t=this.shippingStore,e=t.activeMethod,i=this.$addressFields.country.closest(".form-field"),s=this.$addressFields.state.closest(".form-field"),n=this.$shipping.find(".form-field-shipping-item__address");if(i.addClass("loading"),s.addClass("loading"),n.addClass("loading"),t.getList("pickup").forEach(h=>{let p=this.$shipping.find(`.form-field-shipping-item[data-shipping="${h.id}"] .form-field-shipping-item__address`),u=Xe(h.address,{countriesList:z?.countries||[],statesList:z?.states||[]});p.text(u)}),n.removeClass("loading"),!e)return;let a=e.isInternationalDelivery,o=this.$addressFields.country.val(),r=!this.$addressFields.country.prop("disabled"),c=a?e.availableCountry:[flexbe_cli.vars.site.country],l=(z?.countries||[]).filter(h=>!c.length||c.includes(h.value)).map(h=>({value:h.value,label:h.title}));if(r){if(ht(this.$addressFields.country[0],l),!o||!l.some(h=>h.value===o)){let h=flexbe_cli.vars.site.country;h&&l.some(p=>p.value===h)?this.$addressFields.country.val(h):l.length>0&&this.$addressFields.country.val(l[0].value)}this.$addressFields.country.trigger("syncSelectUI"),i.removeClass("loading")}let d=a&&o==="US"||flexbe_cli.vars.site.country==="US";if(this.updateAddressFieldsConfig(),d){let h=(z?.states||[]).map(p=>({value:p.value,label:p.title}));ht(this.$addressFields.state[0],h),this.$addressFields.state.trigger("syncSelectUI")}s.removeClass("loading")}async loadAddressMeta(){if(z)return;let t=await ii(`/mod/metadata/?filter=country,state&language=${flexbe_cli.vars.page.language}`);t&&(z=t)}updateShippingAddress(){let t=this.shippingStore,e={country:this.$addressFields.country.val(),addressLine1:this.$addressFields.addressLine1.val(),addressLine2:this.$addressFields.addressLine2.val(),city:this.$addressFields.city.val(),region:this.$addressFields.region.val(),state:this.$addressFields.state.val(),zipCode:this.$addressFields.zipCode.val()};t.dispatch("setAddress",e)}updateShippingSwitchVisibility(){let t=this.shippingStore,e=t.getList("delivery").length>0,i=t.getList("pickup").length>0;this.$shipping.find('[data-field-id="shipping-type"]').toggle(e&&i)}
57updateShippingList(){let t=this.shippingStore.activeType,e=this.$shipping.find(".form-field-shipping-wrap"),i=e.filter(`[data-shipping-type="${t}"]`);e.hide(),i.show()}scrollToActiveMethod(t=!0){let e=this.shippingStore.activeMethod;if(!e)return;let i=this.$shipping.find(".form-field-shipping-item").filter(`[data-shipping="${e.id}"]`),s=i.closest(".form-field-shipping-inner")[0];if(s){let n=i[0].getBoundingClientRect().top-s.getBoundingClientRect().top+s.scrollTop-40;s.scrollTo({top:n,behavior:t?"smooth":"auto"})}}syncSwitch(){let t=this.shippingStore.activeType,e=this.$shipping.find(".form-field-switch input[type=radio]"),i=e.filter(`[value="${t}"]`);i.length&&(e.prop("checked",!1),i.prop("checked",!0)),this.updateShippingList()}updateAddressFieldsConfig(){let t=this.shippingStore.activeMethod,e=t.addressFieldsConfig,i=t?.isInternationalDelivery,s=i&&this.$addressFields.country.val()==="US"||flexbe_cli.vars.site.country==="US",n={addressLine1:{show:e?.addressLine1?.show??!0,required:e?.addressLine1?.required??!0},addressLine2:{show:e?.addressLine2?.show??!1,required:e?.addressLine2?.required??!1},country:{show:i||e?.country?.show||!1,required:i||e?.country?.required||!1},state:{show:s&&(e?.region?.show||!1),required:s&&(e?.region?.required||!1)},region:{show:!s&&(e?.region?.show||!1),required:!s&&(e?.region?.required||!1)},city:{show:e?.city?.show??!1,required:e?.city?.required??!1},zipCode:{show:e?.zipCode?.show??!1,required:e?.zipCode?.required??!1}};Object.entries(n).forEach(([a,{show:o,required:r}])=>{let c=this.$shipping.find(`[data-field-id="${a}"]`),l=c.closest(".form-field-address__row:not(.form-field-address__row--multiple)"),d=c.find(".form-field-title"),h=!o||!t?.deliveryAddressEnabled;l.attr("data-hidden",h?"true":null),c.attr("data-hidden",h?"true":null),c.find("input, select, textarea").prop("required",r).attr("disabled",h?"disabled":null);let p=d.text().replace("*","").trim();d.text(p+(r?" *":""))})}onSelectMethod(){let t=this.shippingStore.activeMethod;if(!t)return;let e=this.$shipping,i=e.find(".form-field-shipping-item"),s=e.find(".form-field-shipping-fields"),n=i.filter(`[data-shipping="${t.id}"]`),a=s.filter(`[data-shipping="${t.id}"]`),o=e.find('[data-type="address"]');i.removeClass("form-field-shipping-item--active"),n.addClass("form-field-shipping-item--active"),s.removeClass("form-field-shipping-fields--active").attr("hidden","true"),a.addClass("form-field-shipping-fields--active").attr("hidden",null),s.find("input, textarea, select").prop("disabled",!0),a.find("input, textarea, select").prop("disabled",!1),i.find("input[type=radio]").prop("checked",!1),n.find("input[type=radio]").prop("checked",!0),o.attr("hidden",t.deliveryAddressEnabled?null:"true"),o.find("input, textarea, select").prop("disabled",!t.deliveryAddressEnabled),this.scrollToActiveMethod(),this.updateCountriesAndStates(),this.updateAddressFieldsConfig(),this.syncSwitch()}onUpdatePrices(){let t=this.shippingStore;this.$shipping.find(".form-field-shipping-item").each((e,i)=>{let s=i.getAttribute("data-shipping"),n=$(i),a=n.find(".item-price"),o=n.find(".delimiter"),r=n.find(".form-field-shipping-item__min-total"),c=n.find(".min-total"),l=t.getPrice(s);if(!l.notHasFree&&(!l.untilFree||!l.notFixedPrice)?(a.text(l.currentFormatted),o.text("\u2013")):(a.text(""),o.text("")),l.minTotal){let d=`${flexbe_cli.locale.tr("form::delivery_min_total_tip",{sum:l.minTotalFormatted})}`;c.text(d),r.show()}else r.hide()}),this.updateDiscountBadges()}updateDiscountBadges(){let t=this.$shipping;t.find(".form-field-switch-item").each((e,i)=>{let s=$(i),n=s.find("input[type=radio]").val(),a=s.find(".form-field-switch-item__discount"),o=this.getAppliedGroupDiscount(n);if(!o){flexbe_cli.tip.destroy(a[0]),a.removeAttr("data-tip").attr("hidden","true");return}let r=this.formatDiscountBadgeText(o);a.attr("hidden",null).attr("data-tip",r),flexbe_cli.tip.init(a[0],{content:r})}),t.find(".form-field-shipping-item").each((e,i)=>{let s=$(i),n=i.getAttribute("data-shipping"),a=s.closest("[data-shipping-type]").attr("data-shipping-type"),o=s.find(".form-field-shipping-item__discount");if(!n||a!=="delivery"&&a!=="pickup"){o.text("").attr("hidden","true");return}let r={id:n,type:a},c=this.promotionStore?.getBestDiscountForMethod(r);c&&vt(gt(c))?o.text(this.formatDiscountBadgeText(c)).attr("hidden",null):o.text("").attr("hidden","true")})}getAppliedGroupDiscount(t){if(t!=="delivery"&&t!=="pickup")return null;for(let e of this.shippingStore.getList(t)){let i=this.promotionStore?.getBestDiscountForMethod({id:String(e.id),type:t}),s=gt(i);if(vt(s)&&s[t]?.all===!0)return i}return null}formatDiscountBadgeText(t){return`${t.discount_type==="percent"?`\u2212${+t.discount_amount}%`:`\u2212${flexbe_cli.locale.formatMoney(t.discount_amount)}`} ${flexbe_cli.locale.tr("form::shipping::discount_on_order")}`}},oi=class extends b{static is="form";id;eventId;busy;submitDisabled;products;paymentData;formInited;observable;$form;$formSubmit;$button;$minSumContainer;$fields;$listField;action;payProducts;isInline;noSend;inCart;inModal;$masked;$calendars;$file;hasCalculatorField;$itemTemplateFile;hasMaskedField;hasCalendarField;pays;captcha=null;captchaSubmitToken;shippingManager=null;calculator;constructor(...t){super(...t),this.id=this.$component.closest("[data-id]").attr("data-id"),this.eventId=`.${this.id}`,this.busy=!1,this.submitDisabled=!1,this.products=null,this.paymentData=null,this.formInited=!1,this.captchaSubmitToken=null,this.observable=new J(this),this.$form=this.$component.is("form")?this.$component:this.$component.find("form"),this.$formSubmit=this.$component.find(".form-submit"),this.$button=this.$formSubmit.find(".component-button"),this.$minSumContainer=this.$formSubmit.find(".cart-min-sum-text"),this.$fields=this.$component.find(".form-fields"),this.$listField=this.$component.find(".form-field"),this.action=this.$component.find('input[name="action"]').val(),this.payProducts=this.$component.find('input[name="products"]').val(),this.isInline=this.$component.attr("data-inline")?1:0,this.noSend=this.$component.attr("data-no-send")?1:0,this.inCart=!!this.$form.attr("data-cart"),this.inModal=this.$component.closest(".m_modal").length>0,this.$masked=this.$component.find("[data-mask]"),this.$calendars=this.$component.find("[data-calendar]"),this.$file=this.$component.find(".file-input-outer"),this.hasCalculatorField=!!this.$component.find('[data-type="result"]').length,this.$file.length&&(this.$itemTemplateFile=this.$itemTemplateFile||this.$file.find("template").clone()),this.$masked.length&&(this.hasMaskedField=!0,this.require.push("/_s/lib/imask/imask.min.js")),this.$calendars.length&&(this.hasCalendarField=!0,this.require.push("/_s/lib/scroll-lock/scroll-lock.min.js"),this.require.push("/_s/lib/calendar/dist/js/calendar.js?v2.3.13","/_s/lib/calendar/dist/css/calendar.min.css?v2.3.5"))}onLoad(){(this.core.wasScreen||this.core.wasBeside)&&(this.hasMaskedField&&this.inputMask(),this.hasCalendarField&&this.inputDate()),flexbe_cli.events.trigger("form_event",{type:"form_inited",formId:this.id})}async onScreen({state:t}){if(!t)return!1;await this.formInit()}async onBeside({state:t}){if(!t)return!1;await this.formInit()}onOpen(t={}){let{top:e}=this.component.getBoundingClientRect();!flexbe_cli.run.is_screen_mobile&&flexbe_cli.run.is_preview&&flexbe_cli.resize.viewportHe
57ight>e+100&&this.$component.find(".form-field").eq(0).find("input, textarea").eq(0).focus(),t?.data&&this.setData(t.data)}onResize(){this.$component.find(".range-outer").trigger("resize")}async formInit(){if(this.formInited)return!1;this.formInited=!0,this.$form.attr("action",`/mod/project/${flexbe_cli.group_id}/lead/send/`),this.unbindEvents(),this.bindEvents(),this.noSend||await this.initCaptcha(),this.customize()}customize(){this.fileInput(),this.customSelect(),this.textResize(),this.inputRange(),this.inputNumber(),this.shippingField(),Ke(this.$component),Je(this.$component),Qe(this.$component),this.hasCalculatorField&&this.initCalculator(),this.hasMaskedField&&this.isLoaded&&this.inputMask(),this.hasCalendarField&&this.isLoaded&&this.inputDate(),this.$component.find(".form-field-range").trigger("resize")}unbindEvents(){this.$component.off(this.eventId),this.$form.off(this.eventId)}bindEvents(){let t=this.$component.find('.form-field-text__input, .form-field-text__textarea, .form-field-range__input, input[type="checkbox"], input[type="radio"]'),e=this.$component.closest(".scroller");t.on(`keydown${this.eventId}`,i=>{let s=i.key||"",n=s==="Enter",a=i.ctrlKey||i.metaKey,o=i.currentTarget,r=o.getAttribute("data-check");if(n){if(o.tagName==="TEXTAREA")return;i.preventDefault();let c=t.index(i.currentTarget),l=t.eq(c+1);l.length?l.trigger("focus"):this.$form.trigger("submit")}if(r==="phone"&&!o._mask&&!a&&s.length===1&&/[^\d ()+-]/.test(s)||r==="email"&&/[\s,]/.test(s))return!1}),t.on(`input${this.eventId} change${this.eventId}`,i=>{let s=i.currentTarget,n=$(s);n.attr("value",s.value),Ye(n),this.handleFieldChange(i,s)}),this.$component.find("select").on(`change${this.eventId}`,i=>{let s=i.currentTarget,n=$(s).find("option:selected")[0];this.handleFieldChange(i,n)}),this.hasCalendarField&&(this.inModal||this.inCart)&&setTimeout(()=>{let i=this.$calendars.toArray().map(s=>$(s).data("calendar")).filter(s=>s);e.on(`scroll${this.eventId}`,()=>{i.forEach(s=>s.main.toPosition())})},150),this.$formSubmit.find('button[type="button"]').on(`click${this.eventId}`,()=>{this.$form.trigger("submit")}),this.$form.off("submit").on(`submit${this.eventId}`,i=>((async()=>{let n=Ne("submit",this.$form[0]),a=await this.trigger("submit",n);if(n.defaultPrevented||a.some(o=>o===!1))return!1;try{await this.sendForm()}catch(o){alert(o instanceof Error?o.message:String(o))}})(),i.preventDefault(),i.stopPropagation(),!1))}setData(t){if(!t)return!1;t?.fields&&(this.resetFields("flexbe"),this.addFields(t.fields)),t?.items&&this.addItems(t.items)}on(t,e){return this.observable.on(t,e),this}one(t,e){return this.observable.one(t,e),this}off(t,e){return this.observable.off(t,e),this}async trigger(t,...e){return this.observable.trigger(t,...e)}addFields(t,e="flexbe"){let i=this.$component.find(".form-fields-advanced");t.length&&t.forEach(s=>{i.find(`input[name="${s.name}"][data-namespace="${e}"]`).remove();let n=$("<input>").attr("type",s.type).attr("data-namespace",e).attr("name",s.name);if(s.type==="file"&&s.value){let a=Array.isArray(s.value)?s.value:[s.value];n.attr("data-value",JSON.stringify(a))}else n.attr("value",String(s.value));i.append(n)})}resetFields(t){let e=this.$component.find(".form-fields-advanced");e[0]&&(t?e.find(`input[data-namespace="${t}"]`).remove():e.empty())}addItems(t=[]){if(!t?.length){this.products=null;return}let e=0;this.products=t.map(i=>typeof i!="object"?{}:(i.price=i.price==null?null:parseFloat(String(i.price))||0,i.title=typeof i.title=="string"&&i.title.trim()||i.title||"",e+=(i.price??0)*i.count||0,i)
57)||[],e&&(this.pays={price:e,desc:""})}async sendForm(t=!1){if(this.noSend||this.submitDisabled||this.busy||!this.validateForm())return!1;this.captcha&&t&&(this.captcha.reset(),this.resetCaptchaSubmitToken());let e=this.captcha?.getToken();if(this.captcha?.enabled&&!this.captcha.isOptional&&!e){if(this.captcha.isInvisible){this.captchaInvisibleRun();return}if(this.captcha.inModal){await this.captchaModalRun();return}}this.addSubmitting();let i=Oe(this.$form.get(0)),s=i.id;if(i.is_ajax=!0,s&&!s.includes("cart_")&&(i.forceUpdateProduct=!0),delete i.products,this.products)i.products=JSON.stringify(this.products);else if(this.action==="pay"&&this.payProducts){let o=JSON.parse(this.payProducts),r;if(o=Array.isArray(o)?o[0]:o,o.productId){let c=flexbe_cli.ecommerce.productsStore.getProduct(o.productId);if(c){let l=c.currentVariant(o.variantId).getCartData("image");r=[{...l,count:1,img:D(l.img[0]),strict:o.strict,id:`product_${o.productId}:${o.variantId||"default"}`}]}}else o.title&&(String(o.price).startsWith("<form-result")&&(o.price=Ht(o.price),o.price=parseFloat(o.price.replace(",",".").replace(/\s/g,""))),r=[{id:`${flexbe_cli.p_id}_${flexbe_cli.s_id}`,title:o.title,img:o.img&&D(o.img),price:o.price==null?null:parseFloat(o.price)||0,count:1}]);!flexbe_cli.ecommerce.settings.allowPriceless&&r[0].price==null&&(r=null),r&&(i.products=JSON.stringify(r)),this.pays={price:o.price,desc:o.title}}i.jsform=448312,i.pageId||(i.pageId=String(flexbe_cli.p_id)),flexbe_cli.stat.u_id&&(i.userId=flexbe_cli.stat.u_id),i.utmData=JSON.stringify(flexbe_cli.utm.data),"roistat"in window&&(i.roistatVisit=window.roistat.visit),i.abTest=JSON.stringify(flexbe_cli.stat.AB.getCookie()),e&&(i["captcha-token"]=e),Array.isArray(i.fields)&&i.fields.forEach(o=>{typeof o.value=="string"&&o.value.includes("<form-result")&&(o.value=Ht(o.value))});let n=this.$form.attr("action"),a={type:"POST",dataType:"json",contentType:"application/json",data:JSON.stringify(i)};try{let o=await flexbe_cli.helpers.fetch(n,a);o.pay!=null&&(this.paymentData=o.pay),await this.showDone(i,o),this.captchaRemoveError(),this.action!=="redirect"&&this.clearSubmitting(!0)}catch(o){let r=o?.data;if(r?.captcha){if(this.captcha)e?this.captchaAddError():this.captcha.isVisible?(this.captcha.inModal=!0,await this.captchaModalRun()):this.captcha.isInvisible&&(this.captcha.isOptional=!1,this.captchaInvisibleRun());else{let c=r.captcha==="visible";await this.initCaptcha({enabled:!0,visible:c,isOptional:!0}),c?await this.captchaModalRun():(this.captcha.isOptional=!1,this.captchaInvisibleRun())}return}await this.sendFormError(o)}}async sendFormError(t){if(this.clearSubmitting(),console.error("sendForm error: ",t),(await this.trigger("requestError",t)).some(e=>e===!1))return!1;t.status&&t.status===500&&alert("Network error")}addSubmitting(){this.busy=+Date.now(),this.$component.addClass("submitting"),this.$button.addClass("submitting")}clearSubmitting(t=!1){this.busy&&(this.$component.removeClass("submitting"),this.$button.removeClass("submitting"),t?(this.$component.addClass("success"),this.$button.addClass("success"),this.$component.find(".file-list").empty(),this.$component.find("input.value").remove(),setTimeout(()=>{this.busy=!1,this.$component.removeClass("success"),this.$button.removeClass("success")},1e3)):this.busy=!1)}async showDone(t,e={}){let i={...t,leadId:e.lead_id,pays:e.pay};["is_ajax","captcha-token","roistatVisit","jsform","goal_html","goal","forceUpdateProduct","action","utmData","abTest","pay[price]","pay[desc]","results","fileOriginal","g-recaptcha-response"].forEach(r=>{delete i[r]});let s=this.pays?.price||this.products?.reduce((r,c)=>r+(Number(c.price)||0)*(Number(c.count)||1),0)||0,n={leadId:e.lead_id,formData:i,form_id:this.id,form_name:this.$form.attr("name")||this.$component.attr("data-name")||"",form_destination:this.$form.attr("action")||"",form_submit_text:this.$button.text()?.trim()||"",...s?{currency:flexbe_cli.vars.site.currencyData.code,value:s}:{}};flexbe_cli.stat.goals.reachGoals({mainGoal:flexbe_cli.stat.goals.getGoal("order_done"),goal:this.$component.find('input[name="goal"]').val(),htmlGoal:this.$component.find('textarea[name="goal_html"]').val()},n),this.savePurchaseSnapshot();let a=new Event("submitted",{bubbles:!0}),o=await this.trigger("submitted",a);if(a.defaultPrevented||o.some(r=>r===!1))return!1;if(this.action==="close")await flexbe_cli.events.trigger("ui_modal_close");else if(this.action==="pay")if(typeof this.paymentData<"u"&&this.paymentData!==null){if(this.paymentData.pay_link.length>0){let r=`${window.location.origin+window.location.pathname+(window.location.search?`${window.location.search}&`:"?")}pay_id=${this.paymentData.pay_id}&h=${this.paymentData.pay_hash}`;try{window.history.pushState(null,null,r),setTimeout(async()=>{await flexbe_cli.events.trigger("pay",{action:"init"})},200)}catch{setTimeout(()=>{document.location=r},500)}}}else window.location.hash="pay",await flexbe_cli.events.trigger("pay",{action:"success",withoutPay:!0});else if(this.action==="redirect"){let r=this.$component.find('input[name="action_redirect"]'),c="";r?.length&&(c=r.val()),c&&setTimeout(()=>{flexbe_cli.helpers.gotoLink(c),this.clearSubmitting(!0)},500)}else if(this.action==="code"){if(!flexbe_cli.run.is_preview)return;(async c=>{let l=this.$component.data("code")||"",d=Object.getPrototypeOf(async()=>{}).constructor;await new d("formData",l)(c)})(i).catch(c=>{console.error("Error executing action code:",c)})}else if(this.action==="modal"){let r=this.$component.find("[data-modal-id]").attr("data-modal-id"),c=this.$component.closest("[data-page-id]").attr("data-page-id");/^(form|done)$/.test(r)&&!flexbe_cli.modal.find(r,c)&&(r=`${String(this.id
57).split("_")[0]}_${r}`),await flexbe_cli.events.trigger("ui_modal_open",{id:r,pageId:c})}this.$form.get(0).dispatchEvent(a),this.resetForm()}savePurchaseSnapshot(){let t=this.paymentData?.pay_id;if(!t)return;let e=this.products;if(!e?.length&&this.payProducts)try{let i=JSON.parse(this.payProducts);e=Array.isArray(i)?i:[i]}catch{e=null}(e?.length||this.paymentData?.pay_hash)&&flexbe_cli.stat.ecommerce.savePurchaseSnapshot(t,e,this.paymentData?.pay_hash,this.pays?.price?{value:Number(this.pays.price)||0}:{})}resetForm(){this.$component.find(".file-input-outer").removeClass("active");let t=this.$fields.find("input, textarea, select"),e=t.not("select").not('[type="hidden"]').not(".form-field-range__input").not(".g-recaptcha-response"),i=t.filter("select"),s=t.filter(".form-field-range__input");i.each((n,a)=>{O.getInstance(a).reset()}),s.each((n,a)=>{a.value=a.getAttribute("data-value"),a.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),e.each((n,a)=>{let r=a.defaultChecked;if(["radio","checkbox"].includes(a.type))r?a.setAttribute("checked","checked"):a.removeAttribute("checked"),a.checked=r;else{a.removeAttribute("value"),a.value="",a.removeAttribute("data-mask-complete");let c=a._mask;
57c&&c.updateValue()}a.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),this.captcha?.enabled&&(this.captcha.reset(),this.resetCaptchaSubmitToken(),this.captchaRemoveError()),this.paymentData=null,Z(),this.$form.get(0).reset(),this.resetFields(),this.hasCalculatorField&&(this.calculator.destroy(),this.initCalculator())}validateForm(){let t=!0,e=!0,i=!0;this.removeFieldsErrors(),this.$component.find(".policy-data-warning--checkbox").each((n,a)=>{let o=$(a),r=o.find(".policy-data-warning__input")[0];r&&!r.checked&&(t=!1,o.addClass("is_error"))}),this.$component.find(".form-field[data-type]:not([data-hidden])").each((n,a)=>{let o,r=$(a),c=r.find("input, textarea, select").not('[type="hidden"]'),l=c[0],d=r.attr("data-type");if(!l&&!["captcha","html"].includes(d))return;let h=l?.getAttribute("data-type")||l?.type,p=h==="file"?!!r.find("input.value")[0]:!!l?.value;if(["radio","checkbox"].includes(h)&&(p=c.toArray().some(u=>u.checked)),!l&&d==="html"&&(p=r.closest(".form-fields").prev(".form-fields-advanced").length>0),d==="captcha"){if(!this.captcha)return;o=this.captcha.getToken()?!1:flexbe_cli.locale.tr("form::captcha_not_checked")}else o=this.checkField(r,c);o&&(Ge(a,o),e=!1),i&&p&&d!=="captcha"&&(i=!1)}),this.$fields.removeClass("all-fields-empty"),this.$fields.outerWidth(),e||this.$fields.addClass("has-error");let s=this.$component.find(".is_error");return s.addClass("animate"),setTimeout(()=>{s.removeClass("animate")},500),i&&(this.$fields.toggleClass("all-fields-empty",i),e=!1),e&&t}checkField(t,e){let i=e[0];if(!i||i.disabled||i.hidden)return!1;let s=i.getAttribute("data-type")||i.type,n=i.value.trim(),a=!0;["radio","checkbox"].includes(s)&&(a=e.toArray().some(d=>d.checked));let o=i.required,r=i.getAttribute("data-check")||!1,c=i._mask&&i.getAttribute("data-mask")||!1,l=o&&(!n||!a)?"form::required":!1;if(c)!o&&!n||i.getAttribute("data-mask-complete")||(["tel","phone"].includes(s)&&n?l="form::phone":s==="text"&&n?l="form::text":l="form::required");else if(r){if(r==="date"||r==="datetime"){let d=$(i).data("calendar")?.input.checkError();d&&(l=d)}else if(n.length&&r==="email")/^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\wÐÐ-ÑÑ-]+\.)+[A-Za-zÐÐ-ÑÑ]{2,}))$/.test(n)||(l="form::email");else if(n.length&&r==="phone")/[^\d\s()+-]/.test(n)?l="form::digits":n.replace(/\D/g,"").length<5&&(l="form::phone_minlength");else if(r==="file"){let d=t.find("input.value");o&&!d.length?l="form::required":t.hasClass("loading")?l="form::loading":l=!1}}return l=l&&flexbe_cli.locale.tr(l)||!1,l}removeFieldsErrors(){this.$fields.removeClass("has-error"),this.$component.find(".is_error").removeClass("is_error animate"),this.$component.find(".allocate-space-for-error").removeClass("allocate-space-for-error"),this.$fields.outerWidth()}disableSubmit(t=""){this.submitDisabled=!0,this.$button.attr("disabled","disabled"),t&&(flexbe_cli.run.is_mobile?this.$minSumContainer.text(t):this.$button.attr("data-tip",t||""),flexbe_cli.tip.init(this.$button[0]))}enableSubmit(){this.submitDisabled=!1,flexbe_cli.run.is_mobile?this.$minSumContainer.empty():this.$button.removeAttr("data-tip"),this.$button.removeAttr("data-tip disabled"),flexbe_cli.tip.destroy(this.$button[0])}async initCaptcha(t){this.captcha||(this.captcha=new it({...t,id:this.id,form:this.$component[0],inModal:this.isInline,onSuccess:async e=>{this.acceptCaptchaToken(e)&&(this.captchaRemoveError(),this.clearSubmitting(),(this.captcha.inModal||this.captcha.isInvisible)&&await this.sendForm())},onError:()=>{this.captchaAddError()}}),await this.captcha.init(),this.captcha.enabled&&await this.captcha.renderCaptcha({target:"form"}))}acceptCaptchaToken(t){return!t||this.captcha?.getToken()!==t||this.captchaSubmitToken===t||this.busy&&this.captchaSubmitToken?!1:(this.captchaSubmitToken=t,!0)}resetCaptchaSubmitToken(){this.captchaSubmitToken=null}captchaAddError(t){if(!this.captcha?.enabled)return;this.resetCaptchaSubmitToken(),t==null&&(t=flexbe_cli.locale.tr("form::captcha_error"));let e=this.$component.find(".captcha-global-error");e.find(".error-text").text(t),e.addClass("show"),this.busy&&this.clearSubmitting()}captchaRemoveError(){if(!this.captcha?.enabled)return;let t=this.$component.find('.form-field[data-type="captcha"]'),e=this.$component.find(".captcha-global-error");t.removeClass("is_error allocate-space-for-error"),e.removeClass("show")}async captchaModalRun(){!this.captcha?.enabled||!this.captcha.loaded||await this.captcha.renderCaptcha({target:"modal"})}
57captchaInvisibleRun(){if(!this.captcha?.enabled||!this.captcha.loaded||this.captcha.isVisible)return;this.addSubmitting(),this.captcha.runInvisibleChallenge();let t=this.busy;setTimeout(()=>{t===this.busy&&this.clearSubmitting()},2500)}fileInput(){let t=this.$component,e=this.eventId,i=this.$itemTemplateFile?.html();X(t,e,i)}textResize(){this.$component.find(".autosize").each((t,e)=>{let i=e.offsetHeight-e.clientHeight,s=$(e),n=getComputedStyle(e),a=+s.attr("rows")||0,o=parseInt(n.borderTop,10)+parseInt(n.borderBottom,10),r=parseInt(n.paddingTop,10)+parseInt(n.paddingBottom,10),c=Math.round(+n.lineHeight.split("px")[0]);if(flexbe_cli.run.is_ios){let d=parseInt(n.textSizeAdjust||n.webkitTextSizeAdjust||"120%",10)/100;c/=d}s.removeAttr("data-autoresize"),s.off(".autoresize").on("keyup.autoresize input.autoresize",l),s.css("minHeight",`${o+r+c*a}px`);function l(d){let h=d.currentTarget;h.style.height=`${h.scrollHeight+i}px`}})}customSelect(){this.$component.find(".dropdown-container").remove();let t=this.$component.find("select.atom-custom-select"),e={dropdownClass:this.$component.hasClass("style-underlined")?`sharp size--medium select-container-${this.id} `:`size--medium select-container-${this.id}`};t.each((i,s)=>{let n=$(s).closest('[data-type="select"]');jt({$field:n,selector:"option",attribute:"selected",attrValue:"selected"});let a=()=>{n.removeClass("active")},o=()=>{n.addClass("active"),n.siblings('[data-type="select"]').removeClass("active")};O.create({element:s,config:e,onCollapse:a,onActivate:o})})}shippingField(){this.shippingManager=new ai({$component:this.$component,id:this.id})}inputRange(){this.$component.find(".form-field-range").each((t,e)=>new et($(e)))}inputNumber(){this.$component.find('[data-type="number"]').each((t,e)=>new ze($(e)))}initCalculator(){try{this.calculator=new Be({formInstance:this}),this.calculator.init()}catch(t){console.error(t)}}inputMask(){return typeof IMask>"u"?!1:(this.hasMaskedField=!1,this.$masked.each((t,e)=>{tt(e);let i=!!e.getAttribute("data-placeholder"),s=e._mask;i&&s&&($(e).on(`focus${this.eventId}`,()=>{s.updateOptions({lazy:!1})}),$(e).on(`blur${this.eventId}`,()=>{if(!s.unmaskedValue){let n=s.mask.replace(/\*/g,"_"),a=s.value;s.updateOptions({lazy:!0}),(!s.masked.rawInputValue||n===a)&&(s.unmaskedValue="",s.value="",s.updateValue())}}))}),!0)}inputDate(){this.hasCalendarField=!1;let t=this.$component.closest(".scroller")[0];return this.$calendars.each((e,i)=>{Q(i,t)}),!0}handleFieldChange(t,e){this.calculator&&this.calculator.onFieldChange(t,e),flexbe_cli.events.trigger("form_event",{type:"field_changed",formId:this.id,element:e})}},Gt=class extends oi{};flexbe_cli.entity.setClientJs("element","form01",{components:[Gt]});flexbe_cli.entity.setClientJs("element","html01",{isPure:!0});flexbe_cli.entity.setClientJs("element","logo01",{isPure:!0});function Yt(t){t.params.virtualTranslate=!0,t.params.cssMode=!1,t.params.slidesPerGroup=1,t.params.spaceBetween=0,t.fadeTransitionId=0,t.fadeTransitionTimer=null;function e(s,n){let{slides:a,slidesSizesGrid:o}=s,r=[],c=0;for(let l=0;l<a.length;l+=1)r.push(c),c+=o[l]||0;return n>0&&r.length>1&&(r[r.length-1]=n),r}function i(s){!t||t.destroyed||s!==t.fadeTransitionId||(t.fadeTransitionTimer&&(clearTimeout(t.fadeTransitionTimer),t.fadeTransitionTimer=null),t.animating=!1,$(t.wrapperEl).trigger("transitionend"))}t.on("init",st(()=>{$(t.el).addClass("swiper-effect-fade")})),t.on("setTransition",(s,n)=>{s.params.effect==="fade"&&(s.fadeTransitionDuration=n,s.slides.transition(n))}),t.on("setTranslate",(s,n)=>{let{slides:a,slidesSizesGrid:o}=s;if(s.params.effect!=="fade"||Number.isNaN(n))return;$(s.wrapperEl).css("transform","");let r=s.minTranslate(),c=s.maxTranslate(),l=Number.isFinite(r)&&Number.isFinite(c),d=e(s,l?r-c:0),h=l?Math.min(r,Math.max(n,c))-r:n;for(let v=0;v<a.length;v+=1){let w=s.slides.eq(v),x=o[v]||0,T=x?-(d[v]+h)/x:0;w.css({left:`-${v*100}%`,opacity:Math.min(Math.max(1-Math.abs(T),0),1)})}let p=++s.fadeTransitionId,u=Number(s.fadeTransitionDuration)||0;if(s.fadeTransitionTimer&&(clearTimeout(s.fadeTransitionTimer),s.fadeTransitionTimer=null),!u){s.animating=!1;return}let f=!1,m=s.slides,g=()=>{f||(f=!0,i(p))};m.transitionEnd(g),s.fadeTransitionTimer=setTimeout(g,u+50)}),t.on("destroy",()=>{t.fadeTransitionTimer&&(clearTimeout(t.fadeTransitionTimer),t.fadeTransitionTimer=null)})}function ri(t){t.params.virtualTranslate=!0,t.params.cssMode=!0}var $t="story-active",Kt="story-autoplay-running",li=class{constructor(t,e={}){this.el=t,this.options=e,this.frame=null,this.frameId=0,this.activeIndex=null,this.delay=0,this.progress=0,this.running=!1}update({restart:t=!1}={}){if(!this.el)return;let e=Array.from(this.el.querySelectorAll(".swiper-pagination-bullet"));if(!e.length)return;let i=Math.max(0,Math.min(e.length-1,this.options.getIndex?.()||0)),s=this.options.getDelay?.()||0,n=s>0&&!!this.options.isRunning?.(),a=e[i],o=i!==this.activeIndex,r=s!==this.delay,c=t||o||r||!this.running&&n;if(n?c&&(this.progress=0):this.progress=1,this.activeIndex=i,this.delay=s,this.running=n,this.stopProgress(),this.el.classList.toggle(Kt,n),e.forEach((l,d)=>{l.classList.remove($t);let h=this.getBulletProgress(d,i);l.style.setProperty("--storyProgress",String(h)),d===i&&l.classList.add($t)}),!!a){if(!n){a.style.setProperty("--storyProgress",String(this.getBulletProgress(i,i)));return}this.startProgress(a,s)}}startProgress(t,e){let i=performance.now()-this.progress*e,s=++this.frameId,n=a=>
57{if(!this.el||!t.isConnected||s!==this.frameId)return;let o=Math.max(0,Math.min(1,(a-i)/e));this.progress=o,t.style.setProperty("--storyProgress",String(o)),o<1&&this.options.isRunning?.()&&(this.frame=requestAnimationFrame(n))};t.style.setProperty("--storyProgress",String(this.progress)),this.frame=requestAnimationFrame(n)}getBulletProgress(t,e){return t<e&&this.options.fillPrevious?1:t!==e?0:this.progress}stopProgress(){this.frameId+=1,this.frame!=null&&(cancelAnimationFrame(this.frame),this.frame=null)}destroy(){this.el&&(this.stopProgress(),this.activeIndex=null,this.delay=0,this.progress=0,this.running=!1,this.el.classList.remove(Kt),this.el.querySelectorAll(".swiper-pagination-bullet").forEach(t=>{t.classList.remove($t),t.style.removeProperty("--storyProgress")}),this.el=null)}},wt="swiper-slide",Jt="none",_t="slide",Qt="fade",ci="[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]",di={[Jt]:0,[Qt]:200},xt="click.sliderManualNavigation",hi="click.sliderThumbsNavigation",ui=6;function pi(){return window.matchMedia?.("(hover: hover) and (pointer: fine)").matches??!flexbe_cli.run.is_touch}function fi(t){let e=Number(flexbe_cli.resize?.zoom);return t.clientX/(Number.isFinite(e)&&e>0?e:1)}var Xt=class extends b{static is="slider";require=["/_s/lib/swiper8/dist/swiper-bundle.min.js?v848"];constructor(...t){super(...t);let{component:e}=this;this.swiper=null,this.initialSlide=0,this.index=$(e).closest("[data-item-id]").attr("data-item-id"),this.sliderEl=e.classList.contains("swiper")?e:e.querySelector(".swiper"),this.paginationEl=e.querySelector(".slider-pagination"),this.storyPagination=null,this.prevEl=e.querySelector('.slider-prev, [data-direction="prev"]'),this.nextEl=e.querySelector('.slider-next, [data-direction="next"]'),this.$component.on("bringIntoView",i=>{let s=this.swiper,n=$(this.sliderEl).find(`.${wt}`),a=$(i.target).closest(`.${wt}`),o=n.index(a);s&&!s.destroyed&&(s.wrapperEl||s.$wrapperEl)?o!==-1&&s.slideTo(o):this.initialSlide=o}),this.setSwiperOptions()}onLoad(){this.inScreen&&!this.swiper&&this.initSwiper()}onScreen({state:t}){!t||!this.isLoaded||this.swiper||this.initSwiper()}onView({state:t}){this.isLoaded&&(t&&!this.swiper&&this.initSwiper(),this.swiper&&this.toggleAutoplay({state:t}))}onResize(){this.swiper&&(this.setSliderSize(),this.setThumbnailsSize(),this.swiper&&this.swiper.initialized&&this.swiper.update())}onDestroy(){this.destroySwiper()}onHideShowUI(t){this.setSwiperOptions(t!=="editor"),this.destroySwiper(),this.initSwiper()}setSwiperOptions(t=flexbe_cli.run.is_preview){let e=this.paginationEl&&this.paginationEl.getAttribute("data-type")||"bullets",i=this.paginationEl&&this.paginationEl.getAttribute("data-direction")||"horizontal",s=!!Number(this.$component.attr("data-loop")),n=Number(this.$component.attr("data-autoplay")),a=this.$component.attr("data-parallax");this.options={paginationType:e,direction:i,count:this.$component.attr("data-count"),loop:t&&s,autoplay:t&&n||!1,effect:(this.$component.attr("data-effect")||_t).toLowerCase(),parallax:a!=null&&!["0","false"].includes(String(a)),navigationMode:this.$component.attr("data-navigation-mode")||"buttons",storyFillPrevious:!!Number(this.$component.attr("data-story-fill-previous")),slidesPerView:"auto"}}initSwiper(){if(this.swiper||typeof Swiper>"u")return!1;let{options:t,component:e,core:i,root:s,index:n,sliderEl:a,paginationEl:o,prevEl:r,nextEl:c}=this,l=`${i?.id||"-"}:${n}`,{count:d,loop:h,paginationType:p,direction:u}=t,f=t.effect===Jt,m=!!a.querySelector(ci),g=t.effect===_t&&(t.parallax||m),v=f?_t:t.effect,w=flexbe_cli.theme_id===4,x=p==="story"?"bullets":p;g&&e.setAttribute("data-parallax","1");let T=this.owner.closest(".swiper-inited"),j=t.autoplay?{delay:t.autoplay*1e3,stopOnLastSlide:!h,disableOnInteraction:!1,waitForTransition:!1}:!1,N=this.initialSlide;flexbe_cli.run.is_preview||(s._sliderState?s._sliderState[l]&&(N=Math.max(0,Math.min(d-1,s._sliderState[l])||0)):s._sliderState={},s._sliderState[l]=N);let rt={el:o,type:x,clickable:!0,dynamicBullets:w&&p==="bullets",dynamicMainBullets:3};p==="thumbs"&&(rt.type=!1,rt.el=null,this.thumbsSwiper=new Swiper(o,{cssMode:!0,loop:!1,slidesPerView:"auto",normalizeSlideIndex:!1,direction:u}));let y=new Swiper(a,{init:!1,speed:f?0:350,nested:T,slideClass:wt,initialSlide:N,autoplay:j,pagination:rt,thumbs:{swiper:this.thumbsSwiper},navigation:{prevEl:r,nextEl:c},effect:v,parallax:{enabled:g}
57,rewind:h,roundLengths:!0,preventInteractionOnTransition:!1,updateOnWindowResize:!1,watchSlidesProgress:g,slidesPerView:t.slidesPerView,simulateTouch:!flexbe_cli.run.is_touch&&flexbe_cli.run.is_preview,longSwipesMs:100,longSwipesRatio:.1,preloadImages:!1,touchReleaseOnEdges:!1,runCallbacksOnInit:!1});this.swiper=y,v===Qt?Yt(y):w&&ri(y),y.onAny((C,_)=>{y.el.dispatchEvent(new CustomEvent(`swiper:${C}`,{detail:_,bubbles:!1,cancelable:!0}))}),y.on("init",()=>{if(!y.slides)return;this.setSliderSize(),this.setThumbnailsSize(),this.swiper!=null&&this.swiper.$el.addClass("swiper-inited"),$(r).add(c).add(o).removeClass("disabled"),this.updateControlsContrast();let C=y.slides[N],_=y.visibleSlides||[y.slides[N]];this.thumbsSwiper&&this.thumbsSwiper.visibleSlides?.length&&_.push(...this.thumbsSwiper.visibleSlides),H(_),C&&R(C,!1,"sliderActivate"),this.toggleAutoplay({state:this.inView}),this.updateStoryPagination()}),this.thumbsSwiper&&this.thumbsSwiper.on("slideChange",$.debounce(C=>{H(C.visibleSlides)},50)),y.on("slideChange",$.debounce(()=>{if(!y.initialized)return;flexbe_cli.run.is_preview||(s._sliderState[l]=y.realIndex);let C=y.slides[y.previousIndex],_=y.slides[y.activeIndex],ie=_&&(_.getAttribute("data-slider-type")||_.getAttribute("data-type")),se=y.previousIndex<y.activeIndex?Array.from(y.slides).slice(y.activeIndex,y.activeIndex+2):Array.from(y.slides).slice(y.activeIndex-2,y.activeIndex);e.setAttribute("data-current-content",ie),R(C,null,"sliderDeactivate"),R(_,null,"sliderActivate"),H(se),this.updateControlsContrast(),this.updateStoryPagination()},50)),y.on("touchStart",()=>{$(a).addClass("swiper-in-interacting"),this.toggleAutoplay({state:!1})}),y.on("touchEnd",()=>{$(a).removeClass("swiper-in-interacting")}),this.$component.off("reduceSliderControls").on("reduceSliderControls",(C,{state:_=!0})=>{this.preventAutoplay=!!_,this.preventAutoplay&&this.toggleAutoplay({state:!1})}),this.$component.off("pointerenter").one("pointerenter",()=>{let C=Array.from(y.slides||[]);H([y.activeIndex-1,y.activeIndex+1].map(_=>C.at(_)))}),this.$component.off("pointerleave.sliderAutoplay").on("pointerleave.sliderAutoplay",()=>{this.toggleAutoplay({state:this.inView})}),$(r).add(c).add(o).off("click.sliderAutoplay").on("click.sliderAutoplay",()=>{this.toggleAutoplay({state:!1})}),this.initManualNavigation(),this.initThumbsNavigation(),y.on("paginationRender paginationUpdate autoplayStart autoplayStop autoplayPause autoplayResume",()=>{this.updateStoryPagination()}),this.initStoryPagination(),this.initHoverNavigation(),Nt(()=>y.init())}destroySwiper(){if(this.$component.off("pointerleave.sliderAutoplay"),this.$component.off(".sliderHoverNavigation"),this.$hoverNavigationArea?.off(".sliderHoverNavigation"),this.$hoverNavigationArea=null,$(this.prevEl).add(this.nextEl).add(this.paginationEl).off("click.sliderAutoplay"),$(this.prevEl).add(this.nextEl).off(xt),$(this.paginationEl).off(".sliderThumbsNavigation"),this.resetControlsContrast(),this.destroyStoryPagination(),this.swiper)try{this.swiper.destroy()}catch{}finally{this.swiper=null}}toggleAutoplay({state:t}){let{swiper:e,options:i}=this;if(!e||!i.autoplay||!e.autoplay)return!1;this.preventAutoplay&&(t=!1);let s=e.autoplay.running;t&&!s&&e.autoplay.start(),!t&&s&&e.autoplay.stop(),this.updateStoryPagination()}slideTo(t,e=!0,i=null,s=!1){if(!this.swiper){this.initialSlide=t;return}let n=this.swiper.params.loop,a=e?i??this.swiper.params.speed:0;(s||typeof this.swiper.realIndex<"u"&&this.swiper.realIndex!==t)&&(n?this.swiper.slideToLoop(t,a):this.swiper.slideTo(t,a))}getCurrentSlideIndex(){let t=this.swiper;if(!t)return this.initialSlide||0;if(!t.params.cssMode||!t.wrapperEl)return t.realIndex??t.activeIndex??0;let e=t.isHorizontal()?t.wrapperEl.scrollLeft:t.wrapperEl.scrollTop,i=Array.from(t.slides||[]);if(!i.length)return t.realIndex??t.activeIndex??0;let s=0,n=1/0;i.forEach((r,c)=>{let l=t.isHorizontal()?r.offsetLeft:r.offsetTop,d=Math.abs(l-e);d<n&&(n=d,s=c)});let a=i[s]?.getAttribute?.("data-swiper-slide-index")??i[s]?.getAttribute?.("data-real-index"),o=a==null?NaN:Number(a);return Number.isFinite(o)?o:s}slideToAdjacent(t){let e=Number(this.options.count)||0;if(!this.swiper||e<2)return;let i=Math.max(0,Math.min(e-1,this.getCurrentSlideIndex())),s=i+t;s<0?s=this.swiper.params.loop||this.swiper.params.rewind?e-1:0:s>=e&&(s=this.swiper.params.loop||this.swiper.params.rewind?0:e-1),s!==i&&this.slideTo(s,!0,null,!0)}initManualNavigation(){$(this.prevEl).add(this.nextEl).off(xt).on(xt,t=>{let e=t.currentTarget;if(!e)return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();let i=e.getAttribute("data-direction")==="next"?1:-1;this.slideToAdjacent(i)})}initThumbsNavigation(){if(this.options.paginationType!=="thumbs"||!this.paginationEl)return;let t=$(this.paginationEl),e=null;t.off(".sliderThumbsNavigation").on("pointerdown.sliderThumbsNavigation",".thumb
57-item",i=>{e={x:i.clientX,y:i.clientY}}).on("pointercancel.sliderThumbsNavigation",".thumb-item",()=>{e=null}).on(hi,".thumb-item",i=>{if(e){let n=Math.hypot(i.clientX-e.x,i.clientY-e.y);if(e=null,n>ui)return}let s=Array.from(this.paginationEl.querySelectorAll(".thumb-item")).indexOf(i.currentTarget);s<0||(i.preventDefault(),i.stopPropagation(),this.toggleAutoplay({state:!1}),this.slideTo(s,!0,null,!0))})}initHoverNavigation(){let{swiper:t,options:e,sliderEl:i}=this;if(this.$component.off(".sliderHoverNavigation"),this.$hoverNavigationArea?.off(".sliderHoverNavigation"),this.$hoverNavigationArea=null,!t||e.navigationMode!=="hover"||+e.count<2||!pi())return;let s=null,n=di[e.effect]??t.params.speed,a=()=>this.$component.attr("data-navigation-mode")==="hover",o=t.wrapperEl||i.querySelector(".component-slider__wrapper, .swiper-wrapper")||i,r=$(o),c=()=>{if(!a()){s=null;return}let d=s!=null;s=null,d&&this.slideTo(0,!1,0,!0)},l=()=>{s=null};this.$hoverNavigationArea=r,r.on("pointerenter.sliderHoverNavigation pointermove.sliderHoverNavigation",d=>{if(!t||t.destroyed||!a())return;let h=o.getBoundingClientRect(),p=Number(e.count)||0;if(!h.width||p<2)return;let u=Math.max(0,Math.min(1,(fi(d)-h.left)/h.width)),f=Math.min(p-1,Math.floor(u*p));t.realIndex!==f&&(s=f,this.toggleAutoplay({state:!1}),this.slideTo(f,!0,n))}).on("pointerleave.sliderHoverNavigation pointercancel.sliderHoverNavigation",d=>{if(!a()){s=null;return}if(d.relatedTarget instanceof Element&&this.component.contains(d.relatedTarget)){l();return}c()}),this.$component.on("pointerleave.sliderHoverNavigation pointercancel.sliderHoverNavigation",c)}initStoryPagination(){this.options.paginationType!=="story"||!this.paginationEl||(this.destroyStoryPagination(),this.storyPagination=new li(this.paginationEl,{getIndex:()=>this.swiper?.realIndex||0,getDelay:()=>{let t=this.swiper?.slides?.[this.swiper.activeIndex];return Number(t?.getAttribute?.("data-swiper-autoplay"))||(this.options.autoplay?this.options.autoplay*1e3:0)},isRunning:()=>!!this.swiper?.autoplay?.running&&!this.swiper?.autoplay?.paused,fillPrevious:!!this.options.storyFillPrevious}))}updateStoryPagination(t){this.storyPagination?.update(t)}destroyStoryPagination(){this.storyPagination?.destroy(),this.storyPagination=null}getControlsContrast(){let t=this.swiper?.slides?.[this.swiper.activeIndex];if(!t)return null;let e=t.getAttribute("data-slider-contrast");return["dark","light"].includes(e)?e:null}shouldApplyControlsContrast(t){return t?t.classList.contains("slider-pagination")?t.classList.contains("position--inside"):t.classList.contains("slider-button")?t.classList.contains("position--inside")||t.classList.contains("position--overlap"):!1:!1}updateControlsContrast(){let t=this.getControlsContrast();[this.paginationEl,this.prevEl,this.nextEl].forEach(e=>{e&&(t&&this.shouldApplyControlsContrast(e)?e.setAttribute("data-contrast",t):e.removeAttribute("data-contrast"))})}resetControlsContrast(){[this.paginationEl,this.prevEl,this.nextEl].forEach(t=>{t?.removeAttribute("data-contrast")})}setSliderSize(){let t=this.$component.find(".swiper");if(!t.length)return;let e=t[0];e.style.width="";let i=e.getBoundingClientRect().width,s=e.offsetWidth;if(i%1>0&&Math.abs(s-i)<2){e.style.width=`${Math.round(i)}px`;try{this.swiper.update()}catch{}}}setThumbnailsSize(){if(!this.thumbsSwiper||this.options.paginationType!=="thumbs")return;let t=this.options.direction==="horizontal",e=$(this.paginationEl),i=e.find(".thumb-item"),s=2,n=i.length,a=this.thumbsSwiper.params.slidesPerView;e.add(i).css({"--thumbSize":"","--thumbPad":"",width:"",height:""});let o=parseInt(i.css("--thumbPad"),10),r=t?e[0].offsetWidth:e[0].offsetHeight,c=t?i[0].offsetWidth:i[0].offsetHeight,l=Math.max(s,Math.round(r/(c+o)));n>=s&&(n===l+1||n===l-1)?l=n:a&&(a===l+1||a===l-1)&&(l=a),e.toggleClass("is-filled",n>=l),this.thumbsSwiper.params.slidesPerView=l,this.thumbsSwiper.params.spaceBetween=o,this.thumbsSwiper.update(),this.thumbsSwiper.slides.forEach(d=>{d.style.setProperty("--thumbSize",`${d.swiperSlideSize}px`)})}};var ot=class{inited=!1;loaded=!1;destroyed=!1;abortController=new AbortController;constructor(t){this.options=t,this.target=t.target}
57async init(){this.inited=!0,await this.whenLoaded(),this.loaded=!0}destroy(){this.abortController.abort(),this.destroyed=!0}async whenLoaded(t=()=>{}){return new Promise(e=>{if(this.loaded){t(),e();return}if(this.type==="video")this.loaded=!0,t(),e();else{let i=!1,s=setTimeout(()=>{this.loaded=!0,i||(i=!0,t(),e())},1e3);$(this.target).one("load",()=>{clearTimeout(s),this.loaded=!0,i||(i=!0,t(),e())})}})}async play(){}pause(){}onLoadData(){this.options.onLoadData?.()}onPlay(){this.options.onPlay?.()}onPause(t){this.options.onPause?.(t)}onEnded(){this.options.onEnded?.()}onTime(t,e){this.options.onTime?.(t,e)}onError(t){this.options.onError?.(t)}},mi=class extends ot{type="video";_wasClicked=!1;async init(){let t=this.target,e=t.poster||t.dataset.poster,i=t.getAttribute("data-src"),s=t.getAttribute("src");if(t.addEventListener("error",n=>this.onError(n.error)),t.addEventListener("loadeddata",this.onLoadData.bind(this)),t.addEventListener("playing",this.onPlay.bind(this)),t.addEventListener("ended",()=>this.onEnded()),t.addEventListener("timeupdate",()=>this.onTime(t.currentTime,t.duration)),t.addEventListener("pause",()=>{let n=this._wasClicked||t.currentTime===t.duration;this.onPause(n)}),t.addEventListener("pointerup",this.onClick.bind(this)),e&&(this.target.poster=e),i&&!s){let n=document.createElement("source");n.addEventListener("error",a=>this.onError(a.error||a)),n.setAttribute("type","video/mp4"),n.setAttribute("src",i),t.appendChild(n),t.load()}this.inited=!0,await this.whenLoaded(),this.loaded=!0}async play(){await this.whenLoaded(),await this.target.play()}async pause(){this.target.pause()}onClick(){this.target.paused||(this._wasClicked=!0,setTimeout(()=>{this._wasClicked=!1},100))}},Ct=class extends ot{type="embed";async init(){let t=this.target;if(!t)return;let e=t.getAttribute("data-src"),i=t.getAttribute("src");e&&!i&&(t.src=e),this.inited=!0,await this.whenLoaded(),this.loaded=!0}async play(){await this.whenLoaded(),this.target.contentWindow?.postMessage("play","*")}async pause(){this.target.contentWindow?.postMessage("pause","*")}},gi=class extends Ct{type="embed";playerReady=!1;player;async init(){let t=this.target;if(!t)return;let e=t.src||t.dataset.src;this.inited=!0,this.loaded=!0,t.id=Y();try{if(await flexbe_cli.require(["https://player.kinescope.io/latest/iframe.player.js"],null,5e3),this.destroyed||!t.isConnected)return;let i=Object.fromEntries(new URL(e).searchParams.entries());this.player=await Kinescope.IframePlayer.create(t.id,{url:e,playlist:[],behavior:{preload:"none",playsInline:!0,autoPlay:i.autoplay?"viewable":!1,autoPause:!1,localStorage:!1,loop:i.loop==="1",muted:i.muted==="1"},ui:{controls:i.controls!=="0",language:["ru","kk","be"].includes(flexbe_cli.vars.page.language)?"ru":"en"}}),this.player.on(Kinescope.IframePlayer.Events.Play,()=>this.onPlay()),this.player.on(Kinescope.IframePlayer.Events.Pause,()=>this.onPause())}catch(i){if(this.destroyed||!t?.isConnected)return;console.error(i),t.src!==e&&(t.src=e),await this.whenLoaded()}this.playerReady=!0}async destroy(){super.destroy(),this.player&&await this.player.destroy()}async play(){return new Promise(t=>{k(()=>this.playerReady,async()=>{await this.player?.play(),t()},7e3)})}async pause(){this.player&&await this.player.pause()}},vi=class extends Ct{playerReady=!1;async init(){await super.init();let t=e=>{let i=e.data;if(typeof i=="string")try{i=JSON.parse(e.data)}catch{}e.source===this.target.contentWindow&&(["player:ready","player:changeState"].includes(i.type)&&(this.playerReady=!0),i.type==="player:changeState"&&(i.data.state==="playing"?this.onPlay():i.data.state==="paused"&&this.onPause()))};window.addEventListener("message",t,{signal:this.abortController.signal})}async play(){this.command("player:mute"),this.command("player:setCurrentTime",{time:0}),this.command("player:play")}async pause(){this.command("player:pause")}command(t,e={}){k(()=>this.loaded&&this.playerReady,()=>{this.target.contentWindow?.postMessage(JSON.stringify({type:t,data:e}),"*")})}},yi=class extends ot{type="embed";async init(){let t=this.target,e=t.getAttribute("data-src"),i=t.getAttribute("src");e&&!i&&(t.src=e),this.inited=!0,await this.whenLoaded(),flexbe_cli.require(["https://player.vimeo.com/api/player.js"],()=>{this.destroyed||!this.target.isConnected||(this.vPlayer=new window.Vimeo.Player(t),this.vPlayer.on("play",()=>this.onPlay()),this.vPlayer.on("pause",()=>this.onPause()))}),this.loaded=!0}async play(){await this.whenLoaded(),this.vPlayer&&this.vPlayer.play()}async pause(){this.vPlayer&&this.vPlayer.pause()}},bi=class extends ot{type="embed";progressTimer;
57async init(){let t=this.target,e=t.getAttribute("data-src"),i=t.getAttribute("src"),s=n=>{(n===window.YT.PlayerState.BUFFERING||n===window.YT.PlayerState.PLAYING)&&this.onLoadData(),n===window.YT.PlayerState.PLAYING?(this.onPlay(),this.startProgressWatch()):n===window.YT.PlayerState.PAUSED?(this.stopProgressWatch(),this.onPause()):n===window.YT.PlayerState.ENDED&&(this.stopProgressWatch(),this.onPause(),this.onEnded())};e&&!i&&(t.src=e),this.inited=!0,await this.whenLoaded(),flexbe_cli.require([`https://www.youtube.com/iframe_api?origin=${window.location.host}`],()=>{this.destroyed||!this.target.isConnected||k(()=>window.YT?.Player,()=>{this.ytVideo=new window.YT.Player(t,{events:{onStateChange:n=>s(n.data),onReady:()=>s(this.ytVideo.getPlayerState())}})})}),this.loaded=!0}async play(){await this.whenLoaded(),this.target.contentWindow?.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}async pause(){this.target.contentWindow?.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}destroy(){this.stopProgressWatch(),super.destroy()}startProgressWatch(){this.stopProgressWatch(),this.reportTime(),this.progressTimer=setInterval(()=>this.reportTime(),1e3)}stopProgressWatch(){this.progressTimer&&(clearInterval(this.progressTimer),this.progressTimer=void 0)}reportTime(){try{let t=this.ytVideo?.getCurrentTime?.()||0,e=this.ytVideo?.getDuration?.()||0;e&&this.onTime(t,e)}catch{}}},Zt=class extends b{static is="video";videoStarted=!1;videoThresholds=new Set;constructor(...t){super(...t);let e;switch(this.$preview=this.$component.find(".component-video__preview"),this.$iframe=this.$component.find("iframe"),this.$video=this.$component.find("video.custom-video"),this.type=this.$component.data("type"),this.autoplay=!!+this.$component.data("autoplay"),this.autoInit=this.autoplay||!this.$preview.length||this.$preview.hasClass("no-image"),this.type){case"custom":e=mi;break;case"youtube":e=bi;break;case"vimeo":e=yi;break;case"kinescope":e=gi;break;case"rutube":e=vi;break;default:e=Ct}this.provider=new e({target:this.type==="custom"?this.$video[0]:this.$iframe[0],onPlay:this.onPlay.bind(this),onPause:this.onPause.bind(this),onEnded:this.onEnded.bind(this),onTime:this.onTime.bind(this),onError:this.onError.bind(this),onLoadData:this.onLoadData.bind(this)}),this.$preview.removeAttr("hidden"),this.$preview.on("click",async()=>{await this.#t(),await this.play(!0)}),this.$component.off("sliderActivate").on("sliderActivate",async()=>{this.preventAutoplay=!1,this.inScreen&&this.autoInit&&(await this.#t(),this.autoplay&&await this.play())}),this.$component.off("sliderDeactivate").on("sliderDeactivate",async()=>{this.preventAutoplay=!0,await this.pause()})}onDestroy(){this.provider.destroy()}async onScreen({state:t}){t?(this.autoInit&&await this.#t(),this.autoplay&&!this.preventAutoplay&&await this.play()):await this.pause()}async#t(){this.provider.inited||(this.$component.addClass("loading"),await this.provider.init(),this.$component.removeClass("loading"),this.$component.addClass("loaded"))}async play(t=!1){this.isAutoplaying=!t,this.isPaused=!1,this.$preview.off("click").addClass("preloading");try{await this.provider.play(),this.$preview.fadeOut(150,()=>{this.$preview.remove(),this.$component.removeClass("overlayed")})}catch(e){console.warn(e)}}async pause(){this.isAutoplaying=!1,this.isPaused=!0;try{await this.provider.pause()}catch{}}onPlay(){this.isPaused=!1,this.preventAutoplay=!1,this.videoStarted||(this.videoStarted=!0,this.reachVideoGoal("video_start")),!this.autoplay&&!flexbe_cli.is_admin&&flexbe_cli.resize.responsiveMode==="mobile"&&this.component.closest('[data-hidden="desktop"]')&&(this.viewportLocked=!0,flexbe_cli.resize.lockMode(!0)),(!this.autoplay||!this.isAutoplaying)&&(this.sliderAutoplayPrevented=!0,this.$component.trigger("reduceSliderControls",{state:!0}))}onPause(t=this.inScreen){this.isPaused=!0,t&&(this.preventAutoplay=!0),this.viewportLocked&&(this.viewportLocked=!1,flexbe_cli.resize.lockMode(!1)),this.sliderAutoplayPrevented&&(this.sliderAutoplayPrevented=!1,this.$component.trigger("reduceSliderControls",{state:!1}))}onEnded(){this.reachVideoGoal("video_complete"),this.videoStarted=!1,this.videoThresholds.clear()}onTime(t,e){if(!e)return;let i=Math.floor(t/e*100);
57[10,25,50,75].forEach(s=>{i<s||this.videoThresholds.has(s)||(this.videoThresholds.add(s),this.reachVideoGoal("video_progress",{video_current_time:Math.round(t),video_duration:Math.round(e),video_percent:s}))})}onError(t){console.error(t)}onLoadData(t){this.$component.addClass("started")}reachVideoGoal(t,e={}){let i=this.$iframe[0],s=this.$video[0],n=i?.src||i?.getAttribute("data-src")||s?.currentSrc||s?.src||"",a=this.$component.attr("data-title")||this.$preview.attr("title")||"";flexbe_cli.stat.goals.reachGoal(t,{video_provider:this.type,visible:this.inScreen,...n?{video_url:n}:{},...a?{video_title:a}:{},...e})}};flexbe_cli.entity.setClientJs("element","media01",{components:[B,Zt,Xt]});var te=class extends b{static is="menu";get showOnClick(){return this.showType==="click"||flexbe_cli.resize.responsiveMode==="mobile"||flexbe_cli.run.is_touch}get showOnHover(){return this.showType==="hover"&&flexbe_cli.resize.responsiveMode==="desktop"&&flexbe_cli.run.is_pointer}get actualDirection(){return flexbe_cli.resize.responsiveMode==="desktop"?this.direction:this.directionAdaptive}get showAsRollup(){return flexbe_cli.resize.responsiveMode==="mobile"&&this.$component.attr("data-rollup-adaptive")==="true"}constructor(...t){super(...t),this.eventId=this.core?.id,this.isRootModal=this.core.$root.attr("data-is")==="modal",this.$menuList=this.$component.find(".component-menu-list--root"),this.showType=this.$component.attr("data-type"),this.direction=this.$component.attr("data-direction"),this.directionAdaptive=this.$component.attr("data-direction-adaptive"),this.activateMode=this.$component.attr("data-activate-mode"),this.allowShowMore=this.$component.attr("data-show_more"),this.isNested=!!this.$menuList.find(".folder-item").length,this.openFolders=[],this.activeHref=null}_getCleanPath(t){return t?t.split("?")[0]:""}_isInFolder(t){return!!t.closest(".folder-item").length}_isCurrentPageUrl(t){return!t||t.includes("#")?!1:this._getCleanPath(t)===window.location.pathname}_findMenuItemByAnchor(t){return this.$component.find(`a[href*="#${t}"]`).filter((e,i)=>{let s=$(i),[n]=s.attr("href").split("#");return(!n||n===window.location.pathname)&&!this._isInFolder(s)}).closest("li")}_findMenuItemByCurrentUrl(){return this.$component.find("a").filter((t,e)=>{let i=$(e);return this._isCurrentPageUrl(i.attr("href"))&&!this._isInFolder(i)}).closest("li")}activateMenuItem(t){return t&&t.length?(this.setActive(t),this.activeHref=t.find("a").attr("href"),!0):!1}deactivateMenuItem(){return this.clearActive(),this.activeHref=null,!0}activateMenuItems(){let t=this.$component.find("li.menu-item, li.root-item").filter((s,n)=>!this._isInFolder($(n)));t.removeClass("active");let e=[],i=window.location.pathname;if(t.each((s,n)=>{let a=$(n),o=a.find("a").attr("href");o&&(o.includes("#")||this._getCleanPath(o)===i&&e.push(a))}),e.length>0){let s=e.reduce((n,a)=>{let o=n.find("a").attr("href")||"",r=a.find("a").attr("href")||"";return o.length>=r.length?n:a});this.activateMenuItem(s)}this.initAnchorChangeListener()}onBeside({state:t,first:e}){!t||!e||(this.bindEvents(),this.dispatchShowMore(),this.$button=this.$component.find(".folder-item"),!flexbe_cli.is_admin&&this.activateMode&&this.activateMenuItems())}onResize(t={}){["bottom","top"].includes(t.type)||(this.dispatchShowMore(),this.openFolders.forEach(e=>{e.$dropdown?this.setDropdownPosition(e):this.showAsRollup||this._closeFolder(e)}))}onWindowResize(){this.onResize()}onHideShowUI(){this._closeFolder()}onClose(){this.toggleFolder(null,!1)}bindEvents(){$(window).off(`.${this.eventId}`),this.$component.off(".menu"),flexbe_cli.is_admin&&this.$component.on("mouseup.menu.prevent pointerdown.menu.prevent pointerup.menu.prevent",".folder-item",t=>{t.stopPropagation()}),$(window).on(`blur.${this.eventId}`,()=>{this.showAsRollup||this._closeFolder()}),this.$component.on("pointerenter.menu.item pointerleave.menu.item",".menu-item",t=>{if(flexbe_cli.resize.responsiveMode==="desktop"){let e=t.type==="pointerenter";$(t.currentTarget).toggleClass("hover",e)}}),this.$component.on("pointerenter.menu.folder",".folder-item",t=>{this.showOnHover&&(clearTimeout(this._dropdownTimer),$(t.currentTarget).hasClass("show")||(this._dropdownTimer=setTimeout(()=>{flexbe_cli.events.trigger("component_menu:closeAll"),this.toggleFolder(t.currentTarget,!0)},50)))}),this.$component.on("pointerdown.touchfix",t=>{t.target.closest("a")||t.preventDefault()}),this.$component.on("pointerleave.menu.folder",".folder-item",()=>{this.showOnHover&&(clearTimeout(this._dropdownTimer),this._dropdownTimer=setTimeout(()=>{flexbe_cli.events.trigger("component_menu:closeAll")},100))}),this.$component.on("click.menu",".folder-item-text, .show-more",t=>{if(this.showOnClick)return this.toggleFolder(t.currentTarget),!1}),flexbe_cli.events.off(`component_menu:closeAll.${this.eventId}`).on(`component_menu:closeAll.${this.eventId}`,()=>
57{this.openFolders.forEach(t=>this.toggleFolder(t,!1))})}observeItems(){let t,e=!0,i=this.$component.find("li.root-item")[0];this.unobserveItems(),this._resizeObserver=new ResizeObserver(()=>{if(e){e=!1;return}clearTimeout(t),t=setTimeout(()=>{this.onResize({})},30)}),this._resizeObserver.observe(i)}unobserveItems(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}dispatchShowMore(){if(!this.allowShowMore||flexbe_cli.resize.responsiveMode==="mobile"||this.actualDirection==="column"){this.restoreMenuItems();return}this.$componentCopy?this.restoreMenuItems():this.$componentCopy=this.$component.clone();let t=getComputedStyle(this.$component[0]),e=this.$component.innerWidth(),i=this.$menuList.innerWidth(),s=parseInt(t.getPropertyValue("--gapX"),10)||0,n=e+s*2;if(i<=n)return this.observeItems(),!1;let a=this.$menuList.find("li.root-item");this.$menuList.append(` 58 <li class="menu-item root-item folder-item show-more"> 59 <svg viewBox="0 0 18 4"> 60 <path transform="rotate(-90 2 2)" d="M4 2a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 7a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm-2 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/> 61 </svg> 62 63 <ul class="component-menu-list component-menu-list--nested apply-text-style"></ul> 64 </li> 65 `);let o=this.$menuList.find(".show-more .component-menu-list--nested"),r=18+s*2;a.toArray().forEach(c=>{let l=c.offsetWidth;r+l>n&&(o.append(c),$(c).removeClass("root-item")),r+=l}),this.observeItems()}restoreMenuItems(){let t=this.$menuList.find(".show-more");if(t.length){if(this.$componentCopy){let e=this.$componentCopy.find(".component-menu-list--root").clone();this.$menuList.html(e.html())}else{let e=t.find(".component-menu-list").eq(0).children();e.addClass("root-item"),t.replaceWith(e)}this.$menuList.css({position:"",top:"",left:""}),this.unobserveItems()}}toggleFolder(t,e){t=$(t).closest(".folder-item")[0],e==null&&(e=!$(t).hasClass("show")),this[e?"_openFolder":"_closeFolder"](t)}toggleNestedFolder(t,e){e==null&&(e=!$(t).hasClass("show")),this[e?"_openNestedDropdown":"_closeNestedDropdown"](t)}initAnchorChangeListener(){flexbe_cli.block.$blocks.each((t,e)=>{let i=e._core;i?.inFocus&&this.checkBlockInFocus(i)}),flexbe_cli.block.$blocks.off(`focused.${this.eventId}`).on(`focused.${this.eventId}`,t=>{this.checkBlockInFocus(t.currentTarget._core)})}checkBlockInFocus(t){if(!t)return;let e=t.$area.find("> a._anchor").attr("name")||t.$area.attr("data-id");if(e)if(t.inFocus)this.activateMenuItem(this._findMenuItemByAnchor(e));else{if(!this.activeHref)return;this.activeHref&&this.activeHref.includes(`#${e}`)&&(this.deactivateMenuItem(),this.activateMenuItem(this._findMenuItemByCurrentUrl()))}}setActive(t){this.clearActive(),t.addClass("active")}clearActive(){this.$component.find(".active").removeClass("active")}_openFolder(t){let e=$(t);if(!e.length||e.hasClass("show"))return;let i=!flexbe_cli.run.is_preview&&!!this.$component.closest("[data-editor*=menu]:not(.editor-focus)").length,s=!flexbe_cli.run.is_preview&&!!this.$component.closest(".editor-focus").length;if(!i){if(this.showAsRollup)e.find(".component-menu-list--nested").eq(0).slideDown(350),e.addClass("show");else{flexbe_cli.events.trigger("component_menu:closeAll");let n=$("body"),a=e.find(".component-menu-list--nested").eq(0).clone(),o=$(`<div class="component-menu-dropdown ${s?"editor-focus":""}"></div>`);t.$dropdown=o;let r=getComputedStyle(t),c=["--gapY","--fontSize","--lineHeight","--fontWeight","--letterSpacing","--fontStyle","--textDecoration"].reduce((l,d)=>({...l,[d]:r.getPropertyValue(d)}),{});if(o.css(c),this.$component.addClass("in-show"),e.addClass("show"),o.append(a).appendTo(n),this.setDropdownPosition(t),this.component.closest(".m_modal, .fixed-area")){let l=flexbe_cli.helpers.scrollParent(this.component);l===document.documentElement&&(l=document),$(l).one(`scroll.${this.eventId}`,()=>{this.setDropdownPosition(t)})}o.off("pointerenter").on("pointerenter",()=>{clearTimeout(this._dropdownTimer)}),n.on(`keydown.dropdown-${this.eventId}`,l=>{l.code==="Escape"&&this._closeFolder()}),n.on(`click.dropdown-${this.eventId}`,l=>{l.target.closest(".folder-item")||this._closeFolder()}),o.off("pointerleave").on("pointerleave",()=>{clearTimeout(this._dropdownTimer),this.toggleNestedFolder(null,!1),this.showOnHover&&(this._dropdownTimer=setTimeout(()=>{this.toggleFolder(t,!1)},100))}),o.on("pointerenter.menu.folder pointerleave.menu.folder",".menu-item",l=>{$(l.currentTarget).toggleClass("hover",l.type==="pointerenter")}),flexbe_cli.run.is_touch?o.on("click.menu.folder",".folder-item",l=>{this.toggleNestedFolder(l.currentTarget)}):(o.on("pointerenter.menu.folder",".folder-item",l=>{this.toggleNestedFolder(l.currentTarget,!0)}),o.on("pointerleave.menu.folder",".folder-item",l=>{this.toggleNestedFolder(l.currentTarget,!1)}))}this.openFolders.push(t)}}_closeFolder(t){let e=t?$(t):this.$menuList.find(".folder-item.show"),i=flexbe_cli.helpers.scrollParent(this.component);i===document.documentElement&&(i=document),$("body").off(`.dropdown-${this.eventId}`),this.$component.removeClass("in-show"),$(i).off(`.${this.eventId}`),this.showAsRollup?e.find(".component-menu-list--nested").slide
65Up(350):(e.find(".component-menu-list--nested").css("display",""),e.each((s,n)=>{n.$dropdown&&n.$dropdown.remove()})),e.removeClass("show"),e.find(".show").removeClass("show"),this.openFolders=this.openFolders.filter(s=>!e.is(s))}_openNestedDropdown(t){let{viewportWidth:e,documentHeight:i}=flexbe_cli.resize,s=$(t),n=s.siblings(".nested-item.show"),a=s.find(".component-menu-list--nested").eq(0),o=s.offset(),r=s.innerWidth(),c=s.innerHeight(),l=o.left,d=l+r,h=o.top,p=h+c,u=a.innerWidth(),f=a.innerHeight(),m=l>u,g=e-d>u,v=h>f,w=i-p>f;if(n.each((x,T)=>this._closeNestedDropdown(T)),s.addClass("show"),a.addClass("show-dropdown"),g)a.addClass("in-right");else if(m)a.addClass("in-left");else{let x=e>u?u:r;a.addClass("in-right"),a.css({maxWidth:`${r}px`,marginTop:"15px",marginLeft:`-${Math.floor(x-(e-d)+10)}px`})}w?a.addClass("in-bottom"):v?a.addClass("in-top"):a.addClass("in-bottom")}_closeNestedDropdown(t){let e=$(t),i=e.find(".component-menu-list--nested").eq(0);e.removeClass("show"),i.removeClass("show-dropdown in-left in-right in-bottom in-top")}setDropdownPosition(t){if(!t||!t.$dropdown)return;let{documentHeight:e,viewportHeight:i}=flexbe_cli.resize,s=$(t),n=t.$dropdown,a=s.hasClass("show-more"),o=s.closest("[data-fixed]").length,r=n.find(".component-menu-list--nested").eq(0),c=a?s.find("svg"):s.children().first().find("span"),l=c[0].getBoundingClientRect(),d=c.offset(),h=d.left,p=d.top,u=p+l.height,f=document.body.getBoundingClientRect(),m=7,g=parseInt(r.find(".menu-item-text").css("paddingLeft"),10)||10,v={position:"absolute",width:r.innerWidth(),height:r.innerHeight(),top:u,left:h-f.left-g};if(v.width<l.width&&(v.width=l.width+g*2,r.css("width","100%")),a&&(v.left=h+l.width/2-v.width/2),flexbe_cli.run.is_preview){let T=Math.max(0,-v.left+m),j=Math.max(0,v.left+v.width+m-f.width);T?v.left+=T:j&&(v.left-=j)}let w=u+v.height>e&&p>v.height,x=u+v.height>flexbe_cli.scroll.latest+i;o&&v.height+l.bottom<i?(v.position="fixed",v.top=l.bottom,v.left+=f.left):(!this.isRootModal&&w||this.isRootModal&&x)&&(v.top=p-v.height),n.toggleClass("rise",o),n.css(v)}};flexbe_cli.entity.setClientJs("element","menu01",{components:[te]});flexbe_cli.entity.setClientJs("block","FREE",{components:[I]});flexbe_cli.entity.setClientJs("block","HTML",{components:[I]});var ee=class extends G{static is="button"};flexbe_cli.entity.setClientJs("element","button01",{components:[ee,L],isPure:!0});flexbe_cli.entity.setClientJs("element","contacts01",{components:[L],onLoad(){this.fixIcon()},onMsg(t){t==="change_contact"&&this.fixIcon()},fixIcon(){let t=this.$area,e=t.find(".component-icon"),i=t.find(".element-text--contact");if(t.find(".element-text--desc").length&&i.length&&e.length){let s=i[0].offsetHeight,n=e[0].offsetHeight;if(s>n){let a=s/2-n/2;e.css("margin-top",`${a}px`)}else e.css("margin-top","")}}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.