Page Builder Gutenberg Blocks – CoBlocks - Version 2.22.4

Version Description

/ 2022-03-15 =

Bug fixes
  • Fix Form block where nonce is unverified and some sanitization #2329
  • Fix Gist block to make sure there is no PHPCS error #2323
  • Fix Events block timezone problem #2319
Misc
  • Lint everything on CI #2311
  • Update block-assets syntax #2322
  • Update some dependencies #2313
  • Enhance restore cache to also install missing deps on build pipeline #2317
Download this release

Release Info

Developer Godaddy
Plugin Icon 128x128 Page Builder Gutenberg Blocks – CoBlocks
Version 2.22.4
Comparing to
See all releases

Code changes from version 2.22.2 to 2.22.4

class-coblocks.php CHANGED
@@ -4,7 +4,7 @@
4
  * Description: CoBlocks is a suite of professional <strong>page building content blocks</strong> for the WordPress Gutenberg block editor. Our blocks are hyper-focused on empowering makers to build beautifully rich pages in WordPress.
5
  * Author: GoDaddy
6
  * Author URI: https://www.godaddy.com
7
- * Version: 2.22.2
8
  * Text Domain: coblocks
9
  * Domain Path: /languages
10
  * Tested up to: 5.9
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
25
  exit;
26
  }
27
 
28
- define( 'COBLOCKS_VERSION', '2.22.2' );
29
  define( 'COBLOCKS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
30
  define( 'COBLOCKS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
31
  define( 'COBLOCKS_PLUGIN_FILE', __FILE__ );
4
  * Description: CoBlocks is a suite of professional <strong>page building content blocks</strong> for the WordPress Gutenberg block editor. Our blocks are hyper-focused on empowering makers to build beautifully rich pages in WordPress.
5
  * Author: GoDaddy
6
  * Author URI: https://www.godaddy.com
7
+ * Version: 2.22.4
8
  * Text Domain: coblocks
9
  * Domain Path: /languages
10
  * Tested up to: 5.9
25
  exit;
26
  }
27
 
28
+ define( 'COBLOCKS_VERSION', '2.22.4' );
29
  define( 'COBLOCKS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
30
  define( 'COBLOCKS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
31
  define( 'COBLOCKS_PLUGIN_FILE', __FILE__ );
dist/404.js CHANGED
@@ -34,4 +34,4 @@ label:(0,p.__)("S","coblocks"),tooltip:(0,p.__)("Small","coblocks"),value:"sml"}
34
  /* translators: %1$d is the order number of the image, %2$d is the total number of images */
35
  (0,p.__)("image %1$d of %2$d in gallery","coblocks"),t+1,f.length);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)($,{ariaLabel:o,handleRemoveImage:H,handleReplaceImage:j,index:t,setAttributes:m}))}))),[T,M,C,I,P,g,h,f,y,_,L,E,S]),Y=()=>{const t=!(!q||"skip"===q)&&(0,p.sprintf)(
36
  /* translators: %s: Type of gallery variation */
37
- (0,p.__)("%s Carousel","coblocks"),q);return(0,l.createElement)(l.Fragment,null,u,(0,l.createElement)(B,(0,n.Z)({},e,{gutter:o.gutter,icon:(0,l.createElement)(re.Z,{icon:s.cX3}),label:(0,p.__)("Carousel","coblocks"),variationLabel:t})))};return f.length||q?!f.length&&q?Y():(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(k,e),(0,l.createElement)(K,e)),u,(0,l.createElement)(b.ResizableBox,{className:i()({"has-responsive-height":w,"is-selected":c}),enable:{bottom:!0,bottomLeft:!1,bottomRight:!1,left:!1,right:!1,top:!1,topLeft:!1,topRight:!1},minHeight:"0",onClick:()=>{c||t(e.clientId)},onResizeStop:(e,t,o,n)=>{m({height:parseInt(v+n.height,10)})},showHandle:c,size:{height:v,width:"100%"},style:{marginBottom:S?"80px":null}},(0,l.createElement)("div",{className:a},(0,l.createElement)("div",{className:F,style:O},Z))),Y()):(0,l.createElement)(se.VF,e)}))},9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o,n=arguments[t];for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function o(e,t,o,n){e.addEventListener(t,o,n)}function n(e,t,o){e.removeEventListener(t,o)}function l(e,t,o){return void 0===o&&(o=""),e.setAttribute(t,o),e}function a(e,t,o){return Object.keys(t).forEach((function(o){e.style[o]=t[o]})),o&&getComputedStyle(e),e}var i={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,o,n){a(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+n+"ms",transform:o.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function r(){var t=[];return{getDuration:function(){var e=t[0],o=t[t.length-1];return e?o.time-e.time:0},getOffset:function(){var e=t[0],o=t[t.length-1];return e?{x:o.x-e.x,y:o.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return n=(o=t).length-1,l=o[n],o=o[n-1]||l,n={x:l.x-o.x,y:l.y-o.y},l=l.time-o.time,o=n.x/l||0,l=n.y/l||0,e({},n,{angle:Math.atan2(Math.abs(n.y),Math.abs(n.x))*s,velocityX:o,velocityY:l});var o,n,l},clear:function(){t=[]},push:function(o){t.push(e({time:Date.now()},o))}}}function c(){return(performance||Date).now()}function u(){var e=function(){var e,t,o=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,n=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;return{run:function(n){e=void 0===e?c():e,t=o((function(){var t=c(),o=t-e;e=t,n(o)}))},stop:function(){e=void 0,n(t)}}}();return{run:function t(o){e.run((function(e){t(o),o(e)}))},stop:function(){e.stop()}}}function m(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function d(e,t,o,n){var l=n.initLayout,a=n.initStatus,i=n.render,s=n.scrollPixel,r=n.slideTo,c=n.getOffsetSteps,d=u();return{preheat:function(e,t){var n=o.tracker;d.stop(),n.clear(),n.push(e),l(t),a(t),o.isStart=!0,i()},move:function(t){var n,l=o.tracker,a=e.touchRatio,r=e.touchAngle,c=e.isHorizontal;o.isStart&&!o.isScrolling&&(l.push(t),n=l.vector(),((t=l.getOffset()).x||t.y)&&(c&&n.angle<r||!c&&90-n.angle<r||o.isTouching?(a=n[c?"x":"y"]*a,o.isTouching=!0,s(a),i()):(o.isScrolling=!0,l.clear())))},stop:function(){var l,a,u,p=o.index,g=o.tracker,b=t.measure;o.isStart&&(o.isStart=!1,e.freeMode?(l=g.vector()[e.isHorizontal?"velocityX":"velocityY"],d.run((function(e){e*=l,l*=.98,Math.abs(e)<.01?(d.stop(),m(o,n)):(s(e),i(0))}))):(a=g.getDuration(),u=g.getOffset()[e.isHorizontal?"x":"y"],g=Math.ceil(Math.abs(u)/b.boxSize),b=c(u),a>e.longSwipesMs?r(p+b*(0<u?-1:1)):r(0<u?p-g:p+g),m(o,n)))}}}function p(e,t){var o={};return(o.update=function(e){var n,l=function(e,t,o){var n=e.$list,l=t.viewSize,a=t.slideSize,i=t.boxSize,s=-(t=(e=(s=o).loop?Math.ceil(s.slidesPerView):0)*i)+(o.centeredSlides?(l-a)/2:0);return{max:s,min:o.spaceBetween+(o.loop?a:l)+s-i*n.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:n.length-(o.centeredSlides||o.loop?1:Math.ceil(o.slidesPerView))}}(e,(n=t,a=(l=e).$el,n={boxSize:(a=((l=n.isHorizontal?a.offsetWidth:a.offsetHeight)-Math.ceil(n.slidesPerView-1)*n.spaceBetween)/n.slidesPerView)+n.spaceBetween,viewSize:l,slideSize:a}),t),a=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(o,{touchable:a,element:e,measure:n,limitation:l})})(e),o}var g="data-shallow-slider",b="data-slider";function h(e,o){function n(){e.element.$wrapper.querySelectorAll("["+g+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function i(){var t=e.element,n=e.measure,l=t.$wrapper,i={display:"flex",willChange:"transform",flexDirection:o.isHorizontal?"row":"column"},s=((t={})[o.isHorizontal?"width":"height"]=n.slideSize+"px",t[o.isHorizontal?"margin-right":"margin-bottom"]=o.spaceBetween+"px",t);a(l,i),l.querySelectorAll("["+b+"]").forEach((function(e){return a(e,s)}))}return{init:function(){(function(){var t,a,i,s,r,c;e.element.$list.forEach((function(e,t){return l(e,b,t)})),n(),o.loop&&(t=e.element,s=e.limitation,a=t.$list,i=t.$wrapper,s=s.expand,r=a.slice(-s).map((function(e){return e.cloneNode(!0)})),c=a.slice(0,s).map((function(e){return e.cloneNode(!0)})),r.forEach((function(e,t){i.appendChild(l(c[t],g)),i.insertBefore(l(r[t],g),a[0])})))})(),i()},render:function(n,l,a,i){var s=e.element.$wrapper;l=void 0===l?o.speed:l,o.injections.translate(n,e,o,l),n.isStart||function(n){var l=e.element.$wrapper,a=n.index;l.querySelectorAll("["+b+"]").forEach((function(e){var n,l,i=~~e.getAttribute(b);n=e,void 0===(l=[o.slidePrevClass,o.slideNextClass,o.slideActiveClass])&&(l=[]),Array.isArray(l)||(l=[l]),l.forEach((function(e){return n.classList.contains(e)&&n.classList.remove(e)})),i===a&&t(e,o.slideActiveClass),i==a-1&&t(e,o.slidePrevClass),i===a+1&&t(e,o.slideNextClass)}))}(n),i&&getComputedStyle(s).transform,a&&setTimeout(a,l)},destroy:function(){var t=e.element,l=t.$list,a=t.$wrapper,i=o.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){a.style.removeProperty(e)})),l.forEach((function(e){return e.style.removeProperty(i)})),n()},updateSize:i}}function v(e,t){var o=e-t.max;return t=e-t.min,0<o?o:t<0?t:0}function f(t,o,n,l,a){function i(e){var o=t.measure;return Math.ceil(Math.abs(e)/o.boxSize-n.longSwipesRatio)}function s(e,t,n){l.render(o,e,t,n)}function r(l){var i,s,r=(s=t.limitation).min,c=s.max;r=(s=c-r+(n.loop?t.measure.boxSize:0))+1,o.transforms=l,n.loop?(i=(c-l)%r/s,o.progress=i<0?1+i:1<i?i-1:i):(i=(c-l)/s,o.progress=i<0?0:1<i?1:i),a.emit("scroll",e({},o))}function c(e,l){var c,u,m,d,p,g=t.measure,b=t.limitation,h=b.maxIndex-b.minIndex+1,f=n.loop?(e%h+h)%h:e>b.maxIndex?b.maxIndex:e<b.minIndex?b.minIndex:e,k=-f*g.boxSize+b.base;0!==i(k-o.transforms)&&n.loop&&(c=v(o.transforms,b),u=f-o.index,m=o.index,d=f,p=u,e=(h=b).maxIndex,m=(0<p?1:-1)*(h.minIndex-e-1)+d-m,(p=Math.abs(p)>Math.abs(m)?m:p)===u||c?o.index===f&&r(0<c?b.min-g.boxSize+c:b.max+g.boxSize+c):r(p<0?b.min-g.boxSize:b.max+g.boxSize),s(0,void 0,!0)),a.emit("before-slide",o.index,o,f),o.index=f,r(k),s(l,(function(){a.emit("after-slide",f,o)}))}return{update:function(){c(o.index,0),l.updateSize()},render:s,transform:r,slideTo:c,scrollPixel:function(e){var l,a=o.transforms,i=t.measure,s=t.limitation,c=(l=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(l-1)):1,u=a;n.resistance&&!n.loop&&(0<e&&a>=s.max?e-=Math.pow(e*c,n.resistanceRatio)/c:e<0&&a<=s.min&&(e+=Math.pow(-e*c,n.resistanceRatio)/c)),u+=e,n.loop&&(l=o.tracker.vector(),c=n.isHorizontal?l.velocityX:l.velocityY,(e=v(a,s))&&(l=a,a=s,0<(c=c)&&l>a.max||c<0&&l<a.min)&&(u=0<e?s.min-i.boxSize+e:s.max+i.boxSize+e)),r(u)},initStatus:function(e){void 0===e&&(e=0),o.startTransform=e,o.isStart=!1,o.isScrolling=!1,o.isTouching=!1},initLayout:function(e){r(e)},getOffsetSteps:i}}function k(e,t){var o="string"==typeof e?document.body.querySelector(e):e;return e=o.querySelector("."+t.wrapperClass),t=[].slice.call(o.getElementsByClassName(t.slideClass)),{$el:o,$wrapper:e,$list:t}}function _(t,l){var a=(m=e({},i,m=l),e({},m,{isHorizontal:"horizontal"===m.direction})),s=function(){var e={};return{on:function(t,o){e[t]?e[t].push(o):e[t]=[o]},off:function(t,o){!e[t]||-1<(o=e[t].indexOf(o))&&e[t].splice(o,1)},emit:function(t){for(var o=arguments.length,n=new Array(1<o?o-1:0),l=1;l<o;l++)n[l-1]=arguments[l];e[t]&&e[t].forEach((function(e){return e.apply(void 0,n)}))},clear:function(){e={}}}}(),c=p(k(t,a),a),u={tracker:r(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},m=(l=s.on,s.off),g=s.emit,b={on:l,off:m,env:c,state:u,options:a};(a.plugins||_.plugins||[]).forEach((function(e){return e(b,a)})),g("before-init",b);var v=h(c,a),E=f(c,u,a,v,s),S=function(e,t,l,a){var i=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],r=(a=d(l,e,t,a)).preheat,c=a.move,u=a.stop;function m(e){return{x:(e=i?e.changedTouches[0]:e).pageX,y:e.pageY}}function p(t){for(var o=0;o<l.excludeElements.length;o++)if(l.excludeElements[o].contains(t.target))return;var n,a=e.element.$wrapper,c=l.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||l.touchStartForcePreventDefault;!i&&c&&t.preventDefault(),r(m(t),(n=a,c=l.isHorizontal,a=getComputedStyle(n).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),n=[],16===a.length?n=a.slice(12,14):6===a.length&&(n=a.slice(4,6)),n[c?0:1]||0))}function g(e){l.touchMoveStopPropagation&&e.stopPropagation(),c(m(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function b(){u()}return{attach:function(){var t=e.element.$el;i?(o(t,"touchstart",p,{passive:l.passiveListeners,capture:!1}),o(t,"touchmove",g),o(t,"touchend",b),o(t,"touchcancel",b)):(o(t,"mousedown",p),o(document,"mousemove",g),o(document,"mouseup",b))},detach:function(){var t=e.element.$el;n(t,"touchstart",p),n(t,"touchmove",g),n(t,"touchend",b),n(t,"touchcancel",b),n(t,"mousedown",p),n(document,"mousemove",g),n(document,"mouseup",b)}}}(c,u,a,E);return u=E.slideTo,Object.assign(b,{update:function(){v.destroy(),c.update(k(t,a)),v.init(),E.update()},destroy:function(){g("before-destroy",b),S.detach(),v.destroy(),g("after-destroy",b),s.clear()},slideTo:u,updateSize:function(){c.update(k(t,a)),E.update()}}),v.init(),S.attach(),u(a.initialSlide,0),g("after-init",b),b}return _.use=function(e){_.plugins=e},_}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,o,n){e.addEventListener(t,o,n)}function t(e,t,o){e.removeEventListener(t,o)}return function(o,n){function l(e){c(e.target,"next")}function a(e){c(e.target,"prev")}var i=Boolean(n.navigation),s={nextEl:null,prevEl:null},r=Object.assign({disabledClass:"swiper-button-disabled"},n.navigation),c=function(e,t){u(e)&&!o.options.loop||(e=o.state.index,"next"===t&&o.slideTo(e+1),"prev"===t&&o.slideTo(e-1))},u=function(e){return e.classList.contains(r.disabledClass)};o.on("before-slide",(function(e,t,n){var l,a;o.options.loop||(l=n,n=(a=o.env.limitation).minIndex,a=a.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(r.disabledClass)&&n<=l&&s.nextEl.classList.remove(r.disabledClass),s.prevEl.classList.contains(r.disabledClass)&&l<=a&&s.prevEl.classList.remove(r.disabledClass),l===n&&s.prevEl.classList.add(r.disabledClass),l===a&&s.nextEl.classList.add(r.disabledClass)))})),o.on("after-init",(function(){var t,n,c;i&&(s.nextEl="string"==typeof r.nextEl?document.body.querySelector(r.nextEl):r.nextEl,s.prevEl="string"==typeof r.prevEl?document.body.querySelector(r.prevEl):r.prevEl,o.options.loop||(t=o.state.index,n=o.env.element.$list,t===(c=o.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(r.disabledClass),n.length===c&&s.nextEl&&s.nextEl.classList.add(r.disabledClass)),e(s.nextEl,"click",l),e(s.prevEl,"click",a))})),o.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",l),t(s.prevEl,"click",a),delete s.nextEl,delete s.prevEl)}))}}()}}]);
34
  /* translators: %1$d is the order number of the image, %2$d is the total number of images */
35
  (0,p.__)("image %1$d of %2$d in gallery","coblocks"),t+1,f.length);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)($,{ariaLabel:o,handleRemoveImage:H,handleReplaceImage:j,index:t,setAttributes:m}))}))),[T,M,C,I,P,g,h,f,y,_,L,E,S]),Y=()=>{const t=!(!q||"skip"===q)&&(0,p.sprintf)(
36
  /* translators: %s: Type of gallery variation */
37
+ (0,p.__)("%s Carousel","coblocks"),q);return(0,l.createElement)(l.Fragment,null,u,(0,l.createElement)(B,(0,n.Z)({},e,{gutter:o.gutter,icon:(0,l.createElement)(re.Z,{icon:s.cX3}),label:(0,p.__)("Carousel","coblocks"),variationLabel:t})))};return f.length||q?!f.length&&q?Y():(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(k,e),(0,l.createElement)(K,e)),u,(0,l.createElement)(b.ResizableBox,{className:i()({"has-responsive-height":w,"is-selected":c}),enable:{bottom:!0,bottomLeft:!1,bottomRight:!1,left:!1,right:!1,top:!1,topLeft:!1,topRight:!1},minHeight:"0",onClick:()=>{c||t(e.clientId)},onResizeStop:(e,t,o,n)=>{m({height:parseInt(v+n.height,10)})},showHandle:c,size:{height:v,width:"100%"},style:{marginBottom:S?"80px":null}},(0,l.createElement)("div",{className:a},(0,l.createElement)("div",{className:F,style:O},Z))),Y()):(0,l.createElement)(se.VF,e)}))},9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o,n=arguments[t];for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function o(e,t,o,n){e.addEventListener(t,o,n)}function n(e,t,o){e.removeEventListener(t,o)}function l(e,t,o){return void 0===o&&(o=""),e.setAttribute(t,o),e}function a(e,t,o){return Object.keys(t).forEach((function(o){e.style[o]=t[o]})),o&&getComputedStyle(e),e}var i={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,o,n){a(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+n+"ms",transform:o.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function r(){var t=[];return{getDuration:function(){var e=t[0],o=t[t.length-1];return e?o.time-e.time:0},getOffset:function(){var e=t[0],o=t[t.length-1];return e?{x:o.x-e.x,y:o.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return n=(o=t).length-1,l=o[n],o=o[n-1]||l,n={x:l.x-o.x,y:l.y-o.y},l=l.time-o.time,o=n.x/l||0,l=n.y/l||0,e({},n,{angle:Math.atan2(Math.abs(n.y),Math.abs(n.x))*s,velocityX:o,velocityY:l});var o,n,l},clear:function(){t=[]},push:function(o){t.push(e({time:Date.now()},o))}}}function c(){return(performance||Date).now()}var u=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,m=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;function d(){var e=function(){var e,t;return{run:function(o){e=void 0===e?c():e,t=u((function(){var t=c(),n=t-e;e=t,o(n)}))},stop:function(){e=void 0,m(t)}}}();return{run:function t(o){e.run((function(e){t(o),o(e)}))},stop:function(){e.stop()}}}function p(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function g(e,t,o,n){var l=n.initLayout,a=n.initStatus,i=n.render,s=n.scrollPixel,r=n.slideTo,c=n.getOffsetSteps,u=d();return{preheat:function(e,t){var n=o.tracker;u.stop(),n.clear(),n.push(e),l(t),a(t),o.isStart=!0,i()},move:function(t){var n,l=o.tracker,a=e.touchRatio,r=e.touchAngle,c=e.isHorizontal;o.isStart&&!o.isScrolling&&(l.push(t),n=l.vector(),((t=l.getOffset()).x||t.y)&&(c&&n.angle<r||!c&&90-n.angle<r||o.isTouching?(a=n[c?"x":"y"]*a,o.isTouching=!0,s(a),i()):(o.isScrolling=!0,l.clear())))},stop:function(){var l,a,m,d=o.index,g=o.tracker,b=t.measure;o.isStart&&(o.isStart=!1,e.freeMode?(l=g.vector()[e.isHorizontal?"velocityX":"velocityY"],u.run((function(e){e*=l,l*=.98,Math.abs(e)<.01?(u.stop(),p(o,n)):(s(e),i(0))}))):(a=g.getDuration(),m=g.getOffset()[e.isHorizontal?"x":"y"],g=Math.ceil(Math.abs(m)/b.boxSize),b=c(m),a>e.longSwipesMs?r(d+b*(0<m?-1:1)):r(0<m?d-g:d+g),p(o,n)))}}}function b(e,t){var o={};return(o.update=function(e){var n,l=function(e,t,o){var n=e.$list,l=t.viewSize,a=t.slideSize,i=t.boxSize,s=-(t=(e=(s=o).loop?Math.ceil(s.slidesPerView):0)*i)+(o.centeredSlides?(l-a)/2:0);return{max:s,min:o.spaceBetween+(o.loop?a:l)+s-i*n.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:n.length-(o.centeredSlides||o.loop?1:Math.ceil(o.slidesPerView))}}(e,(n=t,a=(l=e).$el,n={boxSize:(a=((l=n.isHorizontal?a.offsetWidth:a.offsetHeight)-Math.ceil(n.slidesPerView-1)*n.spaceBetween)/n.slidesPerView)+n.spaceBetween,viewSize:l,slideSize:a}),t),a=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(o,{touchable:a,element:e,measure:n,limitation:l})})(e),o}var h="data-shallow-slider",v="data-slider";function f(e,o){function n(){e.element.$wrapper.querySelectorAll("["+h+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function i(){var t=e.element,n=e.measure,l=t.$wrapper,i={display:"flex",willChange:"transform",flexDirection:o.isHorizontal?"row":"column"},s=((t={})[o.isHorizontal?"width":"height"]=n.slideSize+"px",t[o.isHorizontal?"margin-right":"margin-bottom"]=o.spaceBetween+"px",t);a(l,i),l.querySelectorAll("["+v+"]").forEach((function(e){return a(e,s)}))}return{init:function(){(function(){var t,a,i,s,r,c;e.element.$list.forEach((function(e,t){return l(e,v,t)})),n(),o.loop&&(t=e.element,s=e.limitation,a=t.$list,i=t.$wrapper,s=s.expand,r=a.slice(-s).map((function(e){return e.cloneNode(!0)})),c=a.slice(0,s).map((function(e){return e.cloneNode(!0)})),r.forEach((function(e,t){i.appendChild(l(c[t],h)),i.insertBefore(l(r[t],h),a[0])})))})(),i()},render:function(n,l,a,i){var s=e.element.$wrapper;l=void 0===l?o.speed:l,o.injections.translate(n,e,o,l),n.isStart||function(n){var l=e.element.$wrapper,a=n.index;l.querySelectorAll("["+v+"]").forEach((function(e){var n,l,i=~~e.getAttribute(v);n=e,void 0===(l=[o.slidePrevClass,o.slideNextClass,o.slideActiveClass])&&(l=[]),Array.isArray(l)||(l=[l]),l.forEach((function(e){return n.classList.contains(e)&&n.classList.remove(e)})),i===a&&t(e,o.slideActiveClass),i==a-1&&t(e,o.slidePrevClass),i===a+1&&t(e,o.slideNextClass)}))}(n),i&&getComputedStyle(s).transform,a&&setTimeout(a,l)},destroy:function(){var t=e.element,l=t.$list,a=t.$wrapper,i=o.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){a.style.removeProperty(e)})),l.forEach((function(e){return e.style.removeProperty(i)})),n()},updateSize:i}}function k(e,t){var o=e-t.max;return t=e-t.min,0<o?o:t<0?t:0}function _(t,o,n,l,a){function i(e){var o=t.measure;return Math.ceil(Math.abs(e)/o.boxSize-n.longSwipesRatio)}function s(e,t,n){l.render(o,e,t,n)}function r(l){var i,s,r=(s=t.limitation).min,c=s.max;r=(s=c-r+(n.loop?t.measure.boxSize:0))+1,o.transforms=l,n.loop?(i=(c-l)%r/s,o.progress=i<0?1+i:1<i?i-1:i):(i=(c-l)/s,o.progress=i<0?0:1<i?1:i),a.emit("scroll",e({},o))}function c(e,l){var c,u,m,d,p,g=t.measure,b=t.limitation,h=b.maxIndex-b.minIndex+1,v=n.loop?(e%h+h)%h:e>b.maxIndex?b.maxIndex:e<b.minIndex?b.minIndex:e,f=-v*g.boxSize+b.base;0!==i(f-o.transforms)&&n.loop&&(c=k(o.transforms,b),u=v-o.index,m=o.index,d=v,p=u,e=(h=b).maxIndex,m=(0<p?1:-1)*(h.minIndex-e-1)+d-m,(p=Math.abs(p)>Math.abs(m)?m:p)===u||c?o.index===v&&r(0<c?b.min-g.boxSize+c:b.max+g.boxSize+c):r(p<0?b.min-g.boxSize:b.max+g.boxSize),s(0,void 0,!0)),a.emit("before-slide",o.index,o,v),o.index=v,r(f),s(l,(function(){a.emit("after-slide",v,o)}))}return{update:function(){c(o.index,0),l.updateSize()},render:s,transform:r,slideTo:c,scrollPixel:function(e){var l,a=o.transforms,i=t.measure,s=t.limitation,c=(l=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(l-1)):1,u=a;n.resistance&&!n.loop&&(0<e&&a>=s.max?e-=Math.pow(e*c,n.resistanceRatio)/c:e<0&&a<=s.min&&(e+=Math.pow(-e*c,n.resistanceRatio)/c)),u+=e,n.loop&&(l=o.tracker.vector(),c=n.isHorizontal?l.velocityX:l.velocityY,(e=k(a,s))&&(l=a,a=s,0<(c=c)&&l>a.max||c<0&&l<a.min)&&(u=0<e?s.min-i.boxSize+e:s.max+i.boxSize+e)),r(u)},initStatus:function(e){void 0===e&&(e=0),o.startTransform=e,o.isStart=!1,o.isScrolling=!1,o.isTouching=!1},initLayout:function(e){r(e)},getOffsetSteps:i}}function E(e,t){var o="string"==typeof e?document.body.querySelector(e):e;return e=o.querySelector("."+t.wrapperClass),t=[].slice.call(o.getElementsByClassName(t.slideClass)),{$el:o,$wrapper:e,$list:t=t.filter((function(e){return null===e.getAttribute("data-shallow-slider")}))}}function S(t,l){var a=(m=e({},i,m=l),e({},m,{isHorizontal:"horizontal"===m.direction})),s=function(){var e={};return{on:function(t,o){e[t]?e[t].push(o):e[t]=[o]},off:function(t,o){!e[t]||-1<(o=e[t].indexOf(o))&&e[t].splice(o,1)},emit:function(t){for(var o=arguments.length,n=new Array(1<o?o-1:0),l=1;l<o;l++)n[l-1]=arguments[l];e[t]&&e[t].forEach((function(e){return e.apply(void 0,n)}))},clear:function(){e={}}}}(),c=b(E(t,a),a),u={tracker:r(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},m=(l=s.on,s.off),d=s.emit,p={on:l,off:m,env:c,state:u,options:a};(a.plugins||S.plugins||[]).forEach((function(e){return e(p,a)})),d("before-init",p);var h=f(c,a),v=_(c,u,a,h,s),k=function(e,t,l,a){var i=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],r=(a=g(l,e,t,a)).preheat,c=a.move,u=a.stop;function m(e){return{x:(e=i?e.changedTouches[0]:e).pageX,y:e.pageY}}function d(t){for(var o=0;o<l.excludeElements.length;o++)if(l.excludeElements[o].contains(t.target))return;var n,a=e.element.$wrapper,c=l.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||l.touchStartForcePreventDefault;!i&&c&&t.preventDefault(),r(m(t),(n=a,c=l.isHorizontal,a=getComputedStyle(n).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),n=[],16===a.length?n=a.slice(12,14):6===a.length&&(n=a.slice(4,6)),n[c?0:1]||0))}function p(e){l.touchMoveStopPropagation&&e.stopPropagation(),c(m(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function b(){u()}return{attach:function(){var t=e.element.$el;i?(o(t,"touchstart",d,{passive:l.passiveListeners,capture:!1}),o(t,"touchmove",p),o(t,"touchend",b),o(t,"touchcancel",b)):(o(t,"mousedown",d),o(document,"mousemove",p),o(document,"mouseup",b))},detach:function(){var t=e.element.$el;n(t,"touchstart",d),n(t,"touchmove",p),n(t,"touchend",b),n(t,"touchcancel",b),n(t,"mousedown",d),n(document,"mousemove",p),n(document,"mouseup",b)}}}(c,u,a,v);return u=v.slideTo,Object.assign(p,{update:function(){h.destroy(),c.update(E(t,a)),h.init(),v.update()},destroy:function(){d("before-destroy",p),k.detach(),h.destroy(),d("after-destroy",p),s.clear()},slideTo:u,updateSize:function(){c.update(E(t,a)),v.update()}}),h.init(),k.attach(),u(a.initialSlide,0),d("after-init",p),p}return S.use=function(e){S.plugins=e},S}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,o,n){e.addEventListener(t,o,n)}function t(e,t,o){e.removeEventListener(t,o)}return function(o,n){function l(e){c(e.target,"next")}function a(e){c(e.target,"prev")}var i=Boolean(n.navigation),s={nextEl:null,prevEl:null},r=Object.assign({disabledClass:"swiper-button-disabled"},n.navigation),c=function(e,t){u(e)&&!o.options.loop||(e=o.state.index,"next"===t&&o.slideTo(e+1),"prev"===t&&o.slideTo(e-1))},u=function(e){return e.classList.contains(r.disabledClass)};o.on("before-slide",(function(e,t,n){var l,a;o.options.loop||(l=n,n=(a=o.env.limitation).minIndex,a=a.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(r.disabledClass)&&n<=l&&s.nextEl.classList.remove(r.disabledClass),s.prevEl.classList.contains(r.disabledClass)&&l<=a&&s.prevEl.classList.remove(r.disabledClass),l===n&&s.prevEl.classList.add(r.disabledClass),l===a&&s.nextEl.classList.add(r.disabledClass)))})),o.on("after-init",(function(){var t,n,c;i&&(s.nextEl="string"==typeof r.nextEl?document.body.querySelector(r.nextEl):r.nextEl,s.prevEl="string"==typeof r.prevEl?document.body.querySelector(r.prevEl):r.prevEl,o.options.loop||(t=o.state.index,n=o.env.element.$list,t===(c=o.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(r.disabledClass),n.length===c&&s.nextEl&&s.nextEl.classList.add(r.disabledClass)),e(s.nextEl,"click",l),e(s.prevEl,"click",a))})),o.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",l),t(s.prevEl,"click",a),delete s.nextEl,delete s.prevEl)}))}}()}}]);
dist/958.js CHANGED
@@ -1 +1 @@
1
- (self.webpackChunkcoblocks=self.webpackChunkcoblocks||[]).push([[958],{4896:function(e,t,n){"use strict";var i=n(8824);t.Z=i.Z},8824:function(e,t,n){"use strict";var i=n(9307),r=n(444);const o=(0,i.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(r.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"}));t.Z=o},4184:function(e,t){var n;!function(){"use strict";var i={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var s in n)i.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},2703:function(e,t,n){"use strict";var i=n(414);function r(){}function o(){}o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,a){if(a!==i){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},5697:function(e,t,n){e.exports=n(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function r(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function o(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){o(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,r=n[i],n=n[i-1]||r,i={x:r.x-n.x,y:r.y-n.y},r=r.time-n.time,n=i.x/r||0,r=i.y/r||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:r});var n,i,r},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}function u(){var e=function(){var e,t,n=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,i=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;return{run:function(i){e=void 0===e?c():e,t=n((function(){var t=c(),n=t-e;e=t,i(n)}))},stop:function(){e=void 0,i(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function f(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function p(e,t,n,i){var r=i.initLayout,o=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,p=u();return{preheat:function(e,t){var i=n.tracker;p.stop(),i.clear(),i.push(e),r(t),o(t),n.isStart=!0,a()},move:function(t){var i,r=n.tracker,o=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(r.push(t),i=r.vector(),((t=r.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(o=i[c?"x":"y"]*o,n.isTouching=!0,s(o),a()):(n.isScrolling=!0,r.clear())))},stop:function(){var r,o,u,d=n.index,m=n.tracker,v=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(r=m.vector()[e.isHorizontal?"velocityX":"velocityY"],p.run((function(e){e*=r,r*=.98,Math.abs(e)<.01?(p.stop(),f(n,i)):(s(e),a(0))}))):(o=m.getDuration(),u=m.getOffset()[e.isHorizontal?"x":"y"],m=Math.ceil(Math.abs(u)/v.boxSize),v=c(u),o>e.longSwipesMs?l(d+v*(0<u?-1:1)):l(0<u?d-m:d+m),f(n,i)))}}}function d(e,t){var n={};return(n.update=function(e){var i,r=function(e,t,n){var i=e.$list,r=t.viewSize,o=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(r-o)/2:0);return{max:s,min:n.spaceBetween+(n.loop?o:r)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,o=(r=e).$el,i={boxSize:(o=((r=i.isHorizontal?o.offsetWidth:o.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:r,slideSize:o}),t),o=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:o,element:e,measure:i,limitation:r})})(e),n}var m="data-shallow-slider",v="data-slider";function h(e,n){function i(){e.element.$wrapper.querySelectorAll("["+m+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,r=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);o(r,a),r.querySelectorAll("["+v+"]").forEach((function(e){return o(e,s)}))}return{init:function(){(function(){var t,o,a,s,l,c;e.element.$list.forEach((function(e,t){return r(e,v,t)})),i(),n.loop&&(t=e.element,s=e.limitation,o=t.$list,a=t.$wrapper,s=s.expand,l=o.slice(-s).map((function(e){return e.cloneNode(!0)})),c=o.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(r(c[t],m)),a.insertBefore(r(l[t],m),o[0])})))})(),a()},render:function(i,r,o,a){var s=e.element.$wrapper;r=void 0===r?n.speed:r,n.injections.translate(i,e,n,r),i.isStart||function(i){var r=e.element.$wrapper,o=i.index;r.querySelectorAll("["+v+"]").forEach((function(e){var i,r,a=~~e.getAttribute(v);i=e,void 0===(r=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(r=[]),Array.isArray(r)||(r=[r]),r.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===o&&t(e,n.slideActiveClass),a==o-1&&t(e,n.slidePrevClass),a===o+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,o&&setTimeout(o,r)},destroy:function(){var t=e.element,r=t.$list,o=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){o.style.removeProperty(e)})),r.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function x(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function g(t,n,i,r,o){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){r.render(n,e,t,i)}function l(r){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=r,i.loop?(a=(c-r)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-r)/s,n.progress=a<0?0:1<a?1:a),o.emit("scroll",e({},n))}function c(e,r){var c,u,f,p,d,m=t.measure,v=t.limitation,h=v.maxIndex-v.minIndex+1,g=i.loop?(e%h+h)%h:e>v.maxIndex?v.maxIndex:e<v.minIndex?v.minIndex:e,y=-g*m.boxSize+v.base;0!==a(y-n.transforms)&&i.loop&&(c=x(n.transforms,v),u=g-n.index,f=n.index,p=g,d=u,e=(h=v).maxIndex,f=(0<d?1:-1)*(h.minIndex-e-1)+p-f,(d=Math.abs(d)>Math.abs(f)?f:d)===u||c?n.index===g&&l(0<c?v.min-m.boxSize+c:v.max+m.boxSize+c):l(d<0?v.min-m.boxSize:v.max+m.boxSize),s(0,void 0,!0)),o.emit("before-slide",n.index,n,g),n.index=g,l(y),s(r,(function(){o.emit("after-slide",g,n)}))}return{update:function(){c(n.index,0),r.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var r,o=n.transforms,a=t.measure,s=t.limitation,c=(r=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(r-1)):1,u=o;i.resistance&&!i.loop&&(0<e&&o>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&o<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(r=n.tracker.vector(),c=i.isHorizontal?r.velocityX:r.velocityY,(e=x(o,s))&&(r=o,o=s,0<(c=c)&&r>o.max||c<0&&r<o.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function y(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t}}function b(t,r){var o=(f=e({},a,f=r),e({},f,{isHorizontal:"horizontal"===f.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=d(y(t,o),o),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},f=(r=s.on,s.off),m=s.emit,v={on:r,off:f,env:c,state:u,options:o};(o.plugins||b.plugins||[]).forEach((function(e){return e(v,o)})),m("before-init",v);var x=h(c,o),S=g(c,u,o,x,s),w=function(e,t,r,o){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(o=p(r,e,t,o)).preheat,c=o.move,u=o.stop;function f(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function d(t){for(var n=0;n<r.excludeElements.length;n++)if(r.excludeElements[n].contains(t.target))return;var i,o=e.element.$wrapper,c=r.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||r.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(f(t),(i=o,c=r.isHorizontal,o=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===o.length?i=o.slice(12,14):6===o.length&&(i=o.slice(4,6)),i[c?0:1]||0))}function m(e){r.touchMoveStopPropagation&&e.stopPropagation(),c(f(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",d,{passive:r.passiveListeners,capture:!1}),n(t,"touchmove",m),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",d),n(document,"mousemove",m),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",d),i(t,"touchmove",m),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",d),i(document,"mousemove",m),i(document,"mouseup",v)}}}(c,u,o,S);return u=S.slideTo,Object.assign(v,{update:function(){x.destroy(),c.update(y(t,o)),x.init(),S.update()},destroy:function(){m("before-destroy",v),w.detach(),x.destroy(),m("after-destroy",v),s.clear()},slideTo:u,updateSize:function(){c.update(y(t,o)),S.update()}}),x.init(),w.attach(),u(o.initialSlide,0),m("after-init",v),v}return b.use=function(e){b.plugins=e},b}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function r(e){c(e.target,"next")}function o(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var r,o;n.options.loop||(r=i,i=(o=n.env.limitation).minIndex,o=o.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=r&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&r<=o&&s.prevEl.classList.remove(l.disabledClass),r===i&&s.prevEl.classList.add(l.disabledClass),r===o&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",r),e(s.prevEl,"click",o))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",r),t(s.prevEl,"click",o),delete s.nextEl,delete s.prevEl)}))}}()},8893:function(e,t){"use strict";t.Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},3653:function(e,t,n){"use strict";var i;n.d(t,{Z:function(){return o}});var r=new Uint8Array(16);function o(){if(!i&&!(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(r)}},3958:function(e,t,n){"use strict";for(var i=n(7283),r=[],o=0;o<256;++o)r.push((o+256).toString(16).substr(1));t.Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]).toLowerCase();if(!(0,i.Z)(n))throw TypeError("Stringified UUID is invalid");return n}},2045:function(e,t,n){"use strict";var i=n(3653),r=n(3958);t.Z=function(e,t,n){var o=(e=e||{}).random||(e.rng||i.Z)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=o[a];return t}return(0,r.Z)(o)}},7283:function(e,t,n){"use strict";var i=n(8893);t.Z=function(e){return"string"==typeof e&&i.Z.test(e)}},7462:function(e,t,n){"use strict";function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},i.apply(this,arguments)}n.d(t,{Z:function(){return i}})}}]);
1
+ (self.webpackChunkcoblocks=self.webpackChunkcoblocks||[]).push([[958],{4896:function(e,t,n){"use strict";var r=n(8824);t.Z=r.Z},8824:function(e,t,n){"use strict";var r=n(9307),i=n(444);const o=(0,r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(i.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"}));t.Z=o},4184:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var a=i.apply(null,n);a&&e.push(a)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var s in n)r.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)}()},2703:function(e,t,n){"use strict";var r=n(414);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},5697:function(e,t,n){e.exports=n(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,r){e.addEventListener(t,n,r)}function r(e,t,n){e.removeEventListener(t,n)}function i(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function o(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,r){o(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+r+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return r=(n=t).length-1,i=n[r],n=n[r-1]||i,r={x:i.x-n.x,y:i.y-n.y},i=i.time-n.time,n=r.x/i||0,i=r.y/i||0,e({},r,{angle:Math.atan2(Math.abs(r.y),Math.abs(r.x))*s,velocityX:n,velocityY:i});var n,r,i},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}var u=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,f=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;function p(){var e=function(){var e,t;return{run:function(n){e=void 0===e?c():e,t=u((function(){var t=c(),r=t-e;e=t,n(r)}))},stop:function(){e=void 0,f(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function d(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function m(e,t,n,r){var i=r.initLayout,o=r.initStatus,a=r.render,s=r.scrollPixel,l=r.slideTo,c=r.getOffsetSteps,u=p();return{preheat:function(e,t){var r=n.tracker;u.stop(),r.clear(),r.push(e),i(t),o(t),n.isStart=!0,a()},move:function(t){var r,i=n.tracker,o=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(i.push(t),r=i.vector(),((t=i.getOffset()).x||t.y)&&(c&&r.angle<l||!c&&90-r.angle<l||n.isTouching?(o=r[c?"x":"y"]*o,n.isTouching=!0,s(o),a()):(n.isScrolling=!0,i.clear())))},stop:function(){var i,o,f,p=n.index,m=n.tracker,v=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(i=m.vector()[e.isHorizontal?"velocityX":"velocityY"],u.run((function(e){e*=i,i*=.98,Math.abs(e)<.01?(u.stop(),d(n,r)):(s(e),a(0))}))):(o=m.getDuration(),f=m.getOffset()[e.isHorizontal?"x":"y"],m=Math.ceil(Math.abs(f)/v.boxSize),v=c(f),o>e.longSwipesMs?l(p+v*(0<f?-1:1)):l(0<f?p-m:p+m),d(n,r)))}}}function v(e,t){var n={};return(n.update=function(e){var r,i=function(e,t,n){var r=e.$list,i=t.viewSize,o=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(i-o)/2:0);return{max:s,min:n.spaceBetween+(n.loop?o:i)+s-a*r.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:r.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(r=t,o=(i=e).$el,r={boxSize:(o=((i=r.isHorizontal?o.offsetWidth:o.offsetHeight)-Math.ceil(r.slidesPerView-1)*r.spaceBetween)/r.slidesPerView)+r.spaceBetween,viewSize:i,slideSize:o}),t),o=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:o,element:e,measure:r,limitation:i})})(e),n}var h="data-shallow-slider",x="data-slider";function g(e,n){function r(){e.element.$wrapper.querySelectorAll("["+h+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,r=e.measure,i=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=r.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);o(i,a),i.querySelectorAll("["+x+"]").forEach((function(e){return o(e,s)}))}return{init:function(){(function(){var t,o,a,s,l,c;e.element.$list.forEach((function(e,t){return i(e,x,t)})),r(),n.loop&&(t=e.element,s=e.limitation,o=t.$list,a=t.$wrapper,s=s.expand,l=o.slice(-s).map((function(e){return e.cloneNode(!0)})),c=o.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(i(c[t],h)),a.insertBefore(i(l[t],h),o[0])})))})(),a()},render:function(r,i,o,a){var s=e.element.$wrapper;i=void 0===i?n.speed:i,n.injections.translate(r,e,n,i),r.isStart||function(r){var i=e.element.$wrapper,o=r.index;i.querySelectorAll("["+x+"]").forEach((function(e){var r,i,a=~~e.getAttribute(x);r=e,void 0===(i=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(i=[]),Array.isArray(i)||(i=[i]),i.forEach((function(e){return r.classList.contains(e)&&r.classList.remove(e)})),a===o&&t(e,n.slideActiveClass),a==o-1&&t(e,n.slidePrevClass),a===o+1&&t(e,n.slideNextClass)}))}(r),a&&getComputedStyle(s).transform,o&&setTimeout(o,i)},destroy:function(){var t=e.element,i=t.$list,o=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){o.style.removeProperty(e)})),i.forEach((function(e){return e.style.removeProperty(a)})),r()},updateSize:a}}function y(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function b(t,n,r,i,o){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-r.longSwipesRatio)}function s(e,t,r){i.render(n,e,t,r)}function l(i){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(r.loop?t.measure.boxSize:0))+1,n.transforms=i,r.loop?(a=(c-i)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-i)/s,n.progress=a<0?0:1<a?1:a),o.emit("scroll",e({},n))}function c(e,i){var c,u,f,p,d,m=t.measure,v=t.limitation,h=v.maxIndex-v.minIndex+1,x=r.loop?(e%h+h)%h:e>v.maxIndex?v.maxIndex:e<v.minIndex?v.minIndex:e,g=-x*m.boxSize+v.base;0!==a(g-n.transforms)&&r.loop&&(c=y(n.transforms,v),u=x-n.index,f=n.index,p=x,d=u,e=(h=v).maxIndex,f=(0<d?1:-1)*(h.minIndex-e-1)+p-f,(d=Math.abs(d)>Math.abs(f)?f:d)===u||c?n.index===x&&l(0<c?v.min-m.boxSize+c:v.max+m.boxSize+c):l(d<0?v.min-m.boxSize:v.max+m.boxSize),s(0,void 0,!0)),o.emit("before-slide",n.index,n,x),n.index=x,l(g),s(i,(function(){o.emit("after-slide",x,n)}))}return{update:function(){c(n.index,0),i.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var i,o=n.transforms,a=t.measure,s=t.limitation,c=(i=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(i-1)):1,u=o;r.resistance&&!r.loop&&(0<e&&o>=s.max?e-=Math.pow(e*c,r.resistanceRatio)/c:e<0&&o<=s.min&&(e+=Math.pow(-e*c,r.resistanceRatio)/c)),u+=e,r.loop&&(i=n.tracker.vector(),c=r.isHorizontal?i.velocityX:i.velocityY,(e=y(o,s))&&(i=o,o=s,0<(c=c)&&i>o.max||c<0&&i<o.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function S(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t=t.filter((function(e){return null===e.getAttribute("data-shallow-slider")}))}}function w(t,i){var o=(f=e({},a,f=i),e({},f,{isHorizontal:"horizontal"===f.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,r=new Array(1<n?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e[t]&&e[t].forEach((function(e){return e.apply(void 0,r)}))},clear:function(){e={}}}}(),c=v(S(t,o),o),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},f=(i=s.on,s.off),p=s.emit,d={on:i,off:f,env:c,state:u,options:o};(o.plugins||w.plugins||[]).forEach((function(e){return e(d,o)})),p("before-init",d);var h=g(c,o),x=b(c,u,o,h,s),y=function(e,t,i,o){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(o=m(i,e,t,o)).preheat,c=o.move,u=o.stop;function f(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function p(t){for(var n=0;n<i.excludeElements.length;n++)if(i.excludeElements[n].contains(t.target))return;var r,o=e.element.$wrapper,c=i.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||i.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(f(t),(r=o,c=i.isHorizontal,o=getComputedStyle(r).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),r=[],16===o.length?r=o.slice(12,14):6===o.length&&(r=o.slice(4,6)),r[c?0:1]||0))}function d(e){i.touchMoveStopPropagation&&e.stopPropagation(),c(f(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",p,{passive:i.passiveListeners,capture:!1}),n(t,"touchmove",d),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",p),n(document,"mousemove",d),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;r(t,"touchstart",p),r(t,"touchmove",d),r(t,"touchend",v),r(t,"touchcancel",v),r(t,"mousedown",p),r(document,"mousemove",d),r(document,"mouseup",v)}}}(c,u,o,x);return u=x.slideTo,Object.assign(d,{update:function(){h.destroy(),c.update(S(t,o)),h.init(),x.update()},destroy:function(){p("before-destroy",d),y.detach(),h.destroy(),p("after-destroy",d),s.clear()},slideTo:u,updateSize:function(){c.update(S(t,o)),x.update()}}),h.init(),y.attach(),u(o.initialSlide,0),p("after-init",d),d}return w.use=function(e){w.plugins=e},w}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,r){e.addEventListener(t,n,r)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,r){function i(e){c(e.target,"next")}function o(e){c(e.target,"prev")}var a=Boolean(r.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},r.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,r){var i,o;n.options.loop||(i=r,r=(o=n.env.limitation).minIndex,o=o.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&r<=i&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&i<=o&&s.prevEl.classList.remove(l.disabledClass),i===r&&s.prevEl.classList.add(l.disabledClass),i===o&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,r,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,r=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),r.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",i),e(s.prevEl,"click",o))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",i),t(s.prevEl,"click",o),delete s.nextEl,delete s.prevEl)}))}}()},8893:function(e,t){"use strict";t.Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},3653:function(e,t,n){"use strict";var r;n.d(t,{Z:function(){return o}});var i=new Uint8Array(16);function o(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}},3958:function(e,t,n){"use strict";for(var r=n(7283),i=[],o=0;o<256;++o)i.push((o+256).toString(16).substr(1));t.Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase();if(!(0,r.Z)(n))throw TypeError("Stringified UUID is invalid");return n}},2045:function(e,t,n){"use strict";var r=n(3653),i=n(3958);t.Z=function(e,t,n){var o=(e=e||{}).random||(e.rng||r.Z)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=o[a];return t}return(0,i.Z)(o)}},7283:function(e,t,n){"use strict";var r=n(8893);t.Z=function(e){return"string"==typeof e&&r.Z.test(e)}},7462:function(e,t,n){"use strict";function r(){return r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{Z:function(){return r}})}}]);
dist/js/coblocks-events.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array(), 'version' => '39d6e9dd13ee38c3741c864684a0140e');
1
+ <?php return array('dependencies' => array(), 'version' => '6b31c5c5eb5f1e200e551df6b0be5e0b');
dist/js/coblocks-events.js CHANGED
@@ -1 +1 @@
1
- !function(){var e={9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function r(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function o(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){o(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,r=n[i],n=n[i-1]||r,i={x:r.x-n.x,y:r.y-n.y},r=r.time-n.time,n=i.x/r||0,r=i.y/r||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:r});var n,i,r},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}function u(){var e=function(){var e,t,n=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,i=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;return{run:function(i){e=void 0===e?c():e,t=n((function(){var t=c(),n=t-e;e=t,i(n)}))},stop:function(){e=void 0,i(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function d(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function p(e,t,n,i){var r=i.initLayout,o=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,p=u();return{preheat:function(e,t){var i=n.tracker;p.stop(),i.clear(),i.push(e),r(t),o(t),n.isStart=!0,a()},move:function(t){var i,r=n.tracker,o=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(r.push(t),i=r.vector(),((t=r.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(o=i[c?"x":"y"]*o,n.isTouching=!0,s(o),a()):(n.isScrolling=!0,r.clear())))},stop:function(){var r,o,u,f=n.index,m=n.tracker,v=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(r=m.vector()[e.isHorizontal?"velocityX":"velocityY"],p.run((function(e){e*=r,r*=.98,Math.abs(e)<.01?(p.stop(),d(n,i)):(s(e),a(0))}))):(o=m.getDuration(),u=m.getOffset()[e.isHorizontal?"x":"y"],m=Math.ceil(Math.abs(u)/v.boxSize),v=c(u),o>e.longSwipesMs?l(f+v*(0<u?-1:1)):l(0<u?f-m:f+m),d(n,i)))}}}function f(e,t){var n={};return(n.update=function(e){var i,r=function(e,t,n){var i=e.$list,r=t.viewSize,o=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(r-o)/2:0);return{max:s,min:n.spaceBetween+(n.loop?o:r)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,o=(r=e).$el,i={boxSize:(o=((r=i.isHorizontal?o.offsetWidth:o.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:r,slideSize:o}),t),o=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:o,element:e,measure:i,limitation:r})})(e),n}var m="data-shallow-slider",v="data-slider";function x(e,n){function i(){e.element.$wrapper.querySelectorAll("["+m+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,r=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);o(r,a),r.querySelectorAll("["+v+"]").forEach((function(e){return o(e,s)}))}return{init:function(){(function(){var t,o,a,s,l,c;e.element.$list.forEach((function(e,t){return r(e,v,t)})),i(),n.loop&&(t=e.element,s=e.limitation,o=t.$list,a=t.$wrapper,s=s.expand,l=o.slice(-s).map((function(e){return e.cloneNode(!0)})),c=o.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(r(c[t],m)),a.insertBefore(r(l[t],m),o[0])})))})(),a()},render:function(i,r,o,a){var s=e.element.$wrapper;r=void 0===r?n.speed:r,n.injections.translate(i,e,n,r),i.isStart||function(i){var r=e.element.$wrapper,o=i.index;r.querySelectorAll("["+v+"]").forEach((function(e){var i,r,a=~~e.getAttribute(v);i=e,void 0===(r=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(r=[]),Array.isArray(r)||(r=[r]),r.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===o&&t(e,n.slideActiveClass),a==o-1&&t(e,n.slidePrevClass),a===o+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,o&&setTimeout(o,r)},destroy:function(){var t=e.element,r=t.$list,o=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){o.style.removeProperty(e)})),r.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function h(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function g(t,n,i,r,o){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){r.render(n,e,t,i)}function l(r){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=r,i.loop?(a=(c-r)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-r)/s,n.progress=a<0?0:1<a?1:a),o.emit("scroll",e({},n))}function c(e,r){var c,u,d,p,f,m=t.measure,v=t.limitation,x=v.maxIndex-v.minIndex+1,g=i.loop?(e%x+x)%x:e>v.maxIndex?v.maxIndex:e<v.minIndex?v.minIndex:e,y=-g*m.boxSize+v.base;0!==a(y-n.transforms)&&i.loop&&(c=h(n.transforms,v),u=g-n.index,d=n.index,p=g,f=u,e=(x=v).maxIndex,d=(0<f?1:-1)*(x.minIndex-e-1)+p-d,(f=Math.abs(f)>Math.abs(d)?d:f)===u||c?n.index===g&&l(0<c?v.min-m.boxSize+c:v.max+m.boxSize+c):l(f<0?v.min-m.boxSize:v.max+m.boxSize),s(0,void 0,!0)),o.emit("before-slide",n.index,n,g),n.index=g,l(y),s(r,(function(){o.emit("after-slide",g,n)}))}return{update:function(){c(n.index,0),r.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var r,o=n.transforms,a=t.measure,s=t.limitation,c=(r=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(r-1)):1,u=o;i.resistance&&!i.loop&&(0<e&&o>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&o<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(r=n.tracker.vector(),c=i.isHorizontal?r.velocityX:r.velocityY,(e=h(o,s))&&(r=o,o=s,0<(c=c)&&r>o.max||c<0&&r<o.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function y(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t}}function w(t,r){var o=(d=e({},a,d=r),e({},d,{isHorizontal:"horizontal"===d.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=f(y(t,o),o),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},d=(r=s.on,s.off),m=s.emit,v={on:r,off:d,env:c,state:u,options:o};(o.plugins||w.plugins||[]).forEach((function(e){return e(v,o)})),m("before-init",v);var h=x(c,o),b=g(c,u,o,h,s),S=function(e,t,r,o){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(o=p(r,e,t,o)).preheat,c=o.move,u=o.stop;function d(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function f(t){for(var n=0;n<r.excludeElements.length;n++)if(r.excludeElements[n].contains(t.target))return;var i,o=e.element.$wrapper,c=r.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||r.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(d(t),(i=o,c=r.isHorizontal,o=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===o.length?i=o.slice(12,14):6===o.length&&(i=o.slice(4,6)),i[c?0:1]||0))}function m(e){r.touchMoveStopPropagation&&e.stopPropagation(),c(d(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",f,{passive:r.passiveListeners,capture:!1}),n(t,"touchmove",m),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",f),n(document,"mousemove",m),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",f),i(t,"touchmove",m),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",f),i(document,"mousemove",m),i(document,"mouseup",v)}}}(c,u,o,b);return u=b.slideTo,Object.assign(v,{update:function(){h.destroy(),c.update(y(t,o)),h.init(),b.update()},destroy:function(){m("before-destroy",v),S.detach(),h.destroy(),m("after-destroy",v),s.clear()},slideTo:u,updateSize:function(){c.update(y(t,o)),b.update()}}),h.init(),S.attach(),u(o.initialSlide,0),m("after-init",v),v}return w.use=function(e){w.plugins=e},w}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function r(e){c(e.target,"next")}function o(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var r,o;n.options.loop||(r=i,i=(o=n.env.limitation).minIndex,o=o.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=r&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&r<=o&&s.prevEl.classList.remove(l.disabledClass),r===i&&s.prevEl.classList.add(l.disabledClass),r===o&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",r),e(s.prevEl,"click",o))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",r),t(s.prevEl,"click",o),delete s.nextEl,delete s.prevEl)}))}}()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(9334),t=n.n(e),i=n(8608),r=n.n(i);document.addEventListener("DOMContentLoaded",(function(){setTimeout((()=>{const e=document.querySelectorAll(".page .wp-block-coblocks-front-events-swiper-container");for(let n=0;n<e.length;n++){const i=e[n];if(!i)return;const o=i.querySelector(".swiper-wrapper-loading"),a=i.querySelectorAll(".swiper-slide"),s=i.parentNode.querySelector("#wp-coblocks-event-swiper-prev"),l=i.parentNode.querySelector("#wp-coblocks-event-swiper-next");a.length>1&&o&&(o.classList.remove("swiper-wrapper-loading"),o.classList.add("swiper-wrapper"),s.style.visibility="visible",l.style.visibility="visible",new(t())(i,{navigation:{nextEl:l,prevEl:s},plugins:[r()],spaceBetween:10,touchable:!1}))}}),500)}),!1)}()}();
1
+ !function(){var e={9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function r(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function o(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){o(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,r=n[i],n=n[i-1]||r,i={x:r.x-n.x,y:r.y-n.y},r=r.time-n.time,n=i.x/r||0,r=i.y/r||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:r});var n,i,r},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}var u=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,d=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;function p(){var e=function(){var e,t;return{run:function(n){e=void 0===e?c():e,t=u((function(){var t=c(),i=t-e;e=t,n(i)}))},stop:function(){e=void 0,d(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function f(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function m(e,t,n,i){var r=i.initLayout,o=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,u=p();return{preheat:function(e,t){var i=n.tracker;u.stop(),i.clear(),i.push(e),r(t),o(t),n.isStart=!0,a()},move:function(t){var i,r=n.tracker,o=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(r.push(t),i=r.vector(),((t=r.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(o=i[c?"x":"y"]*o,n.isTouching=!0,s(o),a()):(n.isScrolling=!0,r.clear())))},stop:function(){var r,o,d,p=n.index,m=n.tracker,v=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(r=m.vector()[e.isHorizontal?"velocityX":"velocityY"],u.run((function(e){e*=r,r*=.98,Math.abs(e)<.01?(u.stop(),f(n,i)):(s(e),a(0))}))):(o=m.getDuration(),d=m.getOffset()[e.isHorizontal?"x":"y"],m=Math.ceil(Math.abs(d)/v.boxSize),v=c(d),o>e.longSwipesMs?l(p+v*(0<d?-1:1)):l(0<d?p-m:p+m),f(n,i)))}}}function v(e,t){var n={};return(n.update=function(e){var i,r=function(e,t,n){var i=e.$list,r=t.viewSize,o=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(r-o)/2:0);return{max:s,min:n.spaceBetween+(n.loop?o:r)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,o=(r=e).$el,i={boxSize:(o=((r=i.isHorizontal?o.offsetWidth:o.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:r,slideSize:o}),t),o=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:o,element:e,measure:i,limitation:r})})(e),n}var x="data-shallow-slider",h="data-slider";function g(e,n){function i(){e.element.$wrapper.querySelectorAll("["+x+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,r=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);o(r,a),r.querySelectorAll("["+h+"]").forEach((function(e){return o(e,s)}))}return{init:function(){(function(){var t,o,a,s,l,c;e.element.$list.forEach((function(e,t){return r(e,h,t)})),i(),n.loop&&(t=e.element,s=e.limitation,o=t.$list,a=t.$wrapper,s=s.expand,l=o.slice(-s).map((function(e){return e.cloneNode(!0)})),c=o.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(r(c[t],x)),a.insertBefore(r(l[t],x),o[0])})))})(),a()},render:function(i,r,o,a){var s=e.element.$wrapper;r=void 0===r?n.speed:r,n.injections.translate(i,e,n,r),i.isStart||function(i){var r=e.element.$wrapper,o=i.index;r.querySelectorAll("["+h+"]").forEach((function(e){var i,r,a=~~e.getAttribute(h);i=e,void 0===(r=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(r=[]),Array.isArray(r)||(r=[r]),r.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===o&&t(e,n.slideActiveClass),a==o-1&&t(e,n.slidePrevClass),a===o+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,o&&setTimeout(o,r)},destroy:function(){var t=e.element,r=t.$list,o=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){o.style.removeProperty(e)})),r.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function y(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function w(t,n,i,r,o){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){r.render(n,e,t,i)}function l(r){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=r,i.loop?(a=(c-r)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-r)/s,n.progress=a<0?0:1<a?1:a),o.emit("scroll",e({},n))}function c(e,r){var c,u,d,p,f,m=t.measure,v=t.limitation,x=v.maxIndex-v.minIndex+1,h=i.loop?(e%x+x)%x:e>v.maxIndex?v.maxIndex:e<v.minIndex?v.minIndex:e,g=-h*m.boxSize+v.base;0!==a(g-n.transforms)&&i.loop&&(c=y(n.transforms,v),u=h-n.index,d=n.index,p=h,f=u,e=(x=v).maxIndex,d=(0<f?1:-1)*(x.minIndex-e-1)+p-d,(f=Math.abs(f)>Math.abs(d)?d:f)===u||c?n.index===h&&l(0<c?v.min-m.boxSize+c:v.max+m.boxSize+c):l(f<0?v.min-m.boxSize:v.max+m.boxSize),s(0,void 0,!0)),o.emit("before-slide",n.index,n,h),n.index=h,l(g),s(r,(function(){o.emit("after-slide",h,n)}))}return{update:function(){c(n.index,0),r.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var r,o=n.transforms,a=t.measure,s=t.limitation,c=(r=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(r-1)):1,u=o;i.resistance&&!i.loop&&(0<e&&o>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&o<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(r=n.tracker.vector(),c=i.isHorizontal?r.velocityX:r.velocityY,(e=y(o,s))&&(r=o,o=s,0<(c=c)&&r>o.max||c<0&&r<o.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function b(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t=t.filter((function(e){return null===e.getAttribute("data-shallow-slider")}))}}function S(t,r){var o=(d=e({},a,d=r),e({},d,{isHorizontal:"horizontal"===d.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=v(b(t,o),o),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},d=(r=s.on,s.off),p=s.emit,f={on:r,off:d,env:c,state:u,options:o};(o.plugins||S.plugins||[]).forEach((function(e){return e(f,o)})),p("before-init",f);var x=g(c,o),h=w(c,u,o,x,s),y=function(e,t,r,o){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(o=m(r,e,t,o)).preheat,c=o.move,u=o.stop;function d(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function p(t){for(var n=0;n<r.excludeElements.length;n++)if(r.excludeElements[n].contains(t.target))return;var i,o=e.element.$wrapper,c=r.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||r.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(d(t),(i=o,c=r.isHorizontal,o=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===o.length?i=o.slice(12,14):6===o.length&&(i=o.slice(4,6)),i[c?0:1]||0))}function f(e){r.touchMoveStopPropagation&&e.stopPropagation(),c(d(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",p,{passive:r.passiveListeners,capture:!1}),n(t,"touchmove",f),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",p),n(document,"mousemove",f),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",p),i(t,"touchmove",f),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",p),i(document,"mousemove",f),i(document,"mouseup",v)}}}(c,u,o,h);return u=h.slideTo,Object.assign(f,{update:function(){x.destroy(),c.update(b(t,o)),x.init(),h.update()},destroy:function(){p("before-destroy",f),y.detach(),x.destroy(),p("after-destroy",f),s.clear()},slideTo:u,updateSize:function(){c.update(b(t,o)),h.update()}}),x.init(),y.attach(),u(o.initialSlide,0),p("after-init",f),f}return S.use=function(e){S.plugins=e},S}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function r(e){c(e.target,"next")}function o(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var r,o;n.options.loop||(r=i,i=(o=n.env.limitation).minIndex,o=o.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=r&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&r<=o&&s.prevEl.classList.remove(l.disabledClass),r===i&&s.prevEl.classList.add(l.disabledClass),r===o&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",r),e(s.prevEl,"click",o))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",r),t(s.prevEl,"click",o),delete s.nextEl,delete s.prevEl)}))}}()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(9334),t=n.n(e),i=n(8608),r=n.n(i);document.addEventListener("DOMContentLoaded",(function(){setTimeout((()=>{const e=document.querySelectorAll(".page .wp-block-coblocks-front-events-swiper-container");for(let n=0;n<e.length;n++){const i=e[n];if(!i)return;const o=i.querySelector(".swiper-wrapper-loading"),a=i.querySelectorAll(".swiper-slide"),s=i.parentNode.querySelector("#wp-coblocks-event-swiper-prev"),l=i.parentNode.querySelector("#wp-coblocks-event-swiper-next");a.length>1&&o&&(o.classList.remove("swiper-wrapper-loading"),o.classList.add("swiper-wrapper"),s.style.visibility="visible",l.style.visibility="visible",new(t())(i,{navigation:{nextEl:l,prevEl:s},plugins:[r()],spaceBetween:10,touchable:!1}))}}),500)}),!1)}()}();
dist/js/coblocks-post-carousel.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array(), 'version' => 'f680a2e566f67d48ca2298ab1e6feb2a');
1
+ <?php return array('dependencies' => array(), 'version' => '7cf69dc8be5853ad381ddcf783d11005');
dist/js/coblocks-post-carousel.js CHANGED
@@ -1 +1 @@
1
- !function(){var e={9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function o(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function r(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){r(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,o=n[i],n=n[i-1]||o,i={x:o.x-n.x,y:o.y-n.y},o=o.time-n.time,n=i.x/o||0,o=i.y/o||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:o});var n,i,o},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}function u(){var e=function(){var e,t,n=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,i=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;return{run:function(i){e=void 0===e?c():e,t=n((function(){var t=c(),n=t-e;e=t,i(n)}))},stop:function(){e=void 0,i(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function d(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function f(e,t,n,i){var o=i.initLayout,r=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,f=u();return{preheat:function(e,t){var i=n.tracker;f.stop(),i.clear(),i.push(e),o(t),r(t),n.isStart=!0,a()},move:function(t){var i,o=n.tracker,r=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(o.push(t),i=o.vector(),((t=o.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(r=i[c?"x":"y"]*r,n.isTouching=!0,s(r),a()):(n.isScrolling=!0,o.clear())))},stop:function(){var o,r,u,p=n.index,m=n.tracker,v=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(o=m.vector()[e.isHorizontal?"velocityX":"velocityY"],f.run((function(e){e*=o,o*=.98,Math.abs(e)<.01?(f.stop(),d(n,i)):(s(e),a(0))}))):(r=m.getDuration(),u=m.getOffset()[e.isHorizontal?"x":"y"],m=Math.ceil(Math.abs(u)/v.boxSize),v=c(u),r>e.longSwipesMs?l(p+v*(0<u?-1:1)):l(0<u?p-m:p+m),d(n,i)))}}}function p(e,t){var n={};return(n.update=function(e){var i,o=function(e,t,n){var i=e.$list,o=t.viewSize,r=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(o-r)/2:0);return{max:s,min:n.spaceBetween+(n.loop?r:o)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,r=(o=e).$el,i={boxSize:(r=((o=i.isHorizontal?r.offsetWidth:r.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:o,slideSize:r}),t),r=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:r,element:e,measure:i,limitation:o})})(e),n}var m="data-shallow-slider",v="data-slider";function x(e,n){function i(){e.element.$wrapper.querySelectorAll("["+m+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,o=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);r(o,a),o.querySelectorAll("["+v+"]").forEach((function(e){return r(e,s)}))}return{init:function(){(function(){var t,r,a,s,l,c;e.element.$list.forEach((function(e,t){return o(e,v,t)})),i(),n.loop&&(t=e.element,s=e.limitation,r=t.$list,a=t.$wrapper,s=s.expand,l=r.slice(-s).map((function(e){return e.cloneNode(!0)})),c=r.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(o(c[t],m)),a.insertBefore(o(l[t],m),r[0])})))})(),a()},render:function(i,o,r,a){var s=e.element.$wrapper;o=void 0===o?n.speed:o,n.injections.translate(i,e,n,o),i.isStart||function(i){var o=e.element.$wrapper,r=i.index;o.querySelectorAll("["+v+"]").forEach((function(e){var i,o,a=~~e.getAttribute(v);i=e,void 0===(o=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(o=[]),Array.isArray(o)||(o=[o]),o.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===r&&t(e,n.slideActiveClass),a==r-1&&t(e,n.slidePrevClass),a===r+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,r&&setTimeout(r,o)},destroy:function(){var t=e.element,o=t.$list,r=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){r.style.removeProperty(e)})),o.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function h(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function g(t,n,i,o,r){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){o.render(n,e,t,i)}function l(o){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=o,i.loop?(a=(c-o)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-o)/s,n.progress=a<0?0:1<a?1:a),r.emit("scroll",e({},n))}function c(e,o){var c,u,d,f,p,m=t.measure,v=t.limitation,x=v.maxIndex-v.minIndex+1,g=i.loop?(e%x+x)%x:e>v.maxIndex?v.maxIndex:e<v.minIndex?v.minIndex:e,y=-g*m.boxSize+v.base;0!==a(y-n.transforms)&&i.loop&&(c=h(n.transforms,v),u=g-n.index,d=n.index,f=g,p=u,e=(x=v).maxIndex,d=(0<p?1:-1)*(x.minIndex-e-1)+f-d,(p=Math.abs(p)>Math.abs(d)?d:p)===u||c?n.index===g&&l(0<c?v.min-m.boxSize+c:v.max+m.boxSize+c):l(p<0?v.min-m.boxSize:v.max+m.boxSize),s(0,void 0,!0)),r.emit("before-slide",n.index,n,g),n.index=g,l(y),s(o,(function(){r.emit("after-slide",g,n)}))}return{update:function(){c(n.index,0),o.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var o,r=n.transforms,a=t.measure,s=t.limitation,c=(o=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(o-1)):1,u=r;i.resistance&&!i.loop&&(0<e&&r>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&r<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(o=n.tracker.vector(),c=i.isHorizontal?o.velocityX:o.velocityY,(e=h(r,s))&&(o=r,r=s,0<(c=c)&&o>r.max||c<0&&o<r.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function y(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t}}function S(t,o){var r=(d=e({},a,d=o),e({},d,{isHorizontal:"horizontal"===d.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=p(y(t,r),r),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},d=(o=s.on,s.off),m=s.emit,v={on:o,off:d,env:c,state:u,options:r};(r.plugins||S.plugins||[]).forEach((function(e){return e(v,r)})),m("before-init",v);var h=x(c,r),b=g(c,u,r,h,s),w=function(e,t,o,r){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(r=f(o,e,t,r)).preheat,c=r.move,u=r.stop;function d(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function p(t){for(var n=0;n<o.excludeElements.length;n++)if(o.excludeElements[n].contains(t.target))return;var i,r=e.element.$wrapper,c=o.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||o.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(d(t),(i=r,c=o.isHorizontal,r=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===r.length?i=r.slice(12,14):6===r.length&&(i=r.slice(4,6)),i[c?0:1]||0))}function m(e){o.touchMoveStopPropagation&&e.stopPropagation(),c(d(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",p,{passive:o.passiveListeners,capture:!1}),n(t,"touchmove",m),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",p),n(document,"mousemove",m),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",p),i(t,"touchmove",m),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",p),i(document,"mousemove",m),i(document,"mouseup",v)}}}(c,u,r,b);return u=b.slideTo,Object.assign(v,{update:function(){h.destroy(),c.update(y(t,r)),h.init(),b.update()},destroy:function(){m("before-destroy",v),w.detach(),h.destroy(),m("after-destroy",v),s.clear()},slideTo:u,updateSize:function(){c.update(y(t,r)),b.update()}}),h.init(),w.attach(),u(r.initialSlide,0),m("after-init",v),v}return S.use=function(e){S.plugins=e},S}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function o(e){c(e.target,"next")}function r(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var o,r;n.options.loop||(o=i,i=(r=n.env.limitation).minIndex,r=r.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=o&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&o<=r&&s.prevEl.classList.remove(l.disabledClass),o===i&&s.prevEl.classList.add(l.disabledClass),o===r&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",o),e(s.prevEl,"click",r))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",o),t(s.prevEl,"click",r),delete s.nextEl,delete s.prevEl)}))}}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(9334),t=n.n(e),i=n(8608),o=n.n(i);document.addEventListener("DOMContentLoaded",(function(){setTimeout((()=>{const e=document.querySelectorAll(".wp-block-coblocks-post-carousel");for(let i=0;i<e.length;i++){const r=e[i];if(r){var n;const e=r.querySelector("[data-swiper]"),i=JSON.parse(null==e||null===(n=e.dataset)||void 0===n?void 0:n.swiper),a=r.querySelector("#wp-coblocks-post-carousel-swiper-prev"),s=r.querySelector("#wp-coblocks-post-carousel-swiper-next");r.querySelectorAll(".swiper-slide").length>1&&(a.style.visibility="visible",s.style.visibility="visible",new(t())(e,{centeredSlides:!1,loop:!0,navigation:{nextEl:s,prevEl:a},plugins:[o()],slidesPerView:i.slidesToShow,spaceBetween:35,touchable:!1}))}}}),1500)}))}()}();
1
+ !function(){var e={9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function o(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function r(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){r(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,o=n[i],n=n[i-1]||o,i={x:o.x-n.x,y:o.y-n.y},o=o.time-n.time,n=i.x/o||0,o=i.y/o||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:o});var n,i,o},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}var u=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,d=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;function f(){var e=function(){var e,t;return{run:function(n){e=void 0===e?c():e,t=u((function(){var t=c(),i=t-e;e=t,n(i)}))},stop:function(){e=void 0,d(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function p(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function m(e,t,n,i){var o=i.initLayout,r=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,u=f();return{preheat:function(e,t){var i=n.tracker;u.stop(),i.clear(),i.push(e),o(t),r(t),n.isStart=!0,a()},move:function(t){var i,o=n.tracker,r=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(o.push(t),i=o.vector(),((t=o.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(r=i[c?"x":"y"]*r,n.isTouching=!0,s(r),a()):(n.isScrolling=!0,o.clear())))},stop:function(){var o,r,d,f=n.index,m=n.tracker,v=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(o=m.vector()[e.isHorizontal?"velocityX":"velocityY"],u.run((function(e){e*=o,o*=.98,Math.abs(e)<.01?(u.stop(),p(n,i)):(s(e),a(0))}))):(r=m.getDuration(),d=m.getOffset()[e.isHorizontal?"x":"y"],m=Math.ceil(Math.abs(d)/v.boxSize),v=c(d),r>e.longSwipesMs?l(f+v*(0<d?-1:1)):l(0<d?f-m:f+m),p(n,i)))}}}function v(e,t){var n={};return(n.update=function(e){var i,o=function(e,t,n){var i=e.$list,o=t.viewSize,r=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(o-r)/2:0);return{max:s,min:n.spaceBetween+(n.loop?r:o)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,r=(o=e).$el,i={boxSize:(r=((o=i.isHorizontal?r.offsetWidth:r.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:o,slideSize:r}),t),r=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:r,element:e,measure:i,limitation:o})})(e),n}var x="data-shallow-slider",h="data-slider";function g(e,n){function i(){e.element.$wrapper.querySelectorAll("["+x+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,o=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);r(o,a),o.querySelectorAll("["+h+"]").forEach((function(e){return r(e,s)}))}return{init:function(){(function(){var t,r,a,s,l,c;e.element.$list.forEach((function(e,t){return o(e,h,t)})),i(),n.loop&&(t=e.element,s=e.limitation,r=t.$list,a=t.$wrapper,s=s.expand,l=r.slice(-s).map((function(e){return e.cloneNode(!0)})),c=r.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(o(c[t],x)),a.insertBefore(o(l[t],x),r[0])})))})(),a()},render:function(i,o,r,a){var s=e.element.$wrapper;o=void 0===o?n.speed:o,n.injections.translate(i,e,n,o),i.isStart||function(i){var o=e.element.$wrapper,r=i.index;o.querySelectorAll("["+h+"]").forEach((function(e){var i,o,a=~~e.getAttribute(h);i=e,void 0===(o=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(o=[]),Array.isArray(o)||(o=[o]),o.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===r&&t(e,n.slideActiveClass),a==r-1&&t(e,n.slidePrevClass),a===r+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,r&&setTimeout(r,o)},destroy:function(){var t=e.element,o=t.$list,r=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){r.style.removeProperty(e)})),o.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function y(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function S(t,n,i,o,r){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){o.render(n,e,t,i)}function l(o){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=o,i.loop?(a=(c-o)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-o)/s,n.progress=a<0?0:1<a?1:a),r.emit("scroll",e({},n))}function c(e,o){var c,u,d,f,p,m=t.measure,v=t.limitation,x=v.maxIndex-v.minIndex+1,h=i.loop?(e%x+x)%x:e>v.maxIndex?v.maxIndex:e<v.minIndex?v.minIndex:e,g=-h*m.boxSize+v.base;0!==a(g-n.transforms)&&i.loop&&(c=y(n.transforms,v),u=h-n.index,d=n.index,f=h,p=u,e=(x=v).maxIndex,d=(0<p?1:-1)*(x.minIndex-e-1)+f-d,(p=Math.abs(p)>Math.abs(d)?d:p)===u||c?n.index===h&&l(0<c?v.min-m.boxSize+c:v.max+m.boxSize+c):l(p<0?v.min-m.boxSize:v.max+m.boxSize),s(0,void 0,!0)),r.emit("before-slide",n.index,n,h),n.index=h,l(g),s(o,(function(){r.emit("after-slide",h,n)}))}return{update:function(){c(n.index,0),o.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var o,r=n.transforms,a=t.measure,s=t.limitation,c=(o=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(o-1)):1,u=r;i.resistance&&!i.loop&&(0<e&&r>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&r<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(o=n.tracker.vector(),c=i.isHorizontal?o.velocityX:o.velocityY,(e=y(r,s))&&(o=r,r=s,0<(c=c)&&o>r.max||c<0&&o<r.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function b(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t=t.filter((function(e){return null===e.getAttribute("data-shallow-slider")}))}}function w(t,o){var r=(d=e({},a,d=o),e({},d,{isHorizontal:"horizontal"===d.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=v(b(t,r),r),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},d=(o=s.on,s.off),f=s.emit,p={on:o,off:d,env:c,state:u,options:r};(r.plugins||w.plugins||[]).forEach((function(e){return e(p,r)})),f("before-init",p);var x=g(c,r),h=S(c,u,r,x,s),y=function(e,t,o,r){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(r=m(o,e,t,r)).preheat,c=r.move,u=r.stop;function d(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function f(t){for(var n=0;n<o.excludeElements.length;n++)if(o.excludeElements[n].contains(t.target))return;var i,r=e.element.$wrapper,c=o.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||o.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(d(t),(i=r,c=o.isHorizontal,r=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===r.length?i=r.slice(12,14):6===r.length&&(i=r.slice(4,6)),i[c?0:1]||0))}function p(e){o.touchMoveStopPropagation&&e.stopPropagation(),c(d(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",f,{passive:o.passiveListeners,capture:!1}),n(t,"touchmove",p),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",f),n(document,"mousemove",p),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",f),i(t,"touchmove",p),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",f),i(document,"mousemove",p),i(document,"mouseup",v)}}}(c,u,r,h);return u=h.slideTo,Object.assign(p,{update:function(){x.destroy(),c.update(b(t,r)),x.init(),h.update()},destroy:function(){f("before-destroy",p),y.detach(),x.destroy(),f("after-destroy",p),s.clear()},slideTo:u,updateSize:function(){c.update(b(t,r)),h.update()}}),x.init(),y.attach(),u(r.initialSlide,0),f("after-init",p),p}return w.use=function(e){w.plugins=e},w}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function o(e){c(e.target,"next")}function r(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var o,r;n.options.loop||(o=i,i=(r=n.env.limitation).minIndex,r=r.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=o&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&o<=r&&s.prevEl.classList.remove(l.disabledClass),o===i&&s.prevEl.classList.add(l.disabledClass),o===r&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",o),e(s.prevEl,"click",r))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",o),t(s.prevEl,"click",r),delete s.nextEl,delete s.prevEl)}))}}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(9334),t=n.n(e),i=n(8608),o=n.n(i);document.addEventListener("DOMContentLoaded",(function(){setTimeout((()=>{const e=document.querySelectorAll(".wp-block-coblocks-post-carousel");for(let i=0;i<e.length;i++){const r=e[i];if(r){var n;const e=r.querySelector("[data-swiper]"),i=JSON.parse(null==e||null===(n=e.dataset)||void 0===n?void 0:n.swiper),a=r.querySelector("#wp-coblocks-post-carousel-swiper-prev"),s=r.querySelector("#wp-coblocks-post-carousel-swiper-next");r.querySelectorAll(".swiper-slide").length>1&&(a.style.visibility="visible",s.style.visibility="visible",new(t())(e,{centeredSlides:!1,loop:!0,navigation:{nextEl:s,prevEl:a},plugins:[o()],slidesPerView:i.slidesToShow,spaceBetween:35,touchable:!1}))}}}),1500)}))}()}();
dist/js/coblocks-tinyswiper-initializer.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array(), 'version' => 'd3c0aef94a9a0e8c54f65ab32d9afddd');
1
+ <?php return array('dependencies' => array(), 'version' => 'a1582df0ef205f771426dd861dbe4c0d');
dist/js/coblocks-tinyswiper-initializer.js CHANGED
@@ -1 +1 @@
1
- !function(){var e={9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function o(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function r(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){r(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,o=n[i],n=n[i-1]||o,i={x:o.x-n.x,y:o.y-n.y},o=o.time-n.time,n=i.x/o||0,o=i.y/o||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:o});var n,i,o},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}function u(){var e=function(){var e,t,n=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,i=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;return{run:function(i){e=void 0===e?c():e,t=n((function(){var t=c(),n=t-e;e=t,i(n)}))},stop:function(){e=void 0,i(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function d(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function p(e,t,n,i){var o=i.initLayout,r=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,p=u();return{preheat:function(e,t){var i=n.tracker;p.stop(),i.clear(),i.push(e),o(t),r(t),n.isStart=!0,a()},move:function(t){var i,o=n.tracker,r=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(o.push(t),i=o.vector(),((t=o.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(r=i[c?"x":"y"]*r,n.isTouching=!0,s(r),a()):(n.isScrolling=!0,o.clear())))},stop:function(){var o,r,u,f=n.index,v=n.tracker,m=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(o=v.vector()[e.isHorizontal?"velocityX":"velocityY"],p.run((function(e){e*=o,o*=.98,Math.abs(e)<.01?(p.stop(),d(n,i)):(s(e),a(0))}))):(r=v.getDuration(),u=v.getOffset()[e.isHorizontal?"x":"y"],v=Math.ceil(Math.abs(u)/m.boxSize),m=c(u),r>e.longSwipesMs?l(f+m*(0<u?-1:1)):l(0<u?f-v:f+v),d(n,i)))}}}function f(e,t){var n={};return(n.update=function(e){var i,o=function(e,t,n){var i=e.$list,o=t.viewSize,r=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(o-r)/2:0);return{max:s,min:n.spaceBetween+(n.loop?r:o)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,r=(o=e).$el,i={boxSize:(r=((o=i.isHorizontal?r.offsetWidth:r.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:o,slideSize:r}),t),r=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:r,element:e,measure:i,limitation:o})})(e),n}var v="data-shallow-slider",m="data-slider";function x(e,n){function i(){e.element.$wrapper.querySelectorAll("["+v+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,o=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);r(o,a),o.querySelectorAll("["+m+"]").forEach((function(e){return r(e,s)}))}return{init:function(){(function(){var t,r,a,s,l,c;e.element.$list.forEach((function(e,t){return o(e,m,t)})),i(),n.loop&&(t=e.element,s=e.limitation,r=t.$list,a=t.$wrapper,s=s.expand,l=r.slice(-s).map((function(e){return e.cloneNode(!0)})),c=r.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(o(c[t],v)),a.insertBefore(o(l[t],v),r[0])})))})(),a()},render:function(i,o,r,a){var s=e.element.$wrapper;o=void 0===o?n.speed:o,n.injections.translate(i,e,n,o),i.isStart||function(i){var o=e.element.$wrapper,r=i.index;o.querySelectorAll("["+m+"]").forEach((function(e){var i,o,a=~~e.getAttribute(m);i=e,void 0===(o=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(o=[]),Array.isArray(o)||(o=[o]),o.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===r&&t(e,n.slideActiveClass),a==r-1&&t(e,n.slidePrevClass),a===r+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,r&&setTimeout(r,o)},destroy:function(){var t=e.element,o=t.$list,r=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){r.style.removeProperty(e)})),o.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function h(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function g(t,n,i,o,r){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){o.render(n,e,t,i)}function l(o){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=o,i.loop?(a=(c-o)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-o)/s,n.progress=a<0?0:1<a?1:a),r.emit("scroll",e({},n))}function c(e,o){var c,u,d,p,f,v=t.measure,m=t.limitation,x=m.maxIndex-m.minIndex+1,g=i.loop?(e%x+x)%x:e>m.maxIndex?m.maxIndex:e<m.minIndex?m.minIndex:e,b=-g*v.boxSize+m.base;0!==a(b-n.transforms)&&i.loop&&(c=h(n.transforms,m),u=g-n.index,d=n.index,p=g,f=u,e=(x=m).maxIndex,d=(0<f?1:-1)*(x.minIndex-e-1)+p-d,(f=Math.abs(f)>Math.abs(d)?d:f)===u||c?n.index===g&&l(0<c?m.min-v.boxSize+c:m.max+v.boxSize+c):l(f<0?m.min-v.boxSize:m.max+v.boxSize),s(0,void 0,!0)),r.emit("before-slide",n.index,n,g),n.index=g,l(b),s(o,(function(){r.emit("after-slide",g,n)}))}return{update:function(){c(n.index,0),o.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var o,r=n.transforms,a=t.measure,s=t.limitation,c=(o=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(o-1)):1,u=r;i.resistance&&!i.loop&&(0<e&&r>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&r<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(o=n.tracker.vector(),c=i.isHorizontal?o.velocityX:o.velocityY,(e=h(r,s))&&(o=r,r=s,0<(c=c)&&o>r.max||c<0&&o<r.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function b(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t}}function y(t,o){var r=(d=e({},a,d=o),e({},d,{isHorizontal:"horizontal"===d.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=f(b(t,r),r),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},d=(o=s.on,s.off),v=s.emit,m={on:o,off:d,env:c,state:u,options:r};(r.plugins||y.plugins||[]).forEach((function(e){return e(m,r)})),v("before-init",m);var h=x(c,r),S=g(c,u,r,h,s),w=function(e,t,o,r){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(r=p(o,e,t,r)).preheat,c=r.move,u=r.stop;function d(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function f(t){for(var n=0;n<o.excludeElements.length;n++)if(o.excludeElements[n].contains(t.target))return;var i,r=e.element.$wrapper,c=o.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||o.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(d(t),(i=r,c=o.isHorizontal,r=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===r.length?i=r.slice(12,14):6===r.length&&(i=r.slice(4,6)),i[c?0:1]||0))}function v(e){o.touchMoveStopPropagation&&e.stopPropagation(),c(d(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function m(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",f,{passive:o.passiveListeners,capture:!1}),n(t,"touchmove",v),n(t,"touchend",m),n(t,"touchcancel",m)):(n(t,"mousedown",f),n(document,"mousemove",v),n(document,"mouseup",m))},detach:function(){var t=e.element.$el;i(t,"touchstart",f),i(t,"touchmove",v),i(t,"touchend",m),i(t,"touchcancel",m),i(t,"mousedown",f),i(document,"mousemove",v),i(document,"mouseup",m)}}}(c,u,r,S);return u=S.slideTo,Object.assign(m,{update:function(){h.destroy(),c.update(b(t,r)),h.init(),S.update()},destroy:function(){v("before-destroy",m),w.detach(),h.destroy(),v("after-destroy",m),s.clear()},slideTo:u,updateSize:function(){c.update(b(t,r)),S.update()}}),h.init(),w.attach(),u(r.initialSlide,0),v("after-init",m),m}return y.use=function(e){y.plugins=e},y}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function o(e){c(e.target,"next")}function r(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var o,r;n.options.loop||(o=i,i=(r=n.env.limitation).minIndex,r=r.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=o&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&o<=r&&s.prevEl.classList.remove(l.disabledClass),o===i&&s.prevEl.classList.add(l.disabledClass),o===r&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",o),e(s.prevEl,"click",r))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",o),t(s.prevEl,"click",r),delete s.nextEl,delete s.prevEl)}))}}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(9334),t=n.n(e),i=n(8608),o=n.n(i);!function(){const e=document.querySelectorAll(".wp-block-coblocks-gallery-carousel");for(let n=0;n<e.length;n++){let i=null,r=0,a=!1;const s=e[n],l=e=>{const t=s.querySelector(`.wp-block-coblocks-gallery-carousel-thumbnail-${r}`);if(t){t.classList.remove("is-active");const n=s.querySelector(`.wp-block-coblocks-gallery-carousel-thumbnail-${e}`);n&&n.classList.add("is-active")}},c=e=>{var t;null===(t=i)||void 0===t||t.slideTo(e),l(e),r=e},u=e=>{e!==r&&(l(e),r=e)},d=s.querySelector(".swiper-container");if(d){const e=d.getAttribute("data-swiper");if(e){const n=JSON.parse(e),r=s.querySelector(".nav-button__prev"),l=s.querySelector(".nav-button__next"),p={centeredSlides:!1,freeMode:!0,longSwipesRatio:.8,loop:!1,passiveListeners:!0,plugins:[],slidesPerView:1,touchable:!1};if(!0===n.loop&&(p.loop=n.loop),n.slidesPerView&&(p.slidesPerView=n.slidesPerView),n.navigation&&(p.plugins=[...p.plugins,o()],p.navigation={nextEl:l,prevEl:r}),i=new(t())(d,p),new ResizeObserver((()=>{i.update()})).observe(d),n.thumbnails){const e=s.querySelectorAll(".wp-block-coblocks-gallery-carousel-thumbnail");for(const[t,n]of Object.entries(e))n.addEventListener("click",(()=>c(t)));const t=s.querySelector(".wp-block-coblocks-gallery-carousel-thumbnail-0");t&&t.classList.add("is-active")}if(!n.thumbnails&&n.pageDots){const e=s.querySelectorAll(".wp-block-coblocks-gallery-carousel-page-dot-pagination");for(const[t,n]of Object.entries(e))n.addEventListener("click",(()=>c(t)));const t=s.querySelector(".wp-block-coblocks-gallery-carousel-page-dot--0");t&&t.classList.add("is-active")}if(!0!==n.draggable){const e=s.querySelector(".swiper-wrapper");null==e||e.addEventListener("mousedown",(e=>{e.stopPropagation()}))}!0===n.autoPlay&&n.autoPlaySpeed&&(!0===n.pauseHover&&(d.addEventListener("mouseenter",(()=>{a=!0})),d.addEventListener("mouseleave",(()=>{a=!1}))),setInterval((()=>{var e;!0===n.pauseHover&&!0===a||null===(e=i)||void 0===e||e.slideTo(i.state.index+1)}),n.autoPlaySpeed)),i.on("after-slide",u)}}}}()}()}();
1
+ !function(){var e={9334:function(e){e.exports=function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function o(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function r(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){r(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s=180/Math.PI;function l(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return i=(n=t).length-1,o=n[i],n=n[i-1]||o,i={x:o.x-n.x,y:o.y-n.y},o=o.time-n.time,n=i.x/o||0,o=i.y/o||0,e({},i,{angle:Math.atan2(Math.abs(i.y),Math.abs(i.x))*s,velocityX:n,velocityY:o});var n,i,o},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function c(){return(performance||Date).now()}var u=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,d=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;function p(){var e=function(){var e,t;return{run:function(n){e=void 0===e?c():e,t=u((function(){var t=c(),i=t-e;e=t,n(i)}))},stop:function(){e=void 0,d(t)}}}();return{run:function t(n){e.run((function(e){t(n),n(e)}))},stop:function(){e.stop()}}}function f(e,t){e=e.tracker,t=t.initStatus,e.clear(),t()}function v(e,t,n,i){var o=i.initLayout,r=i.initStatus,a=i.render,s=i.scrollPixel,l=i.slideTo,c=i.getOffsetSteps,u=p();return{preheat:function(e,t){var i=n.tracker;u.stop(),i.clear(),i.push(e),o(t),r(t),n.isStart=!0,a()},move:function(t){var i,o=n.tracker,r=e.touchRatio,l=e.touchAngle,c=e.isHorizontal;n.isStart&&!n.isScrolling&&(o.push(t),i=o.vector(),((t=o.getOffset()).x||t.y)&&(c&&i.angle<l||!c&&90-i.angle<l||n.isTouching?(r=i[c?"x":"y"]*r,n.isTouching=!0,s(r),a()):(n.isScrolling=!0,o.clear())))},stop:function(){var o,r,d,p=n.index,v=n.tracker,m=t.measure;n.isStart&&(n.isStart=!1,e.freeMode?(o=v.vector()[e.isHorizontal?"velocityX":"velocityY"],u.run((function(e){e*=o,o*=.98,Math.abs(e)<.01?(u.stop(),f(n,i)):(s(e),a(0))}))):(r=v.getDuration(),d=v.getOffset()[e.isHorizontal?"x":"y"],v=Math.ceil(Math.abs(d)/m.boxSize),m=c(d),r>e.longSwipesMs?l(p+m*(0<d?-1:1)):l(0<d?p-v:p+v),f(n,i)))}}}function m(e,t){var n={};return(n.update=function(e){var i,o=function(e,t,n){var i=e.$list,o=t.viewSize,r=t.slideSize,a=t.boxSize,s=-(t=(e=(s=n).loop?Math.ceil(s.slidesPerView):0)*a)+(n.centeredSlides?(o-r)/2:0);return{max:s,min:n.spaceBetween+(n.loop?r:o)+s-a*i.length,base:s,expand:e,buffer:t,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}(e,(i=t,r=(o=e).$el,i={boxSize:(r=((o=i.isHorizontal?r.offsetWidth:r.offsetHeight)-Math.ceil(i.slidesPerView-1)*i.spaceBetween)/i.slidesPerView)+i.spaceBetween,viewSize:o,slideSize:r}),t),r=Boolean("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:r,element:e,measure:i,limitation:o})})(e),n}var x="data-shallow-slider",h="data-slider";function g(e,n){function i(){e.element.$wrapper.querySelectorAll("["+x+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function a(){var t=e.element,i=e.measure,o=t.$wrapper,a={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},s=((t={})[n.isHorizontal?"width":"height"]=i.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);r(o,a),o.querySelectorAll("["+h+"]").forEach((function(e){return r(e,s)}))}return{init:function(){(function(){var t,r,a,s,l,c;e.element.$list.forEach((function(e,t){return o(e,h,t)})),i(),n.loop&&(t=e.element,s=e.limitation,r=t.$list,a=t.$wrapper,s=s.expand,l=r.slice(-s).map((function(e){return e.cloneNode(!0)})),c=r.slice(0,s).map((function(e){return e.cloneNode(!0)})),l.forEach((function(e,t){a.appendChild(o(c[t],x)),a.insertBefore(o(l[t],x),r[0])})))})(),a()},render:function(i,o,r,a){var s=e.element.$wrapper;o=void 0===o?n.speed:o,n.injections.translate(i,e,n,o),i.isStart||function(i){var o=e.element.$wrapper,r=i.index;o.querySelectorAll("["+h+"]").forEach((function(e){var i,o,a=~~e.getAttribute(h);i=e,void 0===(o=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(o=[]),Array.isArray(o)||(o=[o]),o.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===r&&t(e,n.slideActiveClass),a==r-1&&t(e,n.slidePrevClass),a===r+1&&t(e,n.slideNextClass)}))}(i),a&&getComputedStyle(s).transform,r&&setTimeout(r,o)},destroy:function(){var t=e.element,o=t.$list,r=t.$wrapper,a=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){r.style.removeProperty(e)})),o.forEach((function(e){return e.style.removeProperty(a)})),i()},updateSize:a}}function b(e,t){var n=e-t.max;return t=e-t.min,0<n?n:t<0?t:0}function y(t,n,i,o,r){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){o.render(n,e,t,i)}function l(o){var a,s,l=(s=t.limitation).min,c=s.max;l=(s=c-l+(i.loop?t.measure.boxSize:0))+1,n.transforms=o,i.loop?(a=(c-o)%l/s,n.progress=a<0?1+a:1<a?a-1:a):(a=(c-o)/s,n.progress=a<0?0:1<a?1:a),r.emit("scroll",e({},n))}function c(e,o){var c,u,d,p,f,v=t.measure,m=t.limitation,x=m.maxIndex-m.minIndex+1,h=i.loop?(e%x+x)%x:e>m.maxIndex?m.maxIndex:e<m.minIndex?m.minIndex:e,g=-h*v.boxSize+m.base;0!==a(g-n.transforms)&&i.loop&&(c=b(n.transforms,m),u=h-n.index,d=n.index,p=h,f=u,e=(x=m).maxIndex,d=(0<f?1:-1)*(x.minIndex-e-1)+p-d,(f=Math.abs(f)>Math.abs(d)?d:f)===u||c?n.index===h&&l(0<c?m.min-v.boxSize+c:m.max+v.boxSize+c):l(f<0?m.min-v.boxSize:m.max+v.boxSize),s(0,void 0,!0)),r.emit("before-slide",n.index,n,h),n.index=h,l(g),s(o,(function(){r.emit("after-slide",h,n)}))}return{update:function(){c(n.index,0),o.updateSize()},render:s,transform:l,slideTo:c,scrollPixel:function(e){var o,r=n.transforms,a=t.measure,s=t.limitation,c=(o=Number(e.toExponential().split("e")[1]))<=0?Math.pow(10,-(o-1)):1,u=r;i.resistance&&!i.loop&&(0<e&&r>=s.max?e-=Math.pow(e*c,i.resistanceRatio)/c:e<0&&r<=s.min&&(e+=Math.pow(-e*c,i.resistanceRatio)/c)),u+=e,i.loop&&(o=n.tracker.vector(),c=i.isHorizontal?o.velocityX:o.velocityY,(e=b(r,s))&&(o=r,r=s,0<(c=c)&&o>r.max||c<0&&o<r.min)&&(u=0<e?s.min-a.boxSize+e:s.max+a.boxSize+e)),l(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){l(e)},getOffsetSteps:a}}function S(e,t){var n="string"==typeof e?document.body.querySelector(e):e;return e=n.querySelector("."+t.wrapperClass),t=[].slice.call(n.getElementsByClassName(t.slideClass)),{$el:n,$wrapper:e,$list:t=t.filter((function(e){return null===e.getAttribute("data-shallow-slider")}))}}function w(t,o){var r=(d=e({},a,d=o),e({},d,{isHorizontal:"horizontal"===d.direction})),s=function(){var e={};return{on:function(t,n){e[t]?e[t].push(n):e[t]=[n]},off:function(t,n){!e[t]||-1<(n=e[t].indexOf(n))&&e[t].splice(n,1)},emit:function(t){for(var n=arguments.length,i=new Array(1<n?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e[t]&&e[t].forEach((function(e){return e.apply(void 0,i)}))},clear:function(){e={}}}}(),c=m(S(t,r),r),u={tracker:l(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},d=(o=s.on,s.off),p=s.emit,f={on:o,off:d,env:c,state:u,options:r};(r.plugins||w.plugins||[]).forEach((function(e){return e(f,r)})),p("before-init",f);var x=g(c,r),h=y(c,u,r,x,s),b=function(e,t,o,r){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],l=(r=v(o,e,t,r)).preheat,c=r.move,u=r.stop;function d(e){return{x:(e=a?e.changedTouches[0]:e).pageX,y:e.pageY}}function p(t){for(var n=0;n<o.excludeElements.length;n++)if(o.excludeElements[n].contains(t.target))return;var i,r=e.element.$wrapper,c=o.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||o.touchStartForcePreventDefault;!a&&c&&t.preventDefault(),l(d(t),(i=r,c=o.isHorizontal,r=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),i=[],16===r.length?i=r.slice(12,14):6===r.length&&(i=r.slice(4,6)),i[c?0:1]||0))}function f(e){o.touchMoveStopPropagation&&e.stopPropagation(),c(d(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function m(){u()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",p,{passive:o.passiveListeners,capture:!1}),n(t,"touchmove",f),n(t,"touchend",m),n(t,"touchcancel",m)):(n(t,"mousedown",p),n(document,"mousemove",f),n(document,"mouseup",m))},detach:function(){var t=e.element.$el;i(t,"touchstart",p),i(t,"touchmove",f),i(t,"touchend",m),i(t,"touchcancel",m),i(t,"mousedown",p),i(document,"mousemove",f),i(document,"mouseup",m)}}}(c,u,r,h);return u=h.slideTo,Object.assign(f,{update:function(){x.destroy(),c.update(S(t,r)),x.init(),h.update()},destroy:function(){p("before-destroy",f),b.detach(),x.destroy(),p("after-destroy",f),s.clear()},slideTo:u,updateSize:function(){c.update(S(t,r)),h.update()}}),x.init(),b.attach(),u(r.initialSlide,0),p("after-init",f),f}return w.use=function(e){w.plugins=e},w}()},8608:function(e){e.exports=function(){"use strict";function e(e,t,n,i){e.addEventListener(t,n,i)}function t(e,t,n){e.removeEventListener(t,n)}return function(n,i){function o(e){c(e.target,"next")}function r(e){c(e.target,"prev")}var a=Boolean(i.navigation),s={nextEl:null,prevEl:null},l=Object.assign({disabledClass:"swiper-button-disabled"},i.navigation),c=function(e,t){u(e)&&!n.options.loop||(e=n.state.index,"next"===t&&n.slideTo(e+1),"prev"===t&&n.slideTo(e-1))},u=function(e){return e.classList.contains(l.disabledClass)};n.on("before-slide",(function(e,t,i){var o,r;n.options.loop||(o=i,i=(r=n.env.limitation).minIndex,r=r.maxIndex,s&&s.prevEl&&s.nextEl&&(s.nextEl.classList.contains(l.disabledClass)&&i<=o&&s.nextEl.classList.remove(l.disabledClass),s.prevEl.classList.contains(l.disabledClass)&&o<=r&&s.prevEl.classList.remove(l.disabledClass),o===i&&s.prevEl.classList.add(l.disabledClass),o===r&&s.nextEl.classList.add(l.disabledClass)))})),n.on("after-init",(function(){var t,i,c;a&&(s.nextEl="string"==typeof l.nextEl?document.body.querySelector(l.nextEl):l.nextEl,s.prevEl="string"==typeof l.prevEl?document.body.querySelector(l.prevEl):l.prevEl,n.options.loop||(t=n.state.index,i=n.env.element.$list,t===(c=n.env.limitation.minIndex)&&s.prevEl&&s.prevEl.classList.add(l.disabledClass),i.length===c&&s.nextEl&&s.nextEl.classList.add(l.disabledClass)),e(s.nextEl,"click",o),e(s.prevEl,"click",r))})),n.on("after-destroy",(function(){s&&s.prevEl&&s.nextEl&&(t(s.nextEl,"click",o),t(s.prevEl,"click",r),delete s.nextEl,delete s.prevEl)}))}}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(9334),t=n.n(e),i=n(8608),o=n.n(i);!function(){const e=document.querySelectorAll(".wp-block-coblocks-gallery-carousel");for(let n=0;n<e.length;n++){let i=null,r=0,a=!1;const s=e[n],l=e=>{const t=s.querySelector(`.wp-block-coblocks-gallery-carousel-thumbnail-${r}`);if(t){t.classList.remove("is-active");const n=s.querySelector(`.wp-block-coblocks-gallery-carousel-thumbnail-${e}`);n&&n.classList.add("is-active")}},c=e=>{var t;null===(t=i)||void 0===t||t.slideTo(e),l(e),r=e},u=e=>{e!==r&&(l(e),r=e)},d=s.querySelector(".swiper-container");if(d){const e=d.getAttribute("data-swiper");if(e){const n=JSON.parse(e),r=s.querySelector(".nav-button__prev"),l=s.querySelector(".nav-button__next"),p={centeredSlides:!1,freeMode:!0,longSwipesRatio:.8,loop:!1,passiveListeners:!0,plugins:[],slidesPerView:1,touchable:!1};if(!0===n.loop&&(p.loop=n.loop),n.slidesPerView&&(p.slidesPerView=n.slidesPerView),n.navigation&&(p.plugins=[...p.plugins,o()],p.navigation={nextEl:l,prevEl:r}),i=new(t())(d,p),new ResizeObserver((()=>{i.update()})).observe(d),n.thumbnails){const e=s.querySelectorAll(".wp-block-coblocks-gallery-carousel-thumbnail");for(const[t,n]of Object.entries(e))n.addEventListener("click",(()=>c(t)));const t=s.querySelector(".wp-block-coblocks-gallery-carousel-thumbnail-0");t&&t.classList.add("is-active")}if(!n.thumbnails&&n.pageDots){const e=s.querySelectorAll(".wp-block-coblocks-gallery-carousel-page-dot-pagination");for(const[t,n]of Object.entries(e))n.addEventListener("click",(()=>c(t)));const t=s.querySelector(".wp-block-coblocks-gallery-carousel-page-dot--0");t&&t.classList.add("is-active")}if(!0!==n.draggable){const e=s.querySelector(".swiper-wrapper");null==e||e.addEventListener("mousedown",(e=>{e.stopPropagation()}))}!0===n.autoPlay&&n.autoPlaySpeed&&(!0===n.pauseHover&&(d.addEventListener("mouseenter",(()=>{a=!0})),d.addEventListener("mouseleave",(()=>{a=!1}))),setInterval((()=>{var e;!0===n.pauseHover&&!0===a||null===(e=i)||void 0===e||e.slideTo(i.state.index+1)}),n.autoPlaySpeed)),i.on("after-slide",u)}}}}()}()}();
dist/js/vendors/tiny-swiper.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array(), 'version' => '3f4a7cb0e40e97df059749810bdd90a5');
1
+ <?php return array('dependencies' => array(), 'version' => 'a4f008aa068b60065531221cb996fe6f');
dist/js/vendors/tiny-swiper.js CHANGED
@@ -1 +1 @@
1
- !function(){var e={7300:function(e){e.exports=function(){"use strict";function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function r(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function o(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){o(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s="before-init",c="after-init",u="before-slide",l="scroll",f="after-slide",p="before-destroy",d="after-destroy";var m=180/Math.PI;function v(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return function(t,n){var i=t[n],r=t[n-1]||i,o={x:i.x-r.x,y:i.y-r.y},a=i.time-r.time,s=o.x/a||0,c=o.y/a||0;return e({},o,{angle:Math.atan2(Math.abs(o.y),Math.abs(o.x))*m,velocityX:s,velocityY:c})}(t,t.length-1)},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function h(){return performance?performance.now():Date.now()}function x(){var e,t,n,i,r=(n=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,i=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout,{run:function(i){e=void 0===e?h():e,t=n((function(){var t=h(),n=t-e;e=t,i(n)}))},stop:function(){e=void 0,i(t)}});return{run:function e(t){r.run((function(n){e(t),t(n)}))},stop:function(){r.stop()}}}function g(e,t){var n=e.tracker,i=t.initStatus;n.clear(),i()}function S(e,t,r,o){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],c=function(e,t,n,i){var r=i.initLayout,o=i.initStatus,a=i.render,s=i.scrollPixel,c=i.slideTo,u=i.getOffsetSteps,l=x();return{preheat:function(e,t){var i=n.tracker;l.stop(),i.clear(),i.push(e),r(t),o(t),n.isStart=!0,a()},move:function(t){var i=n.tracker,r=e.touchRatio,o=e.touchAngle,c=e.isHorizontal;if(n.isStart&&!n.isScrolling){i.push(t);var u=i.vector(),l=i.getOffset();if(l.x||l.y)if(c&&u.angle<o||!c&&90-u.angle<o||n.isTouching){var f=u[c?"x":"y"]*r;n.isTouching=!0,s(f),a()}else n.isScrolling=!0,i.clear()}},stop:function(){var r=n.index,o=n.tracker,f=t.measure;if(n.isStart)if(n.isStart=!1,e.freeMode){var p=o.vector()[e.isHorizontal?"velocityX":"velocityY"];l.run((function(e){var t=p*e;p*=.98,Math.abs(t)<.01?(l.stop(),g(n,i)):(s(t),a(0))}))}else{var d=o.getDuration(),m=o.getOffset()[e.isHorizontal?"x":"y"],v=Math.ceil(Math.abs(m)/f.boxSize),h=u(m);d>e.longSwipesMs?c(r+h*(m>0?-1:1)):c(m>0?r-v:r+v),g(n,i)}}}}(r,e,t,o),u=c.preheat,l=c.move,f=c.stop;function p(e){var t=a?e.changedTouches[0]:e;return{x:t.pageX,y:t.pageY}}function d(t){for(var n=0;n<r.excludeElements.length;n++)if(r.excludeElements[n].contains(t.target))return;var i,o,c,l,f=e.element.$wrapper,d=r.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||r.touchStartForcePreventDefault;!a&&d&&t.preventDefault(),u(p(t),(i=f,o=r.isHorizontal,c=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),l=[],16===c.length?l=c.slice(12,14):6===c.length&&(l=c.slice(4,6)),l[o?0:1]||0))}function m(e){r.touchMoveStopPropagation&&e.stopPropagation(),l(p(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){f()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",d,{passive:r.passiveListeners,capture:!1}),n(t,"touchmove",m),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",d),n(document,"mousemove",m),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",d),i(t,"touchmove",m),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",d),i(document,"mousemove",m),i(document,"mouseup",v)}}}function w(e,t,n){var i=e.$list,r=t.viewSize,o=t.slideSize,a=t.boxSize,s=function(e){return e.loop?Math.ceil(e.slidesPerView):0}(n),c=s*a,u=-c+(n.centeredSlides?(r-o)/2:0);return{max:u,min:n.spaceBetween+(n.loop?o:r)+u-a*i.length,base:u,expand:s,buffer:c,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}function y(e,t){var n={};function i(e){var i=function(e,t){var n=t.$el,i=e.isHorizontal?n.offsetWidth:n.offsetHeight,r=(i-Math.ceil(e.slidesPerView-1)*e.spaceBetween)/e.slidesPerView;return{boxSize:r+e.spaceBetween,viewSize:i,slideSize:r}}(t,e),r=w(e,i,t),o=Boolean("ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:o,element:e,measure:i,limitation:r})}return n.update=i,i(e),n}var b="data-shallow-slider",z="data-slider";function T(e,n){function i(i){var r=e.element.$wrapper,o=i.index;r.querySelectorAll("[data-slider]").forEach((function(e){var i,r,a=~~e.getAttribute(z);i=e,void 0===(r=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(r=[]),Array.isArray(r)||(r=[r]),r.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===o&&t(e,n.slideActiveClass),a===o-1&&t(e,n.slidePrevClass),a===o+1&&t(e,n.slideNextClass)}))}function a(){e.element.$wrapper.querySelectorAll("["+b+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function s(){e.element.$list.forEach((function(e,t){return r(e,z,t)})),a(),function(){if(n.loop){var t=e.element,i=e.limitation,o=t.$list,a=t.$wrapper,s=i.expand,c=o.slice(-s).map((function(e){return e.cloneNode(!0)})),u=o.slice(0,s).map((function(e){return e.cloneNode(!0)}));c.forEach((function(e,t){a.appendChild(r(u[t],b)),a.insertBefore(r(c[t],b),o[0])}))}}()}function c(){var t,i=e.element,r=e.measure,a=i.$wrapper,s={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},c=((t={})[n.isHorizontal?"width":"height"]=r.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);o(a,s),a.querySelectorAll("[data-slider]").forEach((function(e){return o(e,c)}))}return{init:function(){s(),c()},render:function(t,r,o,a){var s=e.element.$wrapper,c=void 0===r?n.speed:r;n.injections.translate(t,e,n,c),t.isStart||i(t),a&&getComputedStyle(s).transform,o&&setTimeout(o,c)},destroy:function(){var t=e.element,i=t.$list,r=t.$wrapper,o=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){r.style.removeProperty(e)})),i.forEach((function(e){return e.style.removeProperty(o)})),a()},updateSize:c}}function P(e,t){var n=e-t.max,i=e-t.min;return n>0?n:i<0?i:0}function E(t,n,i,r,o){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){r.render(n,e,t,i)}function c(r){var a,s=t.limitation,c=s.min,u=s.max,f=u-c+(i.loop?t.measure.boxSize:0),p=f+1;n.transforms=r,i.loop?(a=(u-r)%p/f,n.progress=a<0?1+a:a>1?a-1:a):(a=(u-r)/f,n.progress=a<0?0:a>1?1:a),o.emit(l,e({},n))}function p(e,r){var l=t.measure,p=t.limitation,d=p.maxIndex-p.minIndex+1,m=i.loop?(e%d+d)%d:e>p.maxIndex?p.maxIndex:e<p.minIndex?p.minIndex:e,v=-m*l.boxSize+p.base;if(0!==a(v-n.transforms)&&i.loop){var h=P(n.transforms,p),x=m-n.index,g=function(e,t,n,i){var r=n.maxIndex,o=(i>0?1:-1)*(n.minIndex-r-1)+t-e;return Math.abs(i)>Math.abs(o)?o:i}(n.index,m,p,x);g===x||h?n.index===m&&c(h>0?p.min-l.boxSize+h:p.max+l.boxSize+h):c(g<0?p.min-l.boxSize:p.max+l.boxSize),s(0,void 0,!0)}o.emit(u,n.index,n,m),n.index=m,c(v),s(r,(function(){o.emit(f,m,n)}))}return{update:function(){p(n.index,0),r.updateSize()},render:s,transform:c,slideTo:p,scrollPixel:function(e){var r=n.transforms,o=t.measure,a=t.limitation,s=Number(e.toExponential().split("e")[1]),u=s<=0?Math.pow(10,-(s-1)):1,l=r;if(i.resistance&&!i.loop&&(e>0&&r>=a.max?e-=Math.pow(e*u,i.resistanceRatio)/u:e<0&&r<=a.min&&(e+=Math.pow(-e*u,i.resistanceRatio)/u)),l+=e,i.loop){var f=n.tracker.vector(),p=i.isHorizontal?f.velocityX:f.velocityY,d=P(r,a);d&&function(e,t,n){return e>0&&t>n.max||e<0&&t<n.min}(p,r,a)&&(l=d>0?a.min-o.boxSize+d:a.max+o.boxSize+d)}c(l)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){c(e)},getOffsetSteps:a}}function M(e,t){var n="string"==typeof e?document.body.querySelector(e):e,i=n.querySelector("."+t.wrapperClass),r=[].slice.call(n.getElementsByClassName(t.slideClass));return{$el:n,$wrapper:i,$list:r}}var C=function t(n,i){var r,o=function(t){var n=e({},a,t);return e({},n,{isHorizontal:"horizontal"===n.direction})}(i),u=(r={},{on:function(e,t){r[e]?r[e].push(t):r[e]=[t]},off:function(e,t){if(r[e]){var n=r[e].indexOf(t);n>-1&&r[e].splice(n,1)}},emit:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];r[e]&&r[e].forEach((function(e){return e.apply(void 0,n)}))},clear:function(){r={}}}),l=y(M(n,o),o),f={tracker:v(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},m=u.on,h=u.off,x=u.emit,g={on:m,off:h,env:l,state:f,options:o};(o.plugins||t.plugins||[]).forEach((function(e){return e(g,o)})),x(s,g);var w=T(l,o),b=E(l,f,o,w,u),z=S(l,f,o,b);var P=b.slideTo;return Object.assign(g,{update:function(){w.destroy(),l.update(M(n,o)),w.init(),b.update()},destroy:function(){x(p,g),z.detach(),w.destroy(),x(d,g),u.clear()},slideTo:P,updateSize:function(){l.update(M(n,o)),b.update()}}),w.init(),z.attach(),P(o.initialSlide,0),x(c,g),g};return C.use=function(e){C.plugins=e},C}()}},t={};!function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(7300)}();
1
+ !function(){var e={7300:function(e){e.exports=function(){"use strict";function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.apply(this,arguments)}function t(e,t){void 0===t&&(t=[]),Array.isArray(t)||(t=[t]),t.forEach((function(t){return!e.classList.contains(t)&&e.classList.add(t)}))}function n(e,t,n,i){e.addEventListener(t,n,i)}function i(e,t,n){e.removeEventListener(t,n)}function r(e,t,n){return void 0===n&&(n=""),e.setAttribute(t,n),e}function o(e,t,n){return Object.keys(t).forEach((function(n){e.style[n]=t[n]})),n&&getComputedStyle(e),e}var a={direction:"horizontal",touchRatio:1,touchAngle:45,longSwipesRatio:.5,initialSlide:0,loop:!1,freeMode:!1,passiveListeners:!0,resistance:!0,resistanceRatio:.85,speed:300,longSwipesMs:300,spaceBetween:0,slidesPerView:1,centeredSlides:!1,slidePrevClass:"swiper-slide-prev",slideNextClass:"swiper-slide-next",slideActiveClass:"swiper-slide-active",slideClass:"swiper-slide",wrapperClass:"swiper-wrapper",touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchMoveStopPropagation:!1,excludeElements:[],injections:{translate:function(e,t,n,i){o(t.element.$wrapper,{transition:e.isStart?"none":"transform ease "+i+"ms",transform:n.isHorizontal?"translate3d("+e.transforms+"px, 0, 0)":"translate3d(0, "+e.transforms+"px, 0)"})}}};var s="before-init",c="after-init",l="before-slide",u="scroll",f="after-slide",p="before-destroy",d="after-destroy";var m=180/Math.PI;function v(){var t=[];return{getDuration:function(){var e=t[0],n=t[t.length-1];return e?n.time-e.time:0},getOffset:function(){var e=t[0],n=t[t.length-1];return e?{x:n.x-e.x,y:n.y-e.y}:{x:0,y:0}},getLogs:function(){return t},vector:function(){return function(t,n){var i=t[n],r=t[n-1]||i,o={x:i.x-r.x,y:i.y-r.y},a=i.time-r.time,s=o.x/a||0,c=o.y/a||0;return e({},o,{angle:Math.atan2(Math.abs(o.y),Math.abs(o.x))*m,velocityX:s,velocityY:c})}(t,t.length-1)},clear:function(){t=[]},push:function(n){t.push(e({time:Date.now()},n))}}}function h(){return performance?performance.now():Date.now()}var x=requestAnimationFrame||webkitRequestAnimationFrame||setTimeout,g=cancelAnimationFrame||webkitCancelAnimationFrame||clearTimeout;function S(){var e,t,n={run:function(n){e=void 0===e?h():e,t=x((function(){var t=h(),i=t-e;e=t,n(i)}))},stop:function(){e=void 0,g(t)}};return{run:function e(t){n.run((function(n){e(t),t(n)}))},stop:function(){n.stop()}}}function w(e,t){var n=e.tracker,i=t.initStatus;n.clear(),i()}function y(e,t,r,o){var a=e.touchable,s=["INPUT","SELECT","OPTION","TEXTAREA","BUTTON","VIDEO"],c=function(e,t,n,i){var r=i.initLayout,o=i.initStatus,a=i.render,s=i.scrollPixel,c=i.slideTo,l=i.getOffsetSteps,u=S();return{preheat:function(e,t){var i=n.tracker;u.stop(),i.clear(),i.push(e),r(t),o(t),n.isStart=!0,a()},move:function(t){var i=n.tracker,r=e.touchRatio,o=e.touchAngle,c=e.isHorizontal;if(n.isStart&&!n.isScrolling){i.push(t);var l=i.vector(),u=i.getOffset();if(u.x||u.y)if(c&&l.angle<o||!c&&90-l.angle<o||n.isTouching){var f=l[c?"x":"y"]*r;n.isTouching=!0,s(f),a()}else n.isScrolling=!0,i.clear()}},stop:function(){var r=n.index,o=n.tracker,f=t.measure;if(n.isStart)if(n.isStart=!1,e.freeMode){var p=o.vector()[e.isHorizontal?"velocityX":"velocityY"];u.run((function(e){var t=p*e;p*=.98,Math.abs(t)<.01?(u.stop(),w(n,i)):(s(t),a(0))}))}else{var d=o.getDuration(),m=o.getOffset()[e.isHorizontal?"x":"y"],v=Math.ceil(Math.abs(m)/f.boxSize),h=l(m);d>e.longSwipesMs?c(r+h*(m>0?-1:1)):c(m>0?r-v:r+v),w(n,i)}}}}(r,e,t,o),l=c.preheat,u=c.move,f=c.stop;function p(e){var t=a?e.changedTouches[0]:e;return{x:t.pageX,y:t.pageY}}function d(t){for(var n=0;n<r.excludeElements.length;n++)if(r.excludeElements[n].contains(t.target))return;var i,o,c,u,f=e.element.$wrapper,d=r.touchStartPreventDefault&&-1===s.indexOf(t.target.nodeName)||r.touchStartForcePreventDefault;!a&&d&&t.preventDefault(),l(p(t),(i=f,o=r.isHorizontal,c=getComputedStyle(i).transform.replace(/[a-z]|\(|\)|\s/g,"").split(",").map(parseFloat),u=[],16===c.length?u=c.slice(12,14):6===c.length&&(u=c.slice(4,6)),u[o?0:1]||0))}function m(e){r.touchMoveStopPropagation&&e.stopPropagation(),u(p(e)),t.isTouching&&!1!==e.cancelable&&e.preventDefault()}function v(){f()}return{attach:function(){var t=e.element.$el;a?(n(t,"touchstart",d,{passive:r.passiveListeners,capture:!1}),n(t,"touchmove",m),n(t,"touchend",v),n(t,"touchcancel",v)):(n(t,"mousedown",d),n(document,"mousemove",m),n(document,"mouseup",v))},detach:function(){var t=e.element.$el;i(t,"touchstart",d),i(t,"touchmove",m),i(t,"touchend",v),i(t,"touchcancel",v),i(t,"mousedown",d),i(document,"mousemove",m),i(document,"mouseup",v)}}}function b(e,t,n){var i=e.$list,r=t.viewSize,o=t.slideSize,a=t.boxSize,s=function(e){return e.loop?Math.ceil(e.slidesPerView):0}(n),c=s*a,l=-c+(n.centeredSlides?(r-o)/2:0);return{max:l,min:n.spaceBetween+(n.loop?o:r)+l-a*i.length,base:l,expand:s,buffer:c,minIndex:0,maxIndex:i.length-(n.centeredSlides||n.loop?1:Math.ceil(n.slidesPerView))}}function z(e,t){var n={};function i(e){var i=function(e,t){var n=t.$el,i=e.isHorizontal?n.offsetWidth:n.offsetHeight,r=(i-Math.ceil(e.slidesPerView-1)*e.spaceBetween)/e.slidesPerView;return{boxSize:r+e.spaceBetween,viewSize:i,slideSize:r}}(t,e),r=b(e,i,t),o=Boolean("ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0||window.DocumentTouch&&document instanceof DocumentTouch);Object.assign(n,{touchable:o,element:e,measure:i,limitation:r})}return n.update=i,i(e),n}var T="data-shallow-slider",P="data-slider";function E(e,n){function i(i){var r=e.element.$wrapper,o=i.index;r.querySelectorAll("[data-slider]").forEach((function(e){var i,r,a=~~e.getAttribute(P);i=e,void 0===(r=[n.slidePrevClass,n.slideNextClass,n.slideActiveClass])&&(r=[]),Array.isArray(r)||(r=[r]),r.forEach((function(e){return i.classList.contains(e)&&i.classList.remove(e)})),a===o&&t(e,n.slideActiveClass),a===o-1&&t(e,n.slidePrevClass),a===o+1&&t(e,n.slideNextClass)}))}function a(){e.element.$wrapper.querySelectorAll("["+T+"]").forEach((function(t){return e.element.$wrapper.removeChild(t)}))}function s(){e.element.$list.forEach((function(e,t){return r(e,P,t)})),a(),function(){if(n.loop){var t=e.element,i=e.limitation,o=t.$list,a=t.$wrapper,s=i.expand,c=o.slice(-s).map((function(e){return e.cloneNode(!0)})),l=o.slice(0,s).map((function(e){return e.cloneNode(!0)}));c.forEach((function(e,t){a.appendChild(r(l[t],T)),a.insertBefore(r(c[t],T),o[0])}))}}()}function c(){var t,i=e.element,r=e.measure,a=i.$wrapper,s={display:"flex",willChange:"transform",flexDirection:n.isHorizontal?"row":"column"},c=((t={})[n.isHorizontal?"width":"height"]=r.slideSize+"px",t[n.isHorizontal?"margin-right":"margin-bottom"]=n.spaceBetween+"px",t);o(a,s),a.querySelectorAll("[data-slider]").forEach((function(e){return o(e,c)}))}return{init:function(){s(),c()},render:function(t,r,o,a){var s=e.element.$wrapper,c=void 0===r?n.speed:r;n.injections.translate(t,e,n,c),t.isStart||i(t),a&&getComputedStyle(s).transform,o&&setTimeout(o,c)},destroy:function(){var t=e.element,i=t.$list,r=t.$wrapper,o=n.isHorizontal?"margin-right":"margin-bottom";["display","will-change","flex-direction"].forEach((function(e){r.style.removeProperty(e)})),i.forEach((function(e){return e.style.removeProperty(o)})),a()},updateSize:c}}function M(e,t){var n=e-t.max,i=e-t.min;return n>0?n:i<0?i:0}function A(t,n,i,r,o){function a(e){var n=t.measure;return Math.ceil(Math.abs(e)/n.boxSize-i.longSwipesRatio)}function s(e,t,i){r.render(n,e,t,i)}function c(r){var a,s=t.limitation,c=s.min,l=s.max,f=l-c+(i.loop?t.measure.boxSize:0),p=f+1;n.transforms=r,i.loop?(a=(l-r)%p/f,n.progress=a<0?1+a:a>1?a-1:a):(a=(l-r)/f,n.progress=a<0?0:a>1?1:a),o.emit(u,e({},n))}function p(e,r){var u=t.measure,p=t.limitation,d=p.maxIndex-p.minIndex+1,m=i.loop?(e%d+d)%d:e>p.maxIndex?p.maxIndex:e<p.minIndex?p.minIndex:e,v=-m*u.boxSize+p.base;if(0!==a(v-n.transforms)&&i.loop){var h=M(n.transforms,p),x=m-n.index,g=function(e,t,n,i){var r=n.maxIndex,o=(i>0?1:-1)*(n.minIndex-r-1)+t-e;return Math.abs(i)>Math.abs(o)?o:i}(n.index,m,p,x);g===x||h?n.index===m&&c(h>0?p.min-u.boxSize+h:p.max+u.boxSize+h):c(g<0?p.min-u.boxSize:p.max+u.boxSize),s(0,void 0,!0)}o.emit(l,n.index,n,m),n.index=m,c(v),s(r,(function(){o.emit(f,m,n)}))}return{update:function(){p(n.index,0),r.updateSize()},render:s,transform:c,slideTo:p,scrollPixel:function(e){var r=n.transforms,o=t.measure,a=t.limitation,s=Number(e.toExponential().split("e")[1]),l=s<=0?Math.pow(10,-(s-1)):1,u=r;if(i.resistance&&!i.loop&&(e>0&&r>=a.max?e-=Math.pow(e*l,i.resistanceRatio)/l:e<0&&r<=a.min&&(e+=Math.pow(-e*l,i.resistanceRatio)/l)),u+=e,i.loop){var f=n.tracker.vector(),p=i.isHorizontal?f.velocityX:f.velocityY,d=M(r,a);d&&function(e,t,n){return e>0&&t>n.max||e<0&&t<n.min}(p,r,a)&&(u=d>0?a.min-o.boxSize+d:a.max+o.boxSize+d)}c(u)},initStatus:function(e){void 0===e&&(e=0),n.startTransform=e,n.isStart=!1,n.isScrolling=!1,n.isTouching=!1},initLayout:function(e){c(e)},getOffsetSteps:a}}function C(e,t){var n="string"==typeof e?document.body.querySelector(e):e,i=n.querySelector("."+t.wrapperClass),r=[].slice.call(n.getElementsByClassName(t.slideClass));return{$el:n,$wrapper:i,$list:r=r.filter((function(e){return null===e.getAttribute("data-shallow-slider")}))}}var $=function t(n,i){var r,o=function(t){var n=e({},a,t);return e({},n,{isHorizontal:"horizontal"===n.direction})}(i),l=(r={},{on:function(e,t){r[e]?r[e].push(t):r[e]=[t]},off:function(e,t){if(r[e]){var n=r[e].indexOf(t);n>-1&&r[e].splice(n,1)}},emit:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];r[e]&&r[e].forEach((function(e){return e.apply(void 0,n)}))},clear:function(){r={}}}),u=z(C(n,o),o),f={tracker:v(),index:0,startTransform:0,isStart:!1,isScrolling:!1,isTouching:!1,transforms:0,progress:0},m=l.on,h=l.off,x=l.emit,g={on:m,off:h,env:u,state:f,options:o};(o.plugins||t.plugins||[]).forEach((function(e){return e(g,o)})),x(s,g);var S=E(u,o),w=A(u,f,o,S,l),b=y(u,f,o,w);var T=w.slideTo;return Object.assign(g,{update:function(){S.destroy(),u.update(C(n,o)),S.init(),w.update()},destroy:function(){x(p,g),b.detach(),S.destroy(),x(d,g),l.clear()},slideTo:T,updateSize:function(){u.update(C(n,o)),w.update()}}),S.init(),b.attach(),T(o.initialSlide,0),x(c,g),g};return $.use=function(e){$.plugins=e},$}()}},t={};!function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(7300)}();
includes/admin/class-coblocks-crop-settings.php CHANGED
@@ -88,12 +88,10 @@ class CoBlocks_Crop_Settings {
88
  public function get_original_image() {
89
  $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
90
 
91
- if ( ! $nonce ) {
92
  wp_send_json_error( 'No nonce value present' );
93
  }
94
 
95
- wp_verify_nonce( $nonce, 'cropSettingsOriginalImageNonce' );
96
-
97
  $id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT );
98
 
99
  if ( ! $id ) {
@@ -123,12 +121,10 @@ class CoBlocks_Crop_Settings {
123
  public function api_crop() {
124
  $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
125
 
126
- if ( ! $nonce ) {
127
  wp_send_json_error( 'No nonce value present' );
128
  }
129
 
130
- wp_verify_nonce( $nonce, 'cropSettingsNonce' );
131
-
132
  if (
133
  ! isset( $_POST['id'] ) ||
134
  ! isset( $_POST['cropX'] ) ||
88
  public function get_original_image() {
89
  $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
90
 
91
+ if ( ! $nonce || ! wp_verify_nonce( $nonce, 'cropSettingsOriginalImageNonce' ) ) {
92
  wp_send_json_error( 'No nonce value present' );
93
  }
94
 
 
 
95
  $id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT );
96
 
97
  if ( ! $id ) {
121
  public function api_crop() {
122
  $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
123
 
124
+ if ( ! $nonce || ! wp_verify_nonce( $nonce, 'cropSettingsNonce' ) ) {
125
  wp_send_json_error( 'No nonce value present' );
126
  }
127
 
 
 
128
  if (
129
  ! isset( $_POST['id'] ) ||
130
  ! isset( $_POST['cropX'] ) ||
includes/class-coblocks-block-assets.php CHANGED
@@ -522,25 +522,29 @@ class CoBlocks_Block_Assets {
522
  return false;
523
  }
524
 
525
- $admin_page = wp_basename( esc_url( $_SERVER['REQUEST_URI'] ) );
526
 
527
- if ( false !== strpos( $admin_page, 'post-new.php' ) && empty( $_GET['post_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
 
 
 
528
  return true;
529
  }
530
 
531
- if ( false !== strpos( $admin_page, 'post-new.php' ) && isset( $_GET['post_type'] ) && $this->is_post_type_gutenberg( $_GET['post_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
532
  return true;
533
  }
534
 
535
- if ( false !== strpos( $admin_page, 'post.php' ) && isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
536
- $wp_post = get_post( $_GET['post'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
537
  if ( isset( $wp_post ) && isset( $wp_post->post_type ) && $this->is_post_type_gutenberg( $wp_post->post_type ) ) {
538
  return true;
539
  }
540
  }
541
 
542
- if ( false !== strpos( $admin_page, 'revision.php' ) && isset( $_GET['revision'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
543
- $wp_post = get_post( $_GET['revision'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
544
  $post_parent = get_post( $wp_post->post_parent );
545
  if ( isset( $post_parent ) && isset( $post_parent->post_type ) && $this->is_post_type_gutenberg( $post_parent->post_type ) ) {
546
  return true;
522
  return false;
523
  }
524
 
525
+ $admin_page = isset( $_SERVER['REQUEST_URI'] ) ? wp_basename( esc_url( filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ), FILTER_SANITIZE_URL ) ) ) : false;
526
 
527
+ if ( ! $admin_page ) {
528
+ return false;
529
+ }
530
+
531
+ if ( false !== strpos( $admin_page, 'post-new.php' ) && empty( $_GET['post_type'] ) ) {
532
  return true;
533
  }
534
 
535
+ if ( false !== strpos( $admin_page, 'post-new.php' ) && isset( $_GET['post_type'] ) && $this->is_post_type_gutenberg( filter_input( INPUT_GET, wp_unslash( $_GET['post_type'] ), FILTER_SANITIZE_STRING ) ) ) {
536
  return true;
537
  }
538
 
539
+ if ( false !== strpos( $admin_page, 'post.php' ) && isset( $_GET['post'] ) ) {
540
+ $wp_post = get_post( filter_input( INPUT_GET, wp_unslash( $_GET['post'] ), FILTER_SANITIZE_STRING ) );
541
  if ( isset( $wp_post ) && isset( $wp_post->post_type ) && $this->is_post_type_gutenberg( $wp_post->post_type ) ) {
542
  return true;
543
  }
544
  }
545
 
546
+ if ( false !== strpos( $admin_page, 'revision.php' ) && isset( $_GET['revision'] ) ) {
547
+ $wp_post = get_post( filter_input( INPUT_GET, wp_unslash( $_GET['revision'] ), FILTER_SANITIZE_STRING ) );
548
  $post_parent = get_post( $wp_post->post_parent );
549
  if ( isset( $post_parent ) && isset( $post_parent->post_type ) && $this->is_post_type_gutenberg( $post_parent->post_type ) ) {
550
  return true;
includes/class-coblocks-form.php CHANGED
@@ -225,14 +225,14 @@ class CoBlocks_Form {
225
  ?>
226
 
227
  <form action="<?php echo esc_url( sprintf( '%1$s#%2$s', set_url_scheme( get_the_permalink() ), $this->form_hash ) ); ?>" method="post">
228
- <?php echo do_blocks( $content ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
229
  <input class="coblocks-field verify" type="email" name="coblocks-verify-email" autocomplete="off" placeholder="<?php esc_attr_e( 'Email', 'coblocks' ); ?>" tabindex="-1">
230
  <input type="hidden" name="form-hash" value="<?php echo esc_attr( $this->form_hash ); ?>">
231
 
232
  <?php
233
  // Output a submit button if it's not found in the block content.
234
  if ( false === strpos( $content, 'coblocks-form__submit' ) ) :
235
- echo $this->render_field_submit_button( $atts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
236
  endif;
237
  ?>
238
  </form>
@@ -897,8 +897,8 @@ class CoBlocks_Form {
897
 
898
  $post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );
899
  $post_title = get_bloginfo( 'name' ) . ( ( false === $post_id ) ? '' : sprintf( ' - %s', get_the_title( $post_id ) ) );
900
- $email_field_id = isset( $_POST['email-field-id'] ) ? esc_html( $_POST['email-field-id'] ) : 'field-email';
901
- $name_field_id = isset( $_POST['name-field-id'] ) ? esc_html( $_POST['name-field-id'] ) : 'field-name';
902
 
903
  $to = isset( $atts['to'] ) ? sanitize_email( $atts['to'] ) : get_option( 'admin_email' );
904
 
@@ -907,7 +907,7 @@ class CoBlocks_Form {
907
  $recaptcha_site_key = get_option( 'coblocks_google_recaptcha_site_key' );
908
  $recaptcha_secret_key = get_option( 'coblocks_google_recaptcha_secret_key' );
909
  if ( $recaptcha_site_key && $recaptcha_secret_key ) {
910
- if ( ! isset( $_POST['g-recaptcha-token'] ) || ! $this->verify_recaptcha( $_POST['g-recaptcha-token'] ) ) {
911
 
912
  $this->remove_url_form_hash();
913
 
@@ -944,13 +944,19 @@ class CoBlocks_Form {
944
  */
945
  $to = (string) apply_filters( 'coblocks_form_email_to', $to, $_POST, $post_id );
946
 
 
 
947
  /**
948
  * Filter the email subject
949
  *
950
  * @param string $subject Email subject.
951
  * @param array $_POST Submitted form data.
952
  */
953
- $subject = (string) apply_filters( 'coblocks_form_email_subject', $this->setup_email_subject( $atts, $email_field_id, $name_field_id ), $_POST );
 
 
 
 
954
 
955
  /**
956
  * Filter the form email content.
@@ -961,8 +967,8 @@ class CoBlocks_Form {
961
  */
962
  $email_content = (string) apply_filters( 'coblocks_form_email_content', $this->email_content, $_POST, $post_id );
963
 
964
- $sender_email = isset( $_POST[ $email_field_id ]['value'] ) ? esc_html( $_POST[ $email_field_id ]['value'] ) : '';
965
- $sender_name = isset( $_POST[ $name_field_id ]['value'] ) ? esc_html( $_POST[ $name_field_id ]['value'] ) : '';
966
 
967
  $headers = array();
968
 
@@ -1011,11 +1017,11 @@ class CoBlocks_Form {
1011
  * [name] will be replaced with the value of field-name etc.
1012
  *
1013
  * @param array $atts Block attributes array.
1014
- * @param string $email_field_id Email field ID.
1015
- * @param string $name_field_id Nane field ID.
1016
  * @return string Email subject.
1017
  */
1018
- private function setup_email_subject( $atts, $email_field_id, $name_field_id ) {
1019
 
1020
  $subject = isset( $atts['subject'] ) ? sanitize_text_field( $atts['subject'] ) : self::default_subject();
1021
 
@@ -1025,17 +1031,13 @@ class CoBlocks_Form {
1025
 
1026
  array_walk(
1027
  $matches[1],
1028
- function( $match, $key ) use ( $matches, &$subject, &$email_field_id, &$name_field_id ) {
1029
  $slug_match = strtolower( str_replace( ' ', '', $match ) );
1030
 
1031
- // phpcs:disable WordPress.Security.NonceVerification.Missing
1032
  if ( __( 'name', 'coblocks' ) === $slug_match ) {
1033
 
1034
- if ( isset( $_POST[ $name_field_id ]['value'] ) ) {
1035
-
1036
- $name_field_value = is_array( $_POST[ $name_field_id ]['value'] ) ? sanitize_text_field( implode( ' ', $_POST[ $name_field_id ]['value'] ) ) : sanitize_text_field( $_POST[ $name_field_id ]['value'] );
1037
- $value = empty( $name_field_value ) ? $matches[0][ $key ] : $name_field_value;
1038
-
1039
  } else {
1040
 
1041
  $value = $matches[0][ $key ];
@@ -1043,7 +1045,7 @@ class CoBlocks_Form {
1043
  }
1044
  } elseif ( __( 'email', 'coblocks' ) === $slug_match ) {
1045
 
1046
- $value = isset( $_POST[ $email_field_id ]['value'] ) ? sanitize_text_field( $_POST[ $email_field_id ]['value'] ) : $matches[0][ $key ];
1047
 
1048
  }
1049
 
225
  ?>
226
 
227
  <form action="<?php echo esc_url( sprintf( '%1$s#%2$s', set_url_scheme( get_the_permalink() ), $this->form_hash ) ); ?>" method="post">
228
+ <?php echo do_blocks( $content ); ?>
229
  <input class="coblocks-field verify" type="email" name="coblocks-verify-email" autocomplete="off" placeholder="<?php esc_attr_e( 'Email', 'coblocks' ); ?>" tabindex="-1">
230
  <input type="hidden" name="form-hash" value="<?php echo esc_attr( $this->form_hash ); ?>">
231
 
232
  <?php
233
  // Output a submit button if it's not found in the block content.
234
  if ( false === strpos( $content, 'coblocks-form__submit' ) ) :
235
+ echo $this->render_field_submit_button( $atts );
236
  endif;
237
  ?>
238
  </form>
897
 
898
  $post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );
899
  $post_title = get_bloginfo( 'name' ) . ( ( false === $post_id ) ? '' : sprintf( ' - %s', get_the_title( $post_id ) ) );
900
+ $email_field_id = isset( $_POST['email-field-id'] ) ? sanitize_text_field( $_POST['email-field-id'] ) : 'field-email';
901
+ $name_field_id = isset( $_POST['name-field-id'] ) ? sanitize_text_field( $_POST['name-field-id'] ) : 'field-name';
902
 
903
  $to = isset( $atts['to'] ) ? sanitize_email( $atts['to'] ) : get_option( 'admin_email' );
904
 
907
  $recaptcha_site_key = get_option( 'coblocks_google_recaptcha_site_key' );
908
  $recaptcha_secret_key = get_option( 'coblocks_google_recaptcha_secret_key' );
909
  if ( $recaptcha_site_key && $recaptcha_secret_key ) {
910
+ if ( ! isset( $_POST['g-recaptcha-token'] ) || ! $this->verify_recaptcha( sanitize_text_field( $_POST['g-recaptcha-token'] ) ) ) {
911
 
912
  $this->remove_url_form_hash();
913
 
944
  */
945
  $to = (string) apply_filters( 'coblocks_form_email_to', $to, $_POST, $post_id );
946
 
947
+ $name_field_value = sanitize_text_field( $_POST[ $name_field_id ]['value'] );
948
+ $email_field_value = sanitize_text_field( $_POST[ $email_field_id ]['value'] );
949
  /**
950
  * Filter the email subject
951
  *
952
  * @param string $subject Email subject.
953
  * @param array $_POST Submitted form data.
954
  */
955
+ $subject = (string) apply_filters(
956
+ 'coblocks_form_email_subject',
957
+ $this->setup_email_subject( $atts, $name_field_value, $email_field_value ),
958
+ $_POST
959
+ );
960
 
961
  /**
962
  * Filter the form email content.
967
  */
968
  $email_content = (string) apply_filters( 'coblocks_form_email_content', $this->email_content, $_POST, $post_id );
969
 
970
+ $sender_email = isset( $_POST[ $email_field_id ]['value'] ) ? sanitize_text_field( $_POST[ $email_field_id ]['value'] ) : '';
971
+ $sender_name = isset( $_POST[ $name_field_id ]['value'] ) ? sanitize_text_field( $_POST[ $name_field_id ]['value'] ) : '';
972
 
973
  $headers = array();
974
 
1017
  * [name] will be replaced with the value of field-name etc.
1018
  *
1019
  * @param array $atts Block attributes array.
1020
+ * @param string $name_field_value Name field value.
1021
+ * @param string $email_field_value Email field value.
1022
  * @return string Email subject.
1023
  */
1024
+ private function setup_email_subject( $atts, $name_field_value, $email_field_value ) {
1025
 
1026
  $subject = isset( $atts['subject'] ) ? sanitize_text_field( $atts['subject'] ) : self::default_subject();
1027
 
1031
 
1032
  array_walk(
1033
  $matches[1],
1034
+ function( $match, $key ) use ( $matches, &$subject, &$name_field_value, &$email_field_value ) {
1035
  $slug_match = strtolower( str_replace( ' ', '', $match ) );
1036
 
 
1037
  if ( __( 'name', 'coblocks' ) === $slug_match ) {
1038
 
1039
+ if ( isset( $name_field_value ) ) {
1040
+ $value = empty( $name_field_value ) ? $matches[0][ $key ] : $name_field_value;
 
 
 
1041
  } else {
1042
 
1043
  $value = $matches[0][ $key ];
1045
  }
1046
  } elseif ( __( 'email', 'coblocks' ) === $slug_match ) {
1047
 
1048
+ $value = isset( $email_field_value ) ? $email_field_value : $matches[0][ $key ];
1049
 
1050
  }
1051
 
includes/ical-parser/class-coblocks-ical.php CHANGED
@@ -8,6 +8,7 @@
8
  * @author Jonathan Goode <https://github.com/u01jmg3>
9
  * @license https://opensource.org/licenses/mit-license.php MIT License
10
  * @version 2.1.12
 
11
  */
12
 
13
  // Exit if accessed directly.
@@ -15,6 +16,9 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
16
  }
17
 
 
 
 
18
  class CoBlocks_ICal {
19
 
20
  const DATE_TIME_FORMAT = 'Ymd\THis';
@@ -502,8 +506,9 @@ class CoBlocks_ICal {
502
  /**
503
  * Creates the ICal object
504
  *
505
- * @param mixed $files
506
- * @param array $options
 
507
  * @return void
508
  */
509
  public function __construct( $files = false, array $options = array() ) {
@@ -519,7 +524,7 @@ class CoBlocks_ICal {
519
  );
520
 
521
  // Used only for strtotime(), i18n not needed.
522
- $this->weekdays = array(
523
  'SU' => 'Sunday of',
524
  'MO' => 'Monday of',
525
  'TU' => 'Tuesday of',
@@ -561,7 +566,7 @@ class CoBlocks_ICal {
561
  }
562
  }
563
 
564
- // Fallback to use the system default time zone
565
  if ( ! isset( $this->default_time_zone ) || ! $this->is_valid_timezone_id( $this->default_time_zone ) ) {
566
  $this->default_time_zone = date_default_timezone_get();
567
  }
@@ -589,7 +594,8 @@ class CoBlocks_ICal {
589
  /**
590
  * Initialises lines from a string
591
  *
592
- * @param string $string
 
593
  * @return ICal
594
  */
595
  public function init_string( $string ) {
@@ -597,8 +603,6 @@ class CoBlocks_ICal {
597
  $lines = explode( PHP_EOL, $string );
598
 
599
  $this->init_lines( $lines );
600
- } else {
601
- trigger_error( 'ICal::init_string: Calendar already initialised in constructor', E_USER_NOTICE );
602
  }
603
 
604
  return $this;
@@ -607,7 +611,8 @@ class CoBlocks_ICal {
607
  /**
608
  * Initialises lines from a file
609
  *
610
- * @param string $file
 
611
  * @return ICal
612
  */
613
  public function init_file( $file ) {
@@ -615,8 +620,6 @@ class CoBlocks_ICal {
615
  $lines = $this->file_or_url( $file );
616
 
617
  $this->init_lines( $lines );
618
- } else {
619
- trigger_error( 'ICal::init_file: Calendar already initialised in constructor', E_USER_NOTICE );
620
  }
621
 
622
  return $this;
@@ -625,10 +628,11 @@ class CoBlocks_ICal {
625
  /**
626
  * Initialises lines from a URL
627
  *
628
- * @param string $url
629
- * @param string $username
630
- * @param string $password
631
- * @param string $user_agent
 
632
  * @return ICal
633
  */
634
  public function init_url( $url, $username = null, $password = null, $user_agent = null ) {
@@ -650,7 +654,8 @@ class CoBlocks_ICal {
650
  * Initialises the parser using an array
651
  * containing each line of iCal content
652
  *
653
- * @param array $lines
 
654
  * @return void
655
  */
656
  protected function init_lines( array $lines ) {
@@ -659,7 +664,7 @@ class CoBlocks_ICal {
659
  if ( stristr( $lines[0], 'BEGIN:VCALENDAR' ) !== false ) {
660
  $component = '';
661
  foreach ( $lines as $line ) {
662
- $line = rtrim( $line ); // Trim trailing whitespace
663
  $line = $this->remove_unprintable_chars( $line );
664
 
665
  if ( ! $this->disable_character_replacement ) {
@@ -669,26 +674,26 @@ class CoBlocks_ICal {
669
  $add = $this->key_value_from_string( $line );
670
 
671
  $keyword = $add[0];
672
- $values = $add[1]; // May be an array containing multiple values
673
 
674
  if ( ! is_array( $values ) ) {
675
  if ( ! empty( $values ) ) {
676
- $values = array( $values ); // Make an array as not already
677
- $blank_array = array(); // Empty placeholder array
678
  array_push( $values, $blank_array );
679
  } else {
680
- $values = array(); // Use blank array to ignore this line
681
  }
682
  } elseif ( empty( $values[0] ) ) {
683
- $values = array(); // Use blank array to ignore this line
684
  }
685
 
686
- // Reverse so that our array of properties is processed first
687
  $values = array_reverse( $values );
688
 
689
  foreach ( $values as $value ) {
690
  switch ( $line ) {
691
- // https://www.kanzaki.com/docs/ical/vtodo.html
692
  case 'BEGIN:VTODO':
693
  if ( ! is_array( $value ) ) {
694
  $this->todo_count++;
@@ -697,7 +702,7 @@ class CoBlocks_ICal {
697
  $component = 'VTODO';
698
  break;
699
 
700
- // https://www.kanzaki.com/docs/ical/vevent.html
701
  case 'BEGIN:VEVENT':
702
  if ( ! is_array( $value ) ) {
703
  $this->event_count++;
@@ -706,7 +711,7 @@ class CoBlocks_ICal {
706
  $component = 'VEVENT';
707
  break;
708
 
709
- // https://www.kanzaki.com/docs/ical/vfreebusy.html
710
  case 'BEGIN:VFREEBUSY':
711
  if ( ! is_array( $value ) ) {
712
  $this->free_busy_index++;
@@ -763,7 +768,7 @@ class CoBlocks_ICal {
763
  if ( ! $this->skip_recurrence ) {
764
  $this->process_recurrences();
765
 
766
- // Apply changes to altered recurrence instances
767
  if ( ! empty( $this->altered_recurrence_instances ) ) {
768
  $events = $this->cal['VEVENT'];
769
 
@@ -797,7 +802,7 @@ class CoBlocks_ICal {
797
  $events = $this->cal['VEVENT'];
798
 
799
  if ( ! empty( $events ) ) {
800
- $last_index = sizeof( $events ) - 1;
801
  $last_event = $events[ $last_index ];
802
 
803
  if ( ( ! isset( $last_event['RRULE'] ) || '' === $last_event['RRULE'] ) && $this->does_event_start_outside_window( $last_event ) ) {
@@ -842,7 +847,8 @@ class CoBlocks_ICal {
842
  * Determines whether the event start date is outside `$window_min_timestamp` / `$window_max_timestamp`.
843
  * Returns `true` for invalid dates.
844
  *
845
- * @param array $event
 
846
  * @return boolean
847
  */
848
  protected function does_event_start_outside_window( array $event ) {
@@ -852,9 +858,10 @@ class CoBlocks_ICal {
852
  /**
853
  * Determines whether a valid iCalendar date is within a given range
854
  *
855
- * @param string $calendar_date
856
- * @param integer $min_timestamp
857
- * @param integer $max_timestamp
 
858
  * @return boolean
859
  */
860
  protected function is_out_of_range( $calendar_date, $min_timestamp, $max_timestamp ) {
@@ -867,7 +874,8 @@ class CoBlocks_ICal {
867
  * Unfolds an iCal file in preparation for parsing
868
  * (https://icalendar.org/iCalendar-RFC-5545/3-1-content-lines.html)
869
  *
870
- * @param array $lines
 
871
  * @return array
872
  */
873
  protected function unfold( array $lines ) {
@@ -881,9 +889,10 @@ class CoBlocks_ICal {
881
  /**
882
  * Add one key and value pair to the `$this->cal` array
883
  *
884
- * @param string $component
885
- * @param string|boolean $keyword
886
- * @param string $value
 
887
  * @return void
888
  */
889
  protected function add_calendar_component_with_key_and_value( $component, $keyword, $value ) {
@@ -902,7 +911,7 @@ class CoBlocks_ICal {
902
  }
903
 
904
  if ( is_array( $value ) ) {
905
- // Add array of properties to the end
906
  array_push( $this->cal[ $key1 ][ $key2 ][ $key3 ][ "{$keyword}_array" ], $value );
907
  } else {
908
  if ( ! isset( $this->cal[ $key1 ][ $key2 ][ $key3 ][ $keyword ] ) ) {
@@ -924,7 +933,7 @@ class CoBlocks_ICal {
924
  }
925
 
926
  if ( is_array( $value ) ) {
927
- // Add array of properties to the end
928
  array_push( $this->cal[ $key1 ][ $key2 ][ "{$keyword}_array" ], $value );
929
  } else {
930
  if ( ! isset( $this->cal[ $key1 ][ $key2 ][ $keyword ] ) ) {
@@ -991,7 +1000,8 @@ class CoBlocks_ICal {
991
  /**
992
  * Gets the key value pair from an iCal string
993
  *
994
- * @param string $text
 
995
  * @return array|boolean
996
  */
997
  protected function key_value_from_string( $text ) {
@@ -1034,66 +1044,68 @@ class CoBlocks_ICal {
1034
  }
1035
 
1036
  if ( preg_match( '/^([A-Z-]+)([;][\w\W]*)?$/', $matches[1] ) ) {
1037
- $matches = array_splice( $matches, 1, 2 ); // Remove first match and re-align ordering
1038
 
1039
- // Process properties
1040
  if ( preg_match( '/([A-Z-]+)[;]([\w\W]*)/', $matches[0], $properties ) ) {
1041
- // Remove first match
1042
  array_shift( $properties );
1043
- // Fix to ignore everything in keyword after a ; (e.g. Language, TZID, etc.)
1044
  $matches[0] = $properties[0];
1045
- array_shift( $properties ); // Repeat removing first match
1046
 
1047
  $formatted = array();
1048
  foreach ( $properties as $property ) {
1049
- // Match semicolon separator outside of quoted substrings
1050
  preg_match_all( '~[^' . PHP_EOL . '";]+(?:"[^"\\\]*(?:\\\.[^"\\\]*)*"[^' . PHP_EOL . '";]*)*~', $property, $attributes );
1051
- // Remove multi-dimensional array and use the first key
1052
- $attributes = ( sizeof( $attributes ) === 0 ) ? array( $property ) : reset( $attributes );
1053
 
1054
  if ( is_array( $attributes ) ) {
1055
  foreach ( $attributes as $attribute ) {
1056
- // Match equals sign separator outside of quoted substrings
1057
  preg_match_all(
1058
  '~[^' . PHP_EOL . '"=]+(?:"[^"\\\]*(?:\\\.[^"\\\]*)*"[^' . PHP_EOL . '"=]*)*~',
1059
  $attribute,
1060
  $values
1061
  );
1062
- // Remove multi-dimensional array and use the first key
1063
- $value = ( sizeof( $values ) === 0 ) ? null : reset( $values );
1064
 
1065
  if ( is_array( $value ) && isset( $value[1] ) ) {
1066
- // Remove double quotes from beginning and end only
1067
  $formatted[ $value[0] ] = trim( $value[1], '"' );
1068
  }
1069
  }
1070
  }
1071
  }
1072
 
1073
- // Assign the keyword property information
1074
  $properties[0] = $formatted;
1075
 
1076
- // Add match to beginning of array
1077
  array_unshift( $properties, $matches[1] );
1078
  $matches[1] = $properties;
1079
  }
1080
 
1081
  return $matches;
1082
  } else {
1083
- return false; // Ignore this match
1084
  }
1085
  }
1086
 
1087
  /**
1088
  * Returns a `DateTime` object from an iCal date time format
1089
  *
1090
- * @param string $ical_date
 
1091
  * @return \DateTime
1092
- * @throws \Exception
 
1093
  */
1094
  public function ical_date_to_date_time( $ical_date ) {
1095
  /**
1096
- * iCal times may be in 3 formats, (https://www.kanzaki.com/docs/ical/dateTime.html)
1097
  *
1098
  * UTC: Has a trailing 'Z'
1099
  * Floating: No time zone reference specified, no trailing 'Z', use local time
@@ -1102,12 +1114,12 @@ class CoBlocks_ICal {
1102
  * Use DateTime class objects to get around limitations with `mktime` and `gmmktime`.
1103
  * Must have a local time zone set to process floating times.
1104
  */
1105
- $pattern = '/^(?:TZID=)?([^:]*|".*")'; // [1]: Time zone
1106
- $pattern .= ':?'; // Time zone delimiter
1107
- $pattern .= '([0-9]{8})'; // [2]: YYYYMMDD
1108
- $pattern .= 'T?'; // Time delimiter
1109
- $pattern .= '(?(?<=T)([0-9]{6}))'; // [3]: HHMMSS (filled if delimiter present)
1110
- $pattern .= '(Z?)/'; // [4]: UTC flag
1111
 
1112
  preg_match( $pattern, $ical_date, $date );
1113
 
@@ -1142,7 +1154,8 @@ class CoBlocks_ICal {
1142
  /**
1143
  * Returns a Unix timestamp from an iCal date time format
1144
  *
1145
- * @param string $ical_date
 
1146
  * @return integer
1147
  */
1148
  public function ical_date_to_unix_timestamp( $ical_date ) {
@@ -1152,9 +1165,10 @@ class CoBlocks_ICal {
1152
  /**
1153
  * Returns a date adapted to the calendar time zone depending on the event `TZID`
1154
  *
1155
- * @param array $event
1156
- * @param string $key
1157
- * @param string $format
 
1158
  * @return string|boolean
1159
  */
1160
  public function ical_date_with_timezone( array $event, $key, $format = self::DATE_TIME_FORMAT ) {
@@ -1172,7 +1186,7 @@ class CoBlocks_ICal {
1172
  $date_time->setTimezone( new \DateTimeZone( $this->calendar_timezone() ) );
1173
  }
1174
 
1175
- // Force time zone
1176
  if ( isset( $date_array[0]['TZID'] ) ) {
1177
  $date_time->setTimezone( $this->timezone_string_to_date_timezone( $date_array[0]['TZID'] ) );
1178
  }
@@ -1277,7 +1291,7 @@ class CoBlocks_ICal {
1277
  if ( ! empty( $events ) ) {
1278
  foreach ( $events as $an_event ) {
1279
  if ( isset( $an_event['RRULE'] ) && '' !== $an_event['RRULE'] ) {
1280
- // Tag as generated by a recurrence rule
1281
  $an_event['RRULE_array'][2] = self::RECURRENCE_EVENT;
1282
 
1283
  $count_nb = 0;
@@ -1292,7 +1306,7 @@ class CoBlocks_ICal {
1292
  $initial_end_timezone_name = $initial_start_timezone_name;
1293
  }
1294
 
1295
- // Recurring event, parse RRULE and add appropriate duplicate events
1296
  $rrules = array();
1297
  $rrule_strings = explode( ';', $an_event['RRULE'] );
1298
 
@@ -1301,9 +1315,9 @@ class CoBlocks_ICal {
1301
  $rrules[ $k ] = $v;
1302
  }
1303
 
1304
- // Get frequency
1305
  $frequency = $rrules['FREQ'];
1306
- // Get Start timestamp
1307
  $start_timestamp = $initial_start->getTimestamp();
1308
 
1309
  if ( isset( $an_event['DTEND'] ) ) {
@@ -1316,20 +1330,20 @@ class CoBlocks_ICal {
1316
  }
1317
 
1318
  $event_timestamp_offset = $end_timestamp - $start_timestamp;
1319
- // Get Interval
1320
  $interval = ( isset( $rrules['INTERVAL'] ) && '' !== $rrules['INTERVAL'] ) ? $rrules['INTERVAL'] : 1;
1321
 
1322
  $day_number = null;
1323
  $weekday = null;
1324
 
1325
  if ( in_array( $frequency, array( 'MONTHLY', 'YEARLY' ), true ) && isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1326
- // Deal with BYDAY
1327
  $by_day = $rrules['BYDAY'];
1328
  $day_number = intval( $by_day );
1329
 
1330
- if ( empty( $day_number ) ) { // Returns 0 when no number defined in BYDAY
1331
  if ( ! isset( $rrules['BYSETPOS'] ) ) {
1332
- $day_number = 1; // Set first as default
1333
  } elseif ( is_numeric( $rrules['BYSETPOS'] ) ) {
1334
  $day_number = $rrules['BYSETPOS'];
1335
 
@@ -1351,18 +1365,16 @@ class CoBlocks_ICal {
1351
  if ( is_int( $this->default_span ) ) {
1352
  $until_default = date_create( 'now' );
1353
  $until_default->modify( $this->default_span . ' year' );
1354
- $until_default->setTime( 23, 59, 59 ); // End of the day
1355
- } else {
1356
- trigger_error( 'ICal::default_span: User defined value is not an integer', E_USER_NOTICE );
1357
  }
1358
 
1359
- // Compute EXDATEs
1360
  $exdates = $this->parse_ex_dates( $an_event );
1361
 
1362
  $count_orig = null;
1363
 
1364
  if ( isset( $rrules['UNTIL'] ) ) {
1365
- // Get Until
1366
  $until = strtotime( $rrules['UNTIL'] );
1367
  if ( $until > strtotime( '+' . $this->default_span . ' years' ) ) {
1368
  $until = strtotime( '+' . $this->default_span . ' years' );
@@ -1370,10 +1382,10 @@ class CoBlocks_ICal {
1370
  } elseif ( isset( $rrules['COUNT'] ) ) {
1371
  $count_orig = ( is_numeric( $rrules['COUNT'] ) && $rrules['COUNT'] > 1 ) ? $rrules['COUNT'] : 0;
1372
 
1373
- // Increment count by the number of excluded dates
1374
- $count_orig += sizeof( $exdates );
1375
 
1376
- // Remove one to exclude the occurrence that initialises the rule
1377
  $count = ( $count_orig - 1 );
1378
 
1379
  if ( $interval >= 2 ) {
@@ -1400,10 +1412,10 @@ class CoBlocks_ICal {
1400
  $dtstart->modify( $offset );
1401
  }
1402
 
1403
- // Jumping X months forwards doesn't mean
1404
- // the end date will fall on the same day defined in BYDAY
1405
- // Use the largest of these to ensure we are going far enough
1406
- // in the future to capture our final end day
1407
  $until = max( $until, $dtstart->format( self::UNIX_FORMAT ) );
1408
  }
1409
 
@@ -1414,17 +1426,17 @@ class CoBlocks_ICal {
1414
 
1415
  $until = intval( $until );
1416
 
1417
- // Decide how often to add events and do so
1418
  switch ( $frequency ) {
1419
  case 'DAILY':
1420
- // Simply add a new event each interval of days until UNTIL is reached
1421
  $offset = "+{$interval} day";
1422
  $recurring_timestamp = strtotime( $offset, $start_timestamp );
1423
 
1424
  while ( $recurring_timestamp <= $until ) {
1425
  $dayrecurring_timestamp = $recurring_timestamp;
1426
 
1427
- // Adjust time zone from initial event
1428
  $dayrecurring_offset = 0;
1429
  if ( $this->use_timezone_with_r_rules ) {
1430
  $recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $dayrecurring_timestamp );
@@ -1433,20 +1445,20 @@ class CoBlocks_ICal {
1433
  $dayrecurring_timestamp += $dayrecurring_offset;
1434
  }
1435
 
1436
- // Add event
1437
- $an_event['DTSTART'] = date( self::DATE_TIME_FORMAT, $dayrecurring_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1438
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1439
  $an_event['DTSTART_array'][2] = $dayrecurring_timestamp;
1440
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1441
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1442
- $an_event['DTEND'] = date(
1443
  self::DATE_TIME_FORMAT,
1444
  $an_event['DTEND_array'][2]
1445
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1446
 
1447
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1448
 
1449
- // Exclusions
1450
  $is_excluded = array_filter(
1451
  $exdates,
1452
  function ( $exdate ) use ( $an_event, $dayrecurring_offset ) {
@@ -1474,7 +1486,7 @@ class CoBlocks_ICal {
1474
  $recurrence_events[] = $an_event;
1475
  $this->event_count++;
1476
 
1477
- // If RRULE[COUNT] is reached then break
1478
  if ( isset( $rrules['COUNT'] ) ) {
1479
  $count_nb++;
1480
 
@@ -1484,17 +1496,17 @@ class CoBlocks_ICal {
1484
  }
1485
  }
1486
 
1487
- // Move forwards
1488
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
1489
  }
1490
 
1491
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
1492
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
1493
- $recurrence_events = array(); // Reset
1494
  break;
1495
 
1496
  case 'WEEKLY':
1497
- // Create offset
1498
  $offset = "+{$interval} week";
1499
 
1500
  $wkst = ( isset( $rrules['WKST'] ) && in_array( $rrules['WKST'], array( 'SA', 'SU', 'MO' ), true ) ) ? $rrules['WKST'] : $this->default_week_start;
@@ -1505,26 +1517,26 @@ class CoBlocks_ICal {
1505
  'MO' => 'Monday',
1506
  );
1507
 
1508
- // Build list of days of week to add events
1509
  $weekdays = $a_week;
1510
 
1511
  if ( isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1512
  $by_days = explode( ',', $rrules['BYDAY'] );
1513
  } else {
1514
- // A textual representation of a day, two letters (e.g. SU)
1515
  $by_days = array( mb_substr( strtoupper( $initial_start->format( 'D' ) ), 0, 2 ) );
1516
  }
1517
 
1518
- // Get timestamp of first day of start week
1519
  $weekrecurring_timestamp = ( strcasecmp( $initial_start->format( 'l' ), explode( ' ', $this->weekdays[ $wkst ] )[0] ) === 0 )
1520
  ? $start_timestamp
1521
  : strtotime( "last {$days[$wkst]} " . $initial_start->format( 'H:i:s' ), $start_timestamp );
1522
 
1523
- // Step through weeks
1524
  while ( $weekrecurring_timestamp <= $until ) {
1525
  $dayrecurring_timestamp = $weekrecurring_timestamp;
1526
 
1527
- // Adjust time zone from initial event
1528
  $dayrecurring_offset = 0;
1529
  if ( $this->use_timezone_with_r_rules ) {
1530
  $day_recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $dayrecurring_timestamp );
@@ -1534,24 +1546,24 @@ class CoBlocks_ICal {
1534
  }
1535
 
1536
  foreach ( $weekdays as $day ) {
1537
- // Check if day should be added
1538
  if ( in_array( $day, $by_days, true ) && $dayrecurring_timestamp > $start_timestamp
1539
  && $dayrecurring_timestamp <= $until
1540
  ) {
1541
- // Add event
1542
- $an_event['DTSTART'] = date( self::DATE_TIME_FORMAT, $dayrecurring_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1543
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1544
  $an_event['DTSTART_array'][2] = $dayrecurring_timestamp;
1545
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1546
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1547
- $an_event['DTEND'] = date(
1548
  self::DATE_TIME_FORMAT,
1549
  $an_event['DTEND_array'][2]
1550
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1551
 
1552
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1553
 
1554
- // Exclusions
1555
  $is_excluded = array_filter(
1556
  $exdates,
1557
  function ( $exdate ) use ( $an_event, $dayrecurring_offset ) {
@@ -1579,7 +1591,7 @@ class CoBlocks_ICal {
1579
  $recurrence_events[] = $an_event;
1580
  $this->event_count++;
1581
 
1582
- // If RRULE[COUNT] is reached then break
1583
  if ( isset( $rrules['COUNT'] ) ) {
1584
  $count_nb++;
1585
 
@@ -1590,26 +1602,26 @@ class CoBlocks_ICal {
1590
  }
1591
  }
1592
 
1593
- // Move forwards a day
1594
  $dayrecurring_timestamp = strtotime( '+1 day', $dayrecurring_timestamp );
1595
  }
1596
 
1597
- // Move forwards $interval weeks
1598
  $weekrecurring_timestamp = strtotime( $offset, $weekrecurring_timestamp );
1599
  }
1600
 
1601
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
1602
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
1603
- $recurrence_events = array(); // Reset
1604
  break;
1605
 
1606
  case 'MONTHLY':
1607
- // Create offset
1608
  $recurring_timestamp = $start_timestamp;
1609
  $offset = "+{$interval} month";
1610
 
1611
  if ( isset( $rrules['BYMONTHDAY'] ) && '' !== $rrules['BYMONTHDAY'] ) {
1612
- // Deal with BYMONTHDAY
1613
  $monthdays = explode( ',', $rrules['BYMONTHDAY'] );
1614
 
1615
  while ( $recurring_timestamp <= $until ) {
@@ -1617,7 +1629,7 @@ class CoBlocks_ICal {
1617
  $month_recurring_timestamp = null;
1618
 
1619
  if ( 0 === $key ) {
1620
- // Ensure original event conforms to monthday rule
1621
  $an_event['DTSTART'] = gmdate(
1622
  'Ym' . sprintf( '%02d', $monthday ) . '\T' . self::TIME_FORMAT,
1623
  strtotime( $an_event['DTSTART'] )
@@ -1635,7 +1647,7 @@ class CoBlocks_ICal {
1635
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1636
  $an_event['DTEND_array'][2] = $this->ical_date_to_unix_timestamp( $an_event['DTEND'] );
1637
 
1638
- // Ensure recurring timestamp confirms to BYMONTHDAY rule
1639
  $month_recurring_date_time = new \DateTime( '@' . $recurring_timestamp );
1640
  $month_recurring_date_time->setDate(
1641
  $month_recurring_date_time->format( 'Y' ),
@@ -1645,7 +1657,7 @@ class CoBlocks_ICal {
1645
  $month_recurring_timestamp = $month_recurring_date_time->getTimestamp();
1646
  }
1647
 
1648
- // Adjust time zone from initial event
1649
  $monthrecurring_offset = 0;
1650
  if ( $this->use_timezone_with_r_rules ) {
1651
  $recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $month_recurring_timestamp );
@@ -1655,8 +1667,8 @@ class CoBlocks_ICal {
1655
  }
1656
 
1657
  if ( ( $month_recurring_timestamp > $start_timestamp ) && ( $month_recurring_timestamp <= $until ) ) {
1658
- // Add event
1659
- $an_event['DTSTART'] = date(
1660
  'Ym' . sprintf( '%02d', $monthday ) . '\T' . self::TIME_FORMAT,
1661
  $month_recurring_timestamp
1662
  ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
@@ -1664,13 +1676,13 @@ class CoBlocks_ICal {
1664
  $an_event['DTSTART_array'][2] = $month_recurring_timestamp;
1665
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1666
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1667
- $an_event['DTEND'] = date(
1668
  self::DATE_TIME_FORMAT,
1669
  $an_event['DTEND_array'][2]
1670
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1671
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1672
 
1673
- // Exclusions
1674
  $is_excluded = array_filter(
1675
  $exdates,
1676
  function ( $exdate ) use ( $an_event, $monthrecurring_offset ) {
@@ -1698,7 +1710,7 @@ class CoBlocks_ICal {
1698
  $recurrence_events[] = $an_event;
1699
  $this->event_count++;
1700
 
1701
- // If RRULE[COUNT] is reached then break
1702
  if ( isset( $rrules['COUNT'] ) ) {
1703
  $count_nb++;
1704
 
@@ -1710,14 +1722,14 @@ class CoBlocks_ICal {
1710
  }
1711
  }
1712
 
1713
- // Move forwards
1714
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
1715
  }
1716
  } elseif ( isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1717
  while ( $recurring_timestamp <= $until ) {
1718
  $month_recurring_timestamp = $recurring_timestamp;
1719
 
1720
- // Adjust time zone from initial event
1721
  $monthrecurring_offset = 0;
1722
 
1723
  if ( $this->use_timezone_with_r_rules ) {
@@ -1728,25 +1740,25 @@ class CoBlocks_ICal {
1728
  }
1729
 
1730
  $event_start_desc = "{$this->convert_day_ordinal_to_positive($day_number, $weekday, $month_recurring_timestamp)} {$this->weekdays[$weekday]} "
1731
- . date( self::DATE_TIME_FORMAT_PRETTY, $month_recurring_timestamp );
1732
  $event_start_timestamp = strtotime( $event_start_desc );
1733
 
1734
  if ( intval( $rrules['BYDAY'] ) === 0 ) {
1735
  $last_day_desc = "last {$this->weekdays[$weekday]} "
1736
- . date( self::DATE_TIME_FORMAT_PRETTY, $month_recurring_timestamp );
1737
  } else {
1738
  $last_day_desc = "{$this->convert_day_ordinal_to_positive($day_number, $weekday, $month_recurring_timestamp)} {$this->weekdays[$weekday]} "
1739
- . date( self::DATE_TIME_FORMAT_PRETTY, $month_recurring_timestamp );
1740
  }
1741
 
1742
  $last_day_time_stamp = strtotime( $last_day_desc );
1743
 
1744
  do {
1745
- // Prevent 5th day of a month from showing up on the next month
1746
- // If BYDAY and the event falls outside the current month, skip the event
1747
 
1748
- $compare_current_month = date( 'F', $month_recurring_timestamp );
1749
- $compare_event_month = date( 'F', $event_start_timestamp );
1750
 
1751
  if ( $compare_current_month !== $compare_event_month ) {
1752
  $month_recurring_timestamp = strtotime( $offset, $month_recurring_timestamp );
@@ -1754,18 +1766,18 @@ class CoBlocks_ICal {
1754
  }
1755
 
1756
  if ( $event_start_timestamp > $start_timestamp && $event_start_timestamp <= $until ) {
1757
- $an_event['DTSTART'] = date( self::DATE_TIME_FORMAT, $event_start_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1758
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1759
  $an_event['DTSTART_array'][2] = $event_start_timestamp;
1760
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1761
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1762
- $an_event['DTEND'] = date(
1763
  self::DATE_TIME_FORMAT,
1764
  $an_event['DTEND_array'][2]
1765
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1766
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1767
 
1768
- // Exclusions
1769
  $is_excluded = array_filter(
1770
  $exdates,
1771
  function ( $exdate ) use ( $an_event, $monthrecurring_offset ) {
@@ -1793,7 +1805,7 @@ class CoBlocks_ICal {
1793
  $recurrence_events[] = $an_event;
1794
  $this->event_count++;
1795
 
1796
- // If RRULE[COUNT] is reached then break
1797
  if ( isset( $rrules['COUNT'] ) ) {
1798
  $count_nb++;
1799
 
@@ -1805,8 +1817,8 @@ class CoBlocks_ICal {
1805
  }
1806
 
1807
  if ( isset( $rrules['BYSETPOS'] ) ) {
1808
- // BYSETPOS is defined so skip
1809
- // looping through each week
1810
  $last_day_time_stamp = $event_start_timestamp;
1811
  }
1812
 
@@ -1818,27 +1830,27 @@ class CoBlocks_ICal {
1818
 
1819
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
1820
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
1821
- $recurrence_events = array(); // Reset
1822
  break;
1823
 
1824
  case 'YEARLY':
1825
- // Create offset
1826
  $recurring_timestamp = $start_timestamp;
1827
  $offset = "+{$interval} year";
1828
 
1829
- // Deal with BYMONTH
1830
  if ( isset( $rrules['BYMONTH'] ) && '' !== $rrules['BYMONTH'] ) {
1831
  $bymonths = explode( ',', $rrules['BYMONTH'] );
1832
  } else {
1833
  $bymonths = array();
1834
  }
1835
 
1836
- // Check if BYDAY rule exists
1837
  if ( isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1838
  while ( $recurring_timestamp <= $until ) {
1839
  $yearrecurring_timestamp = $recurring_timestamp;
1840
 
1841
- // Adjust time zone from initial event
1842
  $yearrecurring_offset = 0;
1843
 
1844
  if ( $this->use_timezone_with_r_rules ) {
@@ -1868,19 +1880,19 @@ class CoBlocks_ICal {
1868
 
1869
  do {
1870
  if ( $event_start_timestamp > $start_timestamp && $event_start_timestamp <= $until ) {
1871
- $an_event['DTSTART'] = date( self::DATE_TIME_FORMAT, $event_start_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1872
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1873
  $an_event['DTSTART_array'][2] = $event_start_timestamp;
1874
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1875
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1876
- $an_event['DTEND'] = date(
1877
  self::DATE_TIME_FORMAT,
1878
  $an_event['DTEND_array'][2]
1879
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1880
 
1881
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1882
 
1883
- // Exclusions
1884
  $is_excluded = array_filter(
1885
  $exdates,
1886
  function ( $exdate ) use ( $an_event, $yearrecurring_offset ) {
@@ -1908,7 +1920,7 @@ class CoBlocks_ICal {
1908
  $recurrence_events[] = $an_event;
1909
  $this->event_count++;
1910
 
1911
- // If RRULE[COUNT] is reached then break
1912
  if ( isset( $rrules['COUNT'] ) ) {
1913
  $count_nb++;
1914
 
@@ -1923,17 +1935,17 @@ class CoBlocks_ICal {
1923
  } while ( $event_start_timestamp <= $last_day_time_stamp );
1924
  }
1925
 
1926
- // Move forwards
1927
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
1928
  }
1929
  } else {
1930
  $day = $initial_start->format( 'd' );
1931
 
1932
- // Step through years
1933
  while ( $recurring_timestamp <= $until ) {
1934
  $yearrecurring_timestamp = $recurring_timestamp;
1935
 
1936
- // Adjust time zone from initial event
1937
  $yearrecurring_offset = 0;
1938
  if ( $this->use_timezone_with_r_rules ) {
1939
  $recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $yearrecurring_timestamp );
@@ -1955,18 +1967,18 @@ class CoBlocks_ICal {
1955
  $event_start_timestamp = strtotime( $event_start_desc );
1956
 
1957
  if ( $event_start_timestamp > $start_timestamp && $until >= $event_start_timestamp ) {
1958
- $an_event['DTSTART'] = date( self::DATE_TIME_FORMAT, $event_start_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1959
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1960
  $an_event['DTSTART_array'][2] = $event_start_timestamp;
1961
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1962
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1963
- $an_event['DTEND'] = date(
1964
  self::DATE_TIME_FORMAT,
1965
  $an_event['DTEND_array'][2]
1966
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1967
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1968
 
1969
- // Exclusions
1970
  $is_excluded = array_filter(
1971
  $exdates,
1972
  function ( $exdate ) use ( $an_event, $yearrecurring_offset ) {
@@ -1994,7 +2006,7 @@ class CoBlocks_ICal {
1994
  $recurrence_events[] = $an_event;
1995
  $this->event_count++;
1996
 
1997
- // If RRULE[COUNT] is reached then break
1998
  if ( isset( $rrules['COUNT'] ) ) {
1999
  $count_nb++;
2000
 
@@ -2006,14 +2018,14 @@ class CoBlocks_ICal {
2006
  }
2007
  }
2008
 
2009
- // Move forwards
2010
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
2011
  }
2012
  }
2013
 
2014
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
2015
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
2016
- $recurrence_events = array(); // Reset
2017
  break;
2018
  }
2019
  }
@@ -2071,8 +2083,9 @@ class CoBlocks_ICal {
2071
  * array to include an iCal date time for each event
2072
  * (`TZID=Timezone:YYYYMMDD[T]HHMMSS`)
2073
  *
2074
- * @param array $event
2075
- * @param integer $index
 
2076
  * @return array
2077
  */
2078
  protected function process_event_ical_datetime( array $event, $index = 3 ) {
@@ -2092,8 +2105,7 @@ class CoBlocks_ICal {
2092
 
2093
  /**
2094
  * Returns an array of Events.
2095
- * Every event is a class with the event
2096
- * details being properties within it.
2097
  *
2098
  * @return array
2099
  */
@@ -2132,7 +2144,8 @@ class CoBlocks_ICal {
2132
  /**
2133
  * Returns the calendar time zone
2134
  *
2135
- * @param boolean $ignore_utc
 
2136
  * @return string
2137
  */
2138
  public function calendar_timezone( $ignore_utc = false ) {
@@ -2164,17 +2177,16 @@ class CoBlocks_ICal {
2164
  public function free_busy_events() {
2165
  $array = $this->cal;
2166
 
2167
- return isset( $array['VFREEBUSY'] ) ? $array['VFREEBUSY'] : [];
2168
  }
2169
 
2170
  /**
2171
- * Returns a boolean value whether the
2172
- * current calendar has events or not
2173
  *
2174
  * @return boolean
2175
  */
2176
  public function has_events() {
2177
- return ( count( $this->events() ) > 0 ) ?: false;
2178
  }
2179
 
2180
  /**
@@ -2195,13 +2207,15 @@ class CoBlocks_ICal {
2195
  * problem for events on, during, or after 29 Jan 2038.
2196
  * See https://en.wikipedia.org/wiki/Unix_time#Representing_the_number
2197
  *
2198
- * @param string|null $range_start
2199
- * @param string|null $range_end
 
2200
  * @return array
2201
- * @throws \Exception
 
2202
  */
2203
  public function events_from_range( $range_start = null, $range_end = null ) {
2204
- // Sort events before processing range
2205
  $events = $this->sort_events_with_order( $this->events(), SORT_ASC );
2206
 
2207
  if ( empty( $events ) ) {
@@ -2214,7 +2228,6 @@ class CoBlocks_ICal {
2214
  try {
2215
  $range_start = new \DateTime( $range_start, new \DateTimeZone( $this->default_time_zone ) );
2216
  } catch ( \Exception $e ) {
2217
- error_log( "ICal::events_from_range: Invalid date passed ({$range_start})" );
2218
  $range_start = false;
2219
  }
2220
  } else {
@@ -2225,7 +2238,6 @@ class CoBlocks_ICal {
2225
  try {
2226
  $range_end = new \DateTime( $range_end, new \DateTimeZone( $this->default_time_zone ) );
2227
  } catch ( \Exception $e ) {
2228
- error_log( "ICal::events_from_range: Invalid date passed ({$range_end})" );
2229
  $range_end = false;
2230
  }
2231
  } else {
@@ -2245,11 +2257,11 @@ class CoBlocks_ICal {
2245
  $event_start = $an_event->dtstart_array[2];
2246
  $event_end = ( isset( $an_event->dtend_array[2] ) ) ? $an_event->dtend_array[2] : null;
2247
 
2248
- if ( ( $event_start >= $range_start && $event_start < $range_end ) // Event start date contained in the range
2249
  || ( null !== $event_end
2250
  && (
2251
- ( $event_end > $range_start && $event_end <= $range_end ) // Event end date contained in the range
2252
- || ( $event_start < $range_start && $event_end > $range_end ) // Event starts before and finishes after range
2253
  )
2254
  )
2255
  ) {
@@ -2268,7 +2280,8 @@ class CoBlocks_ICal {
2268
  * Returns a sorted array of the events following a given string,
2269
  * or `false` if no events exist in the range.
2270
  *
2271
- * @param string $interval
 
2272
  * @return array
2273
  */
2274
  public function events_from_interval( $interval ) {
@@ -2284,8 +2297,9 @@ class CoBlocks_ICal {
2284
  /**
2285
  * Sorts events based on a given sort order
2286
  *
2287
- * @param array $events
2288
- * @param integer $sort_order Either SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
 
2289
  * @return array
2290
  */
2291
  public function sort_events_with_order( array $events, $sort_order = SORT_ASC ) {
@@ -2305,7 +2319,8 @@ class CoBlocks_ICal {
2305
  /**
2306
  * Checks if a time zone is valid (IANA, CLDR, or Windows)
2307
  *
2308
- * @param string $timezone
 
2309
  * @return boolean
2310
  */
2311
  protected function is_valid_timezone_id( $timezone ) {
@@ -2317,7 +2332,8 @@ class CoBlocks_ICal {
2317
  /**
2318
  * Checks if a time zone is a valid IANA time zone
2319
  *
2320
- * @param string $timezone
 
2321
  * @return boolean
2322
  */
2323
  protected function is_valid_iana_timezone_id( $timezone ) {
@@ -2348,7 +2364,7 @@ class CoBlocks_ICal {
2348
  /**
2349
  * Checks if a time zone is a valid CLDR time zone
2350
  *
2351
- * @param string $timezone
2352
  * @return boolean
2353
  */
2354
  public function is_valid_cldr_timezone_id( $timezone ) {
@@ -2358,7 +2374,7 @@ class CoBlocks_ICal {
2358
  /**
2359
  * Checks if a time zone is a recognised Windows (non-CLDR) time zone
2360
  *
2361
- * @param string $timezone
2362
  * @return boolean
2363
  */
2364
  public function is_valid_windows_timezone_id( $timezone ) {
@@ -2368,9 +2384,10 @@ class CoBlocks_ICal {
2368
  /**
2369
  * Parses a duration and applies it to a date
2370
  *
2371
- * @param string $date
2372
- * @param object $duration
2373
- * @param string $format
 
2374
  * @return integer|\DateTime
2375
  */
2376
  protected function parse_duration( $date, $duration, $format = self::UNIX_FORMAT ) {
@@ -2398,13 +2415,14 @@ class CoBlocks_ICal {
2398
  /**
2399
  * Gets the number of days between a start and end date
2400
  *
2401
- * @param integer $days
2402
- * @param integer $start
2403
- * @param integer $end
 
2404
  * @return integer
2405
  */
2406
  protected function number_of_days( $days, $start, $end ) {
2407
- $w = array( date( 'w', $start ), date( 'w', $end ) );
2408
  $base = floor( ( $end - $start ) / self::SECONDS_IN_A_WEEK );
2409
  $sum = 0;
2410
 
@@ -2421,13 +2439,14 @@ class CoBlocks_ICal {
2421
  * Converts a negative day ordinal to
2422
  * its equivalent positive form
2423
  *
2424
- * @param integer $day_number
2425
- * @param integer $weekday
2426
- * @param integer|\DateTime $timestamp
 
2427
  * @return string
2428
  */
2429
  protected function convert_day_ordinal_to_positive( $day_number, $weekday, $timestamp ) {
2430
- // 0 when no number is defined for BYDAY
2431
  $day_number = empty( $day_number ) ? 1 : intval( $day_number );
2432
 
2433
  $day_ordinals = $this->day_ordinals;
@@ -2446,15 +2465,15 @@ class CoBlocks_ICal {
2446
  $start = strtotime( 'first day of ' . $timestamp->format( self::DATE_TIME_FORMAT_PRETTY ) );
2447
  $end = strtotime( 'last day of ' . $timestamp->format( self::DATE_TIME_FORMAT_PRETTY ) );
2448
 
2449
- // Used with pow(2, X) so pow(2, 4) is THURSDAY
2450
  $weekdays = array_flip( array_keys( $this->weekdays ) );
2451
 
2452
  $number_of_days = $this->number_of_days( pow( 2, $weekdays[ $weekday ] ), $start, $end );
2453
 
2454
- // Create subset
2455
  $day_ordinals = array_slice( $day_ordinals, 0, $number_of_days, true );
2456
 
2457
- // Reverse only the values
2458
  $day_ordinals = array_combine( array_keys( $day_ordinals ), array_reverse( array_values( $day_ordinals ) ) );
2459
 
2460
  return $day_ordinals[ $day_number * -1 ];
@@ -2463,7 +2482,8 @@ class CoBlocks_ICal {
2463
  /**
2464
  * Removes unprintable ASCII and UTF-8 characters
2465
  *
2466
- * @param string $data
 
2467
  * @return string
2468
  */
2469
  protected function remove_unprintable_chars( $data ) {
@@ -2474,13 +2494,14 @@ class CoBlocks_ICal {
2474
  * Provides a polyfill for PHP 7.2's `mb_chr()`, which is a multibyte safe version of `chr()`.
2475
  * Multibyte safe.
2476
  *
2477
- * @param integer $code
 
2478
  * @return string
2479
  */
2480
  protected function mb_chr( $code ) {
2481
  $code %= 0x200000;
2482
  if ( function_exists( 'mb_chr' ) ) {
2483
- return mb_chr( $code );
2484
  } else {
2485
  if ( 0x80 > $code ) {
2486
  $s = chr( $code );
@@ -2500,23 +2521,24 @@ class CoBlocks_ICal {
2500
  * Replace all occurrences of the search string with the replacement string.
2501
  * Multibyte safe.
2502
  *
2503
- * @param string|array $search
2504
- * @param string|array $replace
2505
- * @param string|array $subject
2506
- * @param string $encoding
2507
- * @param integer $count
 
2508
  * @return array|string
2509
  */
2510
  protected static function mb_str_replace( $search, $replace, $subject, $encoding = null, &$count = 0 ) {
2511
  if ( is_array( $subject ) ) {
2512
- // Call `mb_str_replace()` for each subject in the array, recursively
2513
  foreach ( $subject as $key => $value ) {
2514
  $subject[ $key ] = self::mb_str_replace( $search, $replace, $value, $encoding, $count );
2515
  }
2516
  } else {
2517
- // Normalize $search and $replace so they are both arrays of the same length
2518
- $searches = is_array( $search ) ? array_values( $search ) : [ $search ];
2519
- $replacements = is_array( $replace ) ? array_values( $replace ) : [ $replace ];
2520
  $replacements = array_pad( $replacements, count( $searches ), '' );
2521
 
2522
  foreach ( $searches as $key => $search ) {
@@ -2528,7 +2550,7 @@ class CoBlocks_ICal {
2528
  $search_len = mb_strlen( $search, $encoding );
2529
  $offset = mb_strpos( $subject, $search, 0, $encoding );
2530
 
2531
- $sb = [];
2532
  while ( false !== $offset ) {
2533
  $sb[] = mb_substr( $subject, 0, $offset, $encoding );
2534
  $subject = mb_substr( $subject, $offset + $search_len, null, $encoding );
@@ -2547,7 +2569,7 @@ class CoBlocks_ICal {
2547
  * Places double-quotes around texts that have characters not permitted
2548
  * in parameter-texts, but are permitted in quoted-texts.
2549
  *
2550
- * @param string $candidate_text
2551
  * @return string
2552
  */
2553
  protected function escape_param_text( $candidate_text ) {
@@ -2562,7 +2584,8 @@ class CoBlocks_ICal {
2562
  * Replaces curly quotes and other special characters
2563
  * with their standard equivalents
2564
  *
2565
- * @param string $data
 
2566
  * @return string
2567
  */
2568
  protected function clean_data( $data ) {
@@ -2580,26 +2603,27 @@ class CoBlocks_ICal {
2580
  "\xe2\x80\xa6" => '...', // …
2581
  "\xc2\xa0" => ' ',
2582
  );
2583
- // Replace UTF-8 characters
2584
  $cleaned_data = strtr( $data, $replacement_chars );
2585
 
2586
- // Replace Windows-1252 equivalents
2587
  $chars_to_replace = array_map(
2588
  function ( $code ) {
2589
  return $this->mb_chr( $code );
2590
  },
2591
  array( 133, 145, 146, 147, 148, 150, 151, 194 )
2592
  );
2593
- $cleaned_data = $this->mb_str_replace( $chars_to_replace, $replacement_chars, $cleaned_data );
 
2594
 
2595
  return $cleaned_data;
2596
  }
2597
 
2598
  /**
2599
- * Parses a list of excluded dates
2600
- * to be applied to an Event
 
2601
  *
2602
- * @param array $event
2603
  * @return array
2604
  */
2605
  public function parse_ex_dates( array $event ) {
@@ -2629,7 +2653,7 @@ class CoBlocks_ICal {
2629
  $output[] = new \DateTime( $ical_date, new \DateTimeZone( $current_time_zone ) );
2630
 
2631
  if ( $key === $final_key ) {
2632
- // Reset to default
2633
  $current_time_zone = $this->default_time_zone;
2634
  }
2635
  }
@@ -2642,9 +2666,11 @@ class CoBlocks_ICal {
2642
  /**
2643
  * Checks if a date string is a valid date
2644
  *
2645
- * @param string $value
 
2646
  * @return boolean
2647
- * @throws \Exception
 
2648
  */
2649
  public function is_valid_date( $value ) {
2650
  if ( ! $value ) {
@@ -2663,21 +2689,26 @@ class CoBlocks_ICal {
2663
  /**
2664
  * Checks if a filename exists as a file or URL
2665
  *
2666
- * @param string $filename
 
2667
  * @return boolean
2668
  */
2669
  protected function is_file_or_url( $filename ) {
2670
 
2671
- return ( file_exists( $filename ) || filter_var( $filename, FILTER_VALIDATE_URL ) ) ?: false;
 
 
2672
 
2673
  }
2674
 
2675
  /**
2676
  * Reads an entire file or URL into an array
2677
  *
2678
- * @param string $filename
 
2679
  * @return array
2680
- * @throws \Exception
 
2681
  */
2682
  protected function file_or_url( $filename ) {
2683
  $options = array();
@@ -2686,9 +2717,10 @@ class CoBlocks_ICal {
2686
  $options['http']['header'] = array();
2687
 
2688
  if ( ! empty( $this->http_basic_auth ) ) {
2689
- $username = $this->http_basic_auth['username'];
2690
- $password = $this->http_basic_auth['password'];
2691
- $basic_auth = base64_encode( "{$username}:{$password}" );
 
2692
 
2693
  array_push( $options['http']['header'], "Authorization: Basic {$basic_auth}" );
2694
  }
@@ -2715,7 +2747,8 @@ class CoBlocks_ICal {
2715
  *
2716
  * Falls back to the default time zone if string passed not a recognised time zone.
2717
  *
2718
- * @param string $timezone_string
 
2719
  * @return \date_timezone
2720
  */
2721
  public function timezone_string_to_date_timezone( $timezone_string ) {
@@ -2743,14 +2776,15 @@ class CoBlocks_ICal {
2743
  /**
2744
  * Ensures the recurrence count is enforced against generated recurrence events.
2745
  *
2746
- * @param array $rrules
2747
- * @param array $recurrence_events
 
2748
  * @return array
2749
  */
2750
  protected function trim_to_recurrence_count( array $rrules, array $recurrence_events ) {
2751
  if ( isset( $rrules['COUNT'] ) ) {
2752
  $recurrence_count = ( intval( $rrules['COUNT'] ) - 1 );
2753
- $surplus_count = ( sizeof( $recurrence_events ) - $recurrence_count );
2754
 
2755
  if ( $surplus_count > 0 ) {
2756
  $recurrence_events = array_slice( $recurrence_events, 0, $recurrence_count );
@@ -2764,25 +2798,26 @@ class CoBlocks_ICal {
2764
  /**
2765
  * Checks if an excluded date matches a given date by reconciling time zones.
2766
  *
2767
- * @param DateTime $exdate
2768
- * @param array $an_event
2769
- * @param integer $recurring_offset
 
2770
  * @return boolean
2771
  */
2772
  protected function is_ex_date_match( $exdate, array $an_event, $recurring_offset ) {
2773
  $search_date = $an_event['DTSTART'];
2774
 
2775
  if ( substr( $search_date, -1 ) === 'Z' ) {
2776
- $timezone = new \DateTimeZone(self::TIME_ZONE_UTC);
2777
  } elseif ( isset( $an_event['DTSTART_array'][0]['TZID'] ) ) {
2778
  $timezone = $this->timezone_string_to_date_timezone( $an_event['DTSTART_array'][0]['TZID'] );
2779
  } else {
2780
- $timezone = new \DateTimeZone($this->default_time_zone);
2781
  }
2782
 
2783
  $a = new \DateTime( $search_date, $timezone );
2784
  $b = $exdate->add( \DateInterval::createFromDateString( $recurring_offset . ' seconds' ) );
2785
 
2786
- return $a == $b;
2787
  }
2788
  }
8
  * @author Jonathan Goode <https://github.com/u01jmg3>
9
  * @license https://opensource.org/licenses/mit-license.php MIT License
10
  * @version 2.1.12
11
+ * @package CoBlocks
12
  */
13
 
14
  // Exit if accessed directly.
16
  exit;
17
  }
18
 
19
+ /**
20
+ * CoBlocks iCal class.
21
+ */
22
  class CoBlocks_ICal {
23
 
24
  const DATE_TIME_FORMAT = 'Ymd\THis';
506
  /**
507
  * Creates the ICal object
508
  *
509
+ * @param mixed $files Files.
510
+ * @param array $options Options array.
511
+ *
512
  * @return void
513
  */
514
  public function __construct( $files = false, array $options = array() ) {
524
  );
525
 
526
  // Used only for strtotime(), i18n not needed.
527
+ $this->weekdays = array(
528
  'SU' => 'Sunday of',
529
  'MO' => 'Monday of',
530
  'TU' => 'Tuesday of',
566
  }
567
  }
568
 
569
+ // Fallback to use the system default time zone.
570
  if ( ! isset( $this->default_time_zone ) || ! $this->is_valid_timezone_id( $this->default_time_zone ) ) {
571
  $this->default_time_zone = date_default_timezone_get();
572
  }
594
  /**
595
  * Initialises lines from a string
596
  *
597
+ * @param string $string String value.
598
+ *
599
  * @return ICal
600
  */
601
  public function init_string( $string ) {
603
  $lines = explode( PHP_EOL, $string );
604
 
605
  $this->init_lines( $lines );
 
 
606
  }
607
 
608
  return $this;
611
  /**
612
  * Initialises lines from a file
613
  *
614
+ * @param string $file File string.
615
+ *
616
  * @return ICal
617
  */
618
  public function init_file( $file ) {
620
  $lines = $this->file_or_url( $file );
621
 
622
  $this->init_lines( $lines );
 
 
623
  }
624
 
625
  return $this;
628
  /**
629
  * Initialises lines from a URL
630
  *
631
+ * @param string $url URL.
632
+ * @param string $username Username.
633
+ * @param string $password Password.
634
+ * @param string $user_agent User agent.
635
+ *
636
  * @return ICal
637
  */
638
  public function init_url( $url, $username = null, $password = null, $user_agent = null ) {
654
  * Initialises the parser using an array
655
  * containing each line of iCal content
656
  *
657
+ * @param array $lines Lines array.
658
+ *
659
  * @return void
660
  */
661
  protected function init_lines( array $lines ) {
664
  if ( stristr( $lines[0], 'BEGIN:VCALENDAR' ) !== false ) {
665
  $component = '';
666
  foreach ( $lines as $line ) {
667
+ $line = rtrim( $line ); // Trim trailing whitespace.
668
  $line = $this->remove_unprintable_chars( $line );
669
 
670
  if ( ! $this->disable_character_replacement ) {
674
  $add = $this->key_value_from_string( $line );
675
 
676
  $keyword = $add[0];
677
+ $values = $add[1]; // May be an array containing multiple values.
678
 
679
  if ( ! is_array( $values ) ) {
680
  if ( ! empty( $values ) ) {
681
+ $values = array( $values ); // Make an array as not already.
682
+ $blank_array = array(); // Empty placeholder array.
683
  array_push( $values, $blank_array );
684
  } else {
685
+ $values = array(); // Use blank array to ignore this line.
686
  }
687
  } elseif ( empty( $values[0] ) ) {
688
+ $values = array(); // Use blank array to ignore this line.
689
  }
690
 
691
+ // Reverse so that our array of properties is processed first.
692
  $values = array_reverse( $values );
693
 
694
  foreach ( $values as $value ) {
695
  switch ( $line ) {
696
+ /* https://www.kanzaki.com/docs/ical/vtodo.html */
697
  case 'BEGIN:VTODO':
698
  if ( ! is_array( $value ) ) {
699
  $this->todo_count++;
702
  $component = 'VTODO';
703
  break;
704
 
705
+ /* https://www.kanzaki.com/docs/ical/vevent.html */
706
  case 'BEGIN:VEVENT':
707
  if ( ! is_array( $value ) ) {
708
  $this->event_count++;
711
  $component = 'VEVENT';
712
  break;
713
 
714
+ /* https://www.kanzaki.com/docs/ical/vfreebusy.html */
715
  case 'BEGIN:VFREEBUSY':
716
  if ( ! is_array( $value ) ) {
717
  $this->free_busy_index++;
768
  if ( ! $this->skip_recurrence ) {
769
  $this->process_recurrences();
770
 
771
+ // Apply changes to altered recurrence instances.
772
  if ( ! empty( $this->altered_recurrence_instances ) ) {
773
  $events = $this->cal['VEVENT'];
774
 
802
  $events = $this->cal['VEVENT'];
803
 
804
  if ( ! empty( $events ) ) {
805
+ $last_index = count( $events ) - 1;
806
  $last_event = $events[ $last_index ];
807
 
808
  if ( ( ! isset( $last_event['RRULE'] ) || '' === $last_event['RRULE'] ) && $this->does_event_start_outside_window( $last_event ) ) {
847
  * Determines whether the event start date is outside `$window_min_timestamp` / `$window_max_timestamp`.
848
  * Returns `true` for invalid dates.
849
  *
850
+ * @param array $event Event data.
851
+ *
852
  * @return boolean
853
  */
854
  protected function does_event_start_outside_window( array $event ) {
858
  /**
859
  * Determines whether a valid iCalendar date is within a given range
860
  *
861
+ * @param string $calendar_date Calendar date.
862
+ * @param integer $min_timestamp Minimum timestamp value.
863
+ * @param integer $max_timestamp Maximum timestamp value.
864
+ *
865
  * @return boolean
866
  */
867
  protected function is_out_of_range( $calendar_date, $min_timestamp, $max_timestamp ) {
874
  * Unfolds an iCal file in preparation for parsing
875
  * (https://icalendar.org/iCalendar-RFC-5545/3-1-content-lines.html)
876
  *
877
+ * @param array $lines iCal data.
878
+ *
879
  * @return array
880
  */
881
  protected function unfold( array $lines ) {
889
  /**
890
  * Add one key and value pair to the `$this->cal` array
891
  *
892
+ * @param string $component Component name.
893
+ * @param string|boolean $keyword Keyword value.
894
+ * @param string $value Value.
895
+ *
896
  * @return void
897
  */
898
  protected function add_calendar_component_with_key_and_value( $component, $keyword, $value ) {
911
  }
912
 
913
  if ( is_array( $value ) ) {
914
+ // Add array of properties to the end.
915
  array_push( $this->cal[ $key1 ][ $key2 ][ $key3 ][ "{$keyword}_array" ], $value );
916
  } else {
917
  if ( ! isset( $this->cal[ $key1 ][ $key2 ][ $key3 ][ $keyword ] ) ) {
933
  }
934
 
935
  if ( is_array( $value ) ) {
936
+ // Add array of properties to the end.
937
  array_push( $this->cal[ $key1 ][ $key2 ][ "{$keyword}_array" ], $value );
938
  } else {
939
  if ( ! isset( $this->cal[ $key1 ][ $key2 ][ $keyword ] ) ) {
1000
  /**
1001
  * Gets the key value pair from an iCal string
1002
  *
1003
+ * @param string $text Text value.
1004
+ *
1005
  * @return array|boolean
1006
  */
1007
  protected function key_value_from_string( $text ) {
1044
  }
1045
 
1046
  if ( preg_match( '/^([A-Z-]+)([;][\w\W]*)?$/', $matches[1] ) ) {
1047
+ $matches = array_splice( $matches, 1, 2 ); // Remove first match and re-align ordering.
1048
 
1049
+ // Process properties.
1050
  if ( preg_match( '/([A-Z-]+)[;]([\w\W]*)/', $matches[0], $properties ) ) {
1051
+ // Remove first match.
1052
  array_shift( $properties );
1053
+ // Fix to ignore everything in keyword after a ; (e.g. Language, TZID, etc.).
1054
  $matches[0] = $properties[0];
1055
+ array_shift( $properties ); // Repeat removing first match.
1056
 
1057
  $formatted = array();
1058
  foreach ( $properties as $property ) {
1059
+ // Match semicolon separator outside of quoted substrings.
1060
  preg_match_all( '~[^' . PHP_EOL . '";]+(?:"[^"\\\]*(?:\\\.[^"\\\]*)*"[^' . PHP_EOL . '";]*)*~', $property, $attributes );
1061
+ // Remove multi-dimensional array and use the first key.
1062
+ $attributes = ( count( $attributes ) === 0 ) ? array( $property ) : reset( $attributes );
1063
 
1064
  if ( is_array( $attributes ) ) {
1065
  foreach ( $attributes as $attribute ) {
1066
+ // Match equals sign separator outside of quoted substrings.
1067
  preg_match_all(
1068
  '~[^' . PHP_EOL . '"=]+(?:"[^"\\\]*(?:\\\.[^"\\\]*)*"[^' . PHP_EOL . '"=]*)*~',
1069
  $attribute,
1070
  $values
1071
  );
1072
+ // Remove multi-dimensional array and use the first key.
1073
+ $value = ( count( $values ) === 0 ) ? null : reset( $values );
1074
 
1075
  if ( is_array( $value ) && isset( $value[1] ) ) {
1076
+ // Remove double quotes from beginning and end only.
1077
  $formatted[ $value[0] ] = trim( $value[1], '"' );
1078
  }
1079
  }
1080
  }
1081
  }
1082
 
1083
+ // Assign the keyword property information.
1084
  $properties[0] = $formatted;
1085
 
1086
+ // Add match to beginning of array.
1087
  array_unshift( $properties, $matches[1] );
1088
  $matches[1] = $properties;
1089
  }
1090
 
1091
  return $matches;
1092
  } else {
1093
+ return false; // Ignore this match.
1094
  }
1095
  }
1096
 
1097
  /**
1098
  * Returns a `DateTime` object from an iCal date time format
1099
  *
1100
+ * @param string $ical_date iCal date format.
1101
+ *
1102
  * @return \DateTime
1103
+ *
1104
+ * @throws \Exception Exception thrown on error.
1105
  */
1106
  public function ical_date_to_date_time( $ical_date ) {
1107
  /**
1108
+ * The iCal times may be in 3 formats, (https://www.kanzaki.com/docs/ical/dateTime.html).
1109
  *
1110
  * UTC: Has a trailing 'Z'
1111
  * Floating: No time zone reference specified, no trailing 'Z', use local time
1114
  * Use DateTime class objects to get around limitations with `mktime` and `gmmktime`.
1115
  * Must have a local time zone set to process floating times.
1116
  */
1117
+ $pattern = '/^(?:TZID=)?([^:]*|".*")'; // 1: Time zone
1118
+ $pattern .= ':?'; // Time zone delimiter.
1119
+ $pattern .= '([0-9]{8})'; // 2: YYYYMMDD
1120
+ $pattern .= 'T?'; // Time delimiter.
1121
+ $pattern .= '(?(?<=T)([0-9]{6}))'; // 3: HHMMSS (filled if delimiter present)
1122
+ $pattern .= '(Z?)/'; // 4: UTC flag
1123
 
1124
  preg_match( $pattern, $ical_date, $date );
1125
 
1154
  /**
1155
  * Returns a Unix timestamp from an iCal date time format
1156
  *
1157
+ * @param string $ical_date iCal date value.
1158
+ *
1159
  * @return integer
1160
  */
1161
  public function ical_date_to_unix_timestamp( $ical_date ) {
1165
  /**
1166
  * Returns a date adapted to the calendar time zone depending on the event `TZID`
1167
  *
1168
+ * @param array $event Event array.
1169
+ * @param string $key Array key.
1170
+ * @param string $format Date format.
1171
+ *
1172
  * @return string|boolean
1173
  */
1174
  public function ical_date_with_timezone( array $event, $key, $format = self::DATE_TIME_FORMAT ) {
1186
  $date_time->setTimezone( new \DateTimeZone( $this->calendar_timezone() ) );
1187
  }
1188
 
1189
+ // Force time zone.
1190
  if ( isset( $date_array[0]['TZID'] ) ) {
1191
  $date_time->setTimezone( $this->timezone_string_to_date_timezone( $date_array[0]['TZID'] ) );
1192
  }
1291
  if ( ! empty( $events ) ) {
1292
  foreach ( $events as $an_event ) {
1293
  if ( isset( $an_event['RRULE'] ) && '' !== $an_event['RRULE'] ) {
1294
+ // Tag as generated by a recurrence rule.
1295
  $an_event['RRULE_array'][2] = self::RECURRENCE_EVENT;
1296
 
1297
  $count_nb = 0;
1306
  $initial_end_timezone_name = $initial_start_timezone_name;
1307
  }
1308
 
1309
+ // Recurring event, parse RRULE and add appropriate duplicate events.
1310
  $rrules = array();
1311
  $rrule_strings = explode( ';', $an_event['RRULE'] );
1312
 
1315
  $rrules[ $k ] = $v;
1316
  }
1317
 
1318
+ // Get frequency.
1319
  $frequency = $rrules['FREQ'];
1320
+ // Get Start timestamp.
1321
  $start_timestamp = $initial_start->getTimestamp();
1322
 
1323
  if ( isset( $an_event['DTEND'] ) ) {
1330
  }
1331
 
1332
  $event_timestamp_offset = $end_timestamp - $start_timestamp;
1333
+ // Get Interval.
1334
  $interval = ( isset( $rrules['INTERVAL'] ) && '' !== $rrules['INTERVAL'] ) ? $rrules['INTERVAL'] : 1;
1335
 
1336
  $day_number = null;
1337
  $weekday = null;
1338
 
1339
  if ( in_array( $frequency, array( 'MONTHLY', 'YEARLY' ), true ) && isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1340
+ // Deal with BYDAY.
1341
  $by_day = $rrules['BYDAY'];
1342
  $day_number = intval( $by_day );
1343
 
1344
+ if ( empty( $day_number ) ) { // Returns 0 when no number defined in BYDAY.
1345
  if ( ! isset( $rrules['BYSETPOS'] ) ) {
1346
+ $day_number = 1; // Set first as default.
1347
  } elseif ( is_numeric( $rrules['BYSETPOS'] ) ) {
1348
  $day_number = $rrules['BYSETPOS'];
1349
 
1365
  if ( is_int( $this->default_span ) ) {
1366
  $until_default = date_create( 'now' );
1367
  $until_default->modify( $this->default_span . ' year' );
1368
+ $until_default->setTime( 23, 59, 59 ); // End of the day.
 
 
1369
  }
1370
 
1371
+ // Compute EXDATEs.
1372
  $exdates = $this->parse_ex_dates( $an_event );
1373
 
1374
  $count_orig = null;
1375
 
1376
  if ( isset( $rrules['UNTIL'] ) ) {
1377
+ // Get Until.
1378
  $until = strtotime( $rrules['UNTIL'] );
1379
  if ( $until > strtotime( '+' . $this->default_span . ' years' ) ) {
1380
  $until = strtotime( '+' . $this->default_span . ' years' );
1382
  } elseif ( isset( $rrules['COUNT'] ) ) {
1383
  $count_orig = ( is_numeric( $rrules['COUNT'] ) && $rrules['COUNT'] > 1 ) ? $rrules['COUNT'] : 0;
1384
 
1385
+ // Increment count by the number of excluded dates.
1386
+ $count_orig += count( $exdates );
1387
 
1388
+ // Remove one to exclude the occurrence that initialises the rule.
1389
  $count = ( $count_orig - 1 );
1390
 
1391
  if ( $interval >= 2 ) {
1412
  $dtstart->modify( $offset );
1413
  }
1414
 
1415
+ // Jumping X months forwards doesn't mean.
1416
+ // the end date will fall on the same day defined in BYDAY.
1417
+ // Use the largest of these to ensure we are going far enough.
1418
+ // in the future to capture our final end day.
1419
  $until = max( $until, $dtstart->format( self::UNIX_FORMAT ) );
1420
  }
1421
 
1426
 
1427
  $until = intval( $until );
1428
 
1429
+ // Decide how often to add events and do so.
1430
  switch ( $frequency ) {
1431
  case 'DAILY':
1432
+ // Simply add a new event each interval of days until UNTIL is reached.
1433
  $offset = "+{$interval} day";
1434
  $recurring_timestamp = strtotime( $offset, $start_timestamp );
1435
 
1436
  while ( $recurring_timestamp <= $until ) {
1437
  $dayrecurring_timestamp = $recurring_timestamp;
1438
 
1439
+ // Adjust time zone from initial event.
1440
  $dayrecurring_offset = 0;
1441
  if ( $this->use_timezone_with_r_rules ) {
1442
  $recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $dayrecurring_timestamp );
1445
  $dayrecurring_timestamp += $dayrecurring_offset;
1446
  }
1447
 
1448
+ // Add event.
1449
+ $an_event['DTSTART'] = gmdate( self::DATE_TIME_FORMAT, $dayrecurring_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1450
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1451
  $an_event['DTSTART_array'][2] = $dayrecurring_timestamp;
1452
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1453
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1454
+ $an_event['DTEND'] = gmdate(
1455
  self::DATE_TIME_FORMAT,
1456
  $an_event['DTEND_array'][2]
1457
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1458
 
1459
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1460
 
1461
+ // Exclusions.
1462
  $is_excluded = array_filter(
1463
  $exdates,
1464
  function ( $exdate ) use ( $an_event, $dayrecurring_offset ) {
1486
  $recurrence_events[] = $an_event;
1487
  $this->event_count++;
1488
 
1489
+ // If RRULE[COUNT] is reached then break.
1490
  if ( isset( $rrules['COUNT'] ) ) {
1491
  $count_nb++;
1492
 
1496
  }
1497
  }
1498
 
1499
+ // Move forwards.
1500
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
1501
  }
1502
 
1503
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
1504
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
1505
+ $recurrence_events = array(); // Reset.
1506
  break;
1507
 
1508
  case 'WEEKLY':
1509
+ // Create offset.
1510
  $offset = "+{$interval} week";
1511
 
1512
  $wkst = ( isset( $rrules['WKST'] ) && in_array( $rrules['WKST'], array( 'SA', 'SU', 'MO' ), true ) ) ? $rrules['WKST'] : $this->default_week_start;
1517
  'MO' => 'Monday',
1518
  );
1519
 
1520
+ // Build list of days of week to add events.
1521
  $weekdays = $a_week;
1522
 
1523
  if ( isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1524
  $by_days = explode( ',', $rrules['BYDAY'] );
1525
  } else {
1526
+ // A textual representation of a day, two letters (e.g. SU).
1527
  $by_days = array( mb_substr( strtoupper( $initial_start->format( 'D' ) ), 0, 2 ) );
1528
  }
1529
 
1530
+ // Get timestamp of first day of start week.
1531
  $weekrecurring_timestamp = ( strcasecmp( $initial_start->format( 'l' ), explode( ' ', $this->weekdays[ $wkst ] )[0] ) === 0 )
1532
  ? $start_timestamp
1533
  : strtotime( "last {$days[$wkst]} " . $initial_start->format( 'H:i:s' ), $start_timestamp );
1534
 
1535
+ // Step through weeks.
1536
  while ( $weekrecurring_timestamp <= $until ) {
1537
  $dayrecurring_timestamp = $weekrecurring_timestamp;
1538
 
1539
+ // Adjust time zone from initial event.
1540
  $dayrecurring_offset = 0;
1541
  if ( $this->use_timezone_with_r_rules ) {
1542
  $day_recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $dayrecurring_timestamp );
1546
  }
1547
 
1548
  foreach ( $weekdays as $day ) {
1549
+ // Check if day should be added.
1550
  if ( in_array( $day, $by_days, true ) && $dayrecurring_timestamp > $start_timestamp
1551
  && $dayrecurring_timestamp <= $until
1552
  ) {
1553
+ // Add event.
1554
+ $an_event['DTSTART'] = gmdate( self::DATE_TIME_FORMAT, $dayrecurring_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1555
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1556
  $an_event['DTSTART_array'][2] = $dayrecurring_timestamp;
1557
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1558
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1559
+ $an_event['DTEND'] = gmdate(
1560
  self::DATE_TIME_FORMAT,
1561
  $an_event['DTEND_array'][2]
1562
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1563
 
1564
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1565
 
1566
+ // Exclusions.
1567
  $is_excluded = array_filter(
1568
  $exdates,
1569
  function ( $exdate ) use ( $an_event, $dayrecurring_offset ) {
1591
  $recurrence_events[] = $an_event;
1592
  $this->event_count++;
1593
 
1594
+ // If RRULE[COUNT] is reached then break.
1595
  if ( isset( $rrules['COUNT'] ) ) {
1596
  $count_nb++;
1597
 
1602
  }
1603
  }
1604
 
1605
+ // Move forwards a day.
1606
  $dayrecurring_timestamp = strtotime( '+1 day', $dayrecurring_timestamp );
1607
  }
1608
 
1609
+ // Move forwards $interval weeks.
1610
  $weekrecurring_timestamp = strtotime( $offset, $weekrecurring_timestamp );
1611
  }
1612
 
1613
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
1614
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
1615
+ $recurrence_events = array(); // Reset.
1616
  break;
1617
 
1618
  case 'MONTHLY':
1619
+ // Create offset.
1620
  $recurring_timestamp = $start_timestamp;
1621
  $offset = "+{$interval} month";
1622
 
1623
  if ( isset( $rrules['BYMONTHDAY'] ) && '' !== $rrules['BYMONTHDAY'] ) {
1624
+ // Deal with BYMONTHDAY.
1625
  $monthdays = explode( ',', $rrules['BYMONTHDAY'] );
1626
 
1627
  while ( $recurring_timestamp <= $until ) {
1629
  $month_recurring_timestamp = null;
1630
 
1631
  if ( 0 === $key ) {
1632
+ // Ensure original event conforms to monthday rule.
1633
  $an_event['DTSTART'] = gmdate(
1634
  'Ym' . sprintf( '%02d', $monthday ) . '\T' . self::TIME_FORMAT,
1635
  strtotime( $an_event['DTSTART'] )
1647
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1648
  $an_event['DTEND_array'][2] = $this->ical_date_to_unix_timestamp( $an_event['DTEND'] );
1649
 
1650
+ // Ensure recurring timestamp confirms to BYMONTHDAY rule.
1651
  $month_recurring_date_time = new \DateTime( '@' . $recurring_timestamp );
1652
  $month_recurring_date_time->setDate(
1653
  $month_recurring_date_time->format( 'Y' ),
1657
  $month_recurring_timestamp = $month_recurring_date_time->getTimestamp();
1658
  }
1659
 
1660
+ // Adjust time zone from initial event.
1661
  $monthrecurring_offset = 0;
1662
  if ( $this->use_timezone_with_r_rules ) {
1663
  $recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $month_recurring_timestamp );
1667
  }
1668
 
1669
  if ( ( $month_recurring_timestamp > $start_timestamp ) && ( $month_recurring_timestamp <= $until ) ) {
1670
+ // Add event.
1671
+ $an_event['DTSTART'] = gmdate(
1672
  'Ym' . sprintf( '%02d', $monthday ) . '\T' . self::TIME_FORMAT,
1673
  $month_recurring_timestamp
1674
  ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1676
  $an_event['DTSTART_array'][2] = $month_recurring_timestamp;
1677
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1678
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1679
+ $an_event['DTEND'] = gmdate(
1680
  self::DATE_TIME_FORMAT,
1681
  $an_event['DTEND_array'][2]
1682
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1683
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1684
 
1685
+ // Exclusions.
1686
  $is_excluded = array_filter(
1687
  $exdates,
1688
  function ( $exdate ) use ( $an_event, $monthrecurring_offset ) {
1710
  $recurrence_events[] = $an_event;
1711
  $this->event_count++;
1712
 
1713
+ // If RRULE[COUNT] is reached then break.
1714
  if ( isset( $rrules['COUNT'] ) ) {
1715
  $count_nb++;
1716
 
1722
  }
1723
  }
1724
 
1725
+ // Move forwards.
1726
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
1727
  }
1728
  } elseif ( isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1729
  while ( $recurring_timestamp <= $until ) {
1730
  $month_recurring_timestamp = $recurring_timestamp;
1731
 
1732
+ // Adjust time zone from initial event.
1733
  $monthrecurring_offset = 0;
1734
 
1735
  if ( $this->use_timezone_with_r_rules ) {
1740
  }
1741
 
1742
  $event_start_desc = "{$this->convert_day_ordinal_to_positive($day_number, $weekday, $month_recurring_timestamp)} {$this->weekdays[$weekday]} "
1743
+ . gmdate( self::DATE_TIME_FORMAT_PRETTY, $month_recurring_timestamp );
1744
  $event_start_timestamp = strtotime( $event_start_desc );
1745
 
1746
  if ( intval( $rrules['BYDAY'] ) === 0 ) {
1747
  $last_day_desc = "last {$this->weekdays[$weekday]} "
1748
+ . gmdate( self::DATE_TIME_FORMAT_PRETTY, $month_recurring_timestamp );
1749
  } else {
1750
  $last_day_desc = "{$this->convert_day_ordinal_to_positive($day_number, $weekday, $month_recurring_timestamp)} {$this->weekdays[$weekday]} "
1751
+ . gmdate( self::DATE_TIME_FORMAT_PRETTY, $month_recurring_timestamp );
1752
  }
1753
 
1754
  $last_day_time_stamp = strtotime( $last_day_desc );
1755
 
1756
  do {
1757
+ // Prevent 5th day of a month from showing up on the next month.
1758
+ // If BYDAY and the event falls outside the current month, skip the event.
1759
 
1760
+ $compare_current_month = gmdate( 'F', $month_recurring_timestamp );
1761
+ $compare_event_month = gmdate( 'F', $event_start_timestamp );
1762
 
1763
  if ( $compare_current_month !== $compare_event_month ) {
1764
  $month_recurring_timestamp = strtotime( $offset, $month_recurring_timestamp );
1766
  }
1767
 
1768
  if ( $event_start_timestamp > $start_timestamp && $event_start_timestamp <= $until ) {
1769
+ $an_event['DTSTART'] = gmdate( self::DATE_TIME_FORMAT, $event_start_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1770
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1771
  $an_event['DTSTART_array'][2] = $event_start_timestamp;
1772
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1773
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1774
+ $an_event['DTEND'] = gmdate(
1775
  self::DATE_TIME_FORMAT,
1776
  $an_event['DTEND_array'][2]
1777
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1778
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1779
 
1780
+ // Exclusions.
1781
  $is_excluded = array_filter(
1782
  $exdates,
1783
  function ( $exdate ) use ( $an_event, $monthrecurring_offset ) {
1805
  $recurrence_events[] = $an_event;
1806
  $this->event_count++;
1807
 
1808
+ // If RRULE[COUNT] is reached then break.
1809
  if ( isset( $rrules['COUNT'] ) ) {
1810
  $count_nb++;
1811
 
1817
  }
1818
 
1819
  if ( isset( $rrules['BYSETPOS'] ) ) {
1820
+ // BYSETPOS is defined so skip.
1821
+ // looping through each week.
1822
  $last_day_time_stamp = $event_start_timestamp;
1823
  }
1824
 
1830
 
1831
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
1832
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
1833
+ $recurrence_events = array(); // Reset.
1834
  break;
1835
 
1836
  case 'YEARLY':
1837
+ // Create offset.
1838
  $recurring_timestamp = $start_timestamp;
1839
  $offset = "+{$interval} year";
1840
 
1841
+ // Deal with BYMONTH.
1842
  if ( isset( $rrules['BYMONTH'] ) && '' !== $rrules['BYMONTH'] ) {
1843
  $bymonths = explode( ',', $rrules['BYMONTH'] );
1844
  } else {
1845
  $bymonths = array();
1846
  }
1847
 
1848
+ // Check if BYDAY rule exists.
1849
  if ( isset( $rrules['BYDAY'] ) && '' !== $rrules['BYDAY'] ) {
1850
  while ( $recurring_timestamp <= $until ) {
1851
  $yearrecurring_timestamp = $recurring_timestamp;
1852
 
1853
+ // Adjust time zone from initial event.
1854
  $yearrecurring_offset = 0;
1855
 
1856
  if ( $this->use_timezone_with_r_rules ) {
1880
 
1881
  do {
1882
  if ( $event_start_timestamp > $start_timestamp && $event_start_timestamp <= $until ) {
1883
+ $an_event['DTSTART'] = gmdate( self::DATE_TIME_FORMAT, $event_start_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1884
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1885
  $an_event['DTSTART_array'][2] = $event_start_timestamp;
1886
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1887
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1888
+ $an_event['DTEND'] = gmdate(
1889
  self::DATE_TIME_FORMAT,
1890
  $an_event['DTEND_array'][2]
1891
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1892
 
1893
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1894
 
1895
+ // Exclusions.
1896
  $is_excluded = array_filter(
1897
  $exdates,
1898
  function ( $exdate ) use ( $an_event, $yearrecurring_offset ) {
1920
  $recurrence_events[] = $an_event;
1921
  $this->event_count++;
1922
 
1923
+ // If RRULE[COUNT] is reached then break.
1924
  if ( isset( $rrules['COUNT'] ) ) {
1925
  $count_nb++;
1926
 
1935
  } while ( $event_start_timestamp <= $last_day_time_stamp );
1936
  }
1937
 
1938
+ // Move forwards.
1939
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
1940
  }
1941
  } else {
1942
  $day = $initial_start->format( 'd' );
1943
 
1944
+ // Step through years.
1945
  while ( $recurring_timestamp <= $until ) {
1946
  $yearrecurring_timestamp = $recurring_timestamp;
1947
 
1948
+ // Adjust time zone from initial event.
1949
  $yearrecurring_offset = 0;
1950
  if ( $this->use_timezone_with_r_rules ) {
1951
  $recurring_timezone = \DateTime::createFromFormat( self::UNIX_FORMAT, $yearrecurring_timestamp );
1967
  $event_start_timestamp = strtotime( $event_start_desc );
1968
 
1969
  if ( $event_start_timestamp > $start_timestamp && $until >= $event_start_timestamp ) {
1970
+ $an_event['DTSTART'] = gmdate( self::DATE_TIME_FORMAT, $event_start_timestamp ) . ( ( 'Z' === $initial_start_timezone_name ) ? 'Z' : '' );
1971
  $an_event['DTSTART_array'][1] = $an_event['DTSTART'];
1972
  $an_event['DTSTART_array'][2] = $event_start_timestamp;
1973
  $an_event['DTEND_array'] = $an_event['DTSTART_array'];
1974
  $an_event['DTEND_array'][2] += $event_timestamp_offset;
1975
+ $an_event['DTEND'] = gmdate(
1976
  self::DATE_TIME_FORMAT,
1977
  $an_event['DTEND_array'][2]
1978
  ) . ( ( 'Z' === $initial_end_timezone_name ) ? 'Z' : '' );
1979
  $an_event['DTEND_array'][1] = $an_event['DTEND'];
1980
 
1981
+ // Exclusions.
1982
  $is_excluded = array_filter(
1983
  $exdates,
1984
  function ( $exdate ) use ( $an_event, $yearrecurring_offset ) {
2006
  $recurrence_events[] = $an_event;
2007
  $this->event_count++;
2008
 
2009
+ // If RRULE[COUNT] is reached then break.
2010
  if ( isset( $rrules['COUNT'] ) ) {
2011
  $count_nb++;
2012
 
2018
  }
2019
  }
2020
 
2021
+ // Move forwards.
2022
  $recurring_timestamp = strtotime( $offset, $recurring_timestamp );
2023
  }
2024
  }
2025
 
2026
  $recurrence_events = $this->trim_to_recurrence_count( $rrules, $recurrence_events );
2027
  $all_recurrence_events = array_merge( $all_recurrence_events, $recurrence_events );
2028
+ $recurrence_events = array(); // Reset.
2029
  break;
2030
  }
2031
  }
2083
  * array to include an iCal date time for each event
2084
  * (`TZID=Timezone:YYYYMMDD[T]HHMMSS`)
2085
  *
2086
+ * @param array $event Event array.
2087
+ * @param integer $index Index value.
2088
+ *
2089
  * @return array
2090
  */
2091
  protected function process_event_ical_datetime( array $event, $index = 3 ) {
2105
 
2106
  /**
2107
  * Returns an array of Events.
2108
+ * Every event is a class with the event details being properties within it.
 
2109
  *
2110
  * @return array
2111
  */
2144
  /**
2145
  * Returns the calendar time zone
2146
  *
2147
+ * @param boolean $ignore_utc Whether or not to ignore UTC.
2148
+ *
2149
  * @return string
2150
  */
2151
  public function calendar_timezone( $ignore_utc = false ) {
2177
  public function free_busy_events() {
2178
  $array = $this->cal;
2179
 
2180
+ return isset( $array['VFREEBUSY'] ) ? $array['VFREEBUSY'] : array();
2181
  }
2182
 
2183
  /**
2184
+ * Returns a boolean value whether the current calendar has events or not
 
2185
  *
2186
  * @return boolean
2187
  */
2188
  public function has_events() {
2189
+ return ( count( $this->events() ) > 0 ) ? true : false;
2190
  }
2191
 
2192
  /**
2207
  * problem for events on, during, or after 29 Jan 2038.
2208
  * See https://en.wikipedia.org/wiki/Unix_time#Representing_the_number
2209
  *
2210
+ * @param string|null $range_start Date range start.
2211
+ * @param string|null $range_end Date range end.
2212
+ *
2213
  * @return array
2214
+ *
2215
+ * @throws \Exception Exception thrown on error.
2216
  */
2217
  public function events_from_range( $range_start = null, $range_end = null ) {
2218
+ // Sort events before processing range.
2219
  $events = $this->sort_events_with_order( $this->events(), SORT_ASC );
2220
 
2221
  if ( empty( $events ) ) {
2228
  try {
2229
  $range_start = new \DateTime( $range_start, new \DateTimeZone( $this->default_time_zone ) );
2230
  } catch ( \Exception $e ) {
 
2231
  $range_start = false;
2232
  }
2233
  } else {
2238
  try {
2239
  $range_end = new \DateTime( $range_end, new \DateTimeZone( $this->default_time_zone ) );
2240
  } catch ( \Exception $e ) {
 
2241
  $range_end = false;
2242
  }
2243
  } else {
2257
  $event_start = $an_event->dtstart_array[2];
2258
  $event_end = ( isset( $an_event->dtend_array[2] ) ) ? $an_event->dtend_array[2] : null;
2259
 
2260
+ if ( ( $event_start >= $range_start && $event_start < $range_end ) // Event start date contained in the range.
2261
  || ( null !== $event_end
2262
  && (
2263
+ ( $event_end > $range_start && $event_end <= $range_end ) // Event end date contained in the range.
2264
+ || ( $event_start < $range_start && $event_end > $range_end ) // Event starts before and finishes after range.
2265
  )
2266
  )
2267
  ) {
2280
  * Returns a sorted array of the events following a given string,
2281
  * or `false` if no events exist in the range.
2282
  *
2283
+ * @param string $interval A date with relative parts.
2284
+ *
2285
  * @return array
2286
  */
2287
  public function events_from_interval( $interval ) {
2297
  /**
2298
  * Sorts events based on a given sort order
2299
  *
2300
+ * @param array $events Events array.
2301
+ * @param integer $sort_order Either SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING.
2302
+ *
2303
  * @return array
2304
  */
2305
  public function sort_events_with_order( array $events, $sort_order = SORT_ASC ) {
2319
  /**
2320
  * Checks if a time zone is valid (IANA, CLDR, or Windows)
2321
  *
2322
+ * @param string $timezone Timezone value.
2323
+ *
2324
  * @return boolean
2325
  */
2326
  protected function is_valid_timezone_id( $timezone ) {
2332
  /**
2333
  * Checks if a time zone is a valid IANA time zone
2334
  *
2335
+ * @param string $timezone Timezone value.
2336
+ *
2337
  * @return boolean
2338
  */
2339
  protected function is_valid_iana_timezone_id( $timezone ) {
2364
  /**
2365
  * Checks if a time zone is a valid CLDR time zone
2366
  *
2367
+ * @param string $timezone Timezone value.
2368
  * @return boolean
2369
  */
2370
  public function is_valid_cldr_timezone_id( $timezone ) {
2374
  /**
2375
  * Checks if a time zone is a recognised Windows (non-CLDR) time zone
2376
  *
2377
+ * @param string $timezone Timezone value.
2378
  * @return boolean
2379
  */
2380
  public function is_valid_windows_timezone_id( $timezone ) {
2384
  /**
2385
  * Parses a duration and applies it to a date
2386
  *
2387
+ * @param string $date Date string.
2388
+ * @param object $duration Duration value.
2389
+ * @param string $format Format.
2390
+ *
2391
  * @return integer|\DateTime
2392
  */
2393
  protected function parse_duration( $date, $duration, $format = self::UNIX_FORMAT ) {
2415
  /**
2416
  * Gets the number of days between a start and end date
2417
  *
2418
+ * @param integer $days Number of days.
2419
+ * @param integer $start Start value.
2420
+ * @param integer $end End value.
2421
+ *
2422
  * @return integer
2423
  */
2424
  protected function number_of_days( $days, $start, $end ) {
2425
+ $w = array( gmdate( 'w', $start ), gmdate( 'w', $end ) );
2426
  $base = floor( ( $end - $start ) / self::SECONDS_IN_A_WEEK );
2427
  $sum = 0;
2428
 
2439
  * Converts a negative day ordinal to
2440
  * its equivalent positive form
2441
  *
2442
+ * @param integer $day_number Day number.
2443
+ * @param integer $weekday Weekday value.
2444
+ * @param integer|\DateTime $timestamp Timestamp.
2445
+ *
2446
  * @return string
2447
  */
2448
  protected function convert_day_ordinal_to_positive( $day_number, $weekday, $timestamp ) {
2449
+ // 0 when no number is defined for BYDAY.
2450
  $day_number = empty( $day_number ) ? 1 : intval( $day_number );
2451
 
2452
  $day_ordinals = $this->day_ordinals;
2465
  $start = strtotime( 'first day of ' . $timestamp->format( self::DATE_TIME_FORMAT_PRETTY ) );
2466
  $end = strtotime( 'last day of ' . $timestamp->format( self::DATE_TIME_FORMAT_PRETTY ) );
2467
 
2468
+ // Used with pow(2, X) so pow(2, 4) is THURSDAY.
2469
  $weekdays = array_flip( array_keys( $this->weekdays ) );
2470
 
2471
  $number_of_days = $this->number_of_days( pow( 2, $weekdays[ $weekday ] ), $start, $end );
2472
 
2473
+ // Create subset.
2474
  $day_ordinals = array_slice( $day_ordinals, 0, $number_of_days, true );
2475
 
2476
+ // Reverse only the values.
2477
  $day_ordinals = array_combine( array_keys( $day_ordinals ), array_reverse( array_values( $day_ordinals ) ) );
2478
 
2479
  return $day_ordinals[ $day_number * -1 ];
2482
  /**
2483
  * Removes unprintable ASCII and UTF-8 characters
2484
  *
2485
+ * @param string $data Data to remove characters from.
2486
+ *
2487
  * @return string
2488
  */
2489
  protected function remove_unprintable_chars( $data ) {
2494
  * Provides a polyfill for PHP 7.2's `mb_chr()`, which is a multibyte safe version of `chr()`.
2495
  * Multibyte safe.
2496
  *
2497
+ * @param integer $code Value used to determine encoding.
2498
+ *
2499
  * @return string
2500
  */
2501
  protected function mb_chr( $code ) {
2502
  $code %= 0x200000;
2503
  if ( function_exists( 'mb_chr' ) ) {
2504
+ return mb_chr( $code ); // phpcs:ignore
2505
  } else {
2506
  if ( 0x80 > $code ) {
2507
  $s = chr( $code );
2521
  * Replace all occurrences of the search string with the replacement string.
2522
  * Multibyte safe.
2523
  *
2524
+ * @param string|array $search Needle to search for.
2525
+ * @param string|array $replace Replace value.
2526
+ * @param string|array $subject Subject text.
2527
+ * @param string $encoding Encoding value.
2528
+ * @param integer $count Index value in the iteration.
2529
+ *
2530
  * @return array|string
2531
  */
2532
  protected static function mb_str_replace( $search, $replace, $subject, $encoding = null, &$count = 0 ) {
2533
  if ( is_array( $subject ) ) {
2534
+ // Call `mb_str_replace()` for each subject in the array, recursively.
2535
  foreach ( $subject as $key => $value ) {
2536
  $subject[ $key ] = self::mb_str_replace( $search, $replace, $value, $encoding, $count );
2537
  }
2538
  } else {
2539
+ // Normalize $search and $replace so they are both arrays of the same length.
2540
+ $searches = is_array( $search ) ? array_values( $search ) : array( $search );
2541
+ $replacements = is_array( $replace ) ? array_values( $replace ) : array( $replace );
2542
  $replacements = array_pad( $replacements, count( $searches ), '' );
2543
 
2544
  foreach ( $searches as $key => $search ) {
2550
  $search_len = mb_strlen( $search, $encoding );
2551
  $offset = mb_strpos( $subject, $search, 0, $encoding );
2552
 
2553
+ $sb = array();
2554
  while ( false !== $offset ) {
2555
  $sb[] = mb_substr( $subject, 0, $offset, $encoding );
2556
  $subject = mb_substr( $subject, $offset + $search_len, null, $encoding );
2569
  * Places double-quotes around texts that have characters not permitted
2570
  * in parameter-texts, but are permitted in quoted-texts.
2571
  *
2572
+ * @param string $candidate_text Candidate text string.
2573
  * @return string
2574
  */
2575
  protected function escape_param_text( $candidate_text ) {
2584
  * Replaces curly quotes and other special characters
2585
  * with their standard equivalents
2586
  *
2587
+ * @param string $data Data string.
2588
+ *
2589
  * @return string
2590
  */
2591
  protected function clean_data( $data ) {
2603
  "\xe2\x80\xa6" => '...', // …
2604
  "\xc2\xa0" => ' ',
2605
  );
2606
+ // Replace UTF-8 characters.
2607
  $cleaned_data = strtr( $data, $replacement_chars );
2608
 
2609
+ // Replace Windows-1252 equivalents.
2610
  $chars_to_replace = array_map(
2611
  function ( $code ) {
2612
  return $this->mb_chr( $code );
2613
  },
2614
  array( 133, 145, 146, 147, 148, 150, 151, 194 )
2615
  );
2616
+
2617
+ $cleaned_data = $this->mb_str_replace( $chars_to_replace, $replacement_chars, $cleaned_data );
2618
 
2619
  return $cleaned_data;
2620
  }
2621
 
2622
  /**
2623
+ * Parses a list of excluded dates to be applied to an Event
2624
+ *
2625
+ * @param array $event Event array.
2626
  *
 
2627
  * @return array
2628
  */
2629
  public function parse_ex_dates( array $event ) {
2653
  $output[] = new \DateTime( $ical_date, new \DateTimeZone( $current_time_zone ) );
2654
 
2655
  if ( $key === $final_key ) {
2656
+ // Reset to default.
2657
  $current_time_zone = $this->default_time_zone;
2658
  }
2659
  }
2666
  /**
2667
  * Checks if a date string is a valid date
2668
  *
2669
+ * @param string $value Date value.
2670
+ *
2671
  * @return boolean
2672
+ *
2673
+ * @throws \Exception Exception thrown on error.
2674
  */
2675
  public function is_valid_date( $value ) {
2676
  if ( ! $value ) {
2689
  /**
2690
  * Checks if a filename exists as a file or URL
2691
  *
2692
+ * @param string $filename Filename or URL.
2693
+ *
2694
  * @return boolean
2695
  */
2696
  protected function is_file_or_url( $filename ) {
2697
 
2698
+ $file_or_url = ( file_exists( $filename ) || filter_var( $filename, FILTER_VALIDATE_URL ) );
2699
+
2700
+ return $file_or_url ? $file_or_url : false;
2701
 
2702
  }
2703
 
2704
  /**
2705
  * Reads an entire file or URL into an array
2706
  *
2707
+ * @param string $filename The file name.
2708
+ *
2709
  * @return array
2710
+ *
2711
+ * @throws \Exception Exception thrown on error.
2712
  */
2713
  protected function file_or_url( $filename ) {
2714
  $options = array();
2717
  $options['http']['header'] = array();
2718
 
2719
  if ( ! empty( $this->http_basic_auth ) ) {
2720
+ $username = $this->http_basic_auth['username'];
2721
+ $password = $this->http_basic_auth['password'];
2722
+ // base64_encode() used to encode auth credentials.
2723
+ $basic_auth = base64_encode( "{$username}:{$password}" ); // phpcs:ignore
2724
 
2725
  array_push( $options['http']['header'], "Authorization: Basic {$basic_auth}" );
2726
  }
2747
  *
2748
  * Falls back to the default time zone if string passed not a recognised time zone.
2749
  *
2750
+ * @param string $timezone_string Timezone string.
2751
+ *
2752
  * @return \date_timezone
2753
  */
2754
  public function timezone_string_to_date_timezone( $timezone_string ) {
2776
  /**
2777
  * Ensures the recurrence count is enforced against generated recurrence events.
2778
  *
2779
+ * @param array $rrules Recurring rules.
2780
+ * @param array $recurrence_events Recurring events array.
2781
+ *
2782
  * @return array
2783
  */
2784
  protected function trim_to_recurrence_count( array $rrules, array $recurrence_events ) {
2785
  if ( isset( $rrules['COUNT'] ) ) {
2786
  $recurrence_count = ( intval( $rrules['COUNT'] ) - 1 );
2787
+ $surplus_count = ( count( $recurrence_events ) - $recurrence_count );
2788
 
2789
  if ( $surplus_count > 0 ) {
2790
  $recurrence_events = array_slice( $recurrence_events, 0, $recurrence_count );
2798
  /**
2799
  * Checks if an excluded date matches a given date by reconciling time zones.
2800
  *
2801
+ * @param DateTime $exdate Excluded date class.
2802
+ * @param array $an_event Event array.
2803
+ * @param integer $recurring_offset A date with relative parts.
2804
+ *
2805
  * @return boolean
2806
  */
2807
  protected function is_ex_date_match( $exdate, array $an_event, $recurring_offset ) {
2808
  $search_date = $an_event['DTSTART'];
2809
 
2810
  if ( substr( $search_date, -1 ) === 'Z' ) {
2811
+ $timezone = new \DateTimeZone( self::TIME_ZONE_UTC );
2812
  } elseif ( isset( $an_event['DTSTART_array'][0]['TZID'] ) ) {
2813
  $timezone = $this->timezone_string_to_date_timezone( $an_event['DTSTART_array'][0]['TZID'] );
2814
  } else {
2815
+ $timezone = new \DateTimeZone( $this->default_time_zone );
2816
  }
2817
 
2818
  $a = new \DateTime( $search_date, $timezone );
2819
  $b = $exdate->add( \DateInterval::createFromDateString( $recurring_offset . ' seconds' ) );
2820
 
2821
+ return $a === $b;
2822
  }
2823
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: page builder, Gutenberg blocks, WordPress blocks, gutenberg, blocks
5
  Requires at least: 5.5
6
  Tested up to: 5.9
7
  Requires PHP: 5.6
8
- Stable tag: 2.22.2
9
  License: GPL-2.0
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -112,6 +112,22 @@ Developers can also apply minor style touch-ups to their themes if necessary. If
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  = 2.22.2 / 2022-03-09 =
116
  ##### Enhancements
117
  * Enhance Feature blocks to allow spacer block [#2299](https://github.com/godaddy-wordpress/coblocks/pull/2299)
5
  Requires at least: 5.5
6
  Tested up to: 5.9
7
  Requires PHP: 5.6
8
+ Stable tag: 2.22.4
9
  License: GPL-2.0
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
112
 
113
  == Changelog ==
114
 
115
+ = 2.22.4 / 2022-03-15 =
116
+ ##### Bug fixes
117
+ * Fix Form block where nonce is unverified and some sanitization [#2329](https://github.com/godaddy-wordpress/coblocks/pull/2329)
118
+ * Fix Gist block to make sure there is no PHPCS error [#2323](https://github.com/godaddy-wordpress/coblocks/pull/2323)
119
+ * Fix Events block timezone problem [#2319](https://github.com/godaddy-wordpress/coblocks/pull/2319)
120
+
121
+ ##### Misc
122
+ * Lint everything on CI [#2311](https://github.com/godaddy-wordpress/coblocks/pull/2311)
123
+ * Update block-assets syntax [#2322](https://github.com/godaddy-wordpress/coblocks/pull/2322)
124
+ * Update some dependencies [#2313](https://github.com/godaddy-wordpress/coblocks/pull/2313)
125
+ * Enhance restore cache to also install missing deps on build pipeline [#2317](https://github.com/godaddy-wordpress/coblocks/pull/2317)
126
+
127
+ = 2.22.3 / 2022-03-10 =
128
+ ##### Bug fixes
129
+ * Fix situation where nonce is unverified [#2316](https://github.com/godaddy-wordpress/coblocks/pull/2316)
130
+
131
  = 2.22.2 / 2022-03-09 =
132
  ##### Enhancements
133
  * Enhance Feature blocks to allow spacer block [#2299](https://github.com/godaddy-wordpress/coblocks/pull/2299)
src/blocks/gist/index.php CHANGED
@@ -76,9 +76,8 @@ function coblocks_block_gist_handler( $matches ) {
76
  }
77
 
78
  return sprintf(
79
- // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
80
- '<script src="https://gist.github.com/%1$s"></script><noscript><a href="%2$s">%3$s</a></noscript>',
81
- esc_attr( $script_src ),
82
  esc_url( $gist_url ),
83
  esc_html( __( 'View this gist on GitHub', 'coblocks' ) )
84
  );
76
  }
77
 
78
  return sprintf(
79
+ '%1$s<noscript><a href="%2$s">%3$s</a></noscript>',
80
+ wp_get_inline_script_tag( null, array( 'src' => esc_url( 'https://gist.github.com/' . $script_src ) ) ),
 
81
  esc_url( $gist_url ),
82
  esc_html( __( 'View this gist on GitHub', 'coblocks' ) )
83
  );